Skip to contentSkip to conversation

usb: am654: Add support for host mode to the USB port on overlay board

PATCH New Aswath Govindraju 3 participants 8 messages Nov 20, 2020 – Dec 23, 2020 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover usb: am654: Add support for host mode to the USB port on overlay board

The following series of patches
- adds support for host mode to USB3SS0 controller
- adds aliases for USB subsystems
- adds a workaround to use USB0 in USB 2.0 only mode

Aswath Govindraju (3):
board: ti: am65x: Set SERDES0 mux to PCIe to use USB 2.0 interface
dts: am654-base-board-uboot: Set USB0 dr_mode to host
dts: am654-base-board-uboot: Add aliases for USB subsystems

 arch/arm/dts/k3-am654-base-board-u-boot.dtsi |  4 +++-
 board/ti/am65x/evm.c                         | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 board: ti: am65x: Set SERDES0 mux to PCIe to use USB 2.0 interface

It has been observed that setting SERDES0 lane mux to USB prevents USB 2.0 operation on USB0. Setting SERDES0 lane mux to non-USB when USB0 is used in USB 2.0 only mode solves this issue. However, for USB3.0+2.0 operation this issue is not present.

Implement this workaround by writing 1 to LANE_FUNC_SEL field in CTRLMMR_SERDES0_CTRL register.

---
 board/ti/am65x/evm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/ti/am65x/evm.c +16 -0
index 36063b11383d..4438f14e4ff1 100644
@@ -38,6 +38,10 @@ enum {
 /* Max number of MAC addresses that are parsed/processed per daughter card */
 #define DAUGHTER_CARD_NO_OF_MAC_ADDR	8
 
+/* Regiter that controls the SERDES0 lane and clock assignment */
+#define CTRLMMR_SERDES0_CTRL    0x00104080
+#define PCIE_LANE0              0x1
+
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_init(void)
@@ -312,6 +316,18 @@ static int probe_daughtercards(void)
 						      (uchar *)mac_addr[j]);
 		}
 
+		/*
+		 * It has been observed that setting SERDES0 lane mux to USB prevents USB
+		 * 2.0 operation on USB0. Setting SERDES0 lane mux to non-USB when USB0 is
+		 * used in USB 2.0 only mode solves this issue. For USB3.0+2.0 operation
+		 * this issue is not present.
+		 *
+		 * Implement this workaround by writing 1 to LANE_FUNC_SEL field in
+		 * CTRLMMR_SERDES0_CTRL register.
+		 */
+		if (!strncmp(ep.name, "SER-PCIE2LEVM", sizeof(ep.name)))
+			writel(PCIE_LANE0, CTRLMMR_SERDES0_CTRL);
+
 		/* Skip if no overlays are to be added */
 		if (!strlen(cards[i].dtbo_name))
 			continue;
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 dts: am654-base-board-uboot: Set USB0 dr_mode to host

In reply to Aswath Govindraju

USB3SS0 controller is to be used as a host in U-boot. Fix it by changing the dr_mode to host.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +1 -1
index d75d1b1c285a..bd2f334c2b50 100644
@@ -270,7 +270,7 @@
 &usb0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&usb0_pins_default>;
-	dr_mode = "peripheral";
+	dr_mode = "host";
 	u-boot,dm-spl;
 };
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 2/3 dts: am654-base-board-uboot: Set USB0 dr_mode to host

Quoted 4 lines · Aswath Govindraju

USB3SS0 controller is to be used as a host in U-boot. Fix it by changing the dr_mode to host.

Won't it break dfu support or is it used in different controller?

Thanks and regards,
Lokesh

Quoted 18 lines
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +1 -1
index d75d1b1c285a..bd2f334c2b50 100644
@@ -270,7 +270,7 @@
 &usb0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&usb0_pins_default>;
-	dr_mode = "peripheral";
+	dr_mode = "host";
 	u-boot,dm-spl;
 };
 
#4 lore raw

PATCH 2/3 dts: am654-base-board-uboot: Set USB0 dr_mode to host

Quoted 10 lines · Lokesh Vutla
Quoted 4 lines · Aswath Govindraju

USB3SS0 controller is to be used as a host in U-boot. Fix it by changing the dr_mode to host.

Won't it break dfu support or is it used in different controller?

It is used in a different controller. The port on the base board is used for dfu and and the port on the overlay board is used for host mode.

Thanks,
Aswath

Quoted 19 lines
Quoted 19 lines
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +1 -1
index d75d1b1c285a..bd2f334c2b50 100644
@@ -270,7 +270,7 @@
 &usb0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&usb0_pins_default>;
-	dr_mode = "peripheral";
+	dr_mode = "host";
 	u-boot,dm-spl;
 };
 
#5 lore raw

PATCH 3/3 dts: am654-base-board-uboot: Add aliases for USB subsystems

In reply to Aswath Govindraju

The sequence number assigned for USB subsystem in a uclass is dependent on the order of occurrence in the device tree. If the dr_mode of USB3SS0 controller is varied then the sequence number of USB3SS1 controller also changes. If aliases are added then sequence numbers are assigned using the alias number. This makes the sequence number of USB3SS1 controller independent of USB3SS0 controller's dr_mode.

Therefore, add aliases to fix the sequence number assigned to the USB subsystems.

---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/k3-am654-base-board-u-boot.dtsi +2 -0
index bd2f334c2b50..727bc3e8a0e3 100644
@@ -14,6 +14,8 @@
 	aliases {
 		serial2 = &main_uart0;
 		ethernet0 = &cpsw_port1;
+		usb0 = &usb0;
+		usb1 = &usb1;
 	};
 };
 
Signature · 1 line
2.17.1
#6 lore raw

cover usb: am654: Add support for host mode to the USB port on overlay board

In reply to Aswath Govindraju

Hi,

Quoted 9 lines · Aswath Govindraju

The following series of patches
- adds support for host mode to USB3SS0 controller
- adds aliases for USB subsystems
- adds a workaround to use USB0 in USB 2.0 only mode

Aswath Govindraju (3):
board: ti: am65x: Set SERDES0 mux to PCIe to use USB 2.0 interface
dts: am654-base-board-uboot: Set USB0 dr_mode to host
dts: am654-base-board-uboot: Add aliases for USB subsystems

For all patches,

Quoted 5 lines
  arch/arm/dts/k3-am654-base-board-u-boot.dtsi |  4 +++-
  board/ti/am65x/evm.c                         | 16 ++++++++++++++++
  2 files changed, 19 insertions(+), 1 deletion(-)

cheers,
-roger

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#7 lore raw

cover usb: am654: Add support for host mode to the USB port on overlay board

In reply to Aswath Govindraju
Quoted 4 lines · Aswath Govindraju

The following series of patches
- adds support for host mode to USB3SS0 controller
- adds aliases for USB subsystems
- adds a workaround to use USB0 in USB 2.0 only mode

Fixed the dts patches subject to arm: dts: .... and applied to u-boot-ti for-next branch.

Thanks and regards,
Lokesh

Quoted 10 lines

Aswath Govindraju (3):
board: ti: am65x: Set SERDES0 mux to PCIe to use USB 2.0 interface
dts: am654-base-board-uboot: Set USB0 dr_mode to host
dts: am654-base-board-uboot: Add aliases for USB subsystems

 arch/arm/dts/k3-am654-base-board-u-boot.dtsi |  4 +++-
 board/ti/am65x/evm.c                         | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)