From patchwork Sun Oct 15 23:19:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10007325 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 27B4460230 for ; Sun, 15 Oct 2017 23:19:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 160472239C for ; Sun, 15 Oct 2017 23:19:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 093BA251F4; Sun, 15 Oct 2017 23:19:19 +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 7953A2239C for ; Sun, 15 Oct 2017 23:19:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbdJOXTR (ORCPT ); Sun, 15 Oct 2017 19:19: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 S1751235AbdJOXTR (ORCPT ); Sun, 15 Oct 2017 19:19:17 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990398AbdJOXTPkb0mK (ORCPT ); Mon, 16 Oct 2017 01:19:15 +0200 Date: Mon, 16 Oct 2017 01:19:14 +0200 From: Ladislav Michl To: linux-omap@vger.kernel.org Cc: Roger Quadros , Tony Lindgren Subject: [PATCH 04/11] ARM: OMAP2+: gpmc-onenand: Simplify flags handling Message-ID: <20171015231914.4o2ws4ncicbekclc@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 Currently gpmc_onenand_data->flags is initially set to zero, thus we can stop using this field at all and rely on DT settings only. Signed-off-by: Ladislav Michl --- arch/arm/mach-omap2/gpmc-onenand.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c index 9f3828cc2734..5bdca62fdd54 100644 --- a/arch/arm/mach-omap2/gpmc-onenand.c +++ b/arch/arm/mach-omap2/gpmc-onenand.c @@ -137,7 +137,6 @@ static int omap2_onenand_get_freq(struct omap_onenand_platform_data *cfg, static int omap2_onenand_calc_sync_timings(struct gpmc_timings *t, struct gpmc_settings *s, - unsigned int flags, int freq) { struct gpmc_device_timings dev_t; @@ -149,11 +148,6 @@ static int omap2_onenand_calc_sync_timings(struct gpmc_timings *t, int min_gpmc_clk_period, t_ces, t_avds, t_avdh, t_ach, t_aavdh, t_rdyo; int div, gpmc_clk_ns, latency; - if (flags & ONENAND_SYNC_READ) - onenand_flags = ONENAND_FLAG_SYNCREAD; - else if (flags & ONENAND_SYNC_READWRITE) - onenand_flags = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; - switch (freq) { case 104: min_gpmc_clk_period = 9600; /* 104 MHz */ @@ -253,10 +247,9 @@ static int omap2_onenand_setup_async(void __iomem *onenand_base) */ gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s); if (s.sync_read || s.sync_write) { + onenand_flags |= ONENAND_FLAG_SYNCREAD; if (s.sync_write) - gpmc_onenand_data->flags |= ONENAND_SYNC_READWRITE; - else - gpmc_onenand_data->flags |= ONENAND_SYNC_READ; + onenand_flags |= ONENAND_FLAG_SYNCWRITE; s.sync_read = false; } @@ -291,9 +284,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) gpmc_read_settings_dt(gpmc_onenand_data->of_node, &s); - latency = omap2_onenand_calc_sync_timings(&t, &s, - gpmc_onenand_data->flags, - freq); + latency = omap2_onenand_calc_sync_timings(&t, &s, freq); ret = gpmc_cs_program_settings(gpmc_onenand_data->cs, &s); if (ret < 0) @@ -313,7 +304,7 @@ static int omap2_onenand_setup_sync(void __iomem *onenand_base, int *freq_ptr) static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) { struct device *dev = &gpmc_onenand_device.dev; - unsigned l = ONENAND_SYNC_READ | ONENAND_SYNC_READWRITE; + unsigned l = ONENAND_FLAG_SYNCREAD | ONENAND_FLAG_SYNCWRITE; int ret; ret = omap2_onenand_setup_async(onenand_base); @@ -322,7 +313,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) return ret; } - if (!(gpmc_onenand_data->flags & l)) + if (!(onenand_flags & l)) return 0; ret = omap2_onenand_setup_sync(onenand_base, freq_ptr); @@ -340,13 +331,6 @@ int gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) gpmc_onenand_data->onenand_setup = gpmc_onenand_setup; gpmc_onenand_device.dev.platform_data = gpmc_onenand_data; - if (cpu_is_omap24xx() && - (gpmc_onenand_data->flags & ONENAND_SYNC_READWRITE)) { - dev_warn(dev, "OneNAND using only SYNC_READ on 24xx\n"); - gpmc_onenand_data->flags &= ~ONENAND_SYNC_READWRITE; - gpmc_onenand_data->flags |= ONENAND_SYNC_READ; - } - if (cpu_is_omap34xx()) gpmc_onenand_data->flags |= ONENAND_IN_OMAP34XX; else