From patchwork Sun Oct 15 23:18:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10007321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9E7A60230 for ; Sun, 15 Oct 2017 23:18:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA15C26212 for ; Sun, 15 Oct 2017 23:18:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF01C262FF; Sun, 15 Oct 2017 23:18:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43F5026212 for ; Sun, 15 Oct 2017 23:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751348AbdJOXSR (ORCPT ); Sun, 15 Oct 2017 19:18:17 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:44780 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751235AbdJOXSR (ORCPT ); Sun, 15 Oct 2017 19:18:17 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990398AbdJOXSQBVqRK (ORCPT ); Mon, 16 Oct 2017 01:18:16 +0200 Date: Mon, 16 Oct 2017 01:18:10 +0200 From: Ladislav Michl To: linux-omap@vger.kernel.org Cc: Roger Quadros , Tony Lindgren Subject: [PATCH 02/11] ARM: OMAP2+: gpmc-onenand: Drop global gpmc_settings Message-ID: <20171015231810.zwhwj25sz4pumttf@lenoch> References: <20171015231641.zt5fz6fidp5eczf6@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171015231641.zt5fz6fidp5eczf6@lenoch> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As gpmc_read_settings_dt zeroes gpmc_settings, there is no point to set any defaults. Signed-off-by: Ladislav Michl --- arch/arm/mach-omap2/gpmc-onenand.c | 54 ++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 6847a07aacf9..3b50b9b5cb2f 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c @@ -46,21 +46,8 @@ static struct platform_device gpmc_onenand_device = { .resource = &gpmc_onenand_resource, }; -static struct gpmc_settings onenand_async = { - .device_width = GPMC_DEVWIDTH_16BIT, - .mux_add_data = GPMC_MUX_AD, -}; - -static struct gpmc_settings onenand_sync = { - .burst_read = true, - .burst_wrap = true, - .burst_len = GPMC_BURST_16, - .device_width = GPMC_DEVWIDTH_16BIT, - .mux_add_data = GPMC_MUX_AD, - .wait_pin = 0, -}; - -static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) +static void omap2_onenand_calc_async_timings(struct gpmc_timings *t, + struct gpmc_settings *s) { struct gpmc_device_timings dev_t; const int t_cer = 15; @@ -86,7 +73,7 @@ static void omap2_onenand_calc_async_timings(struct gpmc_timings *t) dev_t.t_wpl = t_wpl * 1000; dev_t.t_wph = t_wph * 1000; - gpmc_calc_timings(t, &onenand_async, &dev_t); + gpmc_calc_timings(t, s, &dev_t); } static void omap2_onenand_set_async_mode(void __iomem *onenand_base) @@ -156,6 +143,7 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, } static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, + struct gpmc_settings *s, unsigned int flags, int freq) { @@ -236,10 +224,10 @@ static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, memset(&dev_t, 0, sizeof(dev_t)); if (onenand_flags & ONENAND_FLAG_SYNCREAD) - onenand_sync.sync_read = true; + s->sync_read = true; if (onenand_flags & ONENAND_FLAG_SYNCWRITE) { - onenand_sync.sync_write = true; - onenand_sync.burst_write = true; + s->sync_write = true; + s->burst_write = true; } else { dev_t.t_avdp_w = max(t_avdp, t_cer) * 1000; dev_t.t_wpl = t_wpl * 1000; @@ -262,12 +250,13 @@ static void omap2_onenand_calc_sync_timings(struct gpmc_timings *t, dev_t.cyc_aavdh_oe = 1; dev_t.t_rdyo = t_rdyo * 1000 + min_gpmc_clk_period; - gpmc_calc_timings(t, &onenand_sync, &dev_t); + gpmc_calc_timings(t, s, &dev_t); } static int omap2_onenand_setup_async(void __iomem *onenand_base) { struct gpmc_timings t; + struct gpmc_settings s; int ret; /* @@ -275,23 +264,23 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) * omap2_onenand_set_async_mode() to work to detect the onenand * supported clock rate for the sync timings. */ - gpmc_read_settings_dt(gpmc_onenand_data->of_node, &onenand_async); - if (onenand_async.sync_read || onenand_async.sync_write) { - if (onenand_async.sync_write) + gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s); + if (s.sync_read || s.sync_write) { + if (s.sync_write) gpmc_onenand_data->flags |= ONENAND_SYNC_READWRITE; else gpmc_onenand_data->flags |= ONENAND_SYNC_READ; - onenand_async.sync_read = false; + s.sync_read = false; } - onenand_async.sync_write = true; - omap2_onenand_calc_async_timings(&t); + s.sync_write = true; + omap2_onenand_calc_async_timings(&t, &s); - ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_async); + ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &s); if (ret < 0) return ret; - ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &onenand_async); + ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &s); if (ret < 0) return ret; @@ -304,6 +293,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) { int ret, freq = *freq_ptr; struct gpmc_timings t; + struct gpmc_settings s; if (!freq) { /* Very first call freq is not known */ @@ -313,15 +303,15 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) set_onenand_cfg(onenand_base); } - gpmc_read_settings_dt(gpmc_onenand_data->of_node, &onenand_sync); + gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s); - omap2_onenand_calc_sync_timings(&t, gpmc_onenand_data->flags, freq); + omap2_onenand_calc_sync_timings(&t, &s, gpmc_onenand_data->flags, freq); - ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &onenand_sync); + ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &s); if (ret < 0) return ret; - ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &onenand_sync); + ret = gpmc_cs_set_timings(gpmc_onenand_data->cs, &t, &s); if (ret < 0) return ret;