[PATCH 0/6] 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.
Sergiu Moga (6): ARM: dts: sam9x60: Add OHCI and EHCI DT nodes dt-bindings: reset: add sama7g5 definitions dt-bindings: clk: at91: Define additional UTMI related clocks ARM: dts: at91: sama7: Add USB related DT nodes ARM: dts: at91: sama5d2_icp: Add pinctrl nodes for USB related DT nodes ARM: dts: at91: 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.dts | 34 +++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++ arch/arm/dts/sam9x60ek.dts | 21 +++++++ arch/arm/dts/sama7g5.dtsi | 73 +++++++++++++++++++++++ include/dt-bindings/clk/at91.h | 5 ++ include/dt-bindings/reset/sama7g5-reset.h | 10 ++++ 9 files changed, 229 insertions(+) create mode 100644 include/dt-bindings/reset/sama7g5-reset.h

Add the OHCI and EHCI DT nodes for the sam9x60 boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++ arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++ 3 files changed, 60 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"; +}; diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 17224ef771..e36a540f78 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -69,6 +69,24 @@ #size-cells = <1>; ranges;
+ usb1: ohci@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: ehci@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"; + }; + ebi: ebi@10000000 { compatible = "microchip,sam9x60-ebi"; #address-cells = <2>; diff --git a/arch/arm/dts/sam9x60ek.dts b/arch/arm/dts/sam9x60ek.dts index 1a02e2cb79..45e2f4cc40 100644 --- a/arch/arm/dts/sam9x60ek.dts +++ b/arch/arm/dts/sam9x60ek.dts @@ -139,6 +139,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>; + }; + }; + }; }; }; @@ -213,3 +220,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"; +};

On 12/23/22 13:33, Sergiu Moga wrote:
Add the OHCI and EHCI DT nodes for the sam9x60 boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++
Board and SoC DT changes should be in separate patches.
arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++ 3 files changed, 60 insertions(+)
[...]
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 17224ef771..e36a540f78 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -69,6 +69,24 @@ #size-cells = <1>; ranges;
usb1: ohci@600000 {
This should be usb@ instead of ohci@ , if you run "make dtbs_check" on this DT in Linux (please do), you would likely get a warning , see Linux Documentation/devicetree/bindings/usb/usb.yaml .
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";
};
[...]

On 1/3/23 01:12, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the OHCI and EHCI DT nodes for the sam9x60 boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++
Board and SoC DT changes should be in separate patches.
arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++ 3 files changed, 60 insertions(+)
[...]
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 17224ef771..e36a540f78 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -69,6 +69,24 @@ #size-cells = <1>; ranges;
+ usb1: ohci@600000 {
This should be usb@ instead of ohci@ , if you run "make dtbs_check" on this DT in Linux (please do), you would likely get a warning , see Linux Documentation/devicetree/bindings/usb/usb.yaml .
If in Linux we have ohci@ , then we need to have the same in U-boot. We can accept the change to usb@ , if there is a pending patch in Linux. U-boot is not the place to review the devicetree. The devicetree must be in sync with Linux.
Eugen
+ 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"; + };
[...]

On 1/4/23 08:30, Eugen.Hristev@microchip.com wrote:
On 1/3/23 01:12, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the OHCI and EHCI DT nodes for the sam9x60 boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++
Board and SoC DT changes should be in separate patches.
arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++ 3 files changed, 60 insertions(+)
[...]
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 17224ef771..e36a540f78 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -69,6 +69,24 @@ #size-cells = <1>; ranges;
+ usb1: ohci@600000 {
This should be usb@ instead of ohci@ , if you run "make dtbs_check" on this DT in Linux (please do), you would likely get a warning , see Linux Documentation/devicetree/bindings/usb/usb.yaml .
If in Linux we have ohci@ , then we need to have the same in U-boot.
You should update the Linux DT to usb@ too to avoid dtbs_check warnings.
We can accept the change to usb@ , if there is a pending patch in Linux.
I can make the same argument about Linux, since DTs are OS agnostic. My comment is OS agnostic too and does not apply specifically to U-Boot or Linux, it applies to DT.
U-boot is not the place to review the devicetree.
I strongly disagree with this statement.
What does it matter where the review feedback came from ? What does matter is that you can improve the DT based on that feedback, if the feedback is valid.
The devicetree must be in sync with Linux.
I agree with this statement.
Please update the Linux DT too.

On 1/4/23 11:38, Marek Vasut wrote:
On 1/4/23 08:30, Eugen.Hristev@microchip.com wrote:
On 1/3/23 01:12, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the OHCI and EHCI DT nodes for the sam9x60 boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++
Board and SoC DT changes should be in separate patches.
arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++ 3 files changed, 60 insertions(+)
[...]
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 17224ef771..e36a540f78 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -69,6 +69,24 @@ #size-cells = <1>; ranges;
+ usb1: ohci@600000 {
This should be usb@ instead of ohci@ , if you run "make dtbs_check" on this DT in Linux (please do), you would likely get a warning , see Linux Documentation/devicetree/bindings/usb/usb.yaml .
If in Linux we have ohci@ , then we need to have the same in U-boot.
You should update the Linux DT to usb@ too to avoid dtbs_check warnings.
We can accept the change to usb@ , if there is a pending patch in Linux.
I can make the same argument about Linux, since DTs are OS agnostic. My comment is OS agnostic too and does not apply specifically to U-Boot or Linux, it applies to DT.
Definitely you can comment in Linux , for sure.
U-boot is not the place to review the devicetree.
I strongly disagree with this statement.
There are a few decisions behind this statement. First, the fact that we no longer take bindings into Uboot, and rely solely on bindings in Linux. This means the bindings were reviewed and validated in Linux. Sure there are a few exceptions but not the usual rule. Second, we rely on devicetree kernel.org mailing list to review all the DTs and binding compliance in Linux. This means that the DT has been validated and checked as ABI in Linux. Hence there is no place to question that in Uboot or any other project. The DT must be the same and ABI across all software that uses the DT. If this was validated and agreed upon in Linux, we can't question that here. So if you disagree with this statement, it's your choice of course.
What does it matter where the review feedback came from ? What does matter is that you can improve the DT based on that feedback, if the feedback is valid.
I agree with that, but if we want to improve things, we need to patch things either in Linux first, or patch projects together. The fact that you are against some patches while they have the same identical node in Linux, is not a reason to not allow devicetree nodes to be added to Uboot. DT syncing with Linux is always a must, and that is part of what Sergiu is doing with these patches.
The devicetree must be in sync with Linux.
I agree with this statement.
Please update the Linux DT too.
That is one approach but as I said, not a reason to reject a node that is identical with Linux.

On 1/4/23 11:11, Eugen.Hristev@microchip.com wrote:
On 1/4/23 11:38, Marek Vasut wrote:
On 1/4/23 08:30, Eugen.Hristev@microchip.com wrote:
On 1/3/23 01:12, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the OHCI and EHCI DT nodes for the sam9x60 boards.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sam9x60_curiosity.dts | 21 +++++++++++++++++++++ arch/arm/dts/sam9x60.dtsi | 18 ++++++++++++++++++
Board and SoC DT changes should be in separate patches.
arch/arm/dts/sam9x60ek.dts | 21 +++++++++++++++++++++ 3 files changed, 60 insertions(+)
[...]
diff --git a/arch/arm/dts/sam9x60.dtsi b/arch/arm/dts/sam9x60.dtsi index 17224ef771..e36a540f78 100644 --- a/arch/arm/dts/sam9x60.dtsi +++ b/arch/arm/dts/sam9x60.dtsi @@ -69,6 +69,24 @@ #size-cells = <1>; ranges;
+ usb1: ohci@600000 {
This should be usb@ instead of ohci@ , if you run "make dtbs_check" on this DT in Linux (please do), you would likely get a warning , see Linux Documentation/devicetree/bindings/usb/usb.yaml .
If in Linux we have ohci@ , then we need to have the same in U-boot.
You should update the Linux DT to usb@ too to avoid dtbs_check warnings.
We can accept the change to usb@ , if there is a pending patch in Linux.
I can make the same argument about Linux, since DTs are OS agnostic. My comment is OS agnostic too and does not apply specifically to U-Boot or Linux, it applies to DT.
Definitely you can comment in Linux , for sure.
U-boot is not the place to review the devicetree.
I strongly disagree with this statement.
There are a few decisions behind this statement. First, the fact that we no longer take bindings into Uboot, and rely solely on bindings in Linux. This means the bindings were reviewed and validated in Linux.
Linux 1e5f532c27371 ("ARM: dts: at91: sam9x60: add device tree for soc and board") which added these ohci@ nodes has been accepted after Linux 14ec072a19ad7 ("dt-bindings: usb: Convert USB HCD generic binding to YAML") was already in place.
Therefore, nobody ran the dtbs_check at that point, which is somewhat understandable, since the dtbs_check at that point was in very early stages.
This however shows the review process is not flawless and subsequent updates may be necessary.
One such update example is Linux: 979813d2ab705 ("ARM: dts: at91: use generic name for reset controller") which does: - reset_controller: rstc@fffffe00 { + reset_controller: reset-controller@fffffe00 { or another one: 6a743ea387e63 ("ARM: dts: at91: Use the generic "rtc" node name for the rtt IPs") - rtt: rtt@fffffe20 { + rtt: rtc@fffffe20 { or another one: 4b6140b96dfe4 ("ARM: dts: at91: Use the generic "crypto" node name for the crypto IPs") - sha: sha@f002c000 { + sha: crypto@f002c000 {
Sure there are a few exceptions but not the usual rule. Second, we rely on devicetree kernel.org mailing list to review all the DTs and binding compliance in Linux. This means that the DT has been validated and checked as ABI in Linux.
I think the ABI argument does not work, your own engineers would've caused multiple ABI breaks by now, see above.
Hence there is no place to question that in Uboot or any other project.
As you can see above, Linux kernel review process is not perfect and the code is constantly evolving rather than begin set in stone. I believe other projects and their reviewers are no worse than Linux kernel ones, and can provide valid review feedback too.
The DT must be the same and ABI across all software that uses the DT. If this was validated and agreed upon in Linux, we can't question that here. So if you disagree with this statement, it's your choice of course.
I strongly disagree.
What does it matter where the review feedback came from ? What does matter is that you can improve the DT based on that feedback, if the feedback is valid.
I agree with that, but if we want to improve things, we need to patch things either in Linux first, or patch projects together. The fact that you are against some patches while they have the same identical node in Linux, is not a reason to not allow devicetree nodes to be added to Uboot. DT syncing with Linux is always a must, and that is part of what Sergiu is doing with these patches.
See below.
The devicetree must be in sync with Linux.
I agree with this statement.
Please update the Linux DT too.
That is one approach but as I said, not a reason to reject a node that is identical with Linux.
Ultimately, I am not the at91 maintainer, so I have no say in this.
I provided review feedback, that the DT checker would warn on the node name, and explained how to deal with it.
Whether the feedback is accepted and the DT is improved , or , the feedback is discarded and the DT checker keeps producing warnings , is not my decision to make.

Upstream linux commit 5994f58977e0.
Add reset bindings for SAMA7G5. At the moment only USB PHYs are included.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- 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 --- 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..386f01cf31 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 UTMI 6 + +#define UTMI1 0 +#define UTMI2 1 +#define UTMI3 2
#endif

On 12/23/22 13:33, Sergiu Moga wrote:
Add definitions for an additional main UTMI clock as well as its respective subclocks.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
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..386f01cf31 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 UTMI 6
+#define UTMI1 0 +#define UTMI2 1 +#define UTMI3 2
Why isn't there PMC_TYPE_ prefix in these new macros ?

On 03.01.2023 01:08, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add definitions for an additional main UTMI clock as well as its respective subclocks.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
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..386f01cf31 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 UTMI 6
+#define UTMI1 0 +#define UTMI2 1 +#define UTMI3 2
Why isn't there PMC_TYPE_ prefix in these new macros ?
There is no PMC_TYPE_ because it refers to a different block external to the PMC block. PMC feeds the UTMI clock which feeds the UTMI block that contains the three UTMI clocks: the one for port A and the ones meant for port B and C which depend on port A's UTMI clock. There is no control in the PMC for these. The reason why I added UTMI in this file is because it is related to DT clock definitions.

On 1/3/23 12:50, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 01:08, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add definitions for an additional main UTMI clock as well as its respective subclocks.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
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..386f01cf31 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 UTMI 6
+#define UTMI1 0 +#define UTMI2 1 +#define UTMI3 2
Why isn't there PMC_TYPE_ prefix in these new macros ?
There is no PMC_TYPE_ because it refers to a different block external to the PMC block. PMC feeds the UTMI clock which feeds the UTMI block that contains the three UTMI clocks: the one for port A and the ones meant for port B and C which depend on port A's UTMI clock. There is no control in the PMC for these. The reason why I added UTMI in this file is because it is related to DT clock definitions.
Can you come up with different prefix then ?

On 03.01.2023 16:35, Marek Vasut wrote:
On 1/3/23 12:50, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 01:08, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add definitions for an additional main UTMI clock as well as its respective subclocks.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
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..386f01cf31 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 UTMI 6
+#define UTMI1 0 +#define UTMI2 1 +#define UTMI3 2
Why isn't there PMC_TYPE_ prefix in these new macros ?
There is no PMC_TYPE_ because it refers to a different block external to the PMC block. PMC feeds the UTMI clock which feeds the UTMI block that contains the three UTMI clocks: the one for port A and the ones meant for port B and C which depend on port A's UTMI clock. There is no control in the PMC for these. The reason why I added UTMI in this file is because it is related to DT clock definitions.
Can you come up with different prefix then ?
How about USB_UTMI? :) Would that be fine with you?

On 1/4/23 10:03, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 16:35, Marek Vasut wrote:
On 1/3/23 12:50, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 01:08, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add definitions for an additional main UTMI clock as well as its respective subclocks.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
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..386f01cf31 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 UTMI 6
+#define UTMI1 0 +#define UTMI2 1 +#define UTMI3 2
Why isn't there PMC_TYPE_ prefix in these new macros ?
There is no PMC_TYPE_ because it refers to a different block external to the PMC block. PMC feeds the UTMI clock which feeds the UTMI block that contains the three UTMI clocks: the one for port A and the ones meant for port B and C which depend on port A's UTMI clock. There is no control in the PMC for these. The reason why I added UTMI in this file is because it is related to DT clock definitions.
Can you come up with different prefix then ?
How about USB_UTMI? :) Would that be fine with you?
If those clock are within the USB IP block itself, sure.
I assume the PMC_ clock are in some clock IP block.

Add the USB related DT nodes for the sama7g5ek board.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- arch/arm/dts/at91-sama7g5ek.dts | 34 +++++++++++++++ arch/arm/dts/sama7g5.dtsi | 73 +++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+)
diff --git a/arch/arm/dts/at91-sama7g5ek.dts b/arch/arm/dts/at91-sama7g5ek.dts index 9b247fcaf6..31adc4d3e7 100644 --- a/arch/arm/dts/at91-sama7g5ek.dts +++ b/arch/arm/dts/at91-sama7g5ek.dts @@ -761,6 +761,11 @@ pinmux = <PIN_PB1__SPDIF_TX>; bias-disable; }; + + pinctrl_usb_default: usb_default { + pinmux = <PIN_PC6__GPIO>; + bias-disable; + }; };
&pwm { @@ -837,6 +842,35 @@ status = "okay"; };
+&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"; +}; + &vddout25 { vin-supply = <&vdd_3v3>; status = "okay"; diff --git a/arch/arm/dts/sama7g5.dtsi b/arch/arm/dts/sama7g5.dtsi index 6388a60e53..a6521aaa82 100644 --- a/arch/arm/dts/sama7g5.dtsi +++ b/arch/arm/dts/sama7g5.dtsi @@ -16,6 +16,8 @@ #include <dt-bindings/dma/at91.h> #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/mfd/at91-usart.h> +#include <dt-bindings/reset/sama7g5-reset.h> +#include <dt-bindings/clock/at91.h>
/ { model = "Microchip SAMA7G5 family SoC"; @@ -103,6 +105,54 @@ }; };
+ 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"; + }; + + 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 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 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 UTMI3>; + clock-names = "utmi_clk"; + status = "disabled"; + #phy-cells = <0>; + }; + }; + vddout25: fixed-regulator-vddout25 { compatible = "regulator-fixed";
@@ -127,6 +177,24 @@ #size-cells = <1>; ranges;
+ usb2: ohci@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 UTMI1>, <&usb_clk>; + clock-names = "ohci_clk", "hclk", "uhpck"; + status = "disabled"; + }; + + usb3: ehci@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"; + }; + nfc_sram: sram@600000 { compatible = "mmio-sram"; no-memory-wc; @@ -559,6 +627,11 @@ status = "disabled"; };
+ sfr: sfr@e1624000 { + compatible = "microchip,sama7g5-sfr", "syscon"; + reg = <0xe1624000 0x4000>; + }; + eic: interrupt-controller@e1628000 { compatible = "microchip,sama7g5-eic"; reg = <0xe1628000 0xec>;

On 12/23/22 13:33, Sergiu Moga wrote:
Add the USB related DT nodes for the sama7g5ek board.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sama7g5ek.dts | 34 +++++++++++++++
Board DT and SoC DT should be separate patches.
Are these DT changes part of upstream Linux yet ?
arch/arm/dts/sama7g5.dtsi | 73 +++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+)
[...]

On 03.01.2023 01:07, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the USB related DT nodes for the sama7g5ek board.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sama7g5ek.dts | 34 +++++++++++++++
Board DT and SoC DT should be separate patches.
Are these DT changes part of upstream Linux yet ?
No, but they will be integrated in the future.
arch/arm/dts/sama7g5.dtsi | 73 +++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+)
[...]

On 1/3/23 12:53, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 01:07, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the USB related DT nodes for the sama7g5ek board.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sama7g5ek.dts | 34 +++++++++++++++
Board DT and SoC DT should be separate patches.
Are these DT changes part of upstream Linux yet ?
No, but they will be integrated in the future.
Were the patches at least posted ?
If not, add the nodes into at91-sama7g5ek-u-boot.dtsi , so it is clear this is temporarily U-Boot specific.

On 03.01.2023 16:35, Marek Vasut wrote:
On 1/3/23 12:53, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 01:07, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the USB related DT nodes for the sama7g5ek board.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sama7g5ek.dts | 34 +++++++++++++++
Board DT and SoC DT should be separate patches.
Are these DT changes part of upstream Linux yet ?
No, but they will be integrated in the future.
Were the patches at least posted ?
If not, add the nodes into at91-sama7g5ek-u-boot.dtsi , so it is clear this is temporarily U-Boot specific.
I am sorry, I somehow did not receive these replies before sending v2. Sure thing, I will try moving them there.

On 1/3/23 16:53, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 16:35, Marek Vasut wrote:
On 1/3/23 12:53, Sergiu.Moga@microchip.com wrote:
On 03.01.2023 01:07, Marek Vasut wrote:
On 12/23/22 13:33, Sergiu Moga wrote:
Add the USB related DT nodes for the sama7g5ek board.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com
arch/arm/dts/at91-sama7g5ek.dts | 34 +++++++++++++++
Board DT and SoC DT should be separate patches.
Are these DT changes part of upstream Linux yet ?
No, but they will be integrated in the future.
Were the patches at least posted ?
If not, add the nodes into at91-sama7g5ek-u-boot.dtsi , so it is clear this is temporarily U-Boot specific.
I am sorry, I somehow did not receive these replies before sending v2. Sure thing, I will try moving them there.
Yes, I was still in the process of handling V1, just wait a few days before sending Vx of patches to give reviews time to review and comment.

Add the pinctrl subnodes required by the USB related DT nodes.
Signed-off-by: Sergiu Moga sergiu.moga@microchip.com --- 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 --- 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"; +};
participants (4)
-
Eugen.Hristev@microchip.com
-
Marek Vasut
-
Sergiu Moga
-
Sergiu.Moga@microchip.com