Skip to contentSkip to conversation

sama5d3.dtsi pinctrl section fix

PATCH In review Alexey Tsirlin 3 participants 11 messages Oct 15, 2024 – Oct 22, 2024 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover sama5d3.dtsi pinctrl section fix

At present, there are no PIO sections inside pinctrl DTS section in constradiction to the same file used in kernel. This problem causes the pinctrl driver in u-boot to wrongly detect number of pio ports to be zero which in turn causes the driver to deny any PIO configuration presented in any section of the DTS, for example Ethernet will not work because of wrong PIO configuration.

Alexey Tsirlin (1):
Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel
dts

 arch/arm/dts/sama5d3.dtsi | 111 +++++++++++++++++++-------------------
 1 file changed, 56 insertions(+), 55 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

---

 arch/arm/dts/sama5d3.dtsi | 111 +++++++++++++++++++-------------------
 1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +56 -55
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
 							 AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;	/* PE17 periph B, conflicts with A17 */
 					};
 				};
-			};
 
-			pioA: gpio@fffff200 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff200 0x100>;
-				interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioA_clk>;
-				bootph-all;
-			};
+				pioA: gpio@fffff200 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
+					reg = <0xfffff200 0x100>;
+					interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioA_clk>;
+					bootph-all;
+				};
 
-			pioB: gpio@fffff400 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff400 0x100>;
-				interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioB_clk>;
-				bootph-all;
-			};
+				pioB: gpio@fffff400 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
+					reg = <0xfffff400 0x100>;
+					interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioB_clk>;
+					bootph-all;
+				};
 
-			pioC: gpio@fffff600 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff600 0x100>;
-				interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioC_clk>;
-				bootph-all;
-			};
+				pioC: gpio@fffff600 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
+					reg = <0xfffff600 0x100>;
+					interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioC_clk>;
+					bootph-all;
+				};
 
-			pioD: gpio@fffff800 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff800 0x100>;
-				interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioD_clk>;
-				bootph-all;
-			};
+				pioD: gpio@fffff800 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
+					reg = <0xfffff800 0x100>;
+					interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioD_clk>;
+					bootph-all;
+				};
+
+				pioE: gpio@fffffa00 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
+					reg = <0xfffffa00 0x100>;
+					interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioE_clk>;
+					bootph-all;
+				};
 
-			pioE: gpio@fffffa00 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffffa00 0x100>;
-				interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioE_clk>;
-				bootph-all;
 			};
 
 			pmc: pmc@fffffc00 {
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Quoted 22 lines · Alexey Tsirlin

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

---

  arch/arm/dts/sama5d3.dtsi | 111 +++++++++++++++++++-------------------
  1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -4
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
  							 AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;	/* PE17 periph B, conflicts with A17 */
  					};
  				};
-			};
 
-			pioA: gpio@fffff200 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff200 0x100>;

arch/arm/dts/sama5d3.dtsi line 878

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;har
-				#interrupt-cells = <2>;
-				clocks = <&pioA_clk>;
-				bootph-all;
-			};
+				pioA: gpio@fffff200 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +9 -3
+					reg = <0xfffff200 0x100>;
+					interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioA_clk>;
+					bootph-all;
+				};
 
-			pioB: gpio@fffff400 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff400 0x100>;

arch/arm/dts/sama5d3.dtsi line 890

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioB_clk>;
-				bootph-all;
-			};
+				pioB: gpio@fffff400 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +9 -3
+					reg = <0xfffff400 0x100>;
+					interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioB_clk>;
+					bootph-all;
+				};
 
-			pioC: gpio@fffff600 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff600 0x100>;

arch/arm/dts/sama5d3.dtsi line 902

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioC_clk>;
-				bootph-all;
-			};
+				pioC: gpio@fffff600 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +9 -3
+					reg = <0xfffff600 0x100>;
+					interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioC_clk>;
+					bootph-all;
+				};
 
-			pioD: gpio@fffff800 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff800 0x100>;

arch/arm/dts/sama5d3.dtsi line 914

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioD_clk>;
-				bootph-all;
-			};
+				pioD: gpio@fffff800 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 926

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +12 -0
+					reg = <0xfffff800 0x100>;
+					interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioD_clk>;
+					bootph-all;
+				};
+
+				pioE: gpio@fffffa00 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 936

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +9 -0
+					reg = <0xfffffa00 0x100>;
+					interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioE_clk>;
+					bootph-all;
+				};
 

Extra line

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +0 -10
-			pioE: gpio@fffffa00 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffffa00 0x100>;
-				interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioE_clk>;
-				bootph-all;
  			};
 
  			pmc: pmc@fffffc00 {
Signature · 2 lines
Thanks and Regards,
Manikandan M.
#3 lore raw

Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 5 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 2 lines · Alexey Tsirlin

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside. Is this no longer true ?

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 142 lines
Quoted 20 lines

---

   arch/arm/dts/sama5d3.dtsi | 111 +++++++++++++++++++-------------------
   1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -4
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
   							 AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;	/* PE17 periph B, conflicts with A17 */
   					};
   				};
-			};
 
-			pioA: gpio@fffff200 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff200 0x100>;

arch/arm/dts/sama5d3.dtsi line 878

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;har
-				#interrupt-cells = <2>;
-				clocks = <&pioA_clk>;
-				bootph-all;
-			};
+				pioA: gpio@fffff200 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +9 -3
+					reg = <0xfffff200 0x100>;
+					interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioA_clk>;
+					bootph-all;
+				};
 
-			pioB: gpio@fffff400 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff400 0x100>;

arch/arm/dts/sama5d3.dtsi line 890

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioB_clk>;
-				bootph-all;
-			};
+				pioB: gpio@fffff400 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +9 -3
+					reg = <0xfffff400 0x100>;
+					interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioB_clk>;
+					bootph-all;
+				};
 
-			pioC: gpio@fffff600 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff600 0x100>;

arch/arm/dts/sama5d3.dtsi line 902

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioC_clk>;
-				bootph-all;
-			};
+				pioC: gpio@fffff600 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +9 -3
+					reg = <0xfffff600 0x100>;
+					interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioC_clk>;
+					bootph-all;
+				};
 
-			pioD: gpio@fffff800 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffff800 0x100>;

arch/arm/dts/sama5d3.dtsi line 914

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-				interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioD_clk>;
-				bootph-all;
-			};
+				pioD: gpio@fffff800 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 926

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +12 -0
+					reg = <0xfffff800 0x100>;
+					interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioD_clk>;
+					bootph-all;
+				};
+
+				pioE: gpio@fffffa00 {
+				      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 936

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +9 -0
+					reg = <0xfffffa00 0x100>;
+					interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
+					#gpio-cells = <2>;
+					gpio-controller;
+					interrupt-controller;
+					#interrupt-cells = <2>;
+					clocks = <&pioE_clk>;
+					bootph-all;
+				};
 

Extra line

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +0 -10
-			pioE: gpio@fffffa00 {
-				compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-				reg = <0xfffffa00 0x100>;
-				interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
-				#gpio-cells = <2>;
-				gpio-controller;
-				interrupt-controller;
-				#interrupt-cells = <2>;
-				clocks = <&pioE_clk>;
-				bootph-all;
   			};
 
   			pmc: pmc@fffffc00 {
#4 lore raw

Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Eugen,

Quoted 14 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 2 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 7 lines
Quoted 3 lines · Alexey Tsirlin
Quoted 2 lines

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside.
Is this no longer true ?

Indeed, you are correct.With the current code base the pinctrl fails to probe if they are defined inside.
I started to review this code with an intention that my changes for pinctrl driver and DT to align U-Boot pinctrl DT node with the kernel had already been made upstream, however that is not the case. This patch is valid and necessary only after when my changes are up-streamed otherwise driver probe will fail

Since I don't own a board with this SoC, Alexey, could you kindly check the GPIO functions and determine whether this patch is actually necessary for the problem you're experiencing?If not, after incorporating the driver changes, you can send this as part of the DT alignment

Quoted 168 lines

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 160 lines
Quoted 20 lines

---

   arch/arm/dts/sama5d3.dtsi | 111
+++++++++++++++++++-------------------

   1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -0
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@

                                                      AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with A17 */
                                     };
                             };
-                    };

Quoted 15 lines

-                    pioA: gpio@fffff200 {
-                            compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                            reg = <0xfffff200 0x100>;
-                            interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>; -                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;har
-                            #interrupt-cells = <2>;
-                            clocks = <&pioA_clk>;
-                            bootph-all;
-                    };
+                            pioA: gpio@fffff200 {
+                                  compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 11 lines

+                                    reg = <0xfffff200 0x100>; +                                    interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
+                                    #gpio-cells = <2>; +                                    gpio-controller; +                                    interrupt-controller; +                                    #interrupt-cells = <2>; +                                    clocks = <&pioA_clk>; +                                    bootph-all;
+                            };

Quoted 15 lines

-                    pioB: gpio@fffff400 {
-                            compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                            reg = <0xfffff400 0x100>;
-                            interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>; -                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioB_clk>;
-                            bootph-all;
-                    };
+                            pioB: gpio@fffff400 {
+                                  compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 11 lines

+                                    reg = <0xfffff400 0x100>; +                                    interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
+                                    #gpio-cells = <2>; +                                    gpio-controller; +                                    interrupt-controller; +                                    #interrupt-cells = <2>; +                                    clocks = <&pioB_clk>; +                                    bootph-all;
+                            };

Quoted 15 lines

-                    pioC: gpio@fffff600 {
-                            compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                            reg = <0xfffff600 0x100>;
-                            interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>; -                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioC_clk>;
-                            bootph-all;
-                    };
+                            pioC: gpio@fffff600 {
+                                  compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 11 lines

+                                    reg = <0xfffff600 0x100>; +                                    interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
+                                    #gpio-cells = <2>; +                                    gpio-controller; +                                    interrupt-controller; +                                    #interrupt-cells = <2>; +                                    clocks = <&pioC_clk>; +                                    bootph-all;
+                            };

Quoted 15 lines

-                    pioD: gpio@fffff800 {
-                            compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                            reg = <0xfffff800 0x100>;
-                            interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>; -                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioD_clk>;
-                            bootph-all;
-                    };
+                            pioD: gpio@fffff800 {
+                                  compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 6 lines

+                                    reg = <0xfffff800 0x100>; +                                    interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
+                                    #gpio-cells = <2>; +                                    gpio-controller; +                                    interrupt-controller;

Quoted 8 lines

+                                    #interrupt-cells = <2>; +                                    clocks = <&pioD_clk>; +                                    bootph-all;
+                            };
+
+                            pioE: gpio@fffffa00 { +                                  compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 11 lines

+                                    reg = <0xfffffa00 0x100>; +                                    interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
+                                    #gpio-cells = <2>; +                                    gpio-controller; +                                    interrupt-controller; +                                    #interrupt-cells = <2>; +                                    clocks = <&pioE_clk>; +                                    bootph-all;
+                            };

Extra line

Quoted 14 lines

-                    pioE: gpio@fffffa00 {
-                            compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                            reg = <0xfffffa00 0x100>;
-                            interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>; -                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioE_clk>;
-                            bootph-all;
                     };

                     pmc: pmc@fffffc00 {

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#5 lore raw

RE: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Manikandan,

I have tested gpio cmd option on SAMA5D3 EDS board (BTW it wasn't enabled by default in sama5d3_xplained_mmc_defconfig which is used by this board) in u-boot with the DT change as I proposed and it seems to work fine, at least it detects all the 5 GPIO ports (A-E). pinmux cmd does not work too much, but this is because pinctrl-at91 does not implement get_pins_count function. Without the proposed change I was not able to make the Ethernet (EMAC) detect the PHY because MDIO interface was not working - the correct peripheral mode for the EMAC pins was not set as defined in DT.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, 18 October 2024 12:30
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Eugen,

Quoted 14 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 2 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 8 lines
Quoted 4 lines · Alexey Tsirlin
Quoted 3 lines

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside.
Is this no longer true ?

Indeed, you are correct.With the current code base the pinctrl fails to probe if they are defined inside.
I started to review this code with an intention that my changes for pinctrl driver and DT to align U-Boot pinctrl DT node with the kernel had already been made upstream, however that is not the case.
This patch is valid and necessary only after when my changes are up-streamed otherwise driver probe will fail

Since I don't own a board with this SoC, Alexey, could you kindly check the GPIO functions and determine whether this patch is actually necessary for the problem you're experiencing?If not, after incorporating the driver changes, you can send this as part of the DT alignment

Quoted 169 lines

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 161 lines
Quoted 34 lines

---

   arch/arm/dts/sama5d3.dtsi | 111
+++++++++++++++++++-------------------
   1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -0
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
                                                      AT91_PIOE 17

AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with A17 */

                                     };
                             };
arch/arm/dts/sama5d3.dtsi +0 -3
-                    };
 
-                    pioA: gpio@fffff200 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff200 0x100>;
-                            interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;har
-                            #interrupt-cells = <2>;
-                            clocks = <&pioA_clk>;
-                            bootph-all;
-                    };
+                            pioA: gpio@fffff200 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff200 0x100>;
+                                    interrupts = <6

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioA_clk>;
+                                    bootph-all;
+                            };
 
-                    pioB: gpio@fffff400 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff400 0x100>;
-                            interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioB_clk>;
-                            bootph-all;
-                    };
+                            pioB: gpio@fffff400 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff400 0x100>;
+                                    interrupts = <7

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioB_clk>;
+                                    bootph-all;
+                            };
 
-                    pioC: gpio@fffff600 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff600 0x100>;
-                            interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioC_clk>;
-                            bootph-all;
-                    };
+                            pioC: gpio@fffff600 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff600 0x100>;
+                                    interrupts = <8

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioC_clk>;
+                                    bootph-all;
+                            };
 
-                    pioD: gpio@fffff800 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff800 0x100>;
-                            interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioD_clk>;
-                            bootph-all;
-                    };
+                            pioD: gpio@fffff800 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff800 0x100>;
+                                    interrupts = <9

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +10 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioD_clk>;
+                                    bootph-all;
+                            };
+
+                            pioE: gpio@fffffa00 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 935

Quoted 11 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffffa00 0x100>;
+                                    interrupts = <10

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioE_clk>;
+                                    bootph-all;
+                            };

Extra line

Quoted 15 lines
arch/arm/dts/sama5d3.dtsi +0 -2
-                    pioE: gpio@fffffa00 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +0 -2
-                            reg = <0xfffffa00 0x100>;
-                            interrupts = <10 IRQ_TYPE_LEVEL_HIGH

1>;

arch/arm/dts/sama5d3.dtsi +0 -6
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioE_clk>;
-                            bootph-all;
                     };
 
                     pmc: pmc@fffffc00 {

--
Thanks and Regards,
Manikandan M.

#6 lore raw

Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Can you confirm if you are using the u-boot-mchp repo from GitHub [1] to test the sama5d3_eds board where the driver changes to align U-Boot and Kernel DT are already present.
The pinctrl driver probe fails with the proposed change and will cause regression on other boards that uses the same pinctrl PIO3 driver in the mainline repo.

[1] --> https://github.com/linux4microchip/u-boot-mchp

Quoted 234 lines · Alexey Tsirlin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Manikandan,

I have tested gpio cmd option on SAMA5D3 EDS board (BTW it wasn't enabled by default in sama5d3_xplained_mmc_defconfig which is used by this board) in u-boot with the DT change as I proposed and it seems to work fine, at least it detects all the 5 GPIO ports (A-E). pinmux cmd does not work too much, but this is because pinctrl-at91 does not implement get_pins_count function. Without the proposed change I was not able to make the Ethernet (EMAC) detect the PHY because MDIO interface was not working - the correct peripheral mode for the EMAC pins was not set as defined in DT.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, 18 October 2024 12:30
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Eugen,

Quoted 14 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 2 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 8 lines
Quoted 4 lines · Alexey Tsirlin
Quoted 3 lines

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside.
Is this no longer true ?

Indeed, you are correct.With the current code base the pinctrl fails to probe if they are defined inside.
I started to review this code with an intention that my changes for pinctrl driver and DT to align U-Boot pinctrl DT node with the kernel had already been made upstream, however that is not the case.
This patch is valid and necessary only after when my changes are up-streamed otherwise driver probe will fail

Since I don't own a board with this SoC, Alexey, could you kindly check the GPIO functions and determine whether this patch is actually necessary for the problem you're experiencing?If not, after incorporating the driver changes, you can send this as part of the DT alignment

Quoted 169 lines

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 161 lines
Quoted 34 lines

---

    arch/arm/dts/sama5d3.dtsi | 111
+++++++++++++++++++-------------------
    1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -0
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
                                                       AT91_PIOE 17

AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with A17 */

                                      };
                              };
arch/arm/dts/sama5d3.dtsi +0 -3
-                    };
 
-                    pioA: gpio@fffff200 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff200 0x100>;
-                            interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;har
-                            #interrupt-cells = <2>;
-                            clocks = <&pioA_clk>;
-                            bootph-all;
-                    };
+                            pioA: gpio@fffff200 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff200 0x100>;
+                                    interrupts = <6

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioA_clk>;
+                                    bootph-all;
+                            };
 
-                    pioB: gpio@fffff400 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff400 0x100>;
-                            interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioB_clk>;
-                            bootph-all;
-                    };
+                            pioB: gpio@fffff400 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff400 0x100>;
+                                    interrupts = <7

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioB_clk>;
+                                    bootph-all;
+                            };
 
-                    pioC: gpio@fffff600 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff600 0x100>;
-                            interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioC_clk>;
-                            bootph-all;
-                    };
+                            pioC: gpio@fffff600 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff600 0x100>;
+                                    interrupts = <8

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioC_clk>;
+                                    bootph-all;
+                            };
 
-                    pioD: gpio@fffff800 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff800 0x100>;
-                            interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioD_clk>;
-                            bootph-all;
-                    };
+                            pioD: gpio@fffff800 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff800 0x100>;
+                                    interrupts = <9

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +10 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioD_clk>;
+                                    bootph-all;
+                            };
+
+                            pioE: gpio@fffffa00 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 935

Quoted 11 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffffa00 0x100>;
+                                    interrupts = <10

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioE_clk>;
+                                    bootph-all;
+                            };

Extra line

Quoted 15 lines
arch/arm/dts/sama5d3.dtsi +0 -2
-                    pioE: gpio@fffffa00 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +0 -2
-                            reg = <0xfffffa00 0x100>;
-                            interrupts = <10 IRQ_TYPE_LEVEL_HIGH

1>;

arch/arm/dts/sama5d3.dtsi +0 -6
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioE_clk>;
-                            bootph-all;
                      };
 
                      pmc: pmc@fffffc00 {

--
Thanks and Regards,
Manikandan M.

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#7 lore raw

RE: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Manikandan,

I am using buildroot 2024.04 sama5d3_eds_headless_defconfig config setup which leads to the following:
1. uboot from https://github.com/linux4microchip/u-boot-mchp.git
2. uboot version linux4microchip-2024.10-rc2
3. uboot config sama5d3_xplained_mmc

My board is sama5d3 EDS with DP83630 PHY connected to EMAC.

I confirm that using configuration above, I was not able to make Ethernet (EMAC) in uboot work because it was failing to configure EMAC pins to the required peripheral mode. The at91_pin_check_config function in pinctrl-at91 returned -EINVAL because of nbanks=0. After applying the patch, the Ethernet is working fine.

I also confirm that after applying the patch, I was able to toggle IO pin with gpio command (tried PIOC18 which is accessible through IO Connector #1), although I cannot tell you if this functionality also worked before applying the patch.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, 21 October 2024 13:19
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Can you confirm if you are using the u-boot-mchp repo from GitHub [1] to test the sama5d3_eds board where the driver changes to align U-Boot and Kernel DT are already present.
The pinctrl driver probe fails with the proposed change and will cause regression on other boards that uses the same pinctrl PIO3 driver in the mainline repo.

[1] --> https://github.com/linux4microchip/u-boot-mchp

Quoted 231 lines · Alexey Tsirlin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Manikandan,

I have tested gpio cmd option on SAMA5D3 EDS board (BTW it wasn't enabled by default in sama5d3_xplained_mmc_defconfig which is used by this board) in u-boot with the DT change as I proposed and it seems to work fine, at least it detects all the 5 GPIO ports (A-E). pinmux cmd does not work too much, but this is because pinctrl-at91 does not implement get_pins_count function.
Without the proposed change I was not able to make the Ethernet (EMAC) detect the PHY because MDIO interface was not working - the correct peripheral mode for the EMAC pins was not set as defined in DT.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, 18 October 2024 12:30
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Eugen,

Quoted 14 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 2 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 8 lines
Quoted 4 lines · Alexey Tsirlin
Quoted 3 lines

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside.
Is this no longer true ?

Indeed, you are correct.With the current code base the pinctrl fails to probe if they are defined inside.
I started to review this code with an intention that my changes for pinctrl driver and DT to align U-Boot pinctrl DT node with the kernel had already been made upstream, however that is not the case. This patch is valid and necessary only after when my changes are up-streamed otherwise driver probe will fail

Since I don't own a board with this SoC, Alexey, could you kindly check the GPIO functions and determine whether this patch is actually necessary for the problem you're experiencing?If not, after incorporating the driver changes, you can send this as part of the DT alignment

Quoted 166 lines

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 159 lines
Quoted 34 lines

---

    arch/arm/dts/sama5d3.dtsi | 111
+++++++++++++++++++-------------------
    1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -0
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
                                                       AT91_PIOE 17

AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with A17 */

                                      };
                              };
arch/arm/dts/sama5d3.dtsi +0 -3
-                    };
 
-                    pioA: gpio@fffff200 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff200 0x100>;
-                            interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;har
-                            #interrupt-cells = <2>;
-                            clocks = <&pioA_clk>;
-                            bootph-all;
-                    };
+                            pioA: gpio@fffff200 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff200 0x100>;
+                                    interrupts = <6

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioA_clk>;
+                                    bootph-all;
+                            };
 
-                    pioB: gpio@fffff400 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff400 0x100>;
-                            interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioB_clk>;
-                            bootph-all;
-                    };
+                            pioB: gpio@fffff400 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff400 0x100>;
+                                    interrupts = <7

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioB_clk>;
+                                    bootph-all;
+                            };
 
-                    pioC: gpio@fffff600 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff600 0x100>;
-                            interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioC_clk>;
-                            bootph-all;
-                    };
+                            pioC: gpio@fffff600 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff600 0x100>;
+                                    interrupts = <8

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioC_clk>;
+                                    bootph-all;
+                            };
 
-                    pioD: gpio@fffff800 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff800 0x100>;
-                            interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioD_clk>;
-                            bootph-all;
-                    };
+                            pioD: gpio@fffff800 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff800 0x100>;
+                                    interrupts = <9

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +10 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioD_clk>;
+                                    bootph-all;
+                            };
+
+                            pioE: gpio@fffffa00 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 935

Quoted 11 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffffa00 0x100>;
+                                    interrupts = <10

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioE_clk>;
+                                    bootph-all;
+                            };

Extra line

Quoted 14 lines
arch/arm/dts/sama5d3.dtsi +0 -2
-                    pioE: gpio@fffffa00 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +0 -2
-                            reg = <0xfffffa00 0x100>;
-                            interrupts = <10 IRQ_TYPE_LEVEL_HIGH

1>;

arch/arm/dts/sama5d3.dtsi +0 -6
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioE_clk>;
-                            bootph-all;
                      };
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
                      pmc: pmc@fffffc00 {

--
Thanks and Regards,
Manikandan M.

--
Thanks and Regards,
Manikandan M.

#8 lore raw

Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Thank you for confirming the u-boot tree used for testing your patch. This suggested modification is a fix-up patch for the pinctrl driver changes present in the uboot-mcho git tree. However, because those changes are not yet present in the mainline U-Boot, this patch will cause regression on all sama5d3 SoC boards.

I appreciate your work in finding and resolving the issue for sama5d3.Please hold on to this patch; you can share a version 2 that resolves the comments once the driver changes are in.

Also, fyi, this change is already present in the u-boot-mchp tree linux4microchip-2024.10-rc2 version,
https://github.com/linux4microchip/u-boot-mchp/commit/a25b31c2558f9fe303a3b97dd660b87476446301

Quoted 288 lines · Alexey Tsirlin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Manikandan,

I am using buildroot 2024.04 sama5d3_eds_headless_defconfig config setup which leads to the following:
1. uboot from https://github.com/linux4microchip/u-boot-mchp.git
2. uboot version linux4microchip-2024.10-rc2
3. uboot config sama5d3_xplained_mmc

My board is sama5d3 EDS with DP83630 PHY connected to EMAC.

I confirm that using configuration above, I was not able to make Ethernet (EMAC) in uboot work because it was failing to configure EMAC pins to the required peripheral mode. The at91_pin_check_config function in pinctrl-at91 returned -EINVAL because of nbanks=0. After applying the patch, the Ethernet is working fine.

I also confirm that after applying the patch, I was able to toggle IO pin with gpio command (tried PIOC18 which is accessible through IO Connector #1), although I cannot tell you if this functionality also worked before applying the patch.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, 21 October 2024 13:19
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Can you confirm if you are using the u-boot-mchp repo from GitHub [1] to test the sama5d3_eds board where the driver changes to align U-Boot and Kernel DT are already present.
The pinctrl driver probe fails with the proposed change and will cause regression on other boards that uses the same pinctrl PIO3 driver in the mainline repo.

[1] --> https://github.com/linux4microchip/u-boot-mchp

Quoted 231 lines · Alexey Tsirlin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Manikandan,

I have tested gpio cmd option on SAMA5D3 EDS board (BTW it wasn't enabled by default in sama5d3_xplained_mmc_defconfig which is used by this board) in u-boot with the DT change as I proposed and it seems to work fine, at least it detects all the 5 GPIO ports (A-E). pinmux cmd does not work too much, but this is because pinctrl-at91 does not implement get_pins_count function.
Without the proposed change I was not able to make the Ethernet (EMAC) detect the PHY because MDIO interface was not working - the correct peripheral mode for the EMAC pins was not set as defined in DT.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, 18 October 2024 12:30
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Eugen,

Quoted 14 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 2 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 8 lines
Quoted 4 lines · Alexey Tsirlin
Quoted 3 lines

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside.
Is this no longer true ?

Indeed, you are correct.With the current code base the pinctrl fails to probe if they are defined inside.
I started to review this code with an intention that my changes for pinctrl driver and DT to align U-Boot pinctrl DT node with the kernel had already been made upstream, however that is not the case. This patch is valid and necessary only after when my changes are up-streamed otherwise driver probe will fail

Since I don't own a board with this SoC, Alexey, could you kindly check the GPIO functions and determine whether this patch is actually necessary for the problem you're experiencing?If not, after incorporating the driver changes, you can send this as part of the DT alignment

Quoted 166 lines

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 159 lines
Quoted 34 lines

---

     arch/arm/dts/sama5d3.dtsi | 111
+++++++++++++++++++-------------------
     1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -0
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
                                                        AT91_PIOE 17

AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with A17 */

                                       };
                               };
arch/arm/dts/sama5d3.dtsi +0 -3
-                    };
 
-                    pioA: gpio@fffff200 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff200 0x100>;
-                            interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;har
-                            #interrupt-cells = <2>;
-                            clocks = <&pioA_clk>;
-                            bootph-all;
-                    };
+                            pioA: gpio@fffff200 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff200 0x100>;
+                                    interrupts = <6

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioA_clk>;
+                                    bootph-all;
+                            };
 
-                    pioB: gpio@fffff400 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff400 0x100>;
-                            interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioB_clk>;
-                            bootph-all;
-                    };
+                            pioB: gpio@fffff400 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff400 0x100>;
+                                    interrupts = <7

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioB_clk>;
+                                    bootph-all;
+                            };
 
-                    pioC: gpio@fffff600 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff600 0x100>;
-                            interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioC_clk>;
-                            bootph-all;
-                    };
+                            pioC: gpio@fffff600 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff600 0x100>;
+                                    interrupts = <8

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioC_clk>;
+                                    bootph-all;
+                            };
 
-                    pioD: gpio@fffff800 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff800 0x100>;
-                            interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioD_clk>;
-                            bootph-all;
-                    };
+                            pioD: gpio@fffff800 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff800 0x100>;
+                                    interrupts = <9

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +10 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioD_clk>;
+                                    bootph-all;
+                            };
+
+                            pioE: gpio@fffffa00 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi

Quoted 11 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffffa00 0x100>;
+                                    interrupts = <10

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioE_clk>;
+                                    bootph-all;
+                            };

Extra line

Quoted 14 lines
arch/arm/dts/sama5d3.dtsi +0 -2
-                    pioE: gpio@fffffa00 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +0 -2
-                            reg = <0xfffffa00 0x100>;
-                            interrupts = <10 IRQ_TYPE_LEVEL_HIGH

1>;

arch/arm/dts/sama5d3.dtsi +0 -6
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioE_clk>;
-                            bootph-all;
                       };
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
                       pmc: pmc@fffffc00 {

--
Thanks and Regards,
Manikandan M.

--
Thanks and Regards,
Manikandan M.

Signature · 2 lines
Thanks and Regards,
Manikandan M.
#9 lore raw

RE: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

No problem!

Thanks!
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, 22 October 2024 11:47
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Thank you for confirming the u-boot tree used for testing your patch. This suggested modification is a fix-up patch for the pinctrl driver changes present in the uboot-mcho git tree. However, because those changes are not yet present in the mainline U-Boot, this patch will cause regression on all sama5d3 SoC boards.

I appreciate your work in finding and resolving the issue for sama5d3.Please hold on to this patch; you can share a version 2 that resolves the comments once the driver changes are in.

Also, fyi, this change is already present in the u-boot-mchp tree linux4microchip-2024.10-rc2 version,
https://github.com/linux4microchip/u-boot-mchp/commit/a25b31c2558f9fe303a3b97dd660b87476446301

Quoted 285 lines · Alexey Tsirlin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Manikandan,

I am using buildroot 2024.04 sama5d3_eds_headless_defconfig config setup which leads to the following:
1. uboot from https://github.com/linux4microchip/u-boot-mchp.git
2. uboot version linux4microchip-2024.10-rc2 3. uboot config sama5d3_xplained_mmc

My board is sama5d3 EDS with DP83630 PHY connected to EMAC.

I confirm that using configuration above, I was not able to make Ethernet
(EMAC) in uboot work because it was failing to configure EMAC pins to the required peripheral mode. The at91_pin_check_config function in pinctrl-at91 returned -EINVAL because of nbanks=0. After applying the patch, the Ethernet is working fine.

I also confirm that after applying the patch, I was able to toggle IO pin with gpio command (tried PIOC18 which is accessible through IO Connector #1), although I cannot tell you if this functionality also worked before applying the patch.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, 21 October 2024 13:19
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Alexey,

Can you confirm if you are using the u-boot-mchp repo from GitHub [1] to test the sama5d3_eds board where the driver changes to align U-Boot and Kernel DT are already present.
The pinctrl driver probe fails with the proposed change and will cause regression on other boards that uses the same pinctrl PIO3 driver in the mainline repo.

[1] --> https://github.com/linux4microchip/u-boot-mchp

Quoted 236 lines · Alexey Tsirlin

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hi Manikandan,

I have tested gpio cmd option on SAMA5D3 EDS board (BTW it wasn't enabled by default in sama5d3_xplained_mmc_defconfig which is used by this board) in u-boot with the DT change as I proposed and it seems to work fine, at least it detects all the 5 GPIO ports (A-E). pinmux cmd does not work too much, but this is because pinctrl-at91 does not implement get_pins_count function.
Without the proposed change I was not able to make the Ethernet (EMAC) detect the PHY because MDIO interface was not working - the correct peripheral mode for the EMAC pins was not set as defined in DT.

Regards,
Alexey.

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Friday, 18 October 2024 12:30
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

Hi Eugen,

Quoted 14 lines · Eugen Hristev

[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 2 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 8 lines
Quoted 4 lines · Alexey Tsirlin
Quoted 3 lines

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside.
Is this no longer true ?

Indeed, you are correct.With the current code base the pinctrl fails to probe if they are defined inside.
I started to review this code with an intention that my changes for pinctrl driver and DT to align U-Boot pinctrl DT node with the kernel had already been made upstream, however that is not the case. This patch is valid and necessary only after when my changes are up-streamed otherwise driver probe will fail

Since I don't own a board with this SoC, Alexey, could you kindly check the GPIO functions and determine whether this patch is actually necessary for the problem you're experiencing?If not, after incorporating the driver changes, you can send this as part of the DT alignment

Quoted 170 lines

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 162 lines
Quoted 35 lines

---

     arch/arm/dts/sama5d3.dtsi | 111
+++++++++++++++++++-------------------
     1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -0
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
                                                        AT91_PIOE

17 AT91_PERIPH_B AT91_PINCTRL_NONE>; /* PE17 periph B, conflicts with
A17 */

                                       };
                               };
arch/arm/dts/sama5d3.dtsi +0 -3
-                    };
 
-                    pioA: gpio@fffff200 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff200 0x100>;
-                            interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;har
-                            #interrupt-cells = <2>;
-                            clocks = <&pioA_clk>;
-                            bootph-all;
-                    };
+                            pioA: gpio@fffff200 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff200 0x100>;
+                                    interrupts = <6

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioA_clk>;
+                                    bootph-all;
+                            };
 
-                    pioB: gpio@fffff400 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff400 0x100>;
-                            interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioB_clk>;
-                            bootph-all;
-                    };
+                            pioB: gpio@fffff400 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff400 0x100>;
+                                    interrupts = <7

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioB_clk>;
+                                    bootph-all;
+                            };
 
-                    pioC: gpio@fffff600 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff600 0x100>;
-                            interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioC_clk>;
-                            bootph-all;
-                    };
+                            pioC: gpio@fffff600 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 25 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff600 0x100>;
+                                    interrupts = <8

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -2
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioC_clk>;
+                                    bootph-all;
+                            };
 
-                    pioD: gpio@fffff800 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +2 -9
-                            reg = <0xfffff800 0x100>;
-                            interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioD_clk>;
-                            bootph-all;
-                    };
+                            pioD: gpio@fffff800 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 13 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffff800 0x100>;
+                                    interrupts = <9

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +10 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioD_clk>;
+                                    bootph-all;
+                            };
+
+                            pioE: gpio@fffffa00 {
+                                  compatible =
Quoted 1 line

"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi

Quoted 11 lines
arch/arm/dts/sama5d3.dtsi +2 -0
+                                    reg = <0xfffffa00 0x100>;
+                                    interrupts = <10

IRQ_TYPE_LEVEL_HIGH 1>;

arch/arm/dts/sama5d3.dtsi +7 -0
+                                    #gpio-cells = <2>;
+                                    gpio-controller;
+                                    interrupt-controller;
+                                    #interrupt-cells = <2>;
+                                    clocks = <&pioE_clk>;
+                                    bootph-all;
+                            };

Extra line

Quoted 15 lines
arch/arm/dts/sama5d3.dtsi +0 -2
-                    pioE: gpio@fffffa00 {
-                            compatible = "atmel,at91sam9x5-gpio",

"atmel,at91rm9200-gpio";

arch/arm/dts/sama5d3.dtsi +0 -2
-                            reg = <0xfffffa00 0x100>;
-                            interrupts = <10 IRQ_TYPE_LEVEL_HIGH

1>;

arch/arm/dts/sama5d3.dtsi +0 -6
-                            #gpio-cells = <2>;
-                            gpio-controller;
-                            interrupt-controller;
-                            #interrupt-cells = <2>;
-                            clocks = <&pioE_clk>;
-                            bootph-all;
                       };
 
                       pmc: pmc@fffffc00 {
Quoted 7 lines
Quoted 3 lines

--
Thanks and Regards,
Manikandan M.

--
Thanks and Regards,
Manikandan M.

--
Thanks and Regards,
Manikandan M.

#10 lore raw

Re: [PATCH 1/1] Fixed sama5d3 dts file so PIO sections are inside pinctrl as in kernel dts

In reply to Eugen Hristev

Hi Eugen,
I will fix the subject as required. Just wanted to tell that I didn’t test the gpio commands in uboot. The part that interested me was the pinctl and that it is unable to set the correct peripheral function from DTS. The function that interested me was Ethernet. I will also check the gpio functionality than I am back to office on Sunday.

Thanks!
Alexey.

Quoted 157 lines · Eugen Hristev

Hello Alexey,

Please fix the subject to adhere to the rules ARM: dts: .... etc, if you are unsure, please follow previous commits that touched this file.

Quoted 5 lines · On 10/17/24 11:51, [email protected] wrote:

Hi Alexey,

Quoted 3 lines · Alexey Tsirlin

This allows setting the GPIO parameters from device tree, otherwise the at91_pin_check_config will fail because the priv->nbanks equal to zero

I remember these pin banks are outside of the pinctrl because the driver fails to probe them if they are inside. Is this no longer true ?

Manikandan, is it possible to test this on the board? and use the gpio command in U-boot to toggle the pins , like e.g. for the LEDs and see if there is no regression ?

Thanks,
Eugen

Quoted 136 lines
Quoted 19 lines

---

  arch/arm/dts/sama5d3.dtsi | 111 +++++++++++++++++++-------------------
  1 file changed, 56 insertions(+), 55 deletions(-)
arch/arm/dts/sama5d3.dtsi +0 -3
index 4c03a302ec..c671ea42f2 100644
@@ -873,66 +873,67 @@
                               AT91_PIOE 17 AT91_PERIPH_B AT91_PINCTRL_NONE>;    /* PE17 periph B, conflicts with A17 */
                      };
                  };
-            };
  -            pioA: gpio@fffff200 {
-                compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                reg = <0xfffff200 0x100>;

arch/arm/dts/sama5d3.dtsi line 878

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-                interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
-                #gpio-cells = <2>;
-                gpio-controller;
-                interrupt-controller;har
-                #interrupt-cells = <2>;
-                clocks = <&pioA_clk>;
-                bootph-all;
-            };
+                pioA: gpio@fffff200 {
+                      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Spaces instead of tab before 'compatible', should be consistent with the remaining properties of pioA node.

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +9 -2
+                    reg = <0xfffff200 0x100>;
+                    interrupts = <6 IRQ_TYPE_LEVEL_HIGH 1>;
+                    #gpio-cells = <2>;
+                    gpio-controller;
+                    interrupt-controller;
+                    #interrupt-cells = <2>;
+                    clocks = <&pioA_clk>;
+                    bootph-all;
+                };
  -            pioB: gpio@fffff400 {
-                compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                reg = <0xfffff400 0x100>;

arch/arm/dts/sama5d3.dtsi line 890

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-                interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
-                #gpio-cells = <2>;
-                gpio-controller;
-                interrupt-controller;
-                #interrupt-cells = <2>;
-                clocks = <&pioB_clk>;
-                bootph-all;
-            };
+                pioB: gpio@fffff400 {
+                      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +9 -2
+                    reg = <0xfffff400 0x100>;
+                    interrupts = <7 IRQ_TYPE_LEVEL_HIGH 1>;
+                    #gpio-cells = <2>;
+                    gpio-controller;
+                    interrupt-controller;
+                    #interrupt-cells = <2>;
+                    clocks = <&pioB_clk>;
+                    bootph-all;
+                };
  -            pioC: gpio@fffff600 {
-                compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                reg = <0xfffff600 0x100>;

arch/arm/dts/sama5d3.dtsi line 902

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-                interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
-                #gpio-cells = <2>;
-                gpio-controller;
-                interrupt-controller;
-                #interrupt-cells = <2>;
-                clocks = <&pioC_clk>;
-                bootph-all;
-            };
+                pioC: gpio@fffff600 {
+                      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +9 -2
+                    reg = <0xfffff600 0x100>;
+                    interrupts = <8 IRQ_TYPE_LEVEL_HIGH 1>;
+                    #gpio-cells = <2>;
+                    gpio-controller;
+                    interrupt-controller;
+                    #interrupt-cells = <2>;
+                    clocks = <&pioC_clk>;
+                    bootph-all;
+                };
  -            pioD: gpio@fffff800 {
-                compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                reg = <0xfffff800 0x100>;

arch/arm/dts/sama5d3.dtsi line 914

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +2 -8
-                interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
-                #gpio-cells = <2>;
-                gpio-controller;
-                interrupt-controller;
-                #interrupt-cells = <2>;
-                clocks = <&pioD_clk>;
-                bootph-all;
-            };
+                pioD: gpio@fffff800 {
+                      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 926

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +12 -0
+                    reg = <0xfffff800 0x100>;
+                    interrupts = <9 IRQ_TYPE_LEVEL_HIGH 1>;
+                    #gpio-cells = <2>;
+                    gpio-controller;
+                    interrupt-controller;
+                    #interrupt-cells = <2>;
+                    clocks = <&pioD_clk>;
+                    bootph-all;
+                };
+
+                pioE: gpio@fffffa00 {
+                      compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";

Ditto

arch/arm/dts/sama5d3.dtsi line 936

Quoted 10 lines
arch/arm/dts/sama5d3.dtsi +9 -0
+                    reg = <0xfffffa00 0x100>;
+                    interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
+                    #gpio-cells = <2>;
+                    gpio-controller;
+                    interrupt-controller;
+                    #interrupt-cells = <2>;
+                    clocks = <&pioE_clk>;
+                    bootph-all;
+                };
 

Extra line

Quoted 12 lines
arch/arm/dts/sama5d3.dtsi +0 -10
-            pioE: gpio@fffffa00 {
-                compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
-                reg = <0xfffffa00 0x100>;
-                interrupts = <10 IRQ_TYPE_LEVEL_HIGH 1>;
-                #gpio-cells = <2>;
-                gpio-controller;
-                interrupt-controller;
-                #interrupt-cells = <2>;
-                clocks = <&pioE_clk>;
-                bootph-all;
              };
                 pmc: pmc@fffffc00 {