Allwinner H6 USB3 support
Samuel Holland
maintainerv2 cover Allwinner H6 USB3 support
This series adds PHY and XHCI driver support for the USB3 controller found in the Allwinner H6 SoC. It has been tested and working on both boards enabled in patch 4, although some users experience issues[1].
[1]: https://lists.denx.de/pipermail/u-boot/2021-February/440767.html
Changes from v1:
- Dropped patches 1-2 (already in u-boot-sunxi/master) and rebased
- Added Andre's Reviewed-by on the PHY driver
- Fixed error handling in xhci_pci_probe
Samuel Holland (4):
phy: sun50i-usb3: Add a driver for the H6 USB3 PHY
usb: xhci-pci: Move reset logic out of XHCI core
usb: xhci-dwc3: Add support for clocks/resets
configs: Enable USB3 on Allwinner H6 boards
configs/orangepi_3_defconfig | 5 + configs/pine_h64_defconfig | 5 + drivers/phy/allwinner/Kconfig | 8 ++ drivers/phy/allwinner/Makefile | 1 + drivers/phy/allwinner/phy-sun50i-usb3.c | 171 ++++++++++++++++++++++++ drivers/usb/host/xhci-dwc3.c | 56 ++++++++ drivers/usb/host/xhci-mem.c | 2 - drivers/usb/host/xhci-pci.c | 51 ++++++- drivers/usb/host/xhci.c | 35 ----- include/usb/xhci.h | 2 - 10 files changed, 293 insertions(+), 43 deletions(-) create mode 100644 drivers/phy/allwinner/phy-sun50i-usb3.c
Signature · 1 line
2.26.2
Samuel Holland
maintainerPATCH v2 1/4 phy: sun50i-usb3: Add a driver for the H6 USB3 PHY
This driver is needed for XHCI to work on the Allwinner H6 SoC. The driver is copied from Linux v5.10.
--- drivers/phy/allwinner/Kconfig | 8 ++ drivers/phy/allwinner/Makefile | 1 + drivers/phy/allwinner/phy-sun50i-usb3.c | 171 ++++++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 drivers/phy/allwinner/phy-sun50i-usb3.c
drivers/phy/allwinner/Kconfig +8 -0
@@ -11,3 +11,11 @@ config PHY_SUN4I_USB This driver controls the entire USB PHY block, both the USB OTG parts, as well as the 2 regular USB 2 host PHYs. + +config PHY_SUN50I_USB3 + bool "Allwinner sun50i USB3 PHY driver" + depends on ARCH_SUNXI + select PHY + help + Enable this to support the USB3 transceiver that is part of + Allwinner sun50i SoCs.
drivers/phy/allwinner/Makefile +1 -0
@@ -4,3 +4,4 @@ # obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o +obj-$(CONFIG_PHY_SUN50I_USB3) += phy-sun50i-usb3.o
drivers/phy/allwinner/phy-sun50i-usb3.c new file +171 -0
171 lines not on this page · raw message
Signature · 1 line
2.26.2
Samuel Holland
maintainerPATCH v2 2/4 usb: xhci-pci: Move reset logic out of XHCI core
In reply to Samuel HollandResetting an XHCI controller inside xhci_register undoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before calling xhci_register.
The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call reset_free if xhci_register failed.
--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)
drivers/usb/host/xhci-mem.c +0 -2
@@ -180,8 +180,6 @@ void xhci_cleanup(struct xhci_ctrl *ctrl)xhci_free_virt_devices (ctrl);free (ctrl->erst.entries);free (ctrl->dcbaa); -if (reset_valid (&ctrl->reset)) -reset_free (&ctrl->reset);memset (ctrl,'\0' ,sizeof (struct xhci_ctrl )); }
drivers/usb/host/xhci-pci.c +47 -4
81 lines not on this page · raw message
drivers/usb/host/xhci.c +0 -35
@@ -188,37 +188,6 @@ static int xhci_start(struct xhci_hcor *hcor)return ret; } -#if CONFIG_IS_ENABLED (DM_USB ) -/** -* Resets XHCI Hardware -* -* @param ctrl pointer to host controller -* @return 0 if OK, or a negative error code. -*/ -static int xhci_reset_hw (struct xhci_ctrl *ctrl) -{ -int ret; - - ret =reset_get_by_index (ctrl->dev,0 , &ctrl->reset); -if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { -dev_err (ctrl->dev,"failed to get reset\n" ); -return ret; - } - -if (reset_valid (&ctrl->reset)) { - ret =reset_assert (&ctrl->reset); -if (ret) -return ret; - - ret =reset_deassert (&ctrl->reset); -if (ret) -return ret; - } - -return 0 ; -} -#endif -/** * Resets the XHCI Controller *
@@ -1534,10 +1503,6 @@ int xhci_register(struct udevice *dev, struct xhci_hccr *hccr, ctrl->dev = dev; - ret =xhci_reset_hw (ctrl); -if (ret) - goto err; -/* * XHCI needs to issue a Address device command to setup * proper device context structures, before it can interact
include/usb/xhci.h +0 -2
@@ -17,7 +17,6 @@#define HOST_XHCI_H_ #include <phys2bus.h> -#include <reset.h> #include <asm/types.h> #include <asm/cache.h> #include <asm/io.h>
@@ -1200,7 +1199,6 @@ struct xhci_ctrl {#if CONFIG_IS_ENABLED (DM_USB )struct udevice *dev;#endif -struct reset_ctl reset;struct xhci_hccr *hccr;/* R/O registers, not need for volatile */ struct xhci_hcor *hcor;struct xhci_doorbell_array *dba;
Signature · 1 line
2.26.2
PATCH v2 2/4 usb: xhci-pci: Move reset logic out of XHCI core
On Sat, 17 Apr 2021 09:20:57 -0500
Samuel Holland <[email protected]> wrote:
Hi,
Quoted 13 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
Quoted 4 lines
This also fixes a failure to call
reset_freeifxhci_registerfailed.Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>
From my research it looks like no other board should be affected by the change, and they have been no reports from the people I asked a few weeks ago.
I'd say we should merge it, to expose it to a wider audience, and keep an eye on bug reports.
Cheers,
Andre
Quoted 181 lines
--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)drivers/usb/host/xhci-mem.c +0
-2@@ -180,8 +180,6 @@ void xhci_cleanup(struct xhci_ctrl *ctrl)xhci_free_virt_devices (ctrl);free (ctrl->erst.entries);free (ctrl->dcbaa); -if (reset_valid (&ctrl->reset)) -reset_free (&ctrl->reset);memset (ctrl,'\0' ,sizeof (struct xhci_ctrl )); }drivers/usb/host/xhci-pci.c +47
-4@@ -10,9 +10,14 @@#include <init.h> #include <log.h> #include <pci.h> +#include <reset.h> #include <usb.h> #include <usb/xhci.h> +struct xhci_pci_plat { +struct reset_ctl reset; +}; +static int xhci_pci_init (struct udevice *dev,struct xhci_hccr **ret_hccr,struct xhci_hcor **ret_hcor) {@@ -45,15 +50,53 @@ static int xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,static int xhci_pci_probe (struct udevice *dev) { + struct xhci_pci_plat = dev_get_plat(dev);struct xhci_hccr *hccr;struct xhci_hcor *hcor;int ret; + ret =reset_get_by_index (dev,0 , &plat->reset); +if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { +dev_err (dev,"failed to get reset\n" ); +return ret; + } + +if (reset_valid (&plat->reset)) { + ret =reset_assert (&plat->reset); +if (ret) + goto err_reset; + + ret =reset_deassert (&plat->reset); +if (ret) + goto err_reset; + } + ret =xhci_pci_init (dev, &hccr, &hcor);if (ret) -return ret; + goto err_reset; + + ret =xhci_register (dev, hccr, hcor); +if (ret) + goto err_reset; + +return 0 ; + +err_reset: +if (reset_valid (&plat->reset)) +reset_free (&plat->reset); + +return ret; +} + +static int xhci_pci_remove (struct udevice *dev) +{ + struct xhci_pci_plat = dev_get_plat(dev); -return xhci_register (dev, hccr, hcor); +xhci_deregister (dev); +if (reset_valid (&plat->reset)) +reset_free (&plat->reset); + +return 0 ; }static const struct udevice_id xhci_pci_ids[] = {@@ -65,10 +108,10 @@ U_BOOT_DRIVER(xhci_pci) = { .name = "xhci_pci", .id = UCLASS_USB, .probe = xhci_pci_probe, - .remove = xhci_deregister, + .remove = xhci_pci_remove, .of_match = xhci_pci_ids, .ops = &xhci_usb_ops, - .plat_auto = sizeof(struct usb_plat), + .plat_auto = sizeof(struct xhci_pci_plat), .priv_auto = sizeof(struct xhci_ctrl), .flags = DM_FLAG_OS_PREPARE | DM_FLAG_ALLOC_PRIV_DMA, };drivers/usb/host/xhci.c +0
-35@@ -188,37 +188,6 @@ static int xhci_start(struct xhci_hcor *hcor)return ret; } -#if CONFIG_IS_ENABLED (DM_USB ) -/** -* Resets XHCI Hardware -* -* @param ctrl pointer to host controller -* @return 0 if OK, or a negative error code. -*/ -static int xhci_reset_hw (struct xhci_ctrl *ctrl) -{ -int ret; - - ret =reset_get_by_index (ctrl->dev,0 , &ctrl->reset); -if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { -dev_err (ctrl->dev,"failed to get reset\n" ); -return ret; - } - -if (reset_valid (&ctrl->reset)) { - ret =reset_assert (&ctrl->reset); -if (ret) -return ret; - - ret =reset_deassert (&ctrl->reset); -if (ret) -return ret; - } - -return 0 ; -} -#endif -/** * Resets the XHCI Controller * @@ -1534,10 +1503,6 @@ int xhci_register(struct udevice *dev, struct xhci_hccr *hccr, ctrl->dev = dev; - ret =xhci_reset_hw (ctrl); -if (ret) - goto err; -/* * XHCI needs to issue a Address device command to setup * proper device context structures, before it can interact include/usb/xhci.h +0
-2@@ -17,7 +17,6 @@#define HOST_XHCI_H_ #include <phys2bus.h> -#include <reset.h> #include <asm/types.h> #include <asm/cache.h> #include <asm/io.h> @@ -1200,7 +1199,6 @@ struct xhci_ctrl {#if CONFIG_IS_ENABLED (DM_USB )struct udevice *dev;#endif -struct reset_ctl reset;struct xhci_hccr *hccr;/* R/O registers, not need for volatile */ struct xhci_hcor *hcor;struct xhci_doorbell_array *dba;
Samuel Holland
maintainerPATCH v2 2/4 usb: xhci-pci: Move reset logic out of XHCI core
Quoted 23 lines · Andre Przywara
On Sat, 17 Apr 2021 09:20:57 -0500
Samuel Holland <[email protected]> wrote:Hi,
Quoted 13 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
Quoted 4 lines
This also fixes a failure to call
reset_freeifxhci_registerfailed.Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>
Quoted 7 lines
From my research it looks like no other board should be affected by the change, and they have been no reports from the people I asked a few weeks ago.
I'd say we should merge it, to expose it to a wider audience, and keep an eye on bug reports.Acked-by Andre Przywara <[email protected]>
Thanks!
Note that after a pending device tree change[1], this patch won't be strictly necessary for this platform anymore, since the DWC3 node will no longer have a resets property. However I still think it's a good change to make.
Regards,
Samuel
[1]:
https://lore.kernel.org/linux-sunxi/20210421042834.27309-3-samuel at sholland.org/
Quoted 185 lines
Cheers,
AndreQuoted 181 lines
--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)drivers/usb/host/xhci-mem.c +0
-2@@ -180,8 +180,6 @@ void xhci_cleanup(struct xhci_ctrl *ctrl)xhci_free_virt_devices (ctrl);free (ctrl->erst.entries);free (ctrl->dcbaa); -if (reset_valid (&ctrl->reset)) -reset_free (&ctrl->reset);memset (ctrl,'\0' ,sizeof (struct xhci_ctrl )); }drivers/usb/host/xhci-pci.c +47
-4@@ -10,9 +10,14 @@#include <init.h> #include <log.h> #include <pci.h> +#include <reset.h> #include <usb.h> #include <usb/xhci.h> +struct xhci_pci_plat { +struct reset_ctl reset; +}; +static int xhci_pci_init (struct udevice *dev,struct xhci_hccr **ret_hccr,struct xhci_hcor **ret_hcor) {@@ -45,15 +50,53 @@ static int xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,static int xhci_pci_probe (struct udevice *dev) { + struct xhci_pci_plat = dev_get_plat(dev);struct xhci_hccr *hccr;struct xhci_hcor *hcor;int ret; + ret =reset_get_by_index (dev,0 , &plat->reset); +if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { +dev_err (dev,"failed to get reset\n" ); +return ret; + } + +if (reset_valid (&plat->reset)) { + ret =reset_assert (&plat->reset); +if (ret) + goto err_reset; + + ret =reset_deassert (&plat->reset); +if (ret) + goto err_reset; + } + ret =xhci_pci_init (dev, &hccr, &hcor);if (ret) -return ret; + goto err_reset; + + ret =xhci_register (dev, hccr, hcor); +if (ret) + goto err_reset; + +return 0 ; + +err_reset: +if (reset_valid (&plat->reset)) +reset_free (&plat->reset); + +return ret; +} + +static int xhci_pci_remove (struct udevice *dev) +{ + struct xhci_pci_plat = dev_get_plat(dev); -return xhci_register (dev, hccr, hcor); +xhci_deregister (dev); +if (reset_valid (&plat->reset)) +reset_free (&plat->reset); + +return 0 ; }static const struct udevice_id xhci_pci_ids[] = {@@ -65,10 +108,10 @@ U_BOOT_DRIVER(xhci_pci) = { .name = "xhci_pci", .id = UCLASS_USB, .probe = xhci_pci_probe, - .remove = xhci_deregister, + .remove = xhci_pci_remove, .of_match = xhci_pci_ids, .ops = &xhci_usb_ops, - .plat_auto = sizeof(struct usb_plat), + .plat_auto = sizeof(struct xhci_pci_plat), .priv_auto = sizeof(struct xhci_ctrl), .flags = DM_FLAG_OS_PREPARE | DM_FLAG_ALLOC_PRIV_DMA, };drivers/usb/host/xhci.c +0
-35@@ -188,37 +188,6 @@ static int xhci_start(struct xhci_hcor *hcor)return ret; } -#if CONFIG_IS_ENABLED (DM_USB ) -/** -* Resets XHCI Hardware -* -* @param ctrl pointer to host controller -* @return 0 if OK, or a negative error code. -*/ -static int xhci_reset_hw (struct xhci_ctrl *ctrl) -{ -int ret; - - ret =reset_get_by_index (ctrl->dev,0 , &ctrl->reset); -if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { -dev_err (ctrl->dev,"failed to get reset\n" ); -return ret; - } - -if (reset_valid (&ctrl->reset)) { - ret =reset_assert (&ctrl->reset); -if (ret) -return ret; - - ret =reset_deassert (&ctrl->reset); -if (ret) -return ret; - } - -return 0 ; -} -#endif -/** * Resets the XHCI Controller * @@ -1534,10 +1503,6 @@ int xhci_register(struct udevice *dev, struct xhci_hccr *hccr, ctrl->dev = dev; - ret =xhci_reset_hw (ctrl); -if (ret) - goto err; -/* * XHCI needs to issue a Address device command to setup * proper device context structures, before it can interact include/usb/xhci.h +0
-2@@ -17,7 +17,6 @@#define HOST_XHCI_H_ #include <phys2bus.h> -#include <reset.h> #include <asm/types.h> #include <asm/cache.h> #include <asm/io.h> @@ -1200,7 +1199,6 @@ struct xhci_ctrl {#if CONFIG_IS_ENABLED (DM_USB )struct udevice *dev;#endif -struct reset_ctl reset;struct xhci_hccr *hccr;/* R/O registers, not need for volatile */ struct xhci_hcor *hcor;struct xhci_doorbell_array *dba;
PATCH v2 2/4 usb: xhci-pci: Move reset logic out of XHCI core
On Wed, 21 Apr 2021 08:36:26 -0500
Samuel Holland <[email protected]> wrote:
Hi,
Quoted 30 lines · Andre Przywara
Quoted 29 lines
On Sat, 17 Apr 2021 09:20:57 -0500
Samuel Holland <[email protected]> wrote:Hi,
Quoted 13 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
Quoted 4 lines
This also fixes a failure to call
reset_freeifxhci_registerfailed.Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>From my research it looks like no other board should be affected by the change, and they have been no reports from the people I asked a few weeks ago.
I'd say we should merge it, to expose it to a wider audience, and keep an eye on bug reports.
Quoted 8 lines
Quoted 1 line
Acked-by Andre Przywara <[email protected]>Thanks!
Note that after a pending device tree change[1], this patch won't be strictly necessary for this platform anymore, since the DWC3 node will no longer have a resets property. However I still think it's a good change to make.
Yes, I saw that, but those DT changes won't make it into U-Boot for a while, so we should go ahead with those patches anyway. This would also allow us the get the PHY driver tested already.
And I think we need another U-Boot patch, to teach it about the new(ly used) compatible string? I don't find "allwinner,sun50i-h6-dwc3" anywhere in the current U-Boot code.
Cheers,
Andre
Quoted 190 lines
[1]:
https://lore.kernel.org/linux-sunxi/20210421042834.27309-3-samuel at sholland.org/Quoted 185 lines
Cheers,
AndreQuoted 181 lines
--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)drivers/usb/host/xhci-mem.c +0
-2@@ -180,8 +180,6 @@ void xhci_cleanup(struct xhci_ctrl *ctrl)xhci_free_virt_devices (ctrl);free (ctrl->erst.entries);free (ctrl->dcbaa); -if (reset_valid (&ctrl->reset)) -reset_free (&ctrl->reset);memset (ctrl,'\0' ,sizeof (struct xhci_ctrl )); }drivers/usb/host/xhci-pci.c +47
-4@@ -10,9 +10,14 @@#include <init.h> #include <log.h> #include <pci.h> +#include <reset.h> #include <usb.h> #include <usb/xhci.h> +struct xhci_pci_plat { +struct reset_ctl reset; +}; +static int xhci_pci_init (struct udevice *dev,struct xhci_hccr **ret_hccr,struct xhci_hcor **ret_hcor) {@@ -45,15 +50,53 @@ static int xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr,static int xhci_pci_probe (struct udevice *dev) { + struct xhci_pci_plat = dev_get_plat(dev);struct xhci_hccr *hccr;struct xhci_hcor *hcor;int ret; + ret =reset_get_by_index (dev,0 , &plat->reset); +if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { +dev_err (dev,"failed to get reset\n" ); +return ret; + } + +if (reset_valid (&plat->reset)) { + ret =reset_assert (&plat->reset); +if (ret) + goto err_reset; + + ret =reset_deassert (&plat->reset); +if (ret) + goto err_reset; + } + ret =xhci_pci_init (dev, &hccr, &hcor);if (ret) -return ret; + goto err_reset; + + ret =xhci_register (dev, hccr, hcor); +if (ret) + goto err_reset; + +return 0 ; + +err_reset: +if (reset_valid (&plat->reset)) +reset_free (&plat->reset); + +return ret; +} + +static int xhci_pci_remove (struct udevice *dev) +{ + struct xhci_pci_plat = dev_get_plat(dev); -return xhci_register (dev, hccr, hcor); +xhci_deregister (dev); +if (reset_valid (&plat->reset)) +reset_free (&plat->reset); + +return 0 ; }static const struct udevice_id xhci_pci_ids[] = {@@ -65,10 +108,10 @@ U_BOOT_DRIVER(xhci_pci) = { .name = "xhci_pci", .id = UCLASS_USB, .probe = xhci_pci_probe, - .remove = xhci_deregister, + .remove = xhci_pci_remove, .of_match = xhci_pci_ids, .ops = &xhci_usb_ops, - .plat_auto = sizeof(struct usb_plat), + .plat_auto = sizeof(struct xhci_pci_plat), .priv_auto = sizeof(struct xhci_ctrl), .flags = DM_FLAG_OS_PREPARE | DM_FLAG_ALLOC_PRIV_DMA, };drivers/usb/host/xhci.c +0
-35@@ -188,37 +188,6 @@ static int xhci_start(struct xhci_hcor *hcor)return ret; } -#if CONFIG_IS_ENABLED (DM_USB ) -/** -* Resets XHCI Hardware -* -* @param ctrl pointer to host controller -* @return 0 if OK, or a negative error code. -*/ -static int xhci_reset_hw (struct xhci_ctrl *ctrl) -{ -int ret; - - ret =reset_get_by_index (ctrl->dev,0 , &ctrl->reset); -if (ret && ret != -ENOENT && ret != -ENOTSUPP ) { -dev_err (ctrl->dev,"failed to get reset\n" ); -return ret; - } - -if (reset_valid (&ctrl->reset)) { - ret =reset_assert (&ctrl->reset); -if (ret) -return ret; - - ret =reset_deassert (&ctrl->reset); -if (ret) -return ret; - } - -return 0 ; -} -#endif -/** * Resets the XHCI Controller * @@ -1534,10 +1503,6 @@ int xhci_register(struct udevice *dev, struct xhci_hccr *hccr, ctrl->dev = dev; - ret =xhci_reset_hw (ctrl); -if (ret) - goto err; -/* * XHCI needs to issue a Address device command to setup * proper device context structures, before it can interact include/usb/xhci.h +0
-2@@ -17,7 +17,6 @@#define HOST_XHCI_H_ #include <phys2bus.h> -#include <reset.h> #include <asm/types.h> #include <asm/cache.h> #include <asm/io.h> @@ -1200,7 +1199,6 @@ struct xhci_ctrl {#if CONFIG_IS_ENABLED (DM_USB )struct udevice *dev;#endif -struct reset_ctl reset;struct xhci_hccr *hccr;/* R/O registers, not need for volatile */ struct xhci_hcor *hcor;struct xhci_doorbell_array *dba;
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
In reply to Samuel HollandQuoted 16 lines · Samuel Holland
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.
Quoted 9 lines
Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
Quoted 27 lines · Bin Meng
Quoted 16 lines · Samuel Holland
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Quoted 9 lines
Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>
So shall we apply this whole thing for 2021.10 ?
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Bin Meng
Quoted 25 lines · Samuel Holland
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)
Quoted 3 lines
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>So shall we apply this whole thing for 2021.10 ?
Yes. Andre wanted to get this in 2021.07 which is too late.
Regards,
Bin
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
On Mon, 5 Jul 2021 16:38:29 +0800
Bin Meng <[email protected]> wrote:
Hi,
Quoted 30 lines · Marek Vasut
Quoted 29 lines · Bin Meng
Quoted 27 lines · Samuel Holland
Quoted 25 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>So shall we apply this whole thing for 2021.10 ?
Yes. Andre wanted to get this in 2021.07 which is too late.
Ah, sorry, I didn't mean into this release, but into the 2021.10 merge window. I was preparing the sunxi patches for the PR, so stumbled upon this.
So I'd be grateful if you could push this into the MW, I can then finish up the sunxi side of things (patch 4/4).
Thanks!
Andre
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
Hi Andre,
Quoted 38 lines · Andre Przywara
On Mon, 5 Jul 2021 16:38:29 +0800
Bin Meng <[email protected]> wrote:Hi,
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Bin Meng
Quoted 28 lines · Samuel Holland
Quoted 16 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Quoted 9 lines
Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)Reviewed-by Bin Meng <[email protected]>
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So shall we apply this whole thing for 2021.10 ?
Yes. Andre wanted to get this in 2021.07 which is too late.
Ah, sorry, I didn't mean into this release, but into the 2021.10 merge window. I was preparing the sunxi patches for the PR, so stumbled upon this.
Ah, 2021.01 is not a problem.
Quoted 3 lines
So I'd be grateful if you could push this into the MW, I can then finish up the sunxi side of things (patch 4/4).
Marek can pick up this soon.
Regards,
Bin
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
Quoted 49 lines · Bin Meng
Hi Andre,
Quoted 38 lines · Andre Przywara
On Mon, 5 Jul 2021 16:38:29 +0800
Bin Meng <[email protected]> wrote:Hi,
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Bin Meng
Quoted 28 lines · Samuel Holland
Quoted 16 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Quoted 9 lines
Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)Reviewed-by Bin Meng <[email protected]>Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So shall we apply this whole thing for 2021.10 ?
Yes. Andre wanted to get this in 2021.07 which is too late.
Ah, sorry, I didn't mean into this release, but into the 2021.10 merge window. I was preparing the sunxi patches for the PR, so stumbled upon this.
Quoted 7 lines
Ah, 2021.01 is not a problem.
Quoted 3 lines
So I'd be grateful if you could push this into the MW, I can then finish up the sunxi side of things (patch 4/4).
Marek can pick up this soon.
U-Boot CI seems to fail on this, please recheck that.
Re: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
On Mon, 5 Jul 2021 12:45:59 +0200
Marek Vasut <[email protected]> wrote:
Hi,
Quoted 53 lines · Bin Meng
Quoted 52 lines
Hi Andre,
Quoted 38 lines · Andre Przywara
On Mon, 5 Jul 2021 16:38:29 +0800
Bin Meng <[email protected]> wrote:Hi,
Quoted 32 lines · Marek Vasut
Quoted 31 lines · Bin Meng
Quoted 28 lines · Samuel Holland
Quoted 16 lines
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Quoted 9 lines
Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)Reviewed-by Bin Meng <[email protected]>Quoted 7 lines
Quoted 3 lines
Quoted 1 line
So shall we apply this whole thing for 2021.10 ?
Yes. Andre wanted to get this in 2021.07 which is too late.
Ah, sorry, I didn't mean into this release, but into the 2021.10 merge window. I was preparing the sunxi patches for the PR, so stumbled upon this.
Ah, 2021.01 is not a problem.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
So I'd be grateful if you could push this into the MW, I can then finish up the sunxi side of things (patch 4/4).
Marek can pick up this soon.
U-Boot CI seems to fail on this, please recheck that.
Ouch, thanks for the heads up!
It's xhci-pci.c failing, as used by the RPi4, for instance.
I will send a v3 ASAP.
Cheers,
Andre
Marek Vasut
AppliedRe: [PATCH v2 2/4] usb: xhci-pci: Move reset logic out of XHCI core
In reply to Bin MengQuoted 30 lines · Bin Meng
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Bin Meng
Quoted 25 lines · Samuel Holland
Resetting an XHCI controller inside
xhci_registerundoes any register setup performed by the platform driver. And at least on the Allwinner H6, resetting the XHCI controller also resets the PHY, which prevents the controller from working. That means the controller must be taken out of reset before initializing the PHY, which must be done before callingxhci_register.The logic in the XHCI core was added to support the Raspberry Pi 4 (although this was not mentioned in the commit log!), which uses the xhci-pci platform driver. Move the reset logic to the platform driver, where it belongs, and where it cannot interfere with other platform drivers.
This also fixes a failure to call
reset_freeifxhci_registerfailed.Fixes 0b80371b350e ("usb: xhci: Add reset controller support")Signed-off-by Samuel Holland <[email protected]>--- drivers/usb/host/xhci-mem.c | 2 -- drivers/usb/host/xhci-pci.c | 51 ++++++++++++++++++++++++++++++++++--- drivers/usb/host/xhci.c | 35 ------------------------- include/usb/xhci.h | 2 -- 4 files changed, 47 insertions(+), 43 deletions(-)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>So shall we apply this whole thing for 2021.10 ?
Yes. Andre wanted to get this in 2021.07 which is too late.
Applied to usb/next, thanks
Samuel Holland
maintainerPATCH v2 3/4 usb: xhci-dwc3: Add support for clocks/resets
In reply to Samuel HollandSome platforms, like the Allwinner H6, do not have a separate glue layer around the dwc3. Instead, they rely on the clocks/resets/phys referenced from the dwc3 DT node itself. Add support for enabling the clocks/resets referenced from the dwc3 DT node.
--- drivers/usb/host/xhci-dwc3.c | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
drivers/usb/host/xhci-dwc3.c +56 -0
@@ -7,10 +7,12 @@* Author: Ramneek Mehresh<[email protected]> */ +#include <clk.h> #include <common.h> #include <dm.h> #include <generic-phy.h> #include <log.h> +#include <reset.h> #include <usb.h> #include <dwc3-uboot.h> #include <linux/delay.h>
@@ -21,7 +23,9 @@#include <linux/usb/otg.h> struct xhci_dwc3_plat { +struct clk_bulk clks;struct phy_bulk phys; +struct reset_ctl_bulk resets; };void dwc3_set_mode (struct dwc3 *dwc3_reg,u32 mode)
@@ -111,6 +115,46 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val) }#if CONFIG_IS_ENABLED (DM_USB ) +static int xhci_dwc3_reset_init (struct udevice *dev, +struct xhci_dwc3_plat *plat) +{ +int ret; + + ret =reset_get_bulk (dev, &plat->resets); +if (ret == -ENOTSUPP || ret == -ENOENT ) +return 0 ; +else if (ret) +return ret; + + ret =reset_deassert_bulk (&plat->resets); +if (ret) { +reset_release_bulk (&plat->resets); +return ret; + } + +return 0 ; +} + +static int xhci_dwc3_clk_init (struct udevice *dev, +struct xhci_dwc3_plat *plat) +{ +int ret; + + ret =clk_get_bulk (dev, &plat->clks); +if (ret == -ENOSYS || ret == -ENOENT ) +return 0 ; +if (ret) +return ret; + + ret =clk_enable_bulk (&plat->clks); +if (ret) { +clk_release_bulk (&plat->clks); +return ret; + } + +return 0 ; +} +static int xhci_dwc3_probe (struct udevice *dev) {struct xhci_hcor *hcor;
@@ -122,6 +166,14 @@ static int xhci_dwc3_probe(struct udevice *dev)u32 reg;int ret; + ret =xhci_dwc3_reset_init (dev, plat); +if (ret) +return ret; + + ret =xhci_dwc3_clk_init (dev, plat); +if (ret) +return ret; + hccr = (struct xhci_hccr *)((uintptr_t )dev_remap_addr (dev)); hcor = (struct xhci_hcor *)((uintptr_t )hccr +HC_LENGTH (xhci_readl (&(hccr)->cr_capbase)));
@@ -171,6 +223,10 @@ static int xhci_dwc3_remove(struct udevice *dev)dwc3_shutdown_phy (dev, &plat->phys); +clk_release_bulk (&plat->clks); + +reset_release_bulk (&plat->resets); +return xhci_deregister (dev); }
Signature · 1 line
2.26.2
PATCH v2 3/4 usb: xhci-dwc3: Add support for clocks/resets
Quoted 6 lines · On Sat, 17 Apr 2021 09:20:58 -0500 Samuel Holland <[email protected]> wrote:
Some platforms, like the Allwinner H6, do not have a separate glue layer around the dwc3. Instead, they rely on the clocks/resets/phys referenced from the dwc3 DT node itself. Add support for enabling the clocks/resets referenced from the dwc3 DT node.
Signed-off-by Samuel Holland <[email protected]>
Looks good, and even if they are redundancies with the other kind of binding, it should not hurt to have it in, to cover our DTs.
Cheers,
Andre
Quoted 104 lines
--- drivers/usb/host/xhci-dwc3.c | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)drivers/usb/host/xhci-dwc3.c +56
-0@@ -7,10 +7,12 @@* Author: Ramneek Mehresh<[email protected]> */ +#include <clk.h> #include <common.h> #include <dm.h> #include <generic-phy.h> #include <log.h> +#include <reset.h> #include <usb.h> #include <dwc3-uboot.h> #include <linux/delay.h> @@ -21,7 +23,9 @@#include <linux/usb/otg.h> struct xhci_dwc3_plat { +struct clk_bulk clks;struct phy_bulk phys; +struct reset_ctl_bulk resets; };void dwc3_set_mode (struct dwc3 *dwc3_reg,u32 mode)@@ -111,6 +115,46 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val) }#if CONFIG_IS_ENABLED (DM_USB ) +static int xhci_dwc3_reset_init (struct udevice *dev, +struct xhci_dwc3_plat *plat) +{ +int ret; + + ret =reset_get_bulk (dev, &plat->resets); +if (ret == -ENOTSUPP || ret == -ENOENT ) +return 0 ; +else if (ret) +return ret; + + ret =reset_deassert_bulk (&plat->resets); +if (ret) { +reset_release_bulk (&plat->resets); +return ret; + } + +return 0 ; +} + +static int xhci_dwc3_clk_init (struct udevice *dev, +struct xhci_dwc3_plat *plat) +{ +int ret; + + ret =clk_get_bulk (dev, &plat->clks); +if (ret == -ENOSYS || ret == -ENOENT ) +return 0 ; +if (ret) +return ret; + + ret =clk_enable_bulk (&plat->clks); +if (ret) { +clk_release_bulk (&plat->clks); +return ret; + } + +return 0 ; +} +static int xhci_dwc3_probe (struct udevice *dev) {struct xhci_hcor *hcor;@@ -122,6 +166,14 @@ static int xhci_dwc3_probe(struct udevice *dev)u32 reg;int ret; + ret =xhci_dwc3_reset_init (dev, plat); +if (ret) +return ret; + + ret =xhci_dwc3_clk_init (dev, plat); +if (ret) +return ret; + hccr = (struct xhci_hccr *)((uintptr_t )dev_remap_addr (dev)); hcor = (struct xhci_hcor *)((uintptr_t )hccr +HC_LENGTH (xhci_readl (&(hccr)->cr_capbase)));@@ -171,6 +223,10 @@ static int xhci_dwc3_remove(struct udevice *dev)dwc3_shutdown_phy (dev, &plat->phys); +clk_release_bulk (&plat->clks); + +reset_release_bulk (&plat->resets); +return xhci_deregister (dev); }
Samuel Holland
maintainerPATCH v2 4/4 configs: Enable USB3 on Allwinner H6 boards
In reply to Samuel HollandPine H64 and Orange Pi 3 both provide a USB3 type A port. Enable it in U-Boot.
--- configs/orangepi_3_defconfig | 5 +++++ configs/pine_h64_defconfig | 5 +++++ 2 files changed, 10 insertions(+)
configs/orangepi_3_defconfig +5 -0
@@ -8,5 +8,10 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_BLUETOOTH_DT_DEVICE_FIXUP="brcm,bcm4345c5" CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-orangepi-3" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_PHY_SUN50I_USB3=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set
configs/pine_h64_defconfig +5 -0
@@ -12,5 +12,10 @@ CONFIG_SPL_SPI_SUNXI=y CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-pine-h64" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SUN8I_EMAC=y +CONFIG_PHY_SUN50I_USB3=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set
Signature · 1 line
2.26.2
PATCH v2 4/4 configs: Enable USB3 on Allwinner H6 boards
Quoted 2 lines · On Sat, 17 Apr 2021 09:20:59 -0500 Samuel Holland <[email protected]> wrote:
Pine H64 and Orange Pi 3 both provide a USB3 type A port. Enable it in U-Boot.
Any reason to enable it only for those two boards? Just because those are the H6 devices you have access to?
I wonder if we should enable this in Kconfig for all H6 boards? Or at least reduce the number of lines in defconfig, by adding select's in Kconfig?
Also: this doesn't work out of the box for the Pine H64, right? Because the official DT keeps the dwc3 and usb3phy nodes disabled.
I was planing on sending a DT fix to the kernel.
But with those nodes enabled it indeed works for me, and adds another usable USB port to those H6 boards.
Cheers,
Andre
Quoted 37 lines
Signed-off-by Samuel Holland <[email protected]>--- configs/orangepi_3_defconfig | 5 +++++ configs/pine_h64_defconfig | 5 +++++ 2 files changed, 10 insertions(+)configs/orangepi_3_defconfig +5
-0@@ -8,5 +8,10 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2 CONFIG_BLUETOOTH_DT_DEVICE_FIXUP="brcm,bcm4345c5" CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-orangepi-3" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_PHY_SUN50I_USB3=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not setconfigs/pine_h64_defconfig +5
-0@@ -12,5 +12,10 @@ CONFIG_SPL_SPI_SUNXI=y CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-pine-h64" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SUN8I_EMAC=y +CONFIG_PHY_SUN50I_USB3=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y +CONFIG_USB_DWC3=y +# CONFIG_USB_DWC3_GADGET is not set
v2 cover Allwinner H6 USB3 support
In reply to Samuel HollandOn Sat, 17 Apr 2021 09:20:55 -0500
Samuel Holland <[email protected]> wrote:
Hi,
Quoted 2 lines
This series adds PHY and XHCI driver support for the USB3 controller found in the Allwinner H6 SoC.
Thanks for the update!
Quoted 4 lines
It has been tested and working on both
boards enabled in patch 4, although some users experience issues[1].[1]: https://lists.denx.de/pipermail/u-boot/2021-February/440767.html
So I could not reproduce those issues either, it works for me fine on my Pine-H64. I'd suggest we merge those patches, and check for more reports from more users.
Bin, Marek: can you push patches 1, 2 and 3 to the USB tree, to get them into the current merge window, still? I would then push 4/4 (pending possible fixes) once the first three reached mainline.
And btw: the first two patches of the original v1 series (adding the sunxi clocks and reset bits) have been merged into master last week already.
Thanks,
Andre
Quoted 24 lines
Changes from v1:
- Dropped patches 1-2 (already in u-boot-sunxi/master) and rebased
- Added Andre's Reviewed-by on the PHY driver
- Fixed error handling inxhci_pci_probeSamuel Holland (4):
phy: sun50i-usb3: Add a driver for the H6 USB3 PHY
usb: xhci-pci: Move reset logic out of XHCI core
usb: xhci-dwc3: Add support for clocks/resets
configs: Enable USB3 on Allwinner H6 boardsconfigs/orangepi_3_defconfig | 5 + configs/pine_h64_defconfig | 5 + drivers/phy/allwinner/Kconfig | 8 ++ drivers/phy/allwinner/Makefile | 1 + drivers/phy/allwinner/phy-sun50i-usb3.c | 171 ++++++++++++++++++++++++ drivers/usb/host/xhci-dwc3.c | 56 ++++++++ drivers/usb/host/xhci-mem.c | 2 - drivers/usb/host/xhci-pci.c | 51 ++++++- drivers/usb/host/xhci.c | 35 ----- include/usb/xhci.h | 2 - 10 files changed, 293 insertions(+), 43 deletions(-) create mode 100644 drivers/phy/allwinner/phy-sun50i-usb3.c
v2 cover Allwinner H6 USB3 support
Quoted 19 lines · Andre Przywara
On Sat, 17 Apr 2021 09:20:55 -0500
Samuel Holland <[email protected]> wrote:Hi,
Quoted 2 lines
This series adds PHY and XHCI driver support for the USB3 controller found in the Allwinner H6 SoC.
Thanks for the update!
Quoted 4 lines
It has been tested and working on both
boards enabled in patch 4, although some users experience issues[1].[1]: https://lists.denx.de/pipermail/u-boot/2021-February/440767.html
So I could not reproduce those issues either, it works for me fine on my Pine-H64. I'd suggest we merge those patches, and check for more reports from more users.
Quoted 7 lines
Bin, Marek: can you push patches 1, 2 and 3 to the USB tree, to get them into the current merge window, still? I would then push 4/4 (pending possible fixes) once the first three reached mainline.
And btw: the first two patches of the original v1 series (adding the sunxi clocks and reset bits) have been merged into master last week already.
I will pick these once I get ack from Bin.
On Wed, 21 Apr 2021 12:53:42 +0200
Marek Vasut <[email protected]> wrote:
Hi,
Quoted 24 lines · Andre Przywara
Quoted 23 lines
On Sat, 17 Apr 2021 09:20:55 -0500
Samuel Holland <[email protected]> wrote:Hi,
Quoted 2 lines
This series adds PHY and XHCI driver support for the USB3 controller found in the Allwinner H6 SoC.
Thanks for the update!
Quoted 4 lines
It has been tested and working on both
boards enabled in patch 4, although some users experience issues[1].[1]: https://lists.denx.de/pipermail/u-boot/2021-February/440767.html
So I could not reproduce those issues either, it works for me fine on my Pine-H64. I'd suggest we merge those patches, and check for more reports from more users.
Bin, Marek: can you push patches 1, 2 and 3 to the USB tree, to get them into the current merge window, still? I would then push 4/4 (pending possible fixes) once the first three reached mainline.
Quoted 5 lines
Quoted 3 lines
And btw: the first two patches of the original v1 series (adding the sunxi clocks and reset bits) have been merged into master last week already.
I will pick these once I get ack from Bin.
Bin, did you have a chance to have a look at those patches? I wonder if we could merge them in the MW, to expose them to a wider audience?
Cheers,
Andre
Hi Andre,
Quoted 30 lines · Andre Przywara
On Wed, 21 Apr 2021 12:53:42 +0200
Marek Vasut <[email protected]> wrote:Hi,
Quoted 24 lines · Andre Przywara
Quoted 23 lines
On Sat, 17 Apr 2021 09:20:55 -0500
Samuel Holland <[email protected]> wrote:Hi,
Quoted 2 lines
This series adds PHY and XHCI driver support for the USB3 controller found in the Allwinner H6 SoC.
Thanks for the update!
Quoted 4 lines
It has been tested and working on both
boards enabled in patch 4, although some users experience issues[1].[1]: https://lists.denx.de/pipermail/u-boot/2021-February/440767.html
So I could not reproduce those issues either, it works for me fine on my Pine-H64. I'd suggest we merge those patches, and check for more reports from more users.
Bin, Marek: can you push patches 1, 2 and 3 to the USB tree, to get them into the current merge window, still? I would then push 4/4 (pending possible fixes) once the first three reached mainline.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
And btw: the first two patches of the original v1 series (adding the sunxi clocks and reset bits) have been merged into master last week already.
I will pick these once I get ack from Bin.
Bin, did you have a chance to have a look at those patches? I wonder if we could merge them in the MW, to expose them to a wider audience?
It looks only this patch is not applied?
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
I am afraid this is too late as the release date is today.
Regards,
Bin