Skip to contentSkip to conversation

Improve K3-am625-sk support (USB, MMC)

PATCH Superseded Sjoerd Simons 2 participants 6 messages Jan 11, 2023

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Improve K3-am625-sk support (USB, MMC)

This series picks up a few patches from the TI BSP tree that unfortunately didn't make it upstream thusfar.

The first patch improve SD card compatibility (allowing U1 class cards to be used), the remaining ones add USB support.

The type-c connector isn't entirely modelled with these changes as it goes through a TPS6598 PD controller. Unfortunately the dtb bindings for that currently require an irq line, which is not connected on E1 and E2 version boards. The patchese to support this setup unfortunately didn't land yet[0].. As such the last patch ignored the PD controller and simply configures usb0 as periphal only rather then mode switch capable, which at least gives some basic usability of that USB port.

0: https://lore.kernel.org/lkml/[email protected]/T/

Changes in v3:
- Rebased against current ti-next aka 6.2-rc1
- Add Martyn's tested-by

Changes in v2:
- Rebase against linux-next 20221220

Aswath Govindraju (2):
arm64: dts: ti: k3-am62-main: Add support for USB
arm64: dts: ti: k3-am625-sk: Add support for USB

Nitin Yadav (1):
arm64: dts: ti: k3-am62-main: Update OTAP and ITAP delay select

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 90 ++++++++++++++++++------
 arch/arm64/boot/dts/ti/k3-am625-sk.dts   | 50 +++++++++++++
 2 files changed, 118 insertions(+), 22 deletions(-)
Signature · 1 line
2.39.0
#1 lore raw

PATCH v3 1/3 arm64: dts: ti: k3-am62-main: Update OTAP and ITAP delay select

From: Nitin Yadav <[email protected]>

UHS Class U1 sd-card are not getting detected due to incorrect OTAP/ITAP delay select values in linux. Update OTAP and ITAP delay select values for various speed modes. For sdhci0, update OTAP delay values for ddr52 & HS200 and add ITAP delay for legacy & mmc-hs. For sdhci1 & sdhci2, update OTAP & ITAP delay select recommended as in RIOT for various speed modes.

[cherry-pick from vendor BSP]

---

Changes in v3:
- Rebased against current ti-next aka 6.2-rc1
- Add Martyn's tested-by

Changes in v2:
- Rebase against linux-next 20221220

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 46 ++++++++++++------------
 1 file changed, 24 insertions(+), 22 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +24 -22
index 072903649d6e..466b94d1cee9 100644
@@ -501,8 +501,10 @@ sdhci0: mmc@fa10000 {
 		ti,clkbuf-sel = <0x7>;
 		ti,otap-del-sel-legacy = <0x0>;
 		ti,otap-del-sel-mmc-hs = <0x0>;
-		ti,otap-del-sel-ddr52 = <0x9>;
-		ti,otap-del-sel-hs200 = <0x6>;
+		ti,otap-del-sel-ddr52 = <0x5>;
+		ti,otap-del-sel-hs200 = <0x5>;
+		ti,itap-del-sel-legacy = <0xa>;
+		ti,itap-del-sel-mmc-hs = <0x1>;
 		status = "disabled";
 	};
 
@@ -514,17 +516,17 @@ sdhci1: mmc@fa00000 {
 		clocks = <&k3_clks 58 5>, <&k3_clks 58 6>;
 		clock-names = "clk_ahb", "clk_xin";
 		ti,trm-icp = <0x2>;
-		ti,otap-del-sel-legacy = <0x0>;
+		ti,otap-del-sel-legacy = <0x8>;
 		ti,otap-del-sel-sd-hs = <0x0>;
-		ti,otap-del-sel-sdr12 = <0xf>;
-		ti,otap-del-sel-sdr25 = <0xf>;
-		ti,otap-del-sel-sdr50 = <0xc>;
-		ti,otap-del-sel-sdr104 = <0x6>;
-		ti,otap-del-sel-ddr50 = <0x9>;
-		ti,itap-del-sel-legacy = <0x0>;
-		ti,itap-del-sel-sd-hs = <0x0>;
-		ti,itap-del-sel-sdr12 = <0x0>;
-		ti,itap-del-sel-sdr25 = <0x0>;
+		ti,otap-del-sel-sdr12 = <0x0>;
+		ti,otap-del-sel-sdr25 = <0x0>;
+		ti,otap-del-sel-sdr50 = <0x8>;
+		ti,otap-del-sel-sdr104 = <0x7>;
+		ti,otap-del-sel-ddr50 = <0x4>;
+		ti,itap-del-sel-legacy = <0xa>;
+		ti,itap-del-sel-sd-hs = <0x1>;
+		ti,itap-del-sel-sdr12 = <0xa>;
+		ti,itap-del-sel-sdr25 = <0x1>;
 		ti,clkbuf-sel = <0x7>;
 		bus-width = <4>;
 		status = "disabled";
@@ -538,17 +540,17 @@ sdhci2: mmc@fa20000 {
 		clocks = <&k3_clks 184 5>, <&k3_clks 184 6>;
 		clock-names = "clk_ahb", "clk_xin";
 		ti,trm-icp = <0x2>;
-		ti,otap-del-sel-legacy = <0x0>;
+		ti,otap-del-sel-legacy = <0x8>;
 		ti,otap-del-sel-sd-hs = <0x0>;
-		ti,otap-del-sel-sdr12 = <0xf>;
-		ti,otap-del-sel-sdr25 = <0xf>;
-		ti,otap-del-sel-sdr50 = <0xc>;
-		ti,otap-del-sel-sdr104 = <0x6>;
-		ti,otap-del-sel-ddr50 = <0x9>;
-		ti,itap-del-sel-legacy = <0x0>;
-		ti,itap-del-sel-sd-hs = <0x0>;
-		ti,itap-del-sel-sdr12 = <0x0>;
-		ti,itap-del-sel-sdr25 = <0x0>;
+		ti,otap-del-sel-sdr12 = <0x0>;
+		ti,otap-del-sel-sdr25 = <0x0>;
+		ti,otap-del-sel-sdr50 = <0x8>;
+		ti,otap-del-sel-sdr104 = <0x7>;
+		ti,otap-del-sel-ddr50 = <0x8>;
+		ti,itap-del-sel-legacy = <0xa>;
+		ti,itap-del-sel-sd-hs = <0xa>;
+		ti,itap-del-sel-sdr12 = <0xa>;
+		ti,itap-del-sel-sdr25 = <0x1>;
 		ti,clkbuf-sel = <0x7>;
 		status = "disabled";
 	};
Signature · 1 line
2.39.0
#2 lore raw

PATCH v3 2/3 arm64: dts: ti: k3-am62-main: Add support for USB

In reply to Sjoerd Simons

From: Aswath Govindraju <[email protected]>

AM62 SoC has two instances of USB on it. Therefore, add support for the same.

---

Changes in v3:
- Rebased against current ti-next aka 6.2-rc1
- Add Martyn's tested-by

Changes in v2:
- Rebase against linux-next 20221220

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 44 ++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +44 -0
index 466b94d1cee9..4da15e8c956f 100644
@@ -555,6 +555,50 @@ sdhci2: mmc@fa20000 {
 		status = "disabled";
 	};
 
+	usbss0: dwc3-usb@f900000 {
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f900000 0x00 0x800>;
+		clocks = <&k3_clks 161 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+
+		usb0: usb@31000000 {
+			compatible = "snps,dwc3";
+			reg =<0x00 0x31000000 0x00 0x50000>;
+			interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */
+				     <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */
+			interrupt-names = "host", "peripheral";
+			maximum-speed = "high-speed";
+			dr_mode = "otg";
+		};
+	};
+
+	usbss1: dwc3-usb@f910000 {
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f910000 0x00 0x800>;
+		clocks = <&k3_clks 162 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+
+		usb1: usb@31100000 {
+			compatible = "snps,dwc3";
+			reg =<0x00 0x31100000 0x00 0x50000>;
+			interrupts = <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */
+				     <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */
+			interrupt-names = "host", "peripheral";
+			maximum-speed = "high-speed";
+			dr_mode = "otg";
+		};
+	};
+
 	fss: bus@fc00000 {
 		compatible = "simple-bus";
 		reg = <0x00 0x0fc00000 0x00 0x70000>;
Signature · 1 line
2.39.0
#3 lore raw

Re: [PATCH v3 2/3] arm64: dts: ti: k3-am62-main: Add support for USB

Quoted 32 lines · Sjoerd Simons

From: Aswath Govindraju <[email protected]>

AM62 SoC has two instances of USB on it. Therefore, add support for the same.

---

Changes in v3:
- Rebased against current ti-next aka 6.2-rc1
- Add Martyn's tested-by

Changes in v2:
- Rebase against linux-next 20221220

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 44 ++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +1 -0
index 466b94d1cee9..4da15e8c956f 100644
@@ -555,6 +555,50 @@ sdhci2: mmc@fa20000 {
 		status = "disabled";
 	};
 
+	usbss0: dwc3-usb@f900000 {

arch/arm64/boot/dts/ti/k3-am62-main.dtsi sdhci2: mmc@fa20000 { · line 568

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +10 -0
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f900000 0x00 0x800>;
+		clocks = <&k3_clks 161 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+

Following the convention of the file, could you please set status = "disabled" here and then set it to okay in board dts file (patch 3/3)

Quoted 12 lines
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +12 -0
+		usb0: usb@31000000 {
+			compatible = "snps,dwc3";
+			reg =<0x00 0x31000000 0x00 0x50000>;
+			interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */
+				     <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */
+			interrupt-names = "host", "peripheral";
+			maximum-speed = "high-speed";
+			dr_mode = "otg";
+		};
+	};
+
+	usbss1: dwc3-usb@f910000 {

arch/arm64/boot/dts/ti/k3-am62-main.dtsi sdhci2: mmc@fa20000 { · line 590

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +10 -0
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f910000 0x00 0x800>;
+		clocks = <&k3_clks 162 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+

Same here...

Quoted 14 lines
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +11 -0
+		usb1: usb@31100000 {
+			compatible = "snps,dwc3";
+			reg =<0x00 0x31100000 0x00 0x50000>;
+			interrupts = <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */
+				     <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */
+			interrupt-names = "host", "peripheral";
+			maximum-speed = "high-speed";
+			dr_mode = "otg";
+		};
+	};
+
 	fss: bus@fc00000 {
 		compatible = "simple-bus";
 		reg = <0x00 0x0fc00000 0x00 0x70000>;
#4 lore raw

PATCH v3 3/3 arm64: dts: ti: k3-am625-sk: Add support for USB

In reply to Sjoerd Simons

From: Aswath Govindraju <[email protected]>

AM62 SoC has two instances of USB and they are brought on to the board in the following way,

-> USB0 instance
- This is brought out to a USB TypeC connector on board through TPS6598 PD controller. The PD controller should decide the role based on CC pin in the connector. Unfortunately the irq line for the TPS isn't hooked up which is a mode not yet support by the driver (some patches were submitted earlier this year[0]). So for now the PD controller is left out and periphal mode chosen.

-> USB1 instance
- This is brought out to a USB TypeA connector on board.

Therefore, add the required device tree support for the above in the board dts file.

0: https://lore.kernel.org/lkml/[email protected]/T/

[merge from vendor bsp, drop TPS6598 support, reword commit message]

---

Changes in v3:
- Rebased against current ti-next aka 6.2-rc1
- Add Martyn's tested-by

Changes in v2:
- Rebase against linux-next 20221220

 arch/arm64/boot/dts/ti/k3-am625-sk.dts | 50 ++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
arch/arm64/boot/dts/ti/k3-am625-sk.dts +50 -0
index 4f179b146cab..c82a0ebf6772 100644
@@ -24,6 +24,8 @@ aliases {
 		spi0 = &ospi0;
 		ethernet0 = &cpsw_port1;
 		ethernet1 = &cpsw_port2;
+		usb0 = &usb0;
+		usb1 = &usb1;
 	};
 
 	chosen {
@@ -284,6 +286,12 @@ main_gpio1_ioexp_intr_pins_default: main-gpio1-ioexp-intr-pins-default {
 			AM62X_IOPAD(0x01d4, PIN_INPUT, 7) /* (B15) UART0_RTSn.GPIO1_23 */
 		>;
 	};
+
+	main_usb1_pins_default: main-usb1-pins-default {
+		pinctrl-single,pins = <
+			AM62X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (F18) USB1_DRVVBUS */
+		>;
+	};
 };
 
 &wkup_uart0 {
@@ -464,3 +472,45 @@ partition@3fc0000 {
 		};
 	};
 };
+
+&ecap0 {
+	status = "disabled";
+};
+
+&ecap1 {
+	status = "disabled";
+};
+
+&ecap2 {
+	status = "disabled";
+};
+
+&main_mcan0 {
+	status = "disabled";
+};
+
+&epwm0 {
+	status = "disabled";
+};
+
+&epwm1 {
+	status = "disabled";
+};
+
+&epwm2 {
+	status = "disabled";
+};
+
+&usbss0 {
+	ti,vbus-divider;
+};
+
+&usb0 {
+	dr_mode = "peripheral";
+};
+
+&usb1 {
+	dr_mode = "host";
+	pinctrl-names = "default";
+	pinctrl-0 = <&main_usb1_pins_default>;
+};
Signature · 1 line
2.39.0
#5 lore raw

Re: [PATCH v3 3/3] arm64: dts: ti: k3-am625-sk: Add support for USB

Hi Sjoerd,

Couple of comments which I failed to notice on v2, sorry

Quoted 5 lines · Sjoerd Simons

From: Aswath Govindraju <[email protected]>

AM62 SoC has two instances of USB and they are brought on to the board in the following way,

Quoted 7 lines

-> USB0 instance
- This is brought out to a USB TypeC connector on board through TPS6598 PD controller. The PD controller should decide the role based on CC pin in the connector. Unfortunately the irq line for the TPS isn't hooked up which is a mode not yet support by the driver (some patches were submitted earlier this year[0]). So for now the PD controller is left out and periphal mode chosen.

s/periphal/peripheral

Quoted 27 lines

-> USB1 instance
- This is brought out to a USB TypeA connector on board.

Therefore, add the required device tree support for the above in the board dts file.

0: https://lore.kernel.org/lkml/[email protected]/T/

[merge from vendor bsp, drop TPS6598 support, reword commit message]

---

Changes in v3:
- Rebased against current ti-next aka 6.2-rc1
- Add Martyn's tested-by

Changes in v2:
- Rebase against linux-next 20221220

 arch/arm64/boot/dts/ti/k3-am625-sk.dts | 50 ++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

[...]

Quoted 19 lines
arch/arm64/boot/dts/ti/k3-am625-sk.dts +19 -0
+
+&ecap0 {
+	status = "disabled";
+};
+
+&ecap1 {
+	status = "disabled";
+};
+
+&ecap2 {
+	status = "disabled";
+};
+
+&main_mcan0 {
+	status = "disabled";
+};
+
+&epwm0 {
+	status = "disabled";

arch/arm64/boot/dts/ti/k3-am625-sk.dts partition@3fc0000 { · line 503

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am625-sk.dts +10 -0
+};
+
+&epwm1 {
+	status = "disabled";
+};
+
+&epwm2 {
+	status = "disabled";
+};
+

Unlike downstream vendor kernel, these nodes are "disabled" by default in k3-am62-main.dtsi. So, these can be dropped.

arch/arm64/boot/dts/ti/k3-am625-sk.dts partition@3fc0000 { · line 516

Quoted 13 lines

+&usbss0 {

arch/arm64/boot/dts/ti/k3-am625-sk.dts +12 -0
+	ti,vbus-divider;
+};
+
+&usb0 {
+	dr_mode = "peripheral";
+};
+
+&usb1 {
+	dr_mode = "host";
+	pinctrl-names = "default";
+	pinctrl-0 = <&main_usb1_pins_default>;
+};

Regards
Vignesh