Skip to contentSkip to conversation

Add PCIe overlay for am642-phyboard-electra

PATCH Superseded Nathan Morrisson 2 participants 4 messages May 3, 2024 – May 6, 2024

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Add PCIe overlay for am642-phyboard-electra

Remove PCIe pinmuxing from the am642-phyboard-electra device tree and provide an overlay to mux and enable PCIe.

Nathan Morrisson (2):
arm64: dts: ti: am642-phyboard-electra: Remove PCIe pinmuxing
arm64: dts: ti: am642-phyboard-electra: Add overlay to enable PCIe

 arch/arm64/boot/dts/ti/Makefile               |  3 +
 .../k3-am642-phyboard-electra-pcie-usb2.dtso  | 88 +++++++++++++++++++
 .../dts/ti/k3-am642-phyboard-electra-rdk.dts  | 12 ---
 3 files changed, 91 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 arm64: dts: ti: am642-phyboard-electra: Remove PCIe pinmuxing

Remove pinmuxing for PCIe so that we can add it in an overlay.

---
 .../boot/dts/ti/k3-am642-phyboard-electra-rdk.dts    | 12 ------------
 1 file changed, 12 deletions(-)
arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-rdk.dts +0 -12
index 8237b8c815b8..58cee0a8412c 100644
@@ -190,18 +190,6 @@ AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0)	/* (E19) USB0_DRVVBUS */
 		>;
 	};
 
-	pcie_usb_sel_pins_default: pcie-usb-sel-default-pins {
-		pinctrl-single,pins = <
-			AM64X_IOPAD(0x017c, PIN_OUTPUT, 7)	/* (T1) PRG0_PRU0_GPO7.GPIO1_7 */
-		>;
-	};
-
-	pcie0_pins_default: pcie0-default-pins {
-		pinctrl-single,pins = <
-			AM64X_IOPAD(0x0098, PIN_OUTPUT, 7)	/* (W19) GPMC0_WAIT0.GPIO0_37 */
-		>;
-	};
-
 	user_leds_pins_default: user-leds-default-pins {
 		pinctrl-single,pins = <
 			AM64X_IOPAD(0x003c, PIN_OUTPUT, 7)	/* (T20) GPMC0_AD0.GPIO0_15 */
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/2 arm64: dts: ti: am642-phyboard-electra: Add overlay to enable PCIe

In reply to Nathan Morrisson

Add an overlay to enable PCIe on the am642-phyboard-electra. This will disable USB3 and restrict us to USB2.

---
 arch/arm64/boot/dts/ti/Makefile               |  3 +
 .../k3-am642-phyboard-electra-pcie-usb2.dtso  | 88 +++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso
arch/arm64/boot/dts/ti/Makefile +3 -0
index 9a722c2473fb..6a38ce2603af 100644
@@ -48,6 +48,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-am642-hummingboard-t.dtb
 dtb-$(CONFIG_ARCH_K3) += k3-am642-hummingboard-t-pcie.dtb
 dtb-$(CONFIG_ARCH_K3) += k3-am642-hummingboard-t-usb3.dtb
 dtb-$(CONFIG_ARCH_K3) += k3-am642-phyboard-electra-rdk.dtb
+dtb-$(CONFIG_ARCH_K3) += k3-am642-phyboard-electra-pcie-usb2.dtbo
 dtb-$(CONFIG_ARCH_K3) += k3-am642-sk.dtb
 dtb-$(CONFIG_ARCH_K3) += k3-am642-tqma64xxl-mbax4xxl.dtb
 dtb-$(CONFIG_ARCH_K3) += k3-am64-tqma64xxl-mbax4xxl-sdcard.dtbo
@@ -131,6 +132,8 @@ k3-am62p5-sk-csi2-tevi-ov5640-dtbs := k3-am62p5-sk.dtb \
 	k3-am62x-sk-csi2-tevi-ov5640.dtbo
 k3-am642-evm-icssg1-dualemac-dtbs := \
 	k3-am642-evm.dtb k3-am642-evm-icssg1-dualemac.dtbo
+k3-am642-phyboard-electra-pcie-usb2.dtbs := \
+	k3-am642-phyboard-electra-rdk.dtb k3-am642-phyboard-electra-pcie-usb2.dtbo
 k3-am642-tqma64xxl-mbax4xxl-sdcard-dtbs := \
 	k3-am642-tqma64xxl-mbax4xxl.dtb k3-am64-tqma64xxl-mbax4xxl-sdcard.dtbo
 k3-am642-tqma64xxl-mbax4xxl-wlan-dtbs := \
arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso new file +88 -0

88 lines not on this page · raw message

Signature · 1 line
2.25.1
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] arm64: dts: ti: am642-phyboard-electra: Add overlay to enable PCIe

Hi Nathan,

Am 04.05.24 um 00:35 schrieb Nathan Morrisson:

Quoted 56 lines

Add an overlay to enable PCIe on the am642-phyboard-electra. This will disable USB3 and restrict us to USB2.

---
  arch/arm64/boot/dts/ti/Makefile               |  3 +
  .../k3-am642-phyboard-electra-pcie-usb2.dtso  | 88 +++++++++++++++++++
  2 files changed, 91 insertions(+)

create mode 100644 arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso

arch/arm64/boot/dts/ti/Makefile +3 -0
index 9a722c2473fb..6a38ce2603af 100644
@@ -48,6 +48,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-am642-hummingboard-t.dtb
  dtb-$(CONFIG_ARCH_K3) += k3-am642-hummingboard-t-pcie.dtb
  dtb-$(CONFIG_ARCH_K3) += k3-am642-hummingboard-t-usb3.dtb
  dtb-$(CONFIG_ARCH_K3) += k3-am642-phyboard-electra-rdk.dtb
+dtb-$(CONFIG_ARCH_K3) += k3-am642-phyboard-electra-pcie-usb2.dtbo
  dtb-$(CONFIG_ARCH_K3) += k3-am642-sk.dtb
  dtb-$(CONFIG_ARCH_K3) += k3-am642-tqma64xxl-mbax4xxl.dtb
  dtb-$(CONFIG_ARCH_K3) += k3-am64-tqma64xxl-mbax4xxl-sdcard.dtbo
@@ -131,6 +132,8 @@ k3-am62p5-sk-csi2-tevi-ov5640-dtbs := k3-am62p5-sk.dtb \
  	k3-am62x-sk-csi2-tevi-ov5640.dtbo
  k3-am642-evm-icssg1-dualemac-dtbs := \
  	k3-am642-evm.dtb k3-am642-evm-icssg1-dualemac.dtbo
+k3-am642-phyboard-electra-pcie-usb2.dtbs := \
+	k3-am642-phyboard-electra-rdk.dtb k3-am642-phyboard-electra-pcie-usb2.dtbo
  k3-am642-tqma64xxl-mbax4xxl-sdcard-dtbs := \
  	k3-am642-tqma64xxl-mbax4xxl.dtb k3-am64-tqma64xxl-mbax4xxl-sdcard.dtbo
  k3-am642-tqma64xxl-mbax4xxl-wlan-dtbs := \
arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso new file +19 -0
new file mode 100644
index 000000000000..03fc81a6018f
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+/*
+ * DT overlay for PCIe support (limits USB to 2.0/high-speed)
+ *
+ * Copyright (C) 2021 PHYTEC America, LLC - https://www.phytec.com
+ * Author: Matt McKee <[email protected]>
+ *
+ * Copyright (C) 2024 PHYTEC America, LLC - https://www.phytec.com
+ * Author: Nathan Morrisson <[email protected]>
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/phy/phy.h>
+#include <dt-bindings/phy/phy-cadence.h>
+
+#include "k3-pinctrl.h"

arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso line 29

Quoted 10 lines
arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso new file +10 -0
+#include "k3-serdes.h"
+
+&{/} {
+	pcie_refclk0: pcie-refclk0 {
+		compatible = "gpio-gate-clock";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pcie_usb_sel_pins_default>;
+		clocks = <&serdes_refclk>;
+		#clock-cells = <0>;
+		enable-gpios =  <&main_gpio1 7 GPIO_ACTIVE_HIGH>;

^ you have two spaces after =

arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso line 30

Quoted 1 line
arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso new file +1 -0
+		status = "okay";

you do not need this status property here.

With this changes, for both patches:

Quoted 58 lines
arch/arm64/boot/dts/ti/k3-am642-phyboard-electra-pcie-usb2.dtso new file +58 -0
+	};
+};
+
+&main_pmx0 {
+	pcie_usb_sel_pins_default: pcie-usb-sel-default-pins {
+		pinctrl-single,pins = <
+			AM64X_IOPAD(0x017c, PIN_OUTPUT, 7)	/* (T1) PRG0_PRU0_GPO7.GPIO1_7 */
+		>;
+	};
+
+	pcie_pins_default: pcie-default-pins {
+		pinctrl-single,pins = <
+			AM64X_IOPAD(0x0098, PIN_OUTPUT, 7)	/* (W19) GPMC0_WAIT0.GPIO0_37 */
+		>;
+	};
+};
+
+&pcie0_rc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie_pins_default>;
+	reset-gpios = <&main_gpio0 37 GPIO_ACTIVE_HIGH>;
+	phys = <&serdes0_pcie_usb_link>;
+	phy-names = "pcie-phy";
+	num-lanes = <1>;
+	status = "okay";
+};
+
+&serdes0_pcie_usb_link {
+	cdns,phy-type = <PHY_TYPE_PCIE>;
+};
+
+&serdes_ln_ctrl {
+	idle-states = <AM64_SERDES0_LANE0_PCIE0>;
+};
+
+&serdes0 {
+	assigned-clock-parents = <&pcie_refclk0>, <&pcie_refclk0>, <&pcie_refclk0>;
+};
+
+&serdes_refclk {
+	clock-frequency = <100000000>;
+};
+
+/*
+ * Assign pcie_refclk0 to serdes_wiz0 as ext_ref_clk.
+ * This makes sure that the clock generator gets enabled at the right time.
+ */
+&serdes_wiz0 {
+	clocks = <&k3_clks 162 0>, <&k3_clks 162 1>, <&pcie_refclk0>;
+};
+
+&usbss0 {
+	ti,usb2-only;
+};
+
+&usb0 {
+	maximum-speed = "high-speed";
+};