Skip to contentSkip to conversation

arm64: dts: ti: am62: Add USB support for k3-am62p

PATCH Superseded Roger Quadros 3 participants 8 messages Jan 26, 2024 – Jan 30, 2024

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover arm64: dts: ti: am62: Add USB support for k3-am62p

Hi,

This series first adds device nodes for USB0_PHY_CTRL and USB1_PHY_CTRL in the wkup_conf node and fixus up the USB nodes to use the newly added nodes.

Then it adds USB support for AM62P5-SK board.

cheers,
-roger

Roger Quadros (1):
arm64: dts: ti: k3-am62/a/p: use sub-node for USB_PHY_CTRL registers

Vignesh Raghavendra (1):
arm64: dts: ti: k3-am62p: add the USB sub-system

 arch/arm64/boot/dts/ti/k3-am62-main.dtsi    |  4 +-
 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi  | 10 +++
 arch/arm64/boot/dts/ti/k3-am62a-main.dtsi   |  4 +-
 arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi | 10 +++
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi   | 46 ++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi | 10 +++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts     | 67 +++++++++++++++++++++
 7 files changed, 147 insertions(+), 4 deletions(-)

base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d

Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 arm64: dts: ti: k3-am62/a/p: use sub-node for USB_PHY_CTRL registers

Exposing the entire CTRL_MMR space to syscon is not a good idea. Add sub-nodes for USB0_PHY_CTRL and USB1_PHY_CTRL and use them in the USB0/USB1 nodes.

---
 arch/arm64/boot/dts/ti/k3-am62-main.dtsi    |  4 ++--
 arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi  | 10 ++++++++++
 arch/arm64/boot/dts/ti/k3-am62a-main.dtsi   |  4 ++--
 arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi | 10 ++++++++++
 arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi | 10 ++++++++++
 5 files changed, 34 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +2 -2
index 464b7565d085..9432ed344d52 100644
@@ -625,7 +625,7 @@ usbss0: dwc3-usb@f900000 {
 		reg = <0x00 0x0f900000 0x00 0x800>;
 		clocks = <&k3_clks 161 3>;
 		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+		ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
 		#address-cells = <2>;
 		#size-cells = <2>;
 		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -648,7 +648,7 @@ usbss1: dwc3-usb@f910000 {
 		reg = <0x00 0x0f910000 0x00 0x800>;
 		clocks = <&k3_clks 162 3>;
 		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
 		#address-cells = <2>;
 		#size-cells = <2>;
 		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +10 -0
index fef76f52a52e..bd09662a3c29 100644
@@ -19,6 +19,16 @@ chipid: chipid@14 {
 			compatible = "ti,am654-chipid";
 			reg = <0x14 0x4>;
 		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";
+			reg = <0x4008 0x4>;
+		};
+
+		usb1_phy_ctrl: syscon@4018 {
+			compatible = "syscon";
+			reg = <0x4018 0x4>;
+		};
 	};
 
 	wkup_uart0: serial@2b300000 {
arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +2 -2
index f0b8c9ab1459..8311c7c44cd3 100644
@@ -566,7 +566,7 @@ usbss0: dwc3-usb@f900000 {
 		reg = <0x00 0x0f900000 0x00 0x800>;
 		clocks = <&k3_clks 161 3>;
 		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+		ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
 		#address-cells = <2>;
 		#size-cells = <2>;
 		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -589,7 +589,7 @@ usbss1: dwc3-usb@f910000 {
 		reg = <0x00 0x0f910000 0x00 0x800>;
 		clocks = <&k3_clks 162 3>;
 		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
 		#address-cells = <2>;
 		#size-cells = <2>;
 		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi +10 -0
index 4e8279fa01e1..26e9fd9da78f 100644
@@ -17,6 +17,16 @@ chipid: chipid@14 {
 			compatible = "ti,am654-chipid";
 			reg = <0x14 0x4>;
 		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";
+			reg = <0x4008 0x4>;
+		};
+
+		usb1_phy_ctrl: syscon@4018 {
+			compatible = "syscon";
+			reg = <0x4018 0x4>;
+		};
 	};
 
 	wkup_uart0: serial@2b300000 {
arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi +10 -0
index 19f42b39394e..0893e63c399a 100644
@@ -18,6 +18,16 @@ chipid: chipid@14 {
 			reg = <0x14 0x4>;
 			bootph-all;
 		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";
+			reg = <0x4008 0x4>;
+		};
+
+		usb1_phy_ctrl: syscon@4018 {
+			compatible = "syscon";
+			reg = <0x4018 0x4>;
+		};
 	};
 
 	wkup_uart0: serial@2b300000 {
Signature · 1 line
2.34.1
#5 lore raw

PATCH 2/2 arm64: dts: ti: k3-am62p: add the USB sub-system

In reply to Roger Quadros

From: Vignesh Raghavendra <[email protected]>

There are two USB instances available on the am62p5 starter kit. Include and enable them for use on the board.

---
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 46 ++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts   | 67 +++++++++++++++++++++++
 2 files changed, 113 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +46 -0
index 4c51bae06b57..7e7cd749d9a5 100644
@@ -560,6 +560,52 @@ 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 = <&usb0_phy_ctrl 0x0>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+		status = "disabled";
+
+		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 = <&usb1_phy_ctrl 0x0>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+		status = "disabled";
+
+		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>;
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +67 -0

91 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/2] arm64: dts: ti: k3-am62/a/p: use sub-node for USB_PHY_CTRL registers

In reply to Roger Quadros
Quoted 40 lines · Roger Quadros

Exposing the entire CTRL_MMR space to syscon is not a good idea. Add sub-nodes for USB0_PHY_CTRL and USB1_PHY_CTRL and use them in the USB0/USB1 nodes.

---
  arch/arm64/boot/dts/ti/k3-am62-main.dtsi    |  4 ++--
  arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi  | 10 ++++++++++
  arch/arm64/boot/dts/ti/k3-am62a-main.dtsi   |  4 ++--
  arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi | 10 ++++++++++
  arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi | 10 ++++++++++
  5 files changed, 34 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +2 -2
index 464b7565d085..9432ed344d52 100644
@@ -625,7 +625,7 @@ usbss0: dwc3-usb@f900000 {
  		reg = <0x00 0x0f900000 0x00 0x800>;
  		clocks = <&k3_clks 161 3>;
  		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+		ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
  		#address-cells = <2>;
  		#size-cells = <2>;
  		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -648,7 +648,7 @@ usbss1: dwc3-usb@f910000 {
  		reg = <0x00 0x0f910000 0x00 0x800>;
  		clocks = <&k3_clks 162 3>;
  		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
  		#address-cells = <2>;
  		#size-cells = <2>;
  		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +0 -0
index fef76f52a52e..bd09662a3c29 100644

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 24

Quoted 6 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +3 -0
@@ -19,6 +19,16 @@ chipid: chipid@14 {
  			compatible = "ti,am654-chipid";
  			reg = <0x14 0x4>;
  		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";

You'll want to add a binding for this to the simple syscon list. See this patch for an example[0]. Otherwise this gives a DT check warning.

Also, adding the new nodes for AM62p should be moved to the next patch in this series. Fixing AM62 and AM62a should be a standalone patch.

Andrew

[0] commit cb523495ee2a ("dt-bindings: mfd: syscon: Add ti,am654-dss-oldi-io-ctrl compatible")

Quoted 74 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +7 -0
+			reg = <0x4008 0x4>;
+		};
+
+		usb1_phy_ctrl: syscon@4018 {
+			compatible = "syscon";
+			reg = <0x4018 0x4>;
+		};
  	};
 
  	wkup_uart0: serial@2b300000 {
arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +2 -2
index f0b8c9ab1459..8311c7c44cd3 100644
@@ -566,7 +566,7 @@ usbss0: dwc3-usb@f900000 {
  		reg = <0x00 0x0f900000 0x00 0x800>;
  		clocks = <&k3_clks 161 3>;
  		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+		ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
  		#address-cells = <2>;
  		#size-cells = <2>;
  		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -589,7 +589,7 @@ usbss1: dwc3-usb@f910000 {
  		reg = <0x00 0x0f910000 0x00 0x800>;
  		clocks = <&k3_clks 162 3>;
  		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
  		#address-cells = <2>;
  		#size-cells = <2>;
  		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi +10 -0
index 4e8279fa01e1..26e9fd9da78f 100644
@@ -17,6 +17,16 @@ chipid: chipid@14 {
  			compatible = "ti,am654-chipid";
  			reg = <0x14 0x4>;
  		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";
+			reg = <0x4008 0x4>;
+		};
+
+		usb1_phy_ctrl: syscon@4018 {
+			compatible = "syscon";
+			reg = <0x4018 0x4>;
+		};
  	};
 
  	wkup_uart0: serial@2b300000 {
arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi +10 -0
index 19f42b39394e..0893e63c399a 100644
@@ -18,6 +18,16 @@ chipid: chipid@14 {
  			reg = <0x14 0x4>;
  			bootph-all;
  		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";
+			reg = <0x4008 0x4>;
+		};
+
+		usb1_phy_ctrl: syscon@4018 {
+			compatible = "syscon";
+			reg = <0x4018 0x4>;
+		};
  	};
 
  	wkup_uart0: serial@2b300000 {
#6 lore raw

Re: [PATCH 2/2] arm64: dts: ti: k3-am62p: add the USB sub-system

In reply to Roger Quadros
Quoted 17 lines · Roger Quadros

From: Vignesh Raghavendra <[email protected]>

There are two USB instances available on the am62p5 starter kit. Include and enable them for use on the board.

---
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 46 ++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts   | 67 +++++++++++++++++++++++
 2 files changed, 113 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +0 -0
index 4c51bae06b57..7e7cd749d9a5 100644

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

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +1 -0
@@ -560,6 +560,52 @@ sdhci2: mmc@fa20000 {
 		status = "disabled";
 	};
 
+	usbss0: dwc3-usb@f900000 {

usb@

Quoted 13 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +13 -0
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f900000 0x00 0x800>;
+		clocks = <&k3_clks 161 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+		status = "disabled";
+
+		usb0: usb@31000000 {
+			compatible = "snps,dwc3";

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

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +10 -0
+			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 {

usb@

Quoted 52 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +22 -0
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f910000 0x00 0x800>;
+		clocks = <&k3_clks 162 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+		status = "disabled";
+
+		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>;
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +8 -0
index 1773c05f752c..7a16e7a8ac66 100644
@@ -27,6 +27,8 @@ aliases {
 		spi0 = &ospi0;
 		ethernet0 = &cpsw_port1;
 		ethernet1 = &cpsw_port2;
+		usb0 = &usb0;
+		usb1 = &usb1;
 	};
 
 	chosen {
@@ -297,6 +299,12 @@ AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (G20) MCASP0_ACLKR.UART1_TXD */
 		bootph-all;
 	};
 
+	main_usb1_pins_default: main-usb1-default-pins {
+		pinctrl-single,pins = <
+			AM62PX_IOPAD(0x0258, PIN_INPUT, 0) /* (G21) USB1_DRVVBUS */
+		>;
+	};
+
 	main_wlirq_pins_default: main-wlirq-default-pins {
 		pinctrl-single,pins = <
 			AM62PX_IOPAD(0x0128, PIN_INPUT, 7) /* (K25) MMC2_SDWP.GPIO0_72 */

arch/arm64/boot/dts/ti/k3-am62p5-sk.dts AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */ · line 357

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +7 -0
@@ -340,6 +348,36 @@ AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */
 	};
 };
 
+&main_i2c0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&main_i2c0_pins_default>;
+	clock-frequency = <400000>;
+
+	typec_pd0: tps6598x@3f {

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

arch/arm64/boot/dts/ti/k3-am62p5-sk.dts AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */ · line 367

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +10 -0
+		compatible = "ti,tps6598x";
+		reg = <0x3f>;
+
+		connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+			self-powered;
+			data-role = "dual";
+			power-role = "sink";
+			ports {

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH 1/2] arm64: dts: ti: k3-am62/a/p: use sub-node for USB_PHY_CTRL registers

In reply to Roger Quadros
Quoted 15 lines · Roger Quadros
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +1 -1
 		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -648,7 +648,7 @@ usbss1: dwc3-usb@f910000 {
 		reg = <0x00 0x0f910000 0x00 0x800>;
 		clocks = <&k3_clks 162 3>;
 		clock-names = "ref";
-		ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
 		#address-cells = <2>;
 		#size-cells = <2>;
 		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +0 -0
index fef76f52a52e..bd09662a3c29 100644

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 24

Quoted 6 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +3 -0
@@ -19,6 +19,16 @@ chipid: chipid@14 {
 			compatible = "ti,am654-chipid";
 			reg = <0x14 0x4>;
 		};
+
+		usb0_phy_ctrl: syscon@4008 {
+			compatible = "syscon";

Not allowed alone and should cause warnings.

It does not look like you tested the DTS against bindings. Please run make dtbs_check W=1 (see Documentation/devicetree/bindings/writing-schema.rst or
https://www.linaro.org/blog/tips-and-tricks-for-validating-devicetree-sources-with-the-devicetree-schema/
for instructions).

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/2] arm64: dts: ti: k3-am62/a/p: use sub-node for USB_PHY_CTRL registers

In reply to Andrew Davis
Quoted 43 lines · Andrew Davis
Quoted 42 lines · Roger Quadros

Exposing the entire CTRL_MMR space to syscon is not a good idea. Add sub-nodes for USB0_PHY_CTRL and USB1_PHY_CTRL and use them in the USB0/USB1 nodes.

---
  arch/arm64/boot/dts/ti/k3-am62-main.dtsi    |  4 ++-- arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi  | 10 ++++++++++ arch/arm64/boot/dts/ti/k3-am62a-main.dtsi   |  4 ++-- arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi | 10 ++++++++++ arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi | 10 ++++++++++

  5 files changed, 34 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +2 -2
index 464b7565d085..9432ed344d52 100644
@@ -625,7 +625,7 @@ usbss0: dwc3-usb@f900000 {
           reg = <0x00 0x0f900000 0x00 0x800>;
           clocks = <&k3_clks 161 3>;
           clock-names = "ref";
-        ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+        ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
           #address-cells = <2>;
           #size-cells = <2>;
           power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -648,7 +648,7 @@ usbss1: dwc3-usb@f910000 {
           reg = <0x00 0x0f910000 0x00 0x800>;
           clocks = <&k3_clks 162 3>;
           clock-names = "ref";
-        ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+        ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
           #address-cells = <2>;
           #size-cells = <2>;
           power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +0 -0
index fef76f52a52e..bd09662a3c29 100644
@@ -19,6 +19,16 @@ chipid: chipid@14 {
               compatible = "ti,am654-chipid";
               reg = <0x14 0x4>;
Quoted 8 lines

arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi chipid: chipid@14 { · line 24

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +3 -0
           };
+
+        usb0_phy_ctrl: syscon@4008 {
+            compatible = "syscon";

You'll want to add a binding for this to the simple syscon list. See this patch for an example[0]. Otherwise this gives a DT check warning.

Thanks for the hint. Will fix.

Quoted 4 lines

Also, adding the new nodes for AM62p should be moved to the next patch in this series. Fixing AM62 and AM62a should be a standalone patch.

Agreed.

Quoted 76 lines

Andrew

[0] commit cb523495ee2a ("dt-bindings: mfd: syscon: Add ti,am654-dss-oldi-io-ctrl compatible")

Quoted 71 lines
arch/arm64/boot/dts/ti/k3-am62-wakeup.dtsi +7 -0
+            reg = <0x4008 0x4>;
+        };
+
+        usb1_phy_ctrl: syscon@4018 {
+            compatible = "syscon";
+            reg = <0x4018 0x4>;
+        };
       };
         wkup_uart0: serial@2b300000 {
arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +2 -2
index f0b8c9ab1459..8311c7c44cd3 100644
@@ -566,7 +566,7 @@ usbss0: dwc3-usb@f900000 {
           reg = <0x00 0x0f900000 0x00 0x800>;
           clocks = <&k3_clks 161 3>;
           clock-names = "ref";
-        ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
+        ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
           #address-cells = <2>;
           #size-cells = <2>;
           power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
@@ -589,7 +589,7 @@ usbss1: dwc3-usb@f910000 {
           reg = <0x00 0x0f910000 0x00 0x800>;
           clocks = <&k3_clks 162 3>;
           clock-names = "ref";
-        ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>;
+        ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
           #address-cells = <2>;
           #size-cells = <2>;
           power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
arch/arm64/boot/dts/ti/k3-am62a-wakeup.dtsi +10 -0
index 4e8279fa01e1..26e9fd9da78f 100644
@@ -17,6 +17,16 @@ chipid: chipid@14 {
               compatible = "ti,am654-chipid";
               reg = <0x14 0x4>;
           };
+
+        usb0_phy_ctrl: syscon@4008 {
+            compatible = "syscon";
+            reg = <0x4008 0x4>;
+        };
+
+        usb1_phy_ctrl: syscon@4018 {
+            compatible = "syscon";
+            reg = <0x4018 0x4>;
+        };
       };
         wkup_uart0: serial@2b300000 {
arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi +10 -0
index 19f42b39394e..0893e63c399a 100644
@@ -18,6 +18,16 @@ chipid: chipid@14 {
               reg = <0x14 0x4>;
               bootph-all;
           };
+
+        usb0_phy_ctrl: syscon@4008 {
+            compatible = "syscon";
+            reg = <0x4008 0x4>;
+        };
+
+        usb1_phy_ctrl: syscon@4018 {
+            compatible = "syscon";
+            reg = <0x4018 0x4>;
+        };
       };
         wkup_uart0: serial@2b300000 {
Signature · 2 lines
cheers,
-roger
#7 lore raw

Re: [PATCH 2/2] arm64: dts: ti: k3-am62p: add the USB sub-system

In reply to Krzysztof Kozlowski
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Roger Quadros

From: Vignesh Raghavendra <[email protected]>

There are two USB instances available on the am62p5 starter kit. Include and enable them for use on the board.

---
 arch/arm64/boot/dts/ti/k3-am62p-main.dtsi | 46 ++++++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts   | 67 +++++++++++++++++++++++
 2 files changed, 113 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +0 -0
index 4c51bae06b57..7e7cd749d9a5 100644
@@ -560,6 +560,52 @@ sdhci2: mmc@fa20000 {
 		status = "disabled";
 	};
 
Quoted 3 lines

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

Quoted 1 line
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +1 -0
+	usbss0: dwc3-usb@f900000 {

usb@

OK.

Quoted 82 lines
Quoted 14 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +13 -0
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f900000 0x00 0x800>;
+		clocks = <&k3_clks 161 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&usb0_phy_ctrl 0x0>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+		status = "disabled";
+
+		usb0: usb@31000000 {
+			compatible = "snps,dwc3";

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

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +10 -0
+			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 {

usb@

Quoted 55 lines
arch/arm64/boot/dts/ti/k3-am62p-main.dtsi +22 -0
+		compatible = "ti,am62-usb";
+		reg = <0x00 0x0f910000 0x00 0x800>;
+		clocks = <&k3_clks 162 3>;
+		clock-names = "ref";
+		ti,syscon-phy-pll-refclk = <&usb1_phy_ctrl 0x0>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		power-domains = <&k3_pds 179 TI_SCI_PD_EXCLUSIVE>;
+		ranges;
+		status = "disabled";
+
+		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>;
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +8 -0
index 1773c05f752c..7a16e7a8ac66 100644
@@ -27,6 +27,8 @@ aliases {
 		spi0 = &ospi0;
 		ethernet0 = &cpsw_port1;
 		ethernet1 = &cpsw_port2;
+		usb0 = &usb0;
+		usb1 = &usb1;
 	};
 
 	chosen {
@@ -297,6 +299,12 @@ AM62PX_IOPAD(0x01b0, PIN_OUTPUT, 2) /* (G20) MCASP0_ACLKR.UART1_TXD */
 		bootph-all;
 	};
 
+	main_usb1_pins_default: main-usb1-default-pins {
+		pinctrl-single,pins = <
+			AM62PX_IOPAD(0x0258, PIN_INPUT, 0) /* (G21) USB1_DRVVBUS */
+		>;
+	};
+
 	main_wlirq_pins_default: main-wlirq-default-pins {
 		pinctrl-single,pins = <
 			AM62PX_IOPAD(0x0128, PIN_INPUT, 7) /* (K25) MMC2_SDWP.GPIO0_72 */
@@ -340,6 +348,36 @@ AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */
 	};
 };
 
Quoted 12 lines

arch/arm64/boot/dts/ti/k3-am62p5-sk.dts AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */ · line 357

Quoted 7 lines
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +7 -0
+&main_i2c0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&main_i2c0_pins_default>;
+	clock-frequency = <400000>;
+
+	typec_pd0: tps6598x@3f {

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

got it. Thanks!

Quoted 16 lines

arch/arm64/boot/dts/ti/k3-am62p5-sk.dts AM62PX_IOPAD(0x0124, PIN_INPUT, 7) /* (J25) MMC2_SDCD.GPIO0_71 */ · line 367

Quoted 11 lines
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +10 -0
+		compatible = "ti,tps6598x";
+		reg = <0x3f>;
+
+		connector {
+			compatible = "usb-c-connector";
+			label = "USB-C";
+			self-powered;
+			data-role = "dual";
+			power-role = "sink";
+			ports {

Best regards,
Krzysztof

Signature · 2 lines
cheers,
-roger