Skip to contentSkip to conversation

Add DT USB definitions for SAM9X60, SAMA5D2 and SAMA7

PATCH In review Sergiu Moga 3 participants 13 messages Jan 4, 2023 – Jan 5, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Add DT USB definitions for SAM9X60, SAMA5D2 and SAMA7

This patch series originates from the bigger patch series:
https://lists.denx.de/pipermail/u-boot/2022-December/502865.html

Add the basic DT USB definitions for SAM9X60, SAMA5D2 and SAMA7. The required pinctrl definitions have been added as well as additional definitions for the UTMI related clocks and their relationship with the Reset driver.

v1 -> v2:
- split patches for SoC/Board separately
- use usb@

v2 -> v3:
- update commit message regarding the SAMA7G5_RESET_USB_PHY id's
- added USB_ prefix to UTMI macro-definitions
- move sama7g5's USB DT definitions to U-Boot specific file

Sergiu Moga (9):
ARM: dts: sam9x60: Add OHCI and EHCI DT nodes
ARM: dts: sam9x60_curiosity: Add pinctrl and gpio properties for USB
ARM: dts: sam9x60ek: Add pinctrl and gpio properties for USB
dt-bindings: reset: add sama7g5 definitions
dt-bindings: clk: at91: Define additional UTMI related clocks
ARM: dts: sama7g5: Add USB and UTMI DT nodes
ARM: dts: sama7g5ek: Add pinctrl, gpio and phy properties for USB
ARM: dts: sama5d2_icp: Add pinctrl nodes for USB related DT nodes
ARM: dts: sama5d27_wlsom1_ek: Add pinctrl nodes for USB DT nodes

 arch/arm/dts/at91-sam9x60_curiosity.dts   |  21 +++++
 arch/arm/dts/at91-sama5d27_wlsom1_ek.dts  |  25 +++++
 arch/arm/dts/at91-sama5d2_icp.dts         |  22 +++++
 arch/arm/dts/at91-sama7g5ek-u-boot.dtsi   | 108 ++++++++++++++++++++++
 arch/arm/dts/sam9x60.dtsi                 |  18 ++++
 arch/arm/dts/sam9x60ek.dts                |  21 +++++
 include/dt-bindings/clk/at91.h            |   5 +
 include/dt-bindings/reset/sama7g5-reset.h |  10 ++
 8 files changed, 230 insertions(+)
 create mode 100644 include/dt-bindings/reset/sama7g5-reset.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/9 ARM: dts: sam9x60: Add OHCI and EHCI DT nodes

Add the OHCI and EHCI DT nodes for the sam9x60 SoC's.

---

v1 -> v2:
- use usb@

v2 -> v3:
- Nothing

 arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm/dts/sam9x60.dtsi +18 -0
index a5c429eb3a..42bf8c6e04 100644
@@ -69,6 +69,24 @@
 		#size-cells = <1>;
 		ranges;
 
+		usb1: usb@600000 {
+			compatible = "atmel,at91rm9200-ohci", "usb-ohci";
+			reg = <0x00600000 0x100000>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 22>, <&pmc PMC_TYPE_PERIPHERAL 22>, <&pmc PMC_TYPE_SYSTEM 21>;
+			clock-names = "ohci_clk", "hclk", "uhpck";
+			status = "disabled";
+		};
+
+		usb2: usb@700000 {
+			compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
+			reg = <0x00700000 0x100000>;
+			clocks = <&pmc PMC_TYPE_CORE 8>, <&pmc PMC_TYPE_PERIPHERAL 22>;
+			clock-names = "usb_clk", "ehci_clk";
+			assigned-clocks = <&pmc PMC_TYPE_CORE 8>;
+			assigned-clock-rates = <480000000>;
+			status = "disabled";
+		};
+
 		sdhci0: sdhci-host@80000000 {
 			compatible = "microchip,sam9x60-sdhci";
 			reg = <0x80000000 0x300>;
Signature · 1 line
2.34.1
#3 lore raw

PATCH v3 2/9 ARM: dts: sam9x60_curiosity: Add pinctrl and gpio properties for USB

In reply to Sergiu Moga

Add the required pinctrl and gpio properties needed by the USB DT nodes of the sam9x60_curiosity boards.

---

v1 -> v2:
- this patch was not here, previously split from 1/6 of v1

v2 -> v3:
- nothing

 arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/dts/at91-sam9x60_curiosity.dts +21 -0
index 7c5b6ae2b8..d6ae3d648d 100644
@@ -49,6 +49,13 @@
 						atmel,pins =
 							<AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
 					};
+
+					usb1 {
+						pinctrl_usb_default: usb_default {
+							atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
+									AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
+						};
+					};
 			};
 		};
 	};
@@ -89,3 +96,17 @@
 	phy-mode = "rmii";
 	status = "okay";
 };
+
+&usb1 {
+	num-ports = <3>;
+	atmel,vbus-gpio = <0
+			   &pioD 15 GPIO_ACTIVE_HIGH
+			   &pioD 18 GPIO_ACTIVE_HIGH>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_default>;
+	status = "okay";
+};
+
+&usb2 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
#4 lore raw

PATCH v3 3/9 ARM: dts: sam9x60ek: Add pinctrl and gpio properties for USB

In reply to Sergiu Moga

Add the required pinctrl and gpio properties required by the USB DT nodes of the sam9x60ek boards.

---

v1 -> v2:
- this patch was not here, previously split from 1/6 of v1

v2 -> v3:
- nothing

 arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/dts/sam9x60ek.dts +21 -0
index eb44868a3e..fb1e63c5b2 100644
@@ -101,6 +101,13 @@
 						<AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
 				};
 
+				usb1 {
+					pinctrl_usb_default: usb_default {
+						atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
+								AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
+					};
+				};
+
 			};
 		};
 	};
@@ -110,3 +117,17 @@
 	phy-mode = "rmii";
 	status = "okay";
 };
+
+&usb1 {
+	num-ports = <3>;
+	atmel,vbus-gpio = <0
+			   &pioD 15 GPIO_ACTIVE_HIGH
+			   &pioD 16 GPIO_ACTIVE_HIGH>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_default>;
+	status = "okay";
+};
+
+&usb2 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
#5 lore raw

PATCH v3 4/9 dt-bindings: reset: add sama7g5 definitions

In reply to Sergiu Moga

Upstream linux commit 5994f58977e0.

Add reset bindings for SAMA7G5. At the moment only USB PHYs are included.

The three reset USB phy's have their ID's mapped from 4 to 6. There are no USB phy's with ID's numbered from 0 to 3.

---

v1 -> v2:
- nothing

v2 -> v3:
- added explanation in the commit message regarding missing id's 0-3

 include/dt-bindings/reset/sama7g5-reset.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 include/dt-bindings/reset/sama7g5-reset.h
include/dt-bindings/reset/sama7g5-reset.h new file +10 -0
new file mode 100644
index 0000000000..2116f41d04
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef __DT_BINDINGS_RESET_SAMA7G5_H
+#define __DT_BINDINGS_RESET_SAMA7G5_H
+
+#define SAMA7G5_RESET_USB_PHY1		4
+#define SAMA7G5_RESET_USB_PHY2		5
+#define SAMA7G5_RESET_USB_PHY3		6
+
+#endif /* __DT_BINDINGS_RESET_SAMA7G5_H */
Signature · 1 line
2.34.1
#6 lore raw

PATCH v3 5/9 dt-bindings: clk: at91: Define additional UTMI related clocks

In reply to Sergiu Moga

Add definitions for an additional main UTMI clock as well as its respective subclocks.

---

v1 -> v2:
- nothing

v2 -> v3:
- added USB_ prefix

 include/dt-bindings/clk/at91.h | 5 +++++
 1 file changed, 5 insertions(+)
include/dt-bindings/clk/at91.h +5 -0
index e30756b280..a178b94157 100644
@@ -18,5 +18,10 @@
 #define PMC_TYPE_PERIPHERAL	3
 #define PMC_TYPE_GCK		4
 #define PMC_TYPE_SLOW		5
+#define USB_UTMI		6
+
+#define USB_UTMI1		0
+#define USB_UTMI2		1
+#define USB_UTMI3		2
 
 #endif
Signature · 1 line
2.34.1
#7 lore raw

PATCH v3 6/9 ARM: dts: sama7g5: Add USB and UTMI DT nodes

In reply to Sergiu Moga

Define the USB and UTMI DT nodes for the sama7g5 SoC's. Since these have not yet been defined in upstream Linux, place them in the U-Boot specific DT file.

---

v1 -> v2:
- use usb@

v2 -> v3:
- place definitions in the U-Boot specific file and mention it in the commit message

 arch/arm/dts/at91-sama7g5ek-u-boot.dtsi | 75 ++++++++++++++++++++++++-
 1 file changed, 74 insertions(+), 1 deletion(-)
arch/arm/dts/at91-sama7g5ek-u-boot.dtsi +74 -1
index d294ddb54a..f563071fe6 100644
@@ -10,13 +10,87 @@
  *
  */
 
+#include <dt-bindings/reset/sama7g5-reset.h>
+#include <dt-bindings/clock/at91.h>
+
 / {
 	chosen {
 		u-boot,dm-pre-reloc;
 	};
 
+	utmi {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		usb_phy0: phy@0 {
+			compatible = "microchip,sama7g5-usb-phy";
+			sfr-phandle = <&sfr>;
+			reg = <0>;
+			clocks = <&utmi_clk USB_UTMI1>;
+			clock-names = "utmi_clk";
+			status = "disabled";
+			#phy-cells = <0>;
+		};
+
+		usb_phy1: phy@1 {
+			compatible = "microchip,sama7g5-usb-phy";
+			sfr-phandle = <&sfr>;
+			reg = <1>;
+			clocks = <&utmi_clk USB_UTMI2>;
+			clock-names = "utmi_clk";
+			status = "disabled";
+			#phy-cells = <0>;
+		};
+
+		usb_phy2: phy@2 {
+			compatible = "microchip,sama7g5-usb-phy";
+			sfr-phandle = <&sfr>;
+			reg = <2>;
+			clocks = <&utmi_clk USB_UTMI3>;
+			clock-names = "utmi_clk";
+			status = "disabled";
+			#phy-cells = <0>;
+		};
+	};
+
+	utmi_clk: utmi-clk {
+		compatible = "microchip,sama7g5-utmi-clk";
+		sfr-phandle = <&sfr>;
+		#clock-cells = <1>;
+		clocks = <&pmc PMC_TYPE_CORE 27>;
+		clock-names = "utmi_clk";
+		resets = <&reset_controller SAMA7G5_RESET_USB_PHY1>,
+			 <&reset_controller SAMA7G5_RESET_USB_PHY2>,
+			 <&reset_controller SAMA7G5_RESET_USB_PHY3>;
+		reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
+	};
+
 	soc {
 		u-boot,dm-pre-reloc;
+
+		usb2: usb@400000 {
+			compatible = "microchip,sama7g5-ohci", "usb-ohci";
+			reg = <0x00400000 0x100000>;
+			interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&pmc PMC_TYPE_PERIPHERAL 106>, <&utmi_clk USB_UTMI1>, <&usb_clk>;
+			clock-names = "ohci_clk", "hclk", "uhpck";
+			status = "disabled";
+		};
+
+		usb3: usb@500000 {
+			compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
+			reg = <0x00500000 0x100000>;
+			interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&usb_clk>, <&pmc PMC_TYPE_PERIPHERAL 106>;
+			clock-names = "usb_clk", "ehci_clk";
+			status = "disabled";
+		};
+
+		sfr: sfr@e1624000 {
+			compatible = "microchip,sama7g5-sfr", "syscon";
+			reg = <0xe1624000 0x4000>;
+		};
 	};
 };
 
@@ -59,4 +133,3 @@
 &uart3 {
 	u-boot,dm-pre-reloc;
 };
-
Signature · 1 line
2.34.1
#9 lore raw

PATCH v3 7/9 ARM: dts: sama7g5ek: Add pinctrl, gpio and phy properties for USB

In reply to Sergiu Moga

Add the required pinctrl, gpio and phy properties required by the USB DT nodes of the sama7g5ek boards. Since these have not yet been defined in upstream Linux, place them in the U-Boot specific DT file.

---

v1 -> v2:
- this patch was not here, previously split from 4/6 of v1

v2 -> v3:
- move the board specific properties in the U-Boot specific file and mention it in the commit message

 arch/arm/dts/at91-sama7g5ek-u-boot.dtsi | 35 +++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm/dts/at91-sama7g5ek-u-boot.dtsi +35 -0
index f563071fe6..a54cfaccbf 100644
@@ -10,6 +10,7 @@
  *
  */
 
+#include "sama7g5-pinfunc.h"
 #include <dt-bindings/reset/sama7g5-reset.h>
 #include <dt-bindings/clock/at91.h>
 
@@ -112,6 +113,11 @@
 
 &pioA {
 	u-boot,dm-pre-reloc;
+
+	pinctrl_usb_default: usb_default {
+		pinmux = <PIN_PC6__GPIO>;
+		bias-disable;
+	};
 };
 
 &pit64b0 {
@@ -133,3 +139,32 @@
 &uart3 {
 	u-boot,dm-pre-reloc;
 };
+
+&usb2 {
+	num-ports = <3>;
+	atmel,vbus-gpio = <0
+			   0
+			   &pioA PIN_PC6 GPIO_ACTIVE_HIGH
+			  >;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_default>;
+	phys = <&usb_phy2>;
+	phy-names = "usb";
+	status = "okay";
+};
+
+&usb3 {
+	status = "okay";
+};
+
+&usb_phy0 {
+	status = "okay";
+};
+
+&usb_phy1 {
+	status = "okay";
+};
+
+&usb_phy2 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
#10 lore raw

PATCH v3 8/9 ARM: dts: sama5d2_icp: Add pinctrl nodes for USB related DT nodes

In reply to Sergiu Moga

Add the pinctrl subnodes required by the USB related DT nodes.

---

v1 -> v3:
- nothing

 arch/arm/dts/at91-sama5d2_icp.dts | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/dts/at91-sama5d2_icp.dts +22 -0
index 2dffae9c5c..4f796c6c94 100644
@@ -154,7 +154,29 @@
 						 <PIN_PA13__SDMMC0_CD>;
 					bias-disable;
 				};
+
+				pinctrl_usb_default: usb_default {
+					pinmux = <PIN_PC17__GPIO>;
+					bias-disable;
+				};
+
+				pinctrl_usba_vbus: usba_vbus {
+					pinmux = <PIN_PD23__GPIO>;
+					bias-disable;
+				};
 			};
 		};
 	};
 };
+
+&usb1 {
+	num-ports = <3>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_default>;
+	status = "okay";
+};
+
+&usb2 {
+	phy_type = "hsic";
+	status = "okay";
+};
Signature · 1 line
2.34.1
#11 lore raw

PATCH v3 9/9 ARM: dts: sama5d27_wlsom1_ek: Add pinctrl nodes for USB DT nodes

In reply to Sergiu Moga

Add the pinctrl nodes required by the USB related DT nodes.

---

v1 -> v3:
- nothing

 arch/arm/dts/at91-sama5d27_wlsom1_ek.dts | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/arm/dts/at91-sama5d27_wlsom1_ek.dts +25 -0
index eec183d5de..6d4b35ea96 100644
@@ -143,7 +143,32 @@
 					pinmux = <PIN_PC9__GPIO>;
 					bias-pull-up;
 				};
+
+				pinctrl_usb_default: usb_default {
+					pinmux = <PIN_PA10__GPIO>;
+					bias-disable;
+				};
+
+				pinctrl_usba_vbus: usba_vbus {
+					pinmux = <PIN_PA16__GPIO>;
+					bias-disable;
+				};
 			};
 		};
 	};
 };
+
+&usb1 {
+	num-ports = <3>;
+	atmel,vbus-gpio = <0
+			   &pioA PIN_PA10 GPIO_ACTIVE_HIGH
+			   0
+			  >;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb_default>;
+	status = "okay";
+};
+
+&usb2 {
+	status = "okay";
+};
Signature · 1 line
2.34.1
#12 lore raw
In reply to Sergiu Moga
Quoted 39 lines · Sergiu Moga

This patch series originates from the bigger patch series:
https://lists.denx.de/pipermail/u-boot/2022-December/502865.html

Add the basic DT USB definitions for SAM9X60, SAMA5D2 and SAMA7. The required pinctrl definitions have been added as well as additional definitions for the UTMI related clocks and their relationship with the Reset driver.

v1 -> v2:
- split patches for SoC/Board separately
- use usb@

v2 -> v3:
- update commit message regarding the SAMA7G5_RESET_USB_PHY id's
- added USB_ prefix to UTMI macro-definitions
- move sama7g5's USB DT definitions to U-Boot specific file

Sergiu Moga (9):
ARM: dts: sam9x60: Add OHCI and EHCI DT nodes
ARM: dts: sam9x60_curiosity: Add pinctrl and gpio properties for USB
ARM: dts: sam9x60ek: Add pinctrl and gpio properties for USB
dt-bindings: reset: add sama7g5 definitions
dt-bindings: clk: at91: Define additional UTMI related clocks
ARM: dts: sama7g5: Add USB and UTMI DT nodes
ARM: dts: sama7g5ek: Add pinctrl, gpio and phy properties for USB
ARM: dts: sama5d2_icp: Add pinctrl nodes for USB related DT nodes
ARM: dts: sama5d27_wlsom1_ek: Add pinctrl nodes for USB DT nodes

  arch/arm/dts/at91-sam9x60_curiosity.dts   |  21 +++++
  arch/arm/dts/at91-sama5d27_wlsom1_ek.dts  |  25 +++++
  arch/arm/dts/at91-sama5d2_icp.dts         |  22 +++++
  arch/arm/dts/at91-sama7g5ek-u-boot.dtsi   | 108 ++++++++++++++++++++++
  arch/arm/dts/sam9x60.dtsi                 |  18 ++++
  arch/arm/dts/sam9x60ek.dts                |  21 +++++
  include/dt-bindings/clk/at91.h            |   5 +
  include/dt-bindings/reset/sama7g5-reset.h |  10 ++
  8 files changed, 230 insertions(+)
Quoted 2 lines

create mode 100644 include/dt-bindings/reset/sama7g5-reset.h

Applied series to u-boot-at91/next, thanks !