public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
@ 2023-08-13 23:40 Fawad Lateef
  2023-08-14  5:07 ` Bagas Sanjaya
  0 siblings, 1 reply; 7+ messages in thread
From: Fawad Lateef @ 2023-08-13 23:40 UTC (permalink / raw)
  To: Linux Kernel Mailing List, kernelnewbies

[-- Attachment #1: Type: text/plain, Size: 6741 bytes --]

Hi,

I am trying to make Linux-6.3.5 working on Olimex/Sunxi A20 SOM with NAND.

Found that the Sunxi A20 NAND is supported in mainline kernel
(drivers/mtd/nand/raw/sunxi_nand.c) and following the guidelines here
(https://linux-sunxi.org/Mainline_NAND_Howto); I added the NFC chip
pin information in sunxi-a20.dtsi and defined/enabled the nfc
controller in the sunxi-a20-olinuxino-micro.dts files.

The changes I made are below. Problem is when I define the nfc node
entry in dts file "without" pinctrl entry (pinctrl-0 = <&nand_pins_a>,
<&nand_cs0_pins_a>, <&nand_rb0_pins_a>;), the sunxi_nfc_probe function
is called (though the No NAND chip is detected).

And if I define the pinctrl-0  in the nfc node, all I see related to
NAND/sunxi in the kernel boot log is this line:  platform
1c03000.nand-controller: deferred probe pending.

Can someone please guide me why the deferred probe is pending but
never call the sunxi_nfc_probe function?  And without pinctrl-0 entry
why probe function is being called?

Seems like I am missing something basic here and any pointers to debug
this will be appreciated.


--- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
2023-05-30 14:17:29.000000000 +0100
+++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
2023-08-13 23:27:22.405058025 +0100
@@ -56,7 +56,7 @@

  aliases {
  serial0 = &uart0;
- serial1 = &uart6;
+ serial1 = &uart2;
  serial2 = &uart7;
  spi0 = &spi1;
  spi1 = &spi2;
@@ -66,17 +66,6 @@
  stdout-path = "serial0:115200n8";
  };

- hdmi-connector {
- compatible = "hdmi-connector";
- type = "a";
-
- port {
- hdmi_con_in: endpoint {
- remote-endpoint = <&hdmi_out_con>;
- };
- };
- };
-
  leds {
  compatible = "gpio-leds";
  pinctrl-names = "default";
@@ -90,16 +79,55 @@
  };
 };

-&ahci {
- target-supply = <&reg_ahci_5v>;
+&nfc {
+ pinctrl-names = "default";
+ pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
  status = "okay";
+
+ nand@0 {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ reg = <0>;
+ allwinner,rb = <0>;
+
+ nand-ecc-mode = "hw";
+ nand-on-flash-bbt;
+ };
+
+ boot0@0 {
+ label = "boot0";
+ reg = /bits/ 64 <0x0 0x200000>;
+ };
+
+ boot0-rescue@200000 {
+ label = "boot0-rescue";
+ reg = /bits/ 64 <0x200000 0x200000>;
+ };
+
+ uboot@400000 {
+ label = "uboot";
+ reg = /bits/ 64 <0x400000 0x200000>;
+ };
+
+ uboot-rescue@600000 {
+ label = "uboot-rescue";
+ reg = /bits/ 64 <0x600000 0x200000>;
+ };
+
+ main@800000 {
+ label = "main";
+ reg = /bits/ 64 <0x800000 0xff800000>;
+ };
+
 };

-&codec {
+&ahci {
+ target-supply = <&reg_ahci_5v>;
  status = "okay";
 };

 &cpu0 {
+ clock-frequency = <900000000>;
  cpu-supply = <&reg_dcdc2>;
 };

@@ -123,34 +151,24 @@
  status = "okay";
 };

-&hdmi {
- status = "okay";
-};
-
-&hdmi_out {
- hdmi_out_con: endpoint {
- remote-endpoint = <&hdmi_con_in>;
- };
-};
-
 &i2c0 {
- status = "okay";
+        status = "okay";

- axp209: pmic@34 {
- reg = <0x34>;
- interrupt-parent = <&nmi_intc>;
- interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
- };
+        axp209: pmic@34 {
+                reg = <0x34>;
+                interrupt-parent = <&nmi_intc>;
+                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+        };
 };

 &i2c1 {
- status = "okay";
+        status = "okay";

- eeprom: eeprom@50 {
- compatible = "atmel,24c16";
- reg = <0x50>;
- pagesize = <16>;
- };
+        eeprom: eeprom@50 {
+                compatible = "atmel,24c16";
+                reg = <0x50>;
+                pagesize = <16>;
+        };
 };

 &i2c2 {
@@ -160,55 +178,6 @@
 &lradc {
  vref-supply = <&reg_vcc3v0>;
  status = "okay";
-
- button-191 {
- label = "Volume Up";
- linux,code = <KEY_VOLUMEUP>;
- channel = <0>;
- voltage = <191274>;
- };
-
- button-392 {
- label = "Volume Down";
- linux,code = <KEY_VOLUMEDOWN>;
- channel = <0>;
- voltage = <392644>;
- };
-
- button-601 {
- label = "Menu";
- linux,code = <KEY_MENU>;
- channel = <0>;
- voltage = <601151>;
- };
-
- button-795 {
- label = "Search";
- linux,code = <KEY_SEARCH>;
- channel = <0>;
- voltage = <795090>;
- };
-
- button-987 {
- label = "Home";
- linux,code = <KEY_HOMEPAGE>;
- channel = <0>;
- voltage = <987387>;
- };
-
- button-1184 {
- label = "Esc";
- linux,code = <KEY_ESC>;
- channel = <0>;
- voltage = <1184678>;
- };
-
- button-1398 {
- label = "Enter";
- linux,code = <KEY_ENTER>;
- channel = <0>;
- voltage = <1398804>;
- };
 };

 &gmac_mdio {
@@ -239,10 +208,6 @@
  status = "okay";
 };

-&otg_sram {
- status = "okay";
-};
-
 &pio {
  gmac_txerr: gmac-txerr-pin {
  pins = "PA17";
@@ -323,9 +288,9 @@
  status = "okay";
 };

-&uart6 {
+&uart2 {
  pinctrl-names = "default";
- pinctrl-0 = <&uart6_pi_pins>;
+ pinctrl-0 = <&uart2_pi_pins>;
  status = "okay";
 };

@@ -352,3 +317,28 @@
  usb2_vbus-supply = <&reg_usb2_vbus>;
  status = "okay";
 };
+
+&fe0 {
+ status = "disabled";
+};
+
+&fe1 {
+ status = "disabled";
+};
+
+&be0 {
+ status = "disabled";
+};
+
+&be1 {
+ status = "disabled";
+};
+
+&tcon0 {
+ status = "disabled";
+};
+
+&tcon1 {
+ status = "disabled";
+};
+


--- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20.dtsi 2023-05-30
14:17:29.000000000 +0100
+++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20.dtsi 2023-08-08
00:30:04.689288733 +0100
@@ -345,6 +345,58 @@
  #size-cells = <0>;
  };

+ nand_pins_a: nand_base0@0 {
+ allwinner,pins = "PC0", "PC1", "PC2",
+ "PC5", "PC8", "PC9", "PC10",
+ "PC11", "PC12", "PC13", "PC14",
+ "PC15", "PC16";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
+ nand_cs0_pins_a: nand_cs@0 {
+ allwinner,pins = "PC4";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
+ nand_cs1_pins_a: nand_cs@1 {
+ allwinner,pins = "PC3";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
+ nand_cs2_pins_a: nand_cs@2 {
+ allwinner,pins = "PC17";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
+ nand_cs3_pins_a: nand_cs@3 {
+ allwinner,pins = "PC18";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
+ nand_rb0_pins_a: nand_rb@0 {
+ allwinner,pins = "PC6";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
+ nand_rb1_pins_a: nand_rb@1 {
+ allwinner,pins = "PC7";
+ allwinner,function = "nand0";
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+ };
+
  spi0: spi@1c05000 {
  compatible = "allwinner,sun4i-a10-spi";
  reg = <0x01c05000 0x1000>;


Thanks and regards,

-- Fawad Lateef

[-- Attachment #2: sun7i-a20-olinuxino-micro.dts.patch --]
[-- Type: text/x-patch, Size: 3984 bytes --]

--- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts	2023-05-30 14:17:29.000000000 +0100
+++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts	2023-08-13 23:27:22.405058025 +0100
@@ -56,7 +56,7 @@
 
 	aliases {
 		serial0 = &uart0;
-		serial1 = &uart6;
+		serial1 = &uart2;
 		serial2 = &uart7;
 		spi0 = &spi1;
 		spi1 = &spi2;
@@ -66,17 +66,6 @@
 		stdout-path = "serial0:115200n8";
 	};
 
-	hdmi-connector {
-		compatible = "hdmi-connector";
-		type = "a";
-
-		port {
-			hdmi_con_in: endpoint {
-				remote-endpoint = <&hdmi_out_con>;
-			};
-		};
-	};
-
 	leds {
 		compatible = "gpio-leds";
 		pinctrl-names = "default";
@@ -90,16 +79,55 @@
 	};
 };
 
-&ahci {
-	target-supply = <&reg_ahci_5v>;
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
 	status = "okay";
+
+	nand@0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+	};
+
+	boot0@0 {
+		label = "boot0";
+		reg = /bits/ 64 <0x0 0x200000>;
+	};
+
+	boot0-rescue@200000 {
+		label = "boot0-rescue";
+		reg = /bits/ 64 <0x200000 0x200000>;
+	};
+
+	uboot@400000 {
+		label = "uboot";
+		reg = /bits/ 64 <0x400000 0x200000>;
+	};
+
+	uboot-rescue@600000 {
+		label = "uboot-rescue";
+		reg = /bits/ 64 <0x600000 0x200000>;
+	};
+
+	main@800000 {
+		label = "main";
+		reg = /bits/ 64 <0x800000 0xff800000>;
+	};
+
 };
 
-&codec {
+&ahci {
+	target-supply = <&reg_ahci_5v>;
 	status = "okay";
 };
 
 &cpu0 {
+	clock-frequency = <900000000>;
 	cpu-supply = <&reg_dcdc2>;
 };
 
@@ -123,34 +151,24 @@
 	status = "okay";
 };
 
-&hdmi {
-	status = "okay";
-};
-
-&hdmi_out {
-	hdmi_out_con: endpoint {
-		remote-endpoint = <&hdmi_con_in>;
-	};
-};
-
 &i2c0 {
-	status = "okay";
+        status = "okay";
 
-	axp209: pmic@34 {
-		reg = <0x34>;
-		interrupt-parent = <&nmi_intc>;
-		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-	};
+        axp209: pmic@34 {
+                reg = <0x34>;
+                interrupt-parent = <&nmi_intc>;
+                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+        };
 };
 
 &i2c1 {
-	status = "okay";
+        status = "okay";
 
-	eeprom: eeprom@50 {
-		compatible = "atmel,24c16";
-		reg = <0x50>;
-		pagesize = <16>;
-	};
+        eeprom: eeprom@50 {
+                compatible = "atmel,24c16";
+                reg = <0x50>;
+                pagesize = <16>;
+        };
 };
 
 &i2c2 {
@@ -160,55 +178,6 @@
 &lradc {
 	vref-supply = <&reg_vcc3v0>;
 	status = "okay";
-
-	button-191 {
-		label = "Volume Up";
-		linux,code = <KEY_VOLUMEUP>;
-		channel = <0>;
-		voltage = <191274>;
-	};
-
-	button-392 {
-		label = "Volume Down";
-		linux,code = <KEY_VOLUMEDOWN>;
-		channel = <0>;
-		voltage = <392644>;
-	};
-
-	button-601 {
-		label = "Menu";
-		linux,code = <KEY_MENU>;
-		channel = <0>;
-		voltage = <601151>;
-	};
-
-	button-795 {
-		label = "Search";
-		linux,code = <KEY_SEARCH>;
-		channel = <0>;
-		voltage = <795090>;
-	};
-
-	button-987 {
-		label = "Home";
-		linux,code = <KEY_HOMEPAGE>;
-		channel = <0>;
-		voltage = <987387>;
-	};
-
-	button-1184 {
-		label = "Esc";
-		linux,code = <KEY_ESC>;
-		channel = <0>;
-		voltage = <1184678>;
-	};
-
-	button-1398 {
-		label = "Enter";
-		linux,code = <KEY_ENTER>;
-		channel = <0>;
-		voltage = <1398804>;
-	};
 };
 
 &gmac_mdio {
@@ -239,10 +208,6 @@
 	status = "okay";
 };
 
-&otg_sram {
-	status = "okay";
-};
-
 &pio {
 	gmac_txerr: gmac-txerr-pin {
 		pins = "PA17";
@@ -323,9 +288,9 @@
 	status = "okay";
 };
 
-&uart6 {
+&uart2 {
 	pinctrl-names = "default";
-	pinctrl-0 = <&uart6_pi_pins>;
+	pinctrl-0 = <&uart2_pi_pins>;
 	status = "okay";
 };
 
@@ -352,3 +317,28 @@
 	usb2_vbus-supply = <&reg_usb2_vbus>;
 	status = "okay";
 };
+
+&fe0 {
+	status = "disabled";
+};
+
+&fe1 {
+	status = "disabled";
+};
+
+&be0 {
+	status = "disabled";
+};
+
+&be1 {
+	status = "disabled";
+};
+
+&tcon0 {
+	status = "disabled";
+};
+
+&tcon1 {
+	status = "disabled";
+};
+

[-- Attachment #3: sun7i-a20.dtsi.patch --]
[-- Type: text/x-patch, Size: 1786 bytes --]

--- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20.dtsi	2023-05-30 14:17:29.000000000 +0100
+++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20.dtsi	2023-08-08 00:30:04.689288733 +0100
@@ -345,6 +345,58 @@
 			#size-cells = <0>;
 		};
 
+		nand_pins_a: nand_base0@0 {
+			allwinner,pins = "PC0", "PC1", "PC2",
+					"PC5", "PC8", "PC9", "PC10",
+					"PC11", "PC12", "PC13", "PC14",
+					"PC15", "PC16";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
+		nand_cs0_pins_a: nand_cs@0 {
+			allwinner,pins = "PC4";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
+		nand_cs1_pins_a: nand_cs@1 {
+			allwinner,pins = "PC3";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
+		nand_cs2_pins_a: nand_cs@2 {
+			allwinner,pins = "PC17";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
+		nand_cs3_pins_a: nand_cs@3 {
+			allwinner,pins = "PC18";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
+		nand_rb0_pins_a: nand_rb@0 {
+			allwinner,pins = "PC6";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
+		nand_rb1_pins_a: nand_rb@1 {
+			allwinner,pins = "PC7";
+			allwinner,function = "nand0";
+			allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+			allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+		};
+
 		spi0: spi@1c05000 {
 			compatible = "allwinner,sun4i-a10-spi";
 			reg = <0x01c05000 0x1000>;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
  2023-08-13 23:40 Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support Fawad Lateef
@ 2023-08-14  5:07 ` Bagas Sanjaya
  2023-08-14 10:16   ` Fawad Lateef
  0 siblings, 1 reply; 7+ messages in thread
From: Bagas Sanjaya @ 2023-08-14  5:07 UTC (permalink / raw)
  To: Fawad Lateef, Linux Kernel Mailing List, kernelnewbies,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Andre Przywara, Viresh Kumar,
	Linus Walleij, Tony Lindgren
  Cc: Linux Devicetree, Linux ARM, Linux sunXi

[-- Attachment #1: Type: text/plain, Size: 8149 bytes --]

On Mon, Aug 14, 2023 at 12:40:26AM +0100, Fawad Lateef wrote:
> Hi,
> 
> I am trying to make Linux-6.3.5 working on Olimex/Sunxi A20 SOM with NAND.
> 
> Found that the Sunxi A20 NAND is supported in mainline kernel
> (drivers/mtd/nand/raw/sunxi_nand.c) and following the guidelines here
> (https://linux-sunxi.org/Mainline_NAND_Howto); I added the NFC chip
> pin information in sunxi-a20.dtsi and defined/enabled the nfc
> controller in the sunxi-a20-olinuxino-micro.dts files.
> 
> The changes I made are below. Problem is when I define the nfc node
> entry in dts file "without" pinctrl entry (pinctrl-0 = <&nand_pins_a>,
> <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;), the sunxi_nfc_probe function
> is called (though the No NAND chip is detected).
> 
> And if I define the pinctrl-0  in the nfc node, all I see related to
> NAND/sunxi in the kernel boot log is this line:  platform
> 1c03000.nand-controller: deferred probe pending.
> 
> Can someone please guide me why the deferred probe is pending but
> never call the sunxi_nfc_probe function?  And without pinctrl-0 entry
> why probe function is being called?
> 
> Seems like I am missing something basic here and any pointers to debug
> this will be appreciated.
> 
> 
> --- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
> 2023-05-30 14:17:29.000000000 +0100
> +++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
> 2023-08-13 23:27:22.405058025 +0100
> @@ -56,7 +56,7 @@
> 
>   aliases {
>   serial0 = &uart0;
> - serial1 = &uart6;
> + serial1 = &uart2;
>   serial2 = &uart7;
>   spi0 = &spi1;
>   spi1 = &spi2;
> @@ -66,17 +66,6 @@
>   stdout-path = "serial0:115200n8";
>   };
> 
> - hdmi-connector {
> - compatible = "hdmi-connector";
> - type = "a";
> -
> - port {
> - hdmi_con_in: endpoint {
> - remote-endpoint = <&hdmi_out_con>;
> - };
> - };
> - };
> -
>   leds {
>   compatible = "gpio-leds";
>   pinctrl-names = "default";
> @@ -90,16 +79,55 @@
>   };
>  };
> 
> -&ahci {
> - target-supply = <&reg_ahci_5v>;
> +&nfc {
> + pinctrl-names = "default";
> + pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
>   status = "okay";
> +
> + nand@0 {
> + #address-cells = <2>;
> + #size-cells = <2>;
> + reg = <0>;
> + allwinner,rb = <0>;
> +
> + nand-ecc-mode = "hw";
> + nand-on-flash-bbt;
> + };
> +
> + boot0@0 {
> + label = "boot0";
> + reg = /bits/ 64 <0x0 0x200000>;
> + };
> +
> + boot0-rescue@200000 {
> + label = "boot0-rescue";
> + reg = /bits/ 64 <0x200000 0x200000>;
> + };
> +
> + uboot@400000 {
> + label = "uboot";
> + reg = /bits/ 64 <0x400000 0x200000>;
> + };
> +
> + uboot-rescue@600000 {
> + label = "uboot-rescue";
> + reg = /bits/ 64 <0x600000 0x200000>;
> + };
> +
> + main@800000 {
> + label = "main";
> + reg = /bits/ 64 <0x800000 0xff800000>;
> + };
> +
>  };
> 
> -&codec {
> +&ahci {
> + target-supply = <&reg_ahci_5v>;
>   status = "okay";
>  };
> 
>  &cpu0 {
> + clock-frequency = <900000000>;
>   cpu-supply = <&reg_dcdc2>;
>  };
> 
> @@ -123,34 +151,24 @@
>   status = "okay";
>  };
> 
> -&hdmi {
> - status = "okay";
> -};
> -
> -&hdmi_out {
> - hdmi_out_con: endpoint {
> - remote-endpoint = <&hdmi_con_in>;
> - };
> -};
> -
>  &i2c0 {
> - status = "okay";
> +        status = "okay";
> 
> - axp209: pmic@34 {
> - reg = <0x34>;
> - interrupt-parent = <&nmi_intc>;
> - interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> - };
> +        axp209: pmic@34 {
> +                reg = <0x34>;
> +                interrupt-parent = <&nmi_intc>;
> +                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +        };
>  };
> 
>  &i2c1 {
> - status = "okay";
> +        status = "okay";
> 
> - eeprom: eeprom@50 {
> - compatible = "atmel,24c16";
> - reg = <0x50>;
> - pagesize = <16>;
> - };
> +        eeprom: eeprom@50 {
> +                compatible = "atmel,24c16";
> +                reg = <0x50>;
> +                pagesize = <16>;
> +        };
>  };
> 
>  &i2c2 {
> @@ -160,55 +178,6 @@
>  &lradc {
>   vref-supply = <&reg_vcc3v0>;
>   status = "okay";
> -
> - button-191 {
> - label = "Volume Up";
> - linux,code = <KEY_VOLUMEUP>;
> - channel = <0>;
> - voltage = <191274>;
> - };
> -
> - button-392 {
> - label = "Volume Down";
> - linux,code = <KEY_VOLUMEDOWN>;
> - channel = <0>;
> - voltage = <392644>;
> - };
> -
> - button-601 {
> - label = "Menu";
> - linux,code = <KEY_MENU>;
> - channel = <0>;
> - voltage = <601151>;
> - };
> -
> - button-795 {
> - label = "Search";
> - linux,code = <KEY_SEARCH>;
> - channel = <0>;
> - voltage = <795090>;
> - };
> -
> - button-987 {
> - label = "Home";
> - linux,code = <KEY_HOMEPAGE>;
> - channel = <0>;
> - voltage = <987387>;
> - };
> -
> - button-1184 {
> - label = "Esc";
> - linux,code = <KEY_ESC>;
> - channel = <0>;
> - voltage = <1184678>;
> - };
> -
> - button-1398 {
> - label = "Enter";
> - linux,code = <KEY_ENTER>;
> - channel = <0>;
> - voltage = <1398804>;
> - };
>  };
> 
>  &gmac_mdio {
> @@ -239,10 +208,6 @@
>   status = "okay";
>  };
> 
> -&otg_sram {
> - status = "okay";
> -};
> -
>  &pio {
>   gmac_txerr: gmac-txerr-pin {
>   pins = "PA17";
> @@ -323,9 +288,9 @@
>   status = "okay";
>  };
> 
> -&uart6 {
> +&uart2 {
>   pinctrl-names = "default";
> - pinctrl-0 = <&uart6_pi_pins>;
> + pinctrl-0 = <&uart2_pi_pins>;
>   status = "okay";
>  };
> 
> @@ -352,3 +317,28 @@
>   usb2_vbus-supply = <&reg_usb2_vbus>;
>   status = "okay";
>  };
> +
> +&fe0 {
> + status = "disabled";
> +};
> +
> +&fe1 {
> + status = "disabled";
> +};
> +
> +&be0 {
> + status = "disabled";
> +};
> +
> +&be1 {
> + status = "disabled";
> +};
> +
> +&tcon0 {
> + status = "disabled";
> +};
> +
> +&tcon1 {
> + status = "disabled";
> +};
> +
> 
> 
> --- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20.dtsi 2023-05-30
> 14:17:29.000000000 +0100
> +++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20.dtsi 2023-08-08
> 00:30:04.689288733 +0100
> @@ -345,6 +345,58 @@
>   #size-cells = <0>;
>   };
> 
> + nand_pins_a: nand_base0@0 {
> + allwinner,pins = "PC0", "PC1", "PC2",
> + "PC5", "PC8", "PC9", "PC10",
> + "PC11", "PC12", "PC13", "PC14",
> + "PC15", "PC16";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
> + nand_cs0_pins_a: nand_cs@0 {
> + allwinner,pins = "PC4";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
> + nand_cs1_pins_a: nand_cs@1 {
> + allwinner,pins = "PC3";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
> + nand_cs2_pins_a: nand_cs@2 {
> + allwinner,pins = "PC17";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
> + nand_cs3_pins_a: nand_cs@3 {
> + allwinner,pins = "PC18";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
> + nand_rb0_pins_a: nand_rb@0 {
> + allwinner,pins = "PC6";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
> + nand_rb1_pins_a: nand_rb@1 {
> + allwinner,pins = "PC7";
> + allwinner,function = "nand0";
> + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> + };
> +
>   spi0: spi@1c05000 {
>   compatible = "allwinner,sun4i-a10-spi";
>   reg = <0x01c05000 0x1000>;
> 
> 

Thanks for the suggestion diff. Can you submit it as formal patch against
current sunxi/for-next tree [1]? See
Documentation/process/submitting-patches.rst for how to properly submit
patches.

Thanks.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/log/?h=sunxi/for-next

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
  2023-08-14  5:07 ` Bagas Sanjaya
@ 2023-08-14 10:16   ` Fawad Lateef
  2023-08-15 22:01     ` Fawad Lateef
  0 siblings, 1 reply; 7+ messages in thread
From: Fawad Lateef @ 2023-08-14 10:16 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Linux Kernel Mailing List, kernelnewbies, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Andre Przywara, Viresh Kumar, Linus Walleij,
	Tony Lindgren, Linux Devicetree, Linux ARM, Linux sunXi,
	boris.brezillon

Hi Bagas,

On Mon, 14 Aug 2023 at 06:07, Bagas Sanjaya <bagasdotme@gmail.com> wrote:
>
> On Mon, Aug 14, 2023 at 12:40:26AM +0100, Fawad Lateef wrote:
> > Hi,
> >
> > I am trying to make Linux-6.3.5 working on Olimex/Sunxi A20 SOM with NAND.
> >
> > Found that the Sunxi A20 NAND is supported in mainline kernel
> > (drivers/mtd/nand/raw/sunxi_nand.c) and following the guidelines here
> > (https://linux-sunxi.org/Mainline_NAND_Howto); I added the NFC chip
> > pin information in sunxi-a20.dtsi and defined/enabled the nfc
> > controller in the sunxi-a20-olinuxino-micro.dts files.
> >
> > The changes I made are below. Problem is when I define the nfc node
> > entry in dts file "without" pinctrl entry (pinctrl-0 = <&nand_pins_a>,
> > <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;), the sunxi_nfc_probe function
> > is called (though the No NAND chip is detected).
> >
> > And if I define the pinctrl-0  in the nfc node, all I see related to
> > NAND/sunxi in the kernel boot log is this line:  platform
> > 1c03000.nand-controller: deferred probe pending.
> >
> > Can someone please guide me why the deferred probe is pending but
> > never call the sunxi_nfc_probe function?  And without pinctrl-0 entry
> > why probe function is being called?
> >
> > Seems like I am missing something basic here and any pointers to debug
> > this will be appreciated.
> >
> >
> > --- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
> > 2023-05-30 14:17:29.000000000 +0100
> > +++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
> > 2023-08-13 23:27:22.405058025 +0100
> > @@ -56,7 +56,7 @@
> >
> >   aliases {
> >   serial0 = &uart0;
> > - serial1 = &uart6;
> > + serial1 = &uart2;
> >   serial2 = &uart7;
> >   spi0 = &spi1;
> >   spi1 = &spi2;
> > @@ -66,17 +66,6 @@
> >   stdout-path = "serial0:115200n8";
> >   };
> >
> > - hdmi-connector {
> > - compatible = "hdmi-connector";
> > - type = "a";
> > -
> > - port {
> > - hdmi_con_in: endpoint {
> > - remote-endpoint = <&hdmi_out_con>;
> > - };
> > - };
> > - };
> > -
> >   leds {
> >   compatible = "gpio-leds";
> >   pinctrl-names = "default";
> > @@ -90,16 +79,55 @@
> >   };
> >  };
> >
> > -&ahci {
> > - target-supply = <&reg_ahci_5v>;
> > +&nfc {
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
> >   status = "okay";
> > +
> > + nand@0 {
> > + #address-cells = <2>;
> > + #size-cells = <2>;
> > + reg = <0>;
> > + allwinner,rb = <0>;
> > +
> > + nand-ecc-mode = "hw";
> > + nand-on-flash-bbt;
> > + };
> > +
> > + boot0@0 {
> > + label = "boot0";
> > + reg = /bits/ 64 <0x0 0x200000>;
> > + };
> > +
> > + boot0-rescue@200000 {
> > + label = "boot0-rescue";
> > + reg = /bits/ 64 <0x200000 0x200000>;
> > + };
> > +
> > + uboot@400000 {
> > + label = "uboot";
> > + reg = /bits/ 64 <0x400000 0x200000>;
> > + };
> > +
> > + uboot-rescue@600000 {
> > + label = "uboot-rescue";
> > + reg = /bits/ 64 <0x600000 0x200000>;
> > + };
> > +
> > + main@800000 {
> > + label = "main";
> > + reg = /bits/ 64 <0x800000 0xff800000>;
> > + };
> > +
> >  };
> >
> > -&codec {
> > +&ahci {
> > + target-supply = <&reg_ahci_5v>;
> >   status = "okay";
> >  };
> >
> >  &cpu0 {
> > + clock-frequency = <900000000>;
> >   cpu-supply = <&reg_dcdc2>;
> >  };
> >
> > @@ -123,34 +151,24 @@
> >   status = "okay";
> >  };
> >
> > -&hdmi {
> > - status = "okay";
> > -};
> > -
> > -&hdmi_out {
> > - hdmi_out_con: endpoint {
> > - remote-endpoint = <&hdmi_con_in>;
> > - };
> > -};
> > -
> >  &i2c0 {
> > - status = "okay";
> > +        status = "okay";
> >
> > - axp209: pmic@34 {
> > - reg = <0x34>;
> > - interrupt-parent = <&nmi_intc>;
> > - interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> > - };
> > +        axp209: pmic@34 {
> > +                reg = <0x34>;
> > +                interrupt-parent = <&nmi_intc>;
> > +                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> > +        };
> >  };
> >
> >  &i2c1 {
> > - status = "okay";
> > +        status = "okay";
> >
> > - eeprom: eeprom@50 {
> > - compatible = "atmel,24c16";
> > - reg = <0x50>;
> > - pagesize = <16>;
> > - };
> > +        eeprom: eeprom@50 {
> > +                compatible = "atmel,24c16";
> > +                reg = <0x50>;
> > +                pagesize = <16>;
> > +        };
> >  };
> >
> >  &i2c2 {
> > @@ -160,55 +178,6 @@
> >  &lradc {
> >   vref-supply = <&reg_vcc3v0>;
> >   status = "okay";
> > -
> > - button-191 {
> > - label = "Volume Up";
> > - linux,code = <KEY_VOLUMEUP>;
> > - channel = <0>;
> > - voltage = <191274>;
> > - };
> > -
> > - button-392 {
> > - label = "Volume Down";
> > - linux,code = <KEY_VOLUMEDOWN>;
> > - channel = <0>;
> > - voltage = <392644>;
> > - };
> > -
> > - button-601 {
> > - label = "Menu";
> > - linux,code = <KEY_MENU>;
> > - channel = <0>;
> > - voltage = <601151>;
> > - };
> > -
> > - button-795 {
> > - label = "Search";
> > - linux,code = <KEY_SEARCH>;
> > - channel = <0>;
> > - voltage = <795090>;
> > - };
> > -
> > - button-987 {
> > - label = "Home";
> > - linux,code = <KEY_HOMEPAGE>;
> > - channel = <0>;
> > - voltage = <987387>;
> > - };
> > -
> > - button-1184 {
> > - label = "Esc";
> > - linux,code = <KEY_ESC>;
> > - channel = <0>;
> > - voltage = <1184678>;
> > - };
> > -
> > - button-1398 {
> > - label = "Enter";
> > - linux,code = <KEY_ENTER>;
> > - channel = <0>;
> > - voltage = <1398804>;
> > - };
> >  };
> >
> >  &gmac_mdio {
> > @@ -239,10 +208,6 @@
> >   status = "okay";
> >  };
> >
> > -&otg_sram {
> > - status = "okay";
> > -};
> > -
> >  &pio {
> >   gmac_txerr: gmac-txerr-pin {
> >   pins = "PA17";
> > @@ -323,9 +288,9 @@
> >   status = "okay";
> >  };
> >
> > -&uart6 {
> > +&uart2 {
> >   pinctrl-names = "default";
> > - pinctrl-0 = <&uart6_pi_pins>;
> > + pinctrl-0 = <&uart2_pi_pins>;
> >   status = "okay";
> >  };
> >
> > @@ -352,3 +317,28 @@
> >   usb2_vbus-supply = <&reg_usb2_vbus>;
> >   status = "okay";
> >  };
> > +
> > +&fe0 {
> > + status = "disabled";
> > +};
> > +
> > +&fe1 {
> > + status = "disabled";
> > +};
> > +
> > +&be0 {
> > + status = "disabled";
> > +};
> > +
> > +&be1 {
> > + status = "disabled";
> > +};
> > +
> > +&tcon0 {
> > + status = "disabled";
> > +};
> > +
> > +&tcon1 {
> > + status = "disabled";
> > +};
> > +
> >
> >
> > --- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20.dtsi 2023-05-30
> > 14:17:29.000000000 +0100
> > +++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20.dtsi 2023-08-08
> > 00:30:04.689288733 +0100
> > @@ -345,6 +345,58 @@
> >   #size-cells = <0>;
> >   };
> >
> > + nand_pins_a: nand_base0@0 {
> > + allwinner,pins = "PC0", "PC1", "PC2",
> > + "PC5", "PC8", "PC9", "PC10",
> > + "PC11", "PC12", "PC13", "PC14",
> > + "PC15", "PC16";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> > + nand_cs0_pins_a: nand_cs@0 {
> > + allwinner,pins = "PC4";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> > + nand_cs1_pins_a: nand_cs@1 {
> > + allwinner,pins = "PC3";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> > + nand_cs2_pins_a: nand_cs@2 {
> > + allwinner,pins = "PC17";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> > + nand_cs3_pins_a: nand_cs@3 {
> > + allwinner,pins = "PC18";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> > + nand_rb0_pins_a: nand_rb@0 {
> > + allwinner,pins = "PC6";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> > + nand_rb1_pins_a: nand_rb@1 {
> > + allwinner,pins = "PC7";
> > + allwinner,function = "nand0";
> > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > + };
> > +
> >   spi0: spi@1c05000 {
> >   compatible = "allwinner,sun4i-a10-spi";
> >   reg = <0x01c05000 0x1000>;
> >
> >
>
> Thanks for the suggestion diff. Can you submit it as formal patch against
> current sunxi/for-next tree [1]? See
> Documentation/process/submitting-patches.rst for how to properly submit
> patches.
>

Sorry for my unclear email. I am currently facing issues when trying
to enable and use the MTD driver for A20 SOM (implemented and likely
maintained by Boris Brezillion); I am confused why the probe is not
called in deferred probe case and overall NAND on A20 SOM is not
detected.

I hope to get help in this regard, and of-course as soon as I got it
working, I will submit patches to be included in the kernel and DTS
files.

I am not sure why there are DTS files for A20 SOMs (especially one
sunxi-a20-olinuxino-micro.dts  which supposed to have NAND on the SOM)
without any NAND pinctrl and nfc node defined. When the kernel have
driver for it and I assume it should be working.

Added Boris Brezellion in the CC list, hoping to get some pointers and
suggestions from him too.

Thanks

Fawad Lateef


> Thanks.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/log/?h=sunxi/for-next
>
> --
> An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
  2023-08-14 10:16   ` Fawad Lateef
@ 2023-08-15 22:01     ` Fawad Lateef
  2023-08-16  0:20       ` John Watts
  0 siblings, 1 reply; 7+ messages in thread
From: Fawad Lateef @ 2023-08-15 22:01 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Linux sunXi; +Cc: kernelnewbies, boris.brezillon

Hi everyone,

Can someone guide me? I am not sure what I am missing here.

I am trying to debug the code but I assume that the SUNXI NAND driver
is supposed to be working and that something is missing from my
changes and additions to the dts/dtsi for A20 SOM.

Thanks in advance


On Mon, 14 Aug 2023 at 11:16, Fawad Lateef <fawadlateef@gmail.com> wrote:
>
> Hi Bagas,
>
> On Mon, 14 Aug 2023 at 06:07, Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> >
> > On Mon, Aug 14, 2023 at 12:40:26AM +0100, Fawad Lateef wrote:
> > > Hi,
> > >
> > > I am trying to make Linux-6.3.5 working on Olimex/Sunxi A20 SOM with NAND.
> > >
> > > Found that the Sunxi A20 NAND is supported in mainline kernel
> > > (drivers/mtd/nand/raw/sunxi_nand.c) and following the guidelines here
> > > (https://linux-sunxi.org/Mainline_NAND_Howto); I added the NFC chip
> > > pin information in sunxi-a20.dtsi and defined/enabled the nfc
> > > controller in the sunxi-a20-olinuxino-micro.dts files.
> > >
> > > The changes I made are below. Problem is when I define the nfc node
> > > entry in dts file "without" pinctrl entry (pinctrl-0 = <&nand_pins_a>,
> > > <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;), the sunxi_nfc_probe function
> > > is called (though the No NAND chip is detected).
> > >
> > > And if I define the pinctrl-0  in the nfc node, all I see related to
> > > NAND/sunxi in the kernel boot log is this line:  platform
> > > 1c03000.nand-controller: deferred probe pending.
> > >
> > > Can someone please guide me why the deferred probe is pending but
> > > never call the sunxi_nfc_probe function?  And without pinctrl-0 entry
> > > why probe function is being called?
> > >
> > > Seems like I am missing something basic here and any pointers to debug
> > > this will be appreciated.
> > >
> > >
> > > --- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
> > > 2023-05-30 14:17:29.000000000 +0100
> > > +++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts
> > > 2023-08-13 23:27:22.405058025 +0100
> > > @@ -56,7 +56,7 @@
> > >
> > >   aliases {
> > >   serial0 = &uart0;
> > > - serial1 = &uart6;
> > > + serial1 = &uart2;
> > >   serial2 = &uart7;
> > >   spi0 = &spi1;
> > >   spi1 = &spi2;
> > > @@ -66,17 +66,6 @@
> > >   stdout-path = "serial0:115200n8";
> > >   };
> > >
> > > - hdmi-connector {
> > > - compatible = "hdmi-connector";
> > > - type = "a";
> > > -
> > > - port {
> > > - hdmi_con_in: endpoint {
> > > - remote-endpoint = <&hdmi_out_con>;
> > > - };
> > > - };
> > > - };
> > > -
> > >   leds {
> > >   compatible = "gpio-leds";
> > >   pinctrl-names = "default";
> > > @@ -90,16 +79,55 @@
> > >   };
> > >  };
> > >
> > > -&ahci {
> > > - target-supply = <&reg_ahci_5v>;
> > > +&nfc {
> > > + pinctrl-names = "default";
> > > + pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
> > >   status = "okay";
> > > +
> > > + nand@0 {
> > > + #address-cells = <2>;
> > > + #size-cells = <2>;
> > > + reg = <0>;
> > > + allwinner,rb = <0>;
> > > +
> > > + nand-ecc-mode = "hw";
> > > + nand-on-flash-bbt;
> > > + };
> > > +
> > > + boot0@0 {
> > > + label = "boot0";
> > > + reg = /bits/ 64 <0x0 0x200000>;
> > > + };
> > > +
> > > + boot0-rescue@200000 {
> > > + label = "boot0-rescue";
> > > + reg = /bits/ 64 <0x200000 0x200000>;
> > > + };
> > > +
> > > + uboot@400000 {
> > > + label = "uboot";
> > > + reg = /bits/ 64 <0x400000 0x200000>;
> > > + };
> > > +
> > > + uboot-rescue@600000 {
> > > + label = "uboot-rescue";
> > > + reg = /bits/ 64 <0x600000 0x200000>;
> > > + };
> > > +
> > > + main@800000 {
> > > + label = "main";
> > > + reg = /bits/ 64 <0x800000 0xff800000>;
> > > + };
> > > +
> > >  };
> > >
> > > -&codec {
> > > +&ahci {
> > > + target-supply = <&reg_ahci_5v>;
> > >   status = "okay";
> > >  };
> > >
> > >  &cpu0 {
> > > + clock-frequency = <900000000>;
> > >   cpu-supply = <&reg_dcdc2>;
> > >  };
> > >
> > > @@ -123,34 +151,24 @@
> > >   status = "okay";
> > >  };
> > >
> > > -&hdmi {
> > > - status = "okay";
> > > -};
> > > -
> > > -&hdmi_out {
> > > - hdmi_out_con: endpoint {
> > > - remote-endpoint = <&hdmi_con_in>;
> > > - };
> > > -};
> > > -
> > >  &i2c0 {
> > > - status = "okay";
> > > +        status = "okay";
> > >
> > > - axp209: pmic@34 {
> > > - reg = <0x34>;
> > > - interrupt-parent = <&nmi_intc>;
> > > - interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> > > - };
> > > +        axp209: pmic@34 {
> > > +                reg = <0x34>;
> > > +                interrupt-parent = <&nmi_intc>;
> > > +                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> > > +        };
> > >  };
> > >
> > >  &i2c1 {
> > > - status = "okay";
> > > +        status = "okay";
> > >
> > > - eeprom: eeprom@50 {
> > > - compatible = "atmel,24c16";
> > > - reg = <0x50>;
> > > - pagesize = <16>;
> > > - };
> > > +        eeprom: eeprom@50 {
> > > +                compatible = "atmel,24c16";
> > > +                reg = <0x50>;
> > > +                pagesize = <16>;
> > > +        };
> > >  };
> > >
> > >  &i2c2 {
> > > @@ -160,55 +178,6 @@
> > >  &lradc {
> > >   vref-supply = <&reg_vcc3v0>;
> > >   status = "okay";
> > > -
> > > - button-191 {
> > > - label = "Volume Up";
> > > - linux,code = <KEY_VOLUMEUP>;
> > > - channel = <0>;
> > > - voltage = <191274>;
> > > - };
> > > -
> > > - button-392 {
> > > - label = "Volume Down";
> > > - linux,code = <KEY_VOLUMEDOWN>;
> > > - channel = <0>;
> > > - voltage = <392644>;
> > > - };
> > > -
> > > - button-601 {
> > > - label = "Menu";
> > > - linux,code = <KEY_MENU>;
> > > - channel = <0>;
> > > - voltage = <601151>;
> > > - };
> > > -
> > > - button-795 {
> > > - label = "Search";
> > > - linux,code = <KEY_SEARCH>;
> > > - channel = <0>;
> > > - voltage = <795090>;
> > > - };
> > > -
> > > - button-987 {
> > > - label = "Home";
> > > - linux,code = <KEY_HOMEPAGE>;
> > > - channel = <0>;
> > > - voltage = <987387>;
> > > - };
> > > -
> > > - button-1184 {
> > > - label = "Esc";
> > > - linux,code = <KEY_ESC>;
> > > - channel = <0>;
> > > - voltage = <1184678>;
> > > - };
> > > -
> > > - button-1398 {
> > > - label = "Enter";
> > > - linux,code = <KEY_ENTER>;
> > > - channel = <0>;
> > > - voltage = <1398804>;
> > > - };
> > >  };
> > >
> > >  &gmac_mdio {
> > > @@ -239,10 +208,6 @@
> > >   status = "okay";
> > >  };
> > >
> > > -&otg_sram {
> > > - status = "okay";
> > > -};
> > > -
> > >  &pio {
> > >   gmac_txerr: gmac-txerr-pin {
> > >   pins = "PA17";
> > > @@ -323,9 +288,9 @@
> > >   status = "okay";
> > >  };
> > >
> > > -&uart6 {
> > > +&uart2 {
> > >   pinctrl-names = "default";
> > > - pinctrl-0 = <&uart6_pi_pins>;
> > > + pinctrl-0 = <&uart2_pi_pins>;
> > >   status = "okay";
> > >  };
> > >
> > > @@ -352,3 +317,28 @@
> > >   usb2_vbus-supply = <&reg_usb2_vbus>;
> > >   status = "okay";
> > >  };
> > > +
> > > +&fe0 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +&fe1 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +&be0 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +&be1 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +&tcon0 {
> > > + status = "disabled";
> > > +};
> > > +
> > > +&tcon1 {
> > > + status = "disabled";
> > > +};
> > > +
> > >
> > >
> > > --- linux-6.3.5.orig/arch/arm/boot/dts/sun7i-a20.dtsi 2023-05-30
> > > 14:17:29.000000000 +0100
> > > +++ linux-6.3.5/arch/arm/boot/dts/sun7i-a20.dtsi 2023-08-08
> > > 00:30:04.689288733 +0100
> > > @@ -345,6 +345,58 @@
> > >   #size-cells = <0>;
> > >   };
> > >
> > > + nand_pins_a: nand_base0@0 {
> > > + allwinner,pins = "PC0", "PC1", "PC2",
> > > + "PC5", "PC8", "PC9", "PC10",
> > > + "PC11", "PC12", "PC13", "PC14",
> > > + "PC15", "PC16";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > > + nand_cs0_pins_a: nand_cs@0 {
> > > + allwinner,pins = "PC4";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > > + nand_cs1_pins_a: nand_cs@1 {
> > > + allwinner,pins = "PC3";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > > + nand_cs2_pins_a: nand_cs@2 {
> > > + allwinner,pins = "PC17";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > > + nand_cs3_pins_a: nand_cs@3 {
> > > + allwinner,pins = "PC18";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > > + nand_rb0_pins_a: nand_rb@0 {
> > > + allwinner,pins = "PC6";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > > + nand_rb1_pins_a: nand_rb@1 {
> > > + allwinner,pins = "PC7";
> > > + allwinner,function = "nand0";
> > > + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
> > > + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
> > > + };
> > > +
> > >   spi0: spi@1c05000 {
> > >   compatible = "allwinner,sun4i-a10-spi";
> > >   reg = <0x01c05000 0x1000>;
> > >
> > >
> >
> > Thanks for the suggestion diff. Can you submit it as formal patch against
> > current sunxi/for-next tree [1]? See
> > Documentation/process/submitting-patches.rst for how to properly submit
> > patches.
> >
>
> Sorry for my unclear email. I am currently facing issues when trying
> to enable and use the MTD driver for A20 SOM (implemented and likely
> maintained by Boris Brezillion); I am confused why the probe is not
> called in deferred probe case and overall NAND on A20 SOM is not
> detected.
>
> I hope to get help in this regard, and of-course as soon as I got it
> working, I will submit patches to be included in the kernel and DTS
> files.
>
> I am not sure why there are DTS files for A20 SOMs (especially one
> sunxi-a20-olinuxino-micro.dts  which supposed to have NAND on the SOM)
> without any NAND pinctrl and nfc node defined. When the kernel have
> driver for it and I assume it should be working.
>
> Added Boris Brezellion in the CC list, hoping to get some pointers and
> suggestions from him too.
>
> Thanks
>
> Fawad Lateef
>
>
> > Thanks.
> >
> > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/log/?h=sunxi/for-next
> >
> > --
> > An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
  2023-08-15 22:01     ` Fawad Lateef
@ 2023-08-16  0:20       ` John Watts
  2023-08-17 21:21         ` Fawad Lateef
  0 siblings, 1 reply; 7+ messages in thread
From: John Watts @ 2023-08-16  0:20 UTC (permalink / raw)
  To: Fawad Lateef
  Cc: Linux Kernel Mailing List, Linux sunXi, kernelnewbies,
	boris.brezillon

On Tue, Aug 15, 2023 at 11:01:02PM +0100, Fawad Lateef wrote:
> Hi everyone,
> 
> Can someone guide me? I am not sure what I am missing here.
> 
> I am trying to debug the code but I assume that the SUNXI NAND driver
> is supposed to be working and that something is missing from my
> changes and additions to the dts/dtsi for A20 SOM.
> 
> Thanks in advance

Hi there Fawad,

I've hit this problem before and it's usually been because the pins are being
used by another peripheral already

Could you post the kernel log? It might have some notes on this.

John.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
  2023-08-16  0:20       ` John Watts
@ 2023-08-17 21:21         ` Fawad Lateef
  2023-08-18  4:41           ` John Watts
  0 siblings, 1 reply; 7+ messages in thread
From: Fawad Lateef @ 2023-08-17 21:21 UTC (permalink / raw)
  To: John Watts
  Cc: Linux Kernel Mailing List, Linux sunXi, kernelnewbies,
	boris.brezillon

On Wed, 16 Aug 2023 at 01:20, John Watts <contact@jookia.org> wrote:
>
> On Tue, Aug 15, 2023 at 11:01:02PM +0100, Fawad Lateef wrote:
> > Hi everyone,
> >
> > Can someone guide me? I am not sure what I am missing here.
> >
> > I am trying to debug the code but I assume that the SUNXI NAND driver
> > is supposed to be working and that something is missing from my
> > changes and additions to the dts/dtsi for A20 SOM.
> >
> > Thanks in advance
>
> Hi there Fawad,
>
> I've hit this problem before and it's usually been because the pins are being
> used by another peripheral already
>
> Could you post the kernel log? It might have some notes on this.
>
> John.

Hi John,

Thanks for your help. I found the reason for my issue. I defined the
pinctrl information under the "soc" next to "nfc" entry in
sunxi-a20.dtsi which was messing it up.

I moved them inside the "pio" dtsi block and NAND is detected now.
Though almost all blocks are reported as bad-blocks.  I am thinking
that it's happening as I don't have partition information defined in
DTS. Do you think that this is the reason for bad-blocks reporting?

Regards,

Fawad Lateef

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support
  2023-08-17 21:21         ` Fawad Lateef
@ 2023-08-18  4:41           ` John Watts
  0 siblings, 0 replies; 7+ messages in thread
From: John Watts @ 2023-08-18  4:41 UTC (permalink / raw)
  To: Fawad Lateef
  Cc: Linux Kernel Mailing List, Linux sunXi, kernelnewbies,
	boris.brezillon

On Thu, Aug 17, 2023 at 10:21:35PM +0100, Fawad Lateef wrote:
> Hi John,
> 
> Thanks for your help. I found the reason for my issue. I defined the
> pinctrl information under the "soc" next to "nfc" entry in
> sunxi-a20.dtsi which was messing it up.
> 
> I moved them inside the "pio" dtsi block and NAND is detected now.

Congratulations!

> Though almost all blocks are reported as bad-blocks.  I am thinking
> that it's happening as I don't have partition information defined in
> DTS. Do you think that this is the reason for bad-blocks reporting?

I don't have much knowledge here but you might want to confirm the
contents of your bad block table is being read and has correct values.

This might help: https://linux-sunxi.org/Mainline_NAND_Howto

> Regards,
> 
> Fawad Lateef

John.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-08-18  4:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13 23:40 Question regarding Linux-6.3.5 and Sunxi A20 NAND/NFC support Fawad Lateef
2023-08-14  5:07 ` Bagas Sanjaya
2023-08-14 10:16   ` Fawad Lateef
2023-08-15 22:01     ` Fawad Lateef
2023-08-16  0:20       ` John Watts
2023-08-17 21:21         ` Fawad Lateef
2023-08-18  4:41           ` John Watts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox