[PATCH v3 0/9] 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

Add the OHCI and EHCI DT nodes for the sam9x60 SoC's.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
v1 -> v2: - use usb@
v2 -> v3: - Nothing
arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index a5c429eb3a..42bf8c6e04 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -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>;

On 1/4/23 15:04, Sergiu Moga wrote:
Add the OHCI and EHCI DT nodes for the sam9x60 SoC's.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
Reviewed-by: Marek Vasut marex@denx.de

Add the required pinctrl and gpio properties needed by the USB DT nodes of the sam9x60_curiosity boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
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(+)
diff --git a/arch/arm/dts/at91-sam9x60_curiosity.dts b/arch/arm/dts/at91-sam9x60_curiosity.dts index 7c5b6ae2b8..d6ae3d648d 100644 --- a/arch/arm/dts/at91-sam9x60_curiosity.dts +++ b/arch/arm/dts/at91-sam9x60_curiosity.dts @@ -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"; +};

Add the required pinctrl and gpio properties required by the USB DT nodes of the sam9x60ek boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
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(+)
diff --git a/arch/arm/dts/sam9x60ek.dts b/arch/arm/dts/sam9x60ek.dts index eb44868a3e..fb1e63c5b2 100644 --- a/arch/arm/dts/sam9x60ek.dts +++ b/arch/arm/dts/sam9x60ek.dts @@ -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"; +};

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.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
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
diff --git a/include/dt-bindings/reset/sama7g5-reset.h b/include/dt-bindings/reset/sama7g5-reset.h new file mode 100644 index 0000000000..2116f41d04 --- /dev/null +++ b/include/dt-bindings/reset/sama7g5-reset.h @@ -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 */

Add definitions for an additional main UTMI clock as well as its respective subclocks.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
v1 -> v2: - nothing
v2 -> v3: - added USB_ prefix
include/dt-bindings/clk/at91.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/dt-bindings/clk/at91.h b/include/dt-bindings/clk/at91.h index e30756b280..a178b94157 100644 --- a/include/dt-bindings/clk/at91.h +++ b/include/dt-bindings/clk/at91.h @@ -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

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.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
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(-)
diff --git a/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi b/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi index d294ddb54a..f563071fe6 100644 --- a/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi +++ b/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi @@ -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; }; -

On 1/4/23 15:04, Sergiu Moga wrote:
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.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
Reviewed-by: Marek Vasut marex@denx.de

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.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
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(+)
diff --git a/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi b/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi index f563071fe6..a54cfaccbf 100644 --- a/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi +++ b/arch/arm/dts/at91-sama7g5ek-u-boot.dtsi @@ -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"; +};

Add the pinctrl subnodes required by the USB related DT nodes.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
v1 -> v3: - nothing
arch/arm/dts/at91-sama5d2_icp.dts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/arch/arm/dts/at91-sama5d2_icp.dts b/arch/arm/dts/at91-sama5d2_icp.dts index 2dffae9c5c..4f796c6c94 100644 --- a/arch/arm/dts/at91-sama5d2_icp.dts +++ b/arch/arm/dts/at91-sama5d2_icp.dts @@ -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"; +};

Add the pinctrl nodes required by the USB related DT nodes.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com ---
v1 -> v3: - nothing
arch/arm/dts/at91-sama5d27_wlsom1_ek.dts | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts b/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts index eec183d5de..6d4b35ea96 100644 --- a/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts +++ b/arch/arm/dts/at91-sama5d27_wlsom1_ek.dts @@ -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"; +};

On 1/4/23 16:04, Sergiu Moga wrote:
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
Applied series to u-boot-at91/next, thanks !
participants (3)
-
Eugen.Hristev@microchip.com
-
Marek Vasut
-
Sergiu Moga