[U-Boot] [PATCH v8 0/8] rk3328: add support of usb host and gadget

Add support of usb host and gadget function for rk3328.
Changed in v8: - Convert CONFIG_USB_DWC2 to a Kconfig entry
Changed in v7: - Romove unused variable ‘prop’ in dwc2 driver
Changed in v6: - Rebase on the newest code of master branch - Make xhci-rockchip driver depend on DM_REGULATOR and DM_USB - Remove #ifdef DM_RERULATOR and DM_USB in xhci-rockchip driver - Use dev_read_boot() instead of fdt_getprop() in dwc2 driver
Changes in v5: - Propagate return value and print error message when failed
Changes in v4: - Splite patch [U-boot,v3,04/10] into two patches - Define set vbus as empty function if the macros aren't set - Prepare a mask and set capabilities in GUSBCFG register once
Changes in v3: - Revert change of macro definition in dwc2 driver - Support host mode without HNP/SRP capability through DTS
Changes in v2: - Add commit messages - Split patch [U-boot,7/8] into two patches - Use fixed regulator to control vbus instead of gpio
Meng Dongyang (8): usb: Kconfig: config USB_XHCI_ROCKCHIP depends on DM_REGULATOR and DM_USB usb: host: xhci-rockchip: use fixed regulator to control vbus rockchip: dts: rk3328: add fixed regulator node for xhci rockchip: configs: rk3328: enable dwc2 driver and config fastboot usb: dwc2: use dev_read_bool() instead of fdt_getprop() rockchip: rk3328: board: add support of dwc2 gadget rockchip: dts: rk3328: support and enable dwc2 rockchip: dts: rk3399: control vbus of typec by fixed regulator
arch/arm/dts/rk3328-evb.dts | 25 +++++++++++++++++++- arch/arm/dts/rk3328.dtsi | 10 ++++++++ arch/arm/dts/rk3399-evb.dts | 16 +++++++++++-- board/rockchip/evb_rk3328/evb-rk3328.c | 42 ++++++++++++++++++++++++++++++++++ configs/evb-rk3328_defconfig | 20 ++++++++++++++-- drivers/usb/host/Kconfig | 12 ++++++++++ drivers/usb/host/dwc2.c | 16 +++++-------- drivers/usb/host/xhci-rockchip.c | 36 ++++++++++++++--------------- 8 files changed, 144 insertions(+), 33 deletions(-)

The xhci-rockchip driver depends on DM_REGULATOR and DM_USB. So add dependent features for xhci-rockchip driver in Kconfig.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: None Changes in v6: - New patch, add depends on features for xhci-rockchip in Kconfig
drivers/usb/host/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index b824eec..5e07a10 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -34,6 +34,8 @@ config USB_XHCI_MVEBU config USB_XHCI_ROCKCHIP bool "Support for Rockchip on-chip xHCI USB controller" depends on ARCH_ROCKCHIP + depends on DM_REGULATOR + depends on DM_USB default y help Enables support for the on-chip xHCI controller on Rockchip SoCs.

The xhci-rockchip driver depends on DM_REGULATOR and DM_USB. So add dependent features for xhci-rockchip driver in Kconfig.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7: None Changes in v6:
- New patch, add depends on features for xhci-rockchip in Kconfig
drivers/usb/host/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
Applied to u-boot-rockchip/next, thanks!

Use fixed regulator to control the voltage of vbus. Enable vbus supply when usb start and disable vbus supply when usb stop.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: None Changes in v6: - Remove #ifdef DM_REGULATOR and DM_USB due to the addition in Kconfig
Changes in v5: - Propagate the return value of setting VBus and print error when failed
Changes in v4: - Splited from patch [Uboot,v3,04/10] - Define set vbus as empty function if the macros aren't set
Changes in v3: None Changes in v2: - Use fixed regulator to control vbus instead of gpio
drivers/usb/host/xhci-rockchip.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c index c4ae55f..6b4caf9 100644 --- a/drivers/usb/host/xhci-rockchip.c +++ b/drivers/usb/host/xhci-rockchip.c @@ -48,7 +48,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) */ plat->hcd_base = devfdt_get_addr(dev); if (plat->hcd_base == FDT_ADDR_T_NONE) { - debug("Can't get the XHCI register base address\n"); + error("Can't get the XHCI register base address\n"); return -ENXIO; }
@@ -62,17 +62,15 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) }
if (plat->phy_base == FDT_ADDR_T_NONE) { - debug("Can't get the usbphy register address\n"); + error("Can't get the usbphy register address\n"); return -ENXIO; }
-#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR) /* Vbus regulator */ ret = device_get_supply_regulator(dev, "vbus-supply", &plat->vbus_supply); if (ret) - debug("Can't get vbus supply\n"); -#endif + debug("Can't get VBus regulator!\n");
return 0; } @@ -126,7 +124,7 @@ static int rockchip_xhci_core_init(struct rockchip_xhci *rkxhci,
ret = dwc3_core_init(rkxhci->dwc3_reg); if (ret) { - debug("failed to initialize core\n"); + error("failed to initialize core\n"); return ret; }
@@ -155,15 +153,17 @@ static int xhci_usb_probe(struct udevice *dev) hcor = (struct xhci_hcor *)((uint64_t)ctx->hcd + HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)));
-#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR) - ret = regulator_set_enable(plat->vbus_supply, true); - if (ret) - debug("XHCI: Failed to enable vbus supply\n"); -#endif + if (plat->vbus_supply) { + ret = regulator_set_enable(plat->vbus_supply, true); + if (ret) { + error("XHCI: failed to set VBus supply\n"); + return ret; + } + }
ret = rockchip_xhci_core_init(ctx, dev); if (ret) { - debug("XHCI: failed to initialize controller\n"); + error("XHCI: failed to initialize controller\n"); return ret; }
@@ -183,13 +183,13 @@ static int xhci_usb_remove(struct udevice *dev) if (ret) return ret;
-#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR) - ret = regulator_set_enable(plat->vbus_supply, false); - if (ret) - debug("XHCI: Failed to disable vbus supply\n"); -#endif + if (plat->vbus_supply) { + ret = regulator_set_enable(plat->vbus_supply, false); + if (ret) + error("XHCI: failed to set VBus supply\n"); + }
- return 0; + return ret; }
static const struct udevice_id xhci_usb_ids[] = {

Use fixed regulator to control the voltage of vbus. Enable vbus supply when usb start and disable vbus supply when usb stop.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7: None Changes in v6:
- Remove #ifdef DM_REGULATOR and DM_USB due to the addition in Kconfig
Changes in v5:
- Propagate the return value of setting VBus and print error when failed
Changes in v4:
- Splited from patch [Uboot,v3,04/10]
- Define set vbus as empty function if the macros aren't set
Changes in v3: None Changes in v2:
- Use fixed regulator to control vbus instead of gpio
drivers/usb/host/xhci-rockchip.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
Applied to u-boot-rockchip/next, thanks!

The driver changes gpio to fixed regulator to control vbus, so add fixed regulator node in DTS for xhci driver.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: None Changes in v6: - New patch, splited from [PATCH,v5,06/11]
arch/arm/dts/rk3328-evb.dts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/rk3328-evb.dts b/arch/arm/dts/rk3328-evb.dts index b807bc5..4cf6d2e 100644 --- a/arch/arm/dts/rk3328-evb.dts +++ b/arch/arm/dts/rk3328-evb.dts @@ -14,6 +14,15 @@ chosen { stdout-path = &uart2; }; + + vcc5v0_host_xhci: vcc5v0-host-xhci-drv { + compatible = "regulator-fixed"; + enable-active-high; + regulator-name = "vcc5v0_host_xhci"; + gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; };
&uart2 { @@ -53,6 +62,6 @@ };
&usb_host0_xhci { - rockchip,vbus-gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>; + vbus-supply = <&vcc5v0_host_xhci>; status = "okay"; };

The driver changes gpio to fixed regulator to control vbus, so add fixed regulator node in DTS for xhci driver.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7: None Changes in v6:
- New patch, splited from [PATCH,v5,06/11]
arch/arm/dts/rk3328-evb.dts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
Applied to u-boot-rockchip/next, thanks!

Config dwc2 driver support host and gadget function. Add support of fastboot function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: - Convert CONFIG_USB_DWC2 to a Kconfig entry
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
configs/evb-rk3328_defconfig | 20 ++++++++++++++++++-- drivers/usb/host/Kconfig | 10 ++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig index 1384e87..aabc8a4 100644 --- a/configs/evb-rk3328_defconfig +++ b/configs/evb-rk3328_defconfig @@ -31,12 +31,28 @@ CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550=y CONFIG_SYSRESET=y CONFIG_USB=y -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_DWC3=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_EHCI_GENERIC=y CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y +CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_RK=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_USB_GADGET_DUALSPEED=y +CONFIG_USB_GADGET_DWC2_OTG=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_G_DNL_MANUFACTURER="Rockchip" +CONFIG_G_DNL_VENDOR_NUM=0x2207 +CONFIG_G_DNL_PRODUCT_NUM=0x330a +CONFIG_FASTBOOT=y +CONFIG_CMD_FASTBOOT=y +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=1 +CONFIG_FASTBOOT_BUF_ADDR=0x00800800 +CONFIG_FASTBOOT_BUF_SIZE=0x08000000 CONFIG_USE_TINY_PRINTF=y CONFIG_ERRNO_STR=y diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 5e07a10..bc2c1f1 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -201,3 +201,13 @@ config USB_UHCI_HCD if USB_UHCI_HCD
endif # USB_UHCI_HCD + +config USB_DWC2 + bool "DesignWare USB2 Core support" + select USB_HOST + ---help--- + The DesignWare USB 2.0 controller is compliant with the + USB-Implementers Forum (USB-IF) USB 2.0 specifications. + Hi-Speed (480 Mbps), Full-Speed (12 Mbps), and Low-Speed (1.5 Mbps) + operation is compliant to the controller Supplement. If you want to + enable this controller in host mode, say Y.

On 28 Jun 2017, at 13:22, Meng Dongyang daniel.meng@rock-chips.com wrote:
Config dwc2 driver support host and gadget function. Add support of fastboot function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
I’ll migrate the remaining uses of CONFIG_USB_DWC2, when I apply.
Regards, Philipp.

On 2017/6/28 19:55, Dr. Philipp Tomsich wrote:
On 28 Jun 2017, at 13:22, Meng Dongyang daniel.meng@rock-chips.com wrote:
Config dwc2 driver support host and gadget function. Add support of fastboot function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
I’ll migrate the remaining uses of CONFIG_USB_DWC2, when I apply.
OK, thanks
Regards, Philipp.

Config dwc2 driver support host and gadget function. Add support of fastboot function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8:
- Convert CONFIG_USB_DWC2 to a Kconfig entry
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
configs/evb-rk3328_defconfig | 20 ++++++++++++++++++-- drivers/usb/host/Kconfig | 10 ++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-)
Applied to u-boot-rockchip/next, thanks!

Config dwc2 driver support host and gadget function. Add support of fastboot function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8:
- Convert CONFIG_USB_DWC2 to a Kconfig entry
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
configs/evb-rk3328_defconfig | 20 ++++++++++++++++++-- drivers/usb/host/Kconfig | 10 ++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Use dev_read_bool() instead of fdt_getprop() to get the property from DTS. And add a comment for "hnp-srp-disable" property to fully describe its effect.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: - Romove unused variable ‘prop’ in dwc2 driver
Changes in v6: - New patch - Use dev_read_bool() instead of fdt_getprop() - Add a comment for "hnp-srp-disable" feature
drivers/usb/host/dwc2.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index 841e596..64c42ac 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -43,6 +43,10 @@ struct dwc2_priv { struct dwc2_core_regs *regs; int root_hub_devnum; bool ext_vbus; + /* + * The hnp/srp capability must be disabled if the platform + * does't support hnp/srp. Otherwise the force mode can't work. + */ bool hnp_srp_disable; bool oc_disable; }; @@ -1239,7 +1243,6 @@ static int dwc2_submit_int_msg(struct udevice *dev, struct usb_device *udev, static int dwc2_usb_ofdata_to_platdata(struct udevice *dev) { struct dwc2_priv *priv = dev_get_priv(dev); - const void *prop; fdt_addr_t addr;
addr = devfdt_get_addr(dev); @@ -1247,15 +1250,8 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev) return -EINVAL; priv->regs = (struct dwc2_core_regs *)addr;
- prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), - "disable-over-current", NULL); - if (prop) - priv->oc_disable = true; - - prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), - "hnp-srp-disable", NULL); - if (prop) - priv->hnp_srp_disable = true; + priv->oc_disable = dev_read_bool(dev, "disable-over-current"); + priv->hnp_srp_disable = dev_read_bool(dev, "hnp-srp-disable");
return 0; }

Use dev_read_bool() instead of fdt_getprop() to get the property from DTS. And add a comment for "hnp-srp-disable" property to fully describe its effect.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7:
- Romove unused variable ‘prop’ in dwc2 driver
Changes in v6:
- New patch
- Use dev_read_bool() instead of fdt_getprop()
- Add a comment for "hnp-srp-disable" feature
drivers/usb/host/dwc2.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
Applied to u-boot-rockchip/next, thanks!

Probe dwc2 udc in the function of board_usb_start to enable usb gadget function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: None Changes in v6: None Chagnes in v5: None Changes in v4: None Changes in v3: None
board/rockchip/evb_rk3328/evb-rk3328.c | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c index 0a26ed5..7fc25bb 100644 --- a/board/rockchip/evb_rk3328/evb-rk3328.c +++ b/board/rockchip/evb_rk3328/evb-rk3328.c @@ -31,7 +31,49 @@ int dram_init_banksize(void) return 0; }
+#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) +#include <usb.h> +#include <usb/dwc2_udc.h> + +static struct dwc2_plat_otg_data rk3328_otg_data = { + .rx_fifo_sz = 512, + .np_tx_fifo_sz = 16, + .tx_fifo_sz = 128, +}; + int board_usb_init(int index, enum usb_init_type init) { + int node; + const char *mode; + bool matched = false; + const void *blob = gd->fdt_blob; + + /* find the usb_otg node */ + node = fdt_node_offset_by_compatible(blob, -1, + "rockchip,rk3328-usb"); + + while (node > 0) { + mode = fdt_getprop(blob, node, "dr_mode", NULL); + if (mode && strcmp(mode, "otg") == 0) { + matched = true; + break; + } + + node = fdt_node_offset_by_compatible(blob, node, + "rockchip,rk3328-usb"); + } + if (!matched) { + debug("Not found usb_otg device\n"); + return -ENODEV; + } + + rk3328_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg"); + + return dwc2_udc_probe(&rk3328_otg_data); +} + +int board_usb_cleanup(int index, enum usb_init_type init) +{ return 0; } +#endif

Probe dwc2 udc in the function of board_usb_start to enable usb gadget function.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7: None Changes in v6: None Chagnes in v5: None Changes in v4: None Changes in v3: None
board/rockchip/evb_rk3328/evb-rk3328.c | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
Applied to u-boot-rockchip/next, thanks!

Enable dwc2 controller and add fixed regulator for dwc2 controller to control vbus.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: - add hnp-srp-disable property
arch/arm/dts/rk3328-evb.dts | 14 ++++++++++++++ arch/arm/dts/rk3328.dtsi | 10 ++++++++++ 2 files changed, 24 insertions(+)
diff --git a/arch/arm/dts/rk3328-evb.dts b/arch/arm/dts/rk3328-evb.dts index 4cf6d2e..220d0ab 100644 --- a/arch/arm/dts/rk3328-evb.dts +++ b/arch/arm/dts/rk3328-evb.dts @@ -15,6 +15,15 @@ stdout-path = &uart2; };
+ vcc5v0_otg: vcc5v0-otg-drv { + compatible = "regulator-fixed"; + enable-active-high; + regulator-name = "vcc5v0_otg"; + gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + vcc5v0_host_xhci: vcc5v0-host-xhci-drv { compatible = "regulator-fixed"; enable-active-high; @@ -61,6 +70,11 @@ status = "okay"; };
+&usb20_otg { + vbus-supply = <&vcc5v0_otg>; + status = "okay"; +}; + &usb_host0_xhci { vbus-supply = <&vcc5v0_host_xhci>; status = "okay"; diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi index f18cfc2..1290982 100644 --- a/arch/arm/dts/rk3328.dtsi +++ b/arch/arm/dts/rk3328.dtsi @@ -460,6 +460,16 @@ status = "disabled"; };
+ usb20_otg: usb@ff580000 { + compatible = "rockchip,rk3328-usb", "rockchip,rk3066-usb", + "snps,dwc2"; + reg = <0x0 0xff580000 0x0 0x40000>; + interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; + hnp-srp-disable; + dr_mode = "otg"; + status = "disabled"; + }; + sdmmc_ext: rksdmmc@ff5f0000 { compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc"; reg = <0x0 0xff5f0000 0x0 0x4000>;

Enable dwc2 controller and add fixed regulator for dwc2 controller to control vbus.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3:
- add hnp-srp-disable property
arch/arm/dts/rk3328-evb.dts | 14 ++++++++++++++ arch/arm/dts/rk3328.dtsi | 10 ++++++++++ 2 files changed, 24 insertions(+)
Applied to u-boot-rockchip/next, thanks!

Add fixed regulator for the port of typec0 and typec1 to control vbus instead of gpio.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com ---
Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None
arch/arm/dts/rk3399-evb.dts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/rk3399-evb.dts b/arch/arm/dts/rk3399-evb.dts index f5af75b..bff00c3 100644 --- a/arch/arm/dts/rk3399-evb.dts +++ b/arch/arm/dts/rk3399-evb.dts @@ -60,6 +60,18 @@ gpio = <&gpio4 25 GPIO_ACTIVE_HIGH>; };
+ vcc5v0_typec0: vcc5v0-typec0-en { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_typec0"; + gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; + }; + + vcc5v0_typec1: vcc5v0-typec1-en { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_typec1"; + gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; + }; + clkin_gmac: external-gmac-clock { compatible = "fixed-clock"; clock-frequency = <125000000>; @@ -163,7 +175,7 @@ };
&dwc3_typec0 { - rockchip,vbus-gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>; + vbus-supply = <&vcc5v0_typec0>; status = "okay"; };
@@ -176,7 +188,7 @@ };
&dwc3_typec1 { - rockchip,vbus-gpio = <&gpio1 4 GPIO_ACTIVE_HIGH>; + vbus-supply = <&vcc5v0_typec1>; status = "okay"; };

Add fixed regulator for the port of typec0 and typec1 to control vbus instead of gpio.
Signed-off-by: Meng Dongyang daniel.meng@rock-chips.com Reviewed-by: Simon Glass sjg@chromium.org Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None
arch/arm/dts/rk3399-evb.dts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
Applied to u-boot-rockchip/next, thanks!
participants (4)
-
Dr. Philipp Tomsich
-
Meng Dongyang
-
Philipp Tomsich
-
rock-chips(daniel.meng)