Skip to contentSkip to conversation

musb: sunxi: Use base address from device tree

PATCH New Chen-Yu Tsai 4 participants 6 messages Dec 12, 2017 – Dec 19, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 musb: sunxi: Use base address from device tree

Now that the musb sunxi glue driver is completely device model / device tree driven, we should use the base address from the device tree, instead of hard-coding it in the source code.

Fixes 3a61b080acee ("musb: sunxi: switch to the device model")
---
 drivers/usb/musb-new/sunxi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb-new/sunxi.c +2 -2
index 7ee44ea91900..ae6a54118cd1 100644
@@ -318,7 +318,7 @@ static int musb_usb_probe(struct udevice *dev)
 
 #ifdef CONFIG_USB_MUSB_HOST
 	host->host = musb_init_controller(&musb_plat, NULL,
-					  (void *)SUNXI_USB0_BASE);
+					 dev_read_addr_ptr(dev));
 	if (!host->host)
 		return -EIO;
 
@@ -326,7 +326,7 @@ static int musb_usb_probe(struct udevice *dev)
 	if (!ret)
 		printf("Allwinner mUSB OTG (Host)\n");
 #else
-	ret = musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE);
+	ret = musb_register(&musb_plat, NULL, dev_read_addr_ptr(dev));
 	if (!ret)
 		printf("Allwinner mUSB OTG (Peripheral)\n");
 #endif
Signature · 1 line
2.15.0
#1 lore raw

PATCH 1/1 musb: sunxi: Use base address from device tree

Quoted 6 lines · Chen-Yu Tsai

Now that the musb sunxi glue driver is completely device model / device tree driven, we should use the base address from the device tree, instead of hard-coding it in the source code.

Fixes 3a61b080acee ("musb: sunxi: switch to the device model")

We should probably do the same for the phy.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171212/78624ae3/attachment.sig>
#2 lore raw

PATCH 1/1 musb: sunxi: Use base address from device tree

In reply to Chen-Yu Tsai
Quoted 15 lines · Chen-Yu Tsai

Now that the musb sunxi glue driver is completely device model / device tree driven, we should use the base address from the device tree, instead of hard-coding it in the source code.

Fixes 3a61b080acee ("musb: sunxi: switch to the device model")
---
 drivers/usb/musb-new/sunxi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb-new/sunxi.c +0 -0
index 7ee44ea91900..ae6a54118cd1 100644

drivers/usb/musb-new/sunxi.c static int musb_usb_probe(struct udevice *dev) · line 321

Quoted 5 lines
drivers/usb/musb-new/sunxi.c +1 -1
@@ -318,7 +318,7 @@ static int musb_usb_probe(struct udevice *dev)
 
 #ifdef CONFIG_USB_MUSB_HOST
 	host->host = musb_init_controller(&musb_plat, NULL,
-					  (void *)SUNXI_USB0_BASE);
+					 dev_read_addr_ptr(dev));

What happens if dev_read_addr_ptr() returns some non-standard value?

Quoted 13 lines
drivers/usb/musb-new/sunxi.c +1 -1
 	if (!host->host)
 		return -EIO;
 
@@ -326,7 +326,7 @@ static int musb_usb_probe(struct udevice *dev)
 	if (!ret)
 		printf("Allwinner mUSB OTG (Host)\n");
 #else
-	ret = musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE);
+	ret = musb_register(&musb_plat, NULL, dev_read_addr_ptr(dev));
 	if (!ret)
 		printf("Allwinner mUSB OTG (Peripheral)\n");
 #endif
Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH 1/1 musb: sunxi: Use base address from device tree

Quoted 17 lines · Marek Vasut
Quoted 16 lines · Chen-Yu Tsai

Now that the musb sunxi glue driver is completely device model / device tree driven, we should use the base address from the device tree, instead of hard-coding it in the source code.

Fixes 3a61b080acee ("musb: sunxi: switch to the device model")
---
 drivers/usb/musb-new/sunxi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb-new/sunxi.c +0 -0
index 7ee44ea91900..ae6a54118cd1 100644
@@ -318,7 +318,7 @@ static int musb_usb_probe(struct udevice *dev)
 
Quoted 6 lines

drivers/usb/musb-new/sunxi.c static int musb_usb_probe(struct udevice *dev) · line 321

Quoted 4 lines
drivers/usb/musb-new/sunxi.c +1 -1
 #ifdef CONFIG_USB_MUSB_HOST
      host->host = musb_init_controller(&musb_plat, NULL,
-                                       (void *)SUNXI_USB0_BASE);
+                                      dev_read_addr_ptr(dev));

What happens if dev_read_addr_ptr() returns some non-standard value?

You mean like an error value? That would likely be a signal that the device tree is broken, like a missing property or invalid value, or a corrupt device tree. In all cases I think blowing up should be an expected result for a device tree driven driver?

ChenYu

Quoted 19 lines
Quoted 6 lines
drivers/usb/musb-new/sunxi.c +0 -0
      if (!host->host)
              return -EIO;
 

drivers/usb/musb-new/sunxi.c static int musb_usb_probe(struct udevice *dev) · line 332

Quoted 8 lines
drivers/usb/musb-new/sunxi.c +1 -1
@@ -326,7 +326,7 @@ static int musb_usb_probe(struct udevice *dev)
      if (!ret)
              printf("Allwinner mUSB OTG (Host)\n");
 #else
-     ret = musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE);
+     ret = musb_register(&musb_plat, NULL, dev_read_addr_ptr(dev));
      if (!ret)
              printf("Allwinner mUSB OTG (Peripheral)\n");
 #endif

--
Best regards,
Marek Vasut

#4 lore raw

PATCH 1/1 musb: sunxi: Use base address from device tree

Quoted 25 lines · Chen-Yu Tsai
Quoted 17 lines · Marek Vasut
Quoted 16 lines · Chen-Yu Tsai

Now that the musb sunxi glue driver is completely device model / device tree driven, we should use the base address from the device tree, instead of hard-coding it in the source code.

Fixes 3a61b080acee ("musb: sunxi: switch to the device model")
---
 drivers/usb/musb-new/sunxi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb-new/sunxi.c +0 -0
index 7ee44ea91900..ae6a54118cd1 100644
@@ -318,7 +318,7 @@ static int musb_usb_probe(struct udevice *dev)
 
Quoted 6 lines

drivers/usb/musb-new/sunxi.c static int musb_usb_probe(struct udevice *dev) · line 321

Quoted 4 lines
drivers/usb/musb-new/sunxi.c +1 -1
 #ifdef CONFIG_USB_MUSB_HOST
      host->host = musb_init_controller(&musb_plat, NULL,
-                                       (void *)SUNXI_USB0_BASE);
+                                      dev_read_addr_ptr(dev));

What happens if dev_read_addr_ptr() returns some non-standard value?

Quoted 4 lines

You mean like an error value? That would likely be a signal that the device tree is broken, like a missing property or invalid value, or a corrupt device tree. In all cases I think blowing up should be an expected result for a device tree driven driver?

What about handling the errors instead ? :)

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH 1/1 musb: sunxi: Use base address from device tree

In reply to Chen-Yu Tsai
Quoted 9 lines · Chen-Yu Tsai

Now that the musb sunxi glue driver is completely device model / device tree driven, we should use the base address from the device tree, instead of hard-coding it in the source code.

Fixes 3a61b080acee ("musb: sunxi: switch to the device model")
---
 drivers/usb/musb-new/sunxi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)