From: Fabio Estevam <[email protected]>

Describe the USB3 OTG controller as a USB role switch and make
peripheral mode the default when no external role provider has selected
host mode. This retains OTG operation and both PHYs inherited from the
SoC devicetree.

Enable the ums command so the onboard eMMC can be exposed as USB mass
storage to a host.

Signed-off-by: Fabio Estevam <[email protected]>
---
Changes since v1:
- Add the same OTG description as submitted upstream:
https://lore.kernel.org/linux-arm-kernel/[email protected]/

 arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi | 6 ++++++
 configs/roc-pc-rk3399_defconfig             | 1 +
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi 
b/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
index c80529a62b97..73027335446e 100644
--- a/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
@@ -1,3 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include "rk3399-roc-pc-u-boot.dtsi"
+
+&usbdrd_dwc3_0 {
+       dr_mode = "otg";
+       role-switch-default-mode = "peripheral";
+       usb-role-switch;
+};
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index 6ef447e0e715..127b71e97917 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -36,6 +36,7 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
-- 
2.43.0

Reply via email to