diff mbox

bank-width property of gpmc child nodes

Message ID 20171103072335.jwphezhpj62s27tn@lenoch (mailing list archive)
State New, archived
Headers show

Commit Message

Ladislav Michl Nov. 3, 2017, 7:23 a.m. UTC
Hi there,

gpmc code checks for bank-width property which reassigns device_width
previously setup in gpmc_read_settings_dt using 'gpmc,device-width'

Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt
does not mention 'bank-width' at all and 'gpmc,device-width' is marked
as optional.

gpmc_cs_program_settings bails out with -EINVAL when this property is
not set.

Is there something I'm missing (historical context) of following patch
and fixing documentation is okay?

	ladis

8<-----------------------
Subject: [PATCH] memory: omap-gpmc: Remove bank-width DT property

'bank-width' is undocumented and unneeded as value of device_width is
previously read from documented 'gpmc,device-width' property.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 drivers/memory/omap-gpmc.c | 8 --------
 1 file changed, 8 deletions(-)

Comments

Ladislav Michl Nov. 3, 2017, 8:37 a.m. UTC | #1
On Fri, Nov 03, 2017 at 08:23:35AM +0100, Ladislav Michl wrote:
> Hi there,
> 
> gpmc code checks for bank-width property which reassigns device_width
> previously setup in gpmc_read_settings_dt using 'gpmc,device-width'
> 
> Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt
> does not mention 'bank-width' at all and 'gpmc,device-width' is marked
> as optional.
> 
> gpmc_cs_program_settings bails out with -EINVAL when this property is
> not set.
> 
> Is there something I'm missing (historical context) of following patch
> and fixing documentation is okay?

I'm sorry, grep, my old friend for not using you more carefully.

A couple of boards are using:
bank-width = <2>;
gpmc,device-width = <1>;

eek?

> 	ladis
> 
> 8<-----------------------
> Subject: [PATCH] memory: omap-gpmc: Remove bank-width DT property
> 
> 'bank-width' is undocumented and unneeded as value of device_width is
> previously read from documented 'gpmc,device-width' property.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>  drivers/memory/omap-gpmc.c | 8 --------
>  1 file changed, 8 deletions(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index 24b584b74d84..9322ff1791df 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2151,14 +2151,6 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>  		/* disable write protect */
>  		gpmc_configure(GPMC_CONFIG_WP, 0);
>  		gpmc_s.device_nand = true;
> -	} else {
> -		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",
> -				child);
> -			goto err;
> -		}
>  	}
>  
>  	/* Reserve wait pin if it is required and valid */
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Roger Quadros Nov. 3, 2017, 11:40 a.m. UTC | #2
Hi,

On 03/11/17 10:37, Ladislav Michl wrote:
> On Fri, Nov 03, 2017 at 08:23:35AM +0100, Ladislav Michl wrote:
>> Hi there,
>>
>> gpmc code checks for bank-width property which reassigns device_width
>> previously setup in gpmc_read_settings_dt using 'gpmc,device-width'
>>
>> Documentation/devicetree/bindings/memory-controllers/omap-gpmc.txt
>> does not mention 'bank-width' at all and 'gpmc,device-width' is marked
>> as optional.
>>
>> gpmc_cs_program_settings bails out with -EINVAL when this property is
>> not set.
>>
>> Is there something I'm missing (historical context) of following patch
>> and fixing documentation is okay?
> 
> I'm sorry, grep, my old friend for not using you more carefully.
> 
> A couple of boards are using:
> bank-width = <2>;
> gpmc,device-width = <1>;
> 
> eek?

bank-width is required property in
Documentation/devicetree/bindings/mtd/gpmc-nor.txt

gpmc,device-width is required property in
Documentation/devicetree/bindings/mtd/gpmc-onenand.txt

nand-bus-width is optional property in
Documentation/devicetree/bindings/mtd/gpmc-nand.txt

We could make some improvements. e.g.

- Make nand-bus-width, mandatory for gpmc-nand in Doc.
- Make bank-width mandatory only for NOR in code.
- Make gpmc,device-width mandatory for all devices
except NOR and NAND.
diff mbox

Patch

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 24b584b74d84..9322ff1791df 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2151,14 +2151,6 @@  static int gpmc_probe_generic_child(struct platform_device *pdev,
 		/* disable write protect */
 		gpmc_configure(GPMC_CONFIG_WP, 0);
 		gpmc_s.device_nand = true;
-	} else {
-		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",
-				child);
-			goto err;
-		}
 	}
 
 	/* Reserve wait pin if it is required and valid */