[PATCH 0/3] usb: am654: Add support for host mode to the USB port on overlay board

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/3] usb: am654: Add support for host mode to the USB port on overlay board

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

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

--
2.17.1

Reply | Threaded
Open this post in threaded view
|

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

Aswath Govindraju
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.

Signed-off-by: Aswath Govindraju <[hidden email]>
---
 board/ti/am65x/evm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index 36063b11383d..4438f14e4ff1 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -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;
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

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

Aswath Govindraju
In reply to this post by Aswath Govindraju
USB3SS0 controller is to be used as a host in U-boot. Fix it by changing
the dr_mode to host.

Signed-off-by: Aswath Govindraju <[hidden email]>
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index d75d1b1c285a..bd2f334c2b50 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -270,7 +270,7 @@
 &usb0 {
  pinctrl-names = "default";
  pinctrl-0 = <&usb0_pins_default>;
- dr_mode = "peripheral";
+ dr_mode = "host";
  u-boot,dm-spl;
 };
 
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

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

Aswath Govindraju
In reply to this post by 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.

Signed-off-by: Aswath Govindraju <[hidden email]>
---
 arch/arm/dts/k3-am654-base-board-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
index bd2f334c2b50..727bc3e8a0e3 100644
--- a/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
+++ b/arch/arm/dts/k3-am654-base-board-u-boot.dtsi
@@ -14,6 +14,8 @@
  aliases {
  serial2 = &main_uart0;
  ethernet0 = &cpsw_port1;
+ usb0 = &usb0;
+ usb1 = &usb1;
  };
 };
 
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/3] usb: am654: Add support for host mode to the USB port on overlay board

Roger Quadros
In reply to this post by Aswath Govindraju
Hi,

On 20/11/2020 17:48, Aswath Govindraju wrote:
> 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,

Acked-by: Roger Quadros <[hidden email]>

>
>   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
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki