diff mbox

memory: omap-gpmc: Make 'bank-width' property optional

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

Commit Message

Ladislav Michl Nov. 3, 2017, 1:43 p.m. UTC
On Fri, Nov 03, 2017 at 03:30:45PM +0200, Roger Quadros wrote:
> On 03/11/17 15:16, Ladislav Michl wrote:
[snip]
> > Actually this comment is still wrong (and thus commit message).
> > Documentation/devicetree/bindings/net/gpmc-eth.txt
> > Ethernet is using this as well...
> 
> Oh :(. Ideally it shouldn't have been the case. But damage is already done.
> 
> I think we should still fix up the gpmc-eth binding document to use gpmc,device-width there.
> And continue to support in code anybody already using bank-width for ethernet.

Agreed, following version with decreased controversy.
(note all this is only to get OneNAND merge ready :))

8<-----------------------
Subject: [PATCH] memory: omap-gpmc: Make 'bank-width' property optional

Some devices are using 'gpmc,device-width' property to configure device
width, so fail on missing 'bank-width' only if this property was previously
unassigned.

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

Comments

Roger Quadros Nov. 6, 2017, 8:33 a.m. UTC | #1
Hi,

On 03/11/17 15:43, Ladislav Michl wrote:
> On Fri, Nov 03, 2017 at 03:30:45PM +0200, Roger Quadros wrote:
>> On 03/11/17 15:16, Ladislav Michl wrote:
> [snip]
>>> Actually this comment is still wrong (and thus commit message).
>>> Documentation/devicetree/bindings/net/gpmc-eth.txt
>>> Ethernet is using this as well...
>>
>> Oh :(. Ideally it shouldn't have been the case. But damage is already done.
>>
>> I think we should still fix up the gpmc-eth binding document to use gpmc,device-width there.
>> And continue to support in code anybody already using bank-width for ethernet.
> 
> Agreed, following version with decreased controversy.
> (note all this is only to get OneNAND merge ready :))
> 
> 8<-----------------------
> Subject: [PATCH] memory: omap-gpmc: Make 'bank-width' property optional
> 
> Some devices are using 'gpmc,device-width' property to configure device
> width, so fail on missing 'bank-width' only if this property was previously
> unassigned.

I would make this something like

"We need either 'bank-width' or 'gpmc,device-width'. Error out only if
both are missing. As 'bank-width' is mostly used for NOR devices and
all other devices must use 'gpmc,device-width' update the error message
accordingly".


Update the error
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> ---
>  drivers/memory/omap-gpmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index ff73f2ad468c..f79e78b16a48 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2159,7 +2159,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>  	} else {
>  		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);

As bank-width property is optional, we should update the error message to complain that
'gpmc,device-width' is missing.

>  			goto err;
>
diff mbox

Patch

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index ff73f2ad468c..f79e78b16a48 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2159,7 +2159,7 @@  static int gpmc_probe_generic_child(struct platform_device *pdev,
 	} else {
 		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;