sunxi: Enable both ehci and otg in host mode on various boards
Subsystems (3)
cover sunxi: Enable both ehci and otg in host mode on various boards
Hi All,
Here is a small series enabling the combined use of ehci + musb-otg on more sunxi boards. This applies on top of my large series for making this possible posted earlier.
As said before I believe it is best if all the sunxi bits of that series go upstream through u-boot-sunxi/master, the same applies for these 3.
Regards,
Hans
PATCH 1/3 sunxi: musb: Improve output during probing
When we return an error the usb core will log a message, so in this case do not print a newline, instead print ": " after our identifier as a seperator between our identifier and the error message logged by the core.
--- drivers/usb/musb-new/sunxi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/usb/musb-new/sunxi.c +8 -3
@@ -301,21 +301,26 @@ int musb_usb_probe(struct udevice *dev) {struct musb_host_data *host =dev_get_priv (dev);struct usb_bus_priv *priv =dev_get_uclass_priv (dev); +int ret; priv->desc_before_addr = true; +printf ("MUSB OTG" ); +if (!host->host) { host->host =musb_init_controller (&musb_plat,NULL , (void *)SUNXI_USB0_BASE );if (!host->host) { -printf ("Failed to init the controller\n" ); +printf (": " );return -EIO ; } } -printf ("MUSB OTG in host-mode\n" ); + ret =musb_lowlevel_init (host); + +printf ((ret ==0 ) ?"\n" :": " ); -return musb_lowlevel_init (host); +return ret; }int musb_usb_remove (struct udevice *dev)
Signature · 1 line
2.4.3
PATCH 1/3 sunxi: musb: Improve output during probing
Quoted 3 lines · Hans de Goede
When we return an error the usb core will log a message, so in this case do not print a newline, instead print ": " after our identifier as a seperator between our identifier and the error message logged by the core.
"separator".
This seems like a lot of fragile faff second guessing what some other component does (and is going to do in the future). Can we not have musb take over init time logging completely or just live with:
MUSB OTG: Failed host init
Flux capacitor has reversed polarity
which I suppose is roughly how it appears today?
Quoted 40 lines
Signed-off-by Hans de Goede <[email protected]>--- drivers/usb/musb-new/sunxi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/usb/musb-new/sunxi.c +8
-3@@ -301,21 +301,26 @@ int musb_usb_probe(struct udevice *dev) {struct musb_host_data *host =dev_get_priv (dev);struct usb_bus_priv *priv =dev_get_uclass_priv (dev); +int ret; priv->desc_before_addr = true; +printf ("MUSB OTG" ); +if (!host->host) { host->host =musb_init_controller (&musb_plat,NULL , (void *)SUNXI_USB0_BASE );if (!host->host) { -printf ("Failed to init the controller\n" ); +printf (": " );return -EIO ; } } -printf ("MUSB OTG in host-mode\n" ); + ret =musb_lowlevel_init (host); + +printf ((ret ==0 ) ?"\n" :": " ); -return musb_lowlevel_init (host); +return ret; }int musb_usb_remove (struct udevice *dev)
PATCH 1/3 sunxi: musb: Improve output during probing
Hi,
Quoted 6 lines · Ian Campbell
Quoted 3 lines · Hans de Goede
When we return an error the usb core will log a message, so in this case do not print a newline, instead print ": " after our identifier as a seperator between our identifier and the error message logged by the core.
"separator".
Fixed in my personal tree.
Quoted 2 lines
This seems like a lot of fragile faff second guessing what some other component does (and is going to do in the future).
Right, but if that other component changes all we end up with is less then optimal console output it will not really break anything.
Can we not have musb
Quoted 1 line
take over init time logging completely
The problem is that all the other usb host drivers also depend on this behavior of the usb core.
Quoted 4 lines
or just live with:
MUSB OTG: Failed host init
Flux capacitor has reversed polarity
which I suppose is roughly how it appears today?
I do not like just living with it, I believe a certain amount of spit and polish is important, even for text messages like these.
I would not have written this if I did not consider the current situation ugly :)
How about the following:
Subject: [PATCH 1/3] sunxi: musb: Improve output during probing
When we return an error the usb core will log a message, so in this case do not print anything.
drivers/usb/musb-new/sunxi.c +6 -5
@@ -301,21 +301,22 @@ int musb_usb_probe(struct udevice *dev) {struct musb_host_data *host =dev_get_priv (dev);struct usb_bus_priv *priv =dev_get_uclass_priv (dev); +int ret; priv->desc_before_addr = true;if (!host->host) { host->host =musb_init_controller (&musb_plat,NULL , (void *)SUNXI_USB0_BASE ); -if (!host->host) { -printf ("Failed to init the controller\n" ); +if (!host->host)return -EIO ; - } } -printf ("MUSB OTG in host-mode\n" ); + ret =musb_lowlevel_init (host); +if (ret ==0 ) +printf ("MUSB OTG\n" ); -return musb_lowlevel_init (host); +return ret; }int musb_usb_remove (struct udevice *dev)
This is exactly what the other host drivers do, only print something on success, and leave printing errors up to the caller.
Regards,
Hans
PATCH 1/3 sunxi: musb: Improve output during probing
Quoted 9 lines · Hans de Goede
How about the following:
Subject: [PATCH 1/3] sunxi: musb: Improve output during probing
When we return an error the usb core will log a message, so in this case do not print anything.
Signed-off-by Hans de Goede <[email protected]>
Much better, especially given the below.
drivers/usb/musb-new/sunxi.c int musb_usb_probe(struct udevice *dev) · line 304
Quoted 8 lines
drivers/usb/musb-new/sunxi.c +1
-0@@ -301,21 +301,22 @@ int musb_usb_probe(struct udevice *dev) {struct musb_host_data *host =dev_get_priv (dev);struct usb_bus_priv *priv =dev_get_uclass_priv (dev); +int ret;
Wrong sort of w/space I suspect.
[...]
Quoted 3 lines
This is exactly what the other host drivers do, only print something on success, and leave printing errors up to the caller.
If all others do this I think doing this is the best compromise too.
Ian.
PATCH 1/3 sunxi: musb: Improve output during probing
Hi,
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Hans de Goede
How about the following:
Subject: [PATCH 1/3] sunxi: musb: Improve output during probing
Quoted 8 lines
Quoted 4 lines
When we return an error the usb core will log a message, so in this case do not print anything.
Signed-off-by Hans de Goede <[email protected]>Much better, especially given the below.
Acked-by Ian Campbell <[email protected]>
Thanks.
Quoted 11 lines
drivers/usb/musb-new/sunxi.c int musb_usb_probe(struct udevice *dev) · line 304
Quoted 9 lines
drivers/usb/musb-new/sunxi.c +1
-0@@ -301,21 +301,22 @@ int musb_usb_probe(struct udevice *dev) {struct musb_host_data *host =dev_get_priv (dev);struct usb_bus_priv *priv =dev_get_uclass_priv (dev); +int ret;Wrong sort of w/space I suspect.
Nope, this comes from me copy and pasting the diff output from a xterm, I just double checked and the whitespace is as it should be in my tree :)
Regards,
Hans
PATCH 2/3 sunxi: musb: Stop treating not having a vbus-det gpio as an error
In reply to Hans de GoedeOn some boards the otg is wired up in host-only mode in this case we have no vbus-det gpio.
Stop logging an error from sunxi_usb_phy_vbus_detect() in this case, and stop treating sunxi_usb_phy_vbus_detect() returning a negative errno, as if a charger is plugged into the otg port.
--- arch/arm/cpu/armv7/sunxi/usb_phy.c | 4 +--- drivers/usb/musb-new/sunxi.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/sunxi/usb_phy.c +1 -3
@@ -237,10 +237,8 @@ int sunxi_usb_phy_vbus_detect(int index)struct sunxi_usb_phy *phy = &sunxi_usb_phy[index];int err, retries =3 ; -if (phy->gpio_vbus_det <0 ) { -eprintf ("Error: invalid vbus detection pin\n" ); +if (phy->gpio_vbus_det <0 )return phy->gpio_vbus_det; - } err =gpio_get_value (phy->gpio_vbus_det);/*
drivers/usb/musb-new/sunxi.c +1 -1
@@ -208,7 +208,7 @@ static int sunxi_musb_enable(struct musb *musb)if (is_host_enabled (musb)) { ret =sunxi_usb_phy_vbus_detect (0 ); -if (ret) { +if (ret ==1 ) {printf ("A charger is plugged into the OTG: " );return -ENODEV ; }
Signature · 1 line
2.4.3
PATCH 2/3 sunxi: musb: Stop treating not having a vbus-det gpio as an error
Quoted 8 lines · Hans de Goede
On some boards the otg is wired up in host-only mode in this case we have no vbus-det gpio.
Stop logging an error from
sunxi_usb_phy_vbus_detect()in this case, and stop treatingsunxi_usb_phy_vbus_detect()returning a negative errno, as if a charger is plugged into the otg port.Signed-off-by Hans de Goede <[email protected]>
PATCH 3/3 sunxi: Enable both ehci and otg in host mode on various boards
In reply to Hans de GoedeNow that the device-model port of the musb mode makes it possible, enable both the ehci and oth in host mode on boards where the otg is wired up in host only mode, either via an usb-a receptacle or via an usb <-> sata converter.
--- configs/CSQ_CS908_defconfig | 4 +++- configs/Mele_A1000G_quad_defconfig | 4 +++- configs/Mini-X_defconfig | 5 ++++- configs/ba10_tv_box_defconfig | 5 ++++- 4 files changed, 14 insertions(+), 4 deletions(-)
configs/CSQ_CS908_defconfig +3 -1
@@ -6,7 +6,9 @@ CONFIG_USB1_VBUS_PIN="" CONFIG_USB2_VBUS_PIN="" CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31s-cs908" CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC" +CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC" CONFIG_ETH_DESIGNWARE=y CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3300 +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_SUNXI=y
configs/Mele_A1000G_quad_defconfig +3 -1
@@ -16,9 +16,11 @@ CONFIG_USB1_VBUS_PIN="PC27" CONFIG_USB2_VBUS_PIN="" CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-mele-a1000g-quad" CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC" +CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC" CONFIG_ETH_DESIGNWARE=y CONFIG_AXP221_DCDC1_VOLT=3300 CONFIG_AXP221_DLDO1_VOLT=3300 CONFIG_AXP221_DLDO4_VOLT=3300 CONFIG_AXP221_ALDO1_VOLT=3300 +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_SUNXI=y
configs/Mini-X_defconfig +4 -1
@@ -3,4 +3,7 @@ CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN4I=y CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-mini-xplus" CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,USB_EHCI" +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_SUNXI=y +CONFIG_USB0_VBUS_PIN="PB9"
configs/ba10_tv_box_defconfig +4 -1
@@ -6,4 +6,7 @@ CONFIG_DRAM_EMR1=4 CONFIG_USB2_VBUS_PIN="PH12" CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-ba10-tvbox" CONFIG_SPL=y -CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC,USB_EHCI" +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_EMAC" +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_MUSB_SUNXI=y +CONFIG_USB0_VBUS_PIN="PB9"
Signature · 1 line
2.4.3
PATCH 3/3 sunxi: Enable both ehci and otg in host mode on various boards
Quoted 2 lines · Hans de Goede
Now that the device-model port of the musb mode makes it possible, enable both the ehci and oth in host mode on boards where the otg is wired up in
"otg"?
Quoted 4 lines
host only mode, either via an usb-a receptacle or via an usb <-> sata converter.
Signed-off-by Hans de Goede <[email protected]>
PATCH 3/3 sunxi: Enable both ehci and otg in host mode on various boards
Hi,
Quoted 5 lines · Ian Campbell
Quoted 2 lines · Hans de Goede
Now that the device-model port of the musb mode makes it possible, enable both the ehci and oth in host mode on boards where the otg is wired up in
"otg"?
Replaced with "musb" in my personal tree.
Regards,
Hans
cover sunxi: Enable both ehci and otg in host mode on various boards
In reply to Hans de GoedeQuoted 10 lines · Hans de Goede
Hi All,
Here is a small series enabling the combined use of ehci + musb-otg on more sunxi boards. This applies on top of my large series for making this possible posted earlier.
As said before I believe it is best if all the sunxi bits of that series go upstream through u-boot-sunxi/master, the same applies for these 3.
Regards,
Series is
Thanks!
Best regards,
Marek Vasut
cover sunxi: Enable both ehci and otg in host mode on various boards
Hi,
Quoted 7 lines · Marek Vasut
Quoted 6 lines · Hans de Goede
Hi All,
Here is a small series enabling the combined use of ehci + musb-otg on more sunxi boards. This applies on top of my large series for making this possible posted earlier.
Quoted 8 lines
Quoted 4 lines
As said before I believe it is best if all the sunxi bits of that series go upstream through u-boot-sunxi/master, the same applies for these 3.
Regards,
Series is
Reviewed-by Marek Vasut <[email protected]>
I assume this only applies to these 3, or do you mean both the original series adding musb device-model support as well as these 3?
Regards,
Hans
cover sunxi: Enable both ehci and otg in host mode on various boards
Quoted 1 line · Hans de Goede
Hi,
Hi!
Quoted 11 lines · Marek Vasut
Quoted 10 lines · Hans de Goede
Quoted 9 lines
Hi All,
Here is a small series enabling the combined use of ehci + musb-otg on more sunxi boards. This applies on top of my large series for making this possible posted earlier.
As said before I believe it is best if all the sunxi bits of that series go upstream through u-boot-sunxi/master, the same applies for these 3.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Regards,
Series is
Reviewed-by Marek Vasut <[email protected]>I assume this only applies to these 3, or do you mean both the original series adding musb device-model support as well as these 3?
I mean these three ;-)
Best regards,
Marek Vasut