From patchwork Fri Nov 3 13:09:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10039993 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 161606032D for ; Fri, 3 Nov 2017 13:09:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15AC2295CD for ; Fri, 3 Nov 2017 13:09:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A9AB295D8; Fri, 3 Nov 2017 13:09:16 +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 63913295CD for ; Fri, 3 Nov 2017 13:09:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756036AbdKCNJN (ORCPT ); Fri, 3 Nov 2017 09:09:13 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:57758 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755859AbdKCNJM (ORCPT ); Fri, 3 Nov 2017 09:09:12 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990740AbdKCNJKcAR65 (ORCPT ); Fri, 3 Nov 2017 14:09:10 +0100 Date: Fri, 3 Nov 2017 14:09:09 +0100 From: Ladislav Michl To: Roger Quadros Cc: linux-omap@vger.kernel.org, Tony Lindgren Subject: Re: [PATCH] memory: omap-gpmc: Make 'bank-width' property optional Message-ID: <20171103130909.ug35yc7ovjgkmahs@lenoch> References: <20171103095706.ws5itsccxe6pwv7d@lenoch> <97cba115-caff-322d-7059-5c7fa5d1ece1@ti.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <97cba115-caff-322d-7059-5c7fa5d1ece1@ti.com> 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 On Fri, Nov 03, 2017 at 02:15:21PM +0200, Roger Quadros wrote: > On 03/11/17 11:57, Ladislav Michl wrote: > > Value of device_width is previously read from documented > > 'gpmc,device-width' property. For now leave 'bank-width' > > as a fallback for older DT blobs. > > bank-width is mandatory for NOR devices only. > > > > > Signed-off-by: Ladislav Michl > > --- > > drivers/memory/omap-gpmc.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c > > index 24b584b74d84..3dc9706e1f15 100644 > > --- a/drivers/memory/omap-gpmc.c > > +++ b/drivers/memory/omap-gpmc.c > > @@ -2152,10 +2152,15 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, > > gpmc_configure(GPMC_CONFIG_WP, 0); > > gpmc_s.device_nand = true; > > } else { > > + /* > > + * Some older DT blobs are missing device-width property, > > + * so try to read bank-width and fail if neither works. > > + */ > > I'd get rid of the above comment and rather say, NOR devices use bank-width > to specify device width. > > > ret = of_property_read_u32(child, "bank-width", > > &gpmc_s.device_width); > > - if (ret < 0) { > > - dev_err(&pdev->dev, "%pOF has no 'bank-width' property\n", > > + if (ret < 0 && !gpmc_s.device_width) { > > + dev_err(&pdev->dev, > > + "%pOF has no 'gpmc,device-width' property\n", > > child); > > goto err; > > } > > > > I'm ok with the approach. > We could also update the DT binding documentation to say > "'gpmc,device-width' is mandatory if device is not NOR or NAND type. > For NOR, bank-width is used and for NAND nand-bus-width is used to figure > out the device-width" Will update documentaton in separate patch. > And update the patch commit log accordingly. Something like the following? 8<----------------------- Subject: [PATCH] memory: omap-gpmc: Make 'bank-width' NOR mandatory only Only NOR devices are using 'bank-width' property to configure device width. Note that code does not do exactly that - it fails only if 'bank-width' is missing and device width was not configured previously using 'gpmc,device-width'. Signed-off-by: Ladislav Michl --- drivers/memory/omap-gpmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c index ff73f2ad468c..26cc447662f0 100644 --- a/drivers/memory/omap-gpmc.c +++ b/drivers/memory/omap-gpmc.c @@ -2157,9 +2157,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, gpmc_configure(GPMC_CONFIG_WP, 0); gpmc_s.device_nand = true; } else { + /* NOR devices use bank-width to specify device width */ ret = of_property_read_u32(child, "bank-width", &gpmc_s.device_width); - if (ret < 0) { + if (ret < 0 && !gpmc_s.device_width) { dev_err(&pdev->dev, "%pOF has no 'bank-width' property\n", child); goto err;