Skip to contentSkip to conversation

dts: sunxi: Add sunxi NAND Flash Controller support

PATCH Superseded Aleksei Mamlin 4 participants 33 messages Jun 6, 2016 – Jun 14, 2016

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

cover dts: sunxi: Add sunxi NAND Flash Controller support

Hello,

This series adds the sunxi NAND Flash Controller nodes to dts.

The first 4 patches is Boris Brezillon's patches with dtsi changes. The second 1 patch adds Hynix H27UBG8T2BTR-BC NAND chip definition. The last 2 patches enables NAND on Marsboard A10 board and Wexler TAB7200 tablet.

Aleksei Mamlin (3):
mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table
ARM: dts: sun4i: Enable NAND on Marsboard A10
ARM: dts: sun7i: Enable NAND on Wexler TAB7200

Boris Brezillon (4):
ARM: dts: sun4i: Add A10 NAND controller pin definitions
ARM: dts: sun4i: Add NFC node to Allwinner A10 SoC
ARM: dts: sun7i: Add A20 NAND controller pin definitions
ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

 arch/arm/boot/dts/sun4i-a10-marsboard.dts      | 41 ++++++++++++
 arch/arm/boot/dts/sun4i-a10.dtsi               | 91 ++++++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts | 41 ++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi               | 91 ++++++++++++++++++++++++++
 drivers/mtd/nand/nand_ids.c                    |  4 ++
 5 files changed, 268 insertions(+)
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/7 ARM: dts: sun4i: Add A10 NAND controller pin definitions

From: Boris Brezillon <[email protected]>

Define the NAND controller pin configs.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 80 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +80 -0
index a9c3190..146a08db 100644
@@ -1144,6 +1144,86 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
 			};
+
+			nand_pins_a: nand_base0 at 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 at 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 at 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 at 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 at 3 {
+				allwinner,pins = "PC18";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs4_pins_a: nand_cs at 4 {
+				allwinner,pins = "PC19";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs5_pins_a: nand_cs at 5 {
+				allwinner,pins = "PC20";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs6_pins_a: nand_cs at 6 {
+				allwinner,pins = "PC21";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs7_pins_a: nand_cs at 7 {
+				allwinner,pins = "PC22";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_rb0_pins_a: nand_rb at 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 at 1 {
+				allwinner,pins = "PC7";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
2.7.3
#2 lore raw

Re: [PATCH 1/7] ARM: dts: sun4i: Add A10 NAND controller pin definitions

Hi,

Quoted 88 lines · Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Define the NAND controller pin configs.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 80 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +70 -0
index a9c3190..146a08db 100644
@@ -1144,6 +1144,86 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
 			};
+
+			nand_pins_a: nand_base0 at 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 at 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 at 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 at 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 at 3 {
+				allwinner,pins = "PC18";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs4_pins_a: nand_cs at 4 {
+				allwinner,pins = "PC19";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs5_pins_a: nand_cs at 5 {
+				allwinner,pins = "PC20";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs6_pins_a: nand_cs at 6 {
+				allwinner,pins = "PC21";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs7_pins_a: nand_cs at 7 {
+				allwinner,pins = "PC22";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_rb0_pins_a: nand_rb at 0 {
+				allwinner,pins = "PC6";
+				allwinner,function = "nand0";

arch/arm/boot/dts/sun4i-a10.dtsi line 1226

Quoted 10 lines
arch/arm/boot/dts/sun4i-a10.dtsi +10 -0
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_rb1_pins_a: nand_rb at 1 {
+				allwinner,pins = "PC7";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};

We usually enable only the pin groups that are actually used by some board to avoid bloating the DT too much.

And the nodes should be sorted alphabetically.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160609/0da21566/attachment-0001.sig>
#3 lore raw

PATCH 2/7 ARM: dts: sun4i: Add NFC node to Allwinner A10 SoC

In reply to Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A10 SoC.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +11 -0
index 146a08db..22950d8 100644
@@ -747,6 +747,17 @@
 			#size-cells = <0>;
 		};
 
+		nfc: nand at 01c03000 {
+			compatible = "allwinner,sun4i-a10-nand";
+			reg = <0x01c03000 0x1000>;
+			interrupts = <37>;
+			clocks = <&ahb_gates 13>, <&nand_clk>;
+			clock-names = "ahb", "mod";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		emac: ethernet at 01c0b000 {
 			compatible = "allwinner,sun4i-a10-emac";
 			reg = <0x01c0b000 0x1000>;
Signature · 1 line
2.7.3
#4 lore raw

PATCH 3/7 ARM: dts: sun7i: Add A20 NAND controller pin definitions

In reply to Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Define the NAND controller pin configs.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 80 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +80 -0
index 82e28c3..915979f 100644
@@ -1328,6 +1328,86 @@
 				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
 				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
 			};
+
+			nand_pins_a: nand_base0 at 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 at 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 at 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 at 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 at 3 {
+				allwinner,pins = "PC18";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs4_pins_a: nand_cs at 4 {
+				allwinner,pins = "PC19";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs5_pins_a: nand_cs at 5 {
+				allwinner,pins = "PC20";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs6_pins_a: nand_cs at 6 {
+				allwinner,pins = "PC21";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_cs7_pins_a: nand_cs at 7 {
+				allwinner,pins = "PC22";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			nand_rb0_pins_a: nand_rb at 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 at 1 {
+				allwinner,pins = "PC7";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
 		};
 
 		timer at 01c20c00 {
Signature · 1 line
2.7.3
#5 lore raw

PATCH 4/7 ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

In reply to Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A20 SoC.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +11 -0
index 915979f..e473570 100644
@@ -826,6 +826,17 @@
 			#size-cells = <0>;
 		};
 
+		nfc: nand at 01c03000 {
+			compatible = "allwinner,sun4i-a10-nand";
+			reg = <0x01c03000 0x1000>;
+			interrupts = <37>;
+			clocks = <&ahb_gates 13>, <&nand_clk>;
+			clock-names = "ahb", "mod";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		emac: ethernet at 01c0b000 {
 			compatible = "allwinner,sun4i-a10-emac";
 			reg = <0x01c0b000 0x1000>;
Signature · 1 line
2.7.3
#6 lore raw

Re: [PATCH 4/7] ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

Quoted 15 lines · On Mon, 6 Jun 2016 13:24:21 +0300 Aleksei Mamlin <[email protected]> wrote:

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A20 SoC.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +0 -0
index 915979f..e473570 100644

arch/arm/boot/dts/sun7i-a20.dtsi line 832

Quoted 7 lines
arch/arm/boot/dts/sun7i-a20.dtsi +4 -0
@@ -826,6 +826,17 @@
 			#size-cells = <0>;
 		};
 
+		nfc: nand at 01c03000 {
+			compatible = "allwinner,sun4i-a10-nand";
+			reg = <0x01c03000 0x1000>;
+			interrupts = <37>;

Should be

			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
Quoted 13 lines
arch/arm/boot/dts/sun7i-a20.dtsi +7 -0
+			clocks = <&ahb_gates 13>, <&nand_clk>;
+			clock-names = "ahb", "mod";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		emac: ethernet at 01c0b000 {
 			compatible = "allwinner,sun4i-a10-emac";
 			reg = <0x01c0b000 0x1000>;
Signature · 1 line
2.7.3
Signature · 2 lines
Thanks and regards,
Aleksei Mamlin
#7 lore raw

PATCH 5/7 mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

In reply to Aleksei Mamlin

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

---
 drivers/mtd/nand/nand_ids.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mtd/nand/nand_ids.c +4 -0
index ccc05f5..ccdc773 100644
@@ -52,6 +52,10 @@ struct nand_flash_dev nand_flash_ids[] = {
 		{ .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} },
 		  SZ_8K, SZ_8K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
 		  NAND_ECC_INFO(40, SZ_1K), 4 },
+	{"H27UBG8T2BTR-BC 32G 3.3V 8-bit",
+		{ .id = {0xad, 0xd7, 0x94, 0xda, 0x74, 0xc3} },
+		  SZ_8K, SZ_4K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
+		  NAND_ECC_INFO(40, SZ_1K), 0 },
 
 	LEGACY_ID_NAND("NAND 4MiB 5V 8-bit",   0x6B, 4, SZ_8K, SP_OPTIONS),
 	LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS),
Signature · 1 line
2.7.3
#8 lore raw

Re: [PATCH 5/7] mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

Quoted 3 lines · On Mon, 6 Jun 2016 13:24:22 +0300 Aleksei Mamlin <[email protected]> wrote:

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

Still hoping to get this series [1] merged in 4.8, but if that's not the case, I'll apply your patch.

BTW, that would be great if you could test it on your platforms.

Regards,

Boris

[1]https://lkml.org/lkml/2016/5/27/264

Quoted 21 lines
---
 drivers/mtd/nand/nand_ids.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mtd/nand/nand_ids.c +4 -0
index ccc05f5..ccdc773 100644
@@ -52,6 +52,10 @@ struct nand_flash_dev nand_flash_ids[] = {
 		{ .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} },
 		  SZ_8K, SZ_8K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
 		  NAND_ECC_INFO(40, SZ_1K), 4 },
+	{"H27UBG8T2BTR-BC 32G 3.3V 8-bit",
+		{ .id = {0xad, 0xd7, 0x94, 0xda, 0x74, 0xc3} },
+		  SZ_8K, SZ_4K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
+		  NAND_ECC_INFO(40, SZ_1K), 0 },
 
 	LEGACY_ID_NAND("NAND 4MiB 5V 8-bit",   0x6B, 4, SZ_8K, SP_OPTIONS),
 	LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS),
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#9 lore raw

Re: [PATCH 5/7] mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

Quoted 12 lines · On Mon, 6 Jun 2016 20:55:49 +0200 Boris Brezillon…
Quoted 3 lines · On Mon, 6 Jun 2016 13:24:22 +0300 Aleksei Mamlin <[email protected]> wrote:

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

Still hoping to get this series [1] merged in 4.8, but if that's not the case, I'll apply your patch.

BTW, that would be great if you could test it on your platforms.

It seems that Hynix-specific initialization code can't handle H27UBG8T2BTR-BC chip:

[    0.886153] nand: Could not find valid ONFI parameter page; aborting
[    0.892665] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.899025] nand: Hynix 1c03000.nand
[    0.902596] nand: bus width 8 instead 16 bit
[    0.906858] nand: No NAND device found
[    0.910620] sunxi_nand 1c03000.nand: failed to init nand chips
[    0.916528] sunxi_nand: probe of 1c03000.nand failed with error -22
Quoted 35 lines

Regards,

Boris

[1]https://lkml.org/lkml/2016/5/27/264

Quoted 21 lines
---
 drivers/mtd/nand/nand_ids.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mtd/nand/nand_ids.c +4 -0
index ccc05f5..ccdc773 100644
@@ -52,6 +52,10 @@ struct nand_flash_dev nand_flash_ids[] = {
 		{ .id = {0xad, 0xde, 0x94, 0xda, 0x74, 0xc4} },
 		  SZ_8K, SZ_8K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
 		  NAND_ECC_INFO(40, SZ_1K), 4 },
+	{"H27UBG8T2BTR-BC 32G 3.3V 8-bit",
+		{ .id = {0xad, 0xd7, 0x94, 0xda, 0x74, 0xc3} },
+		  SZ_8K, SZ_4K, SZ_2M, NAND_NEED_SCRAMBLING, 6, 640,
+		  NAND_ECC_INFO(40, SZ_1K), 0 },
 
 	LEGACY_ID_NAND("NAND 4MiB 5V 8-bit",   0x6B, 4, SZ_8K, SP_OPTIONS),
 	LEGACY_ID_NAND("NAND 4MiB 3,3V 8-bit", 0xE3, 4, SZ_8K, SP_OPTIONS),
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Signature · 2 lines
Thanks and regards,
Aleksei Mamlin
#10 lore raw

Re: [PATCH 5/7] mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

Quoted 19 lines · On Mon, 6 Jun 2016 22:59:03 +0300 Aleksei Mamlin <[email protected]> wrote:
Quoted 12 lines · On Mon, 6 Jun 2016 20:55:49 +0200 Boris Brezillon…
Quoted 3 lines · On Mon, 6 Jun 2016 13:24:22 +0300 Aleksei Mamlin <[email protected]> wrote:

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

Still hoping to get this series [1] merged in 4.8, but if that's not the case, I'll apply your patch.

BTW, that would be great if you could test it on your platforms.

It seems that Hynix-specific initialization code can't handle H27UBG8T2BTR-BC chip:

Quoted 7 lines
[    0.886153] nand: Could not find valid ONFI parameter page; aborting
[    0.892665] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.899025] nand: Hynix 1c03000.nand
[    0.902596] nand: bus width 8 instead 16 bit
[    0.906858] nand: No NAND device found
[    0.910620] sunxi_nand 1c03000.nand: failed to init nand chips
[    0.916528] sunxi_nand: probe of 1c03000.nand failed with error -22

Can you try this patch? It should fix the problem [1].

[1]http://code.bulix.org/6hjww1-100494

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#11 lore raw

Re: [PATCH 5/7] mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

Quoted 30 lines · On Mon, 6 Jun 2016 22:31:38 +0200 Boris Brezillon…
Quoted 19 lines · On Mon, 6 Jun 2016 22:59:03 +0300 Aleksei Mamlin <[email protected]> wrote:
Quoted 12 lines · On Mon, 6 Jun 2016 20:55:49 +0200 Boris Brezillon…
Quoted 3 lines · On Mon, 6 Jun 2016 13:24:22 +0300 Aleksei Mamlin <[email protected]> wrote:

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

Still hoping to get this series [1] merged in 4.8, but if that's not the case, I'll apply your patch.

BTW, that would be great if you could test it on your platforms.

It seems that Hynix-specific initialization code can't handle H27UBG8T2BTR-BC chip:

Quoted 7 lines
[    0.886153] nand: Could not find valid ONFI parameter page; aborting
[    0.892665] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.899025] nand: Hynix 1c03000.nand
[    0.902596] nand: bus width 8 instead 16 bit
[    0.906858] nand: No NAND device found
[    0.910620] sunxi_nand 1c03000.nand: failed to init nand chips
[    0.916528] sunxi_nand: probe of 1c03000.nand failed with error -22
Quoted 4 lines

Can you try this patch? It should fix the problem [1].

[1]http://code.bulix.org/6hjww1-100494

Yes, it fixes problem. What about ONFI parameter page? Should it be ignored?

[    0.886068] nand: Could not find valid ONFI parameter page; aborting
[    0.892571] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.898917] nand: Hynix NAND 4GiB 3,3V 8-bit
[    0.903198] nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 640
[    0.911908] Bad block table found at page 524032, version 0x01
[    0.918534] Bad block table found at page 523776, version 0x01
[    0.972112] 5 ofpart partitions found on MTD device 1c03000.nand
[    0.978116] Creating 5 MTD partitions on "1c03000.nand":
[    0.983477] 0x000000000000-0x000000200000 : "boot0"
[    0.988803] 0x000000200000-0x000000400000 : "boot0-rescue"
[    0.994692] 0x000000400000-0x000000600000 : "uboot"
[    0.999944] 0x000000600000-0x000000800000 : "uboot-rescue"
[    1.005763] 0x000000800000-0x000100000000 : "main"
Quoted 5 lines
Signature · 4 lines
-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Signature · 2 lines
Thanks and regards,
Aleksei Mamlin
#12 lore raw

Re: [PATCH 5/7] mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

Quoted 33 lines · On Tue, 7 Jun 2016 00:06:45 +0300 Aleksei Mamlin <[email protected]> wrote:
Quoted 30 lines · On Mon, 6 Jun 2016 22:31:38 +0200 Boris Brezillon…
Quoted 26 lines · On Mon, 6 Jun 2016 22:59:03 +0300 Aleksei Mamlin <[email protected]> wrote:
Quoted 12 lines · On Mon, 6 Jun 2016 20:55:49 +0200 Boris Brezillon…
Quoted 3 lines · On Mon, 6 Jun 2016 13:24:22 +0300 Aleksei Mamlin <[email protected]> wrote:

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

Still hoping to get this series [1] merged in 4.8, but if that's not the case, I'll apply your patch.

BTW, that would be great if you could test it on your platforms.

It seems that Hynix-specific initialization code can't handle H27UBG8T2BTR-BC chip:

[    0.886153] nand: Could not find valid ONFI parameter page; aborting
[    0.892665] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.899025] nand: Hynix 1c03000.nand
[    0.902596] nand: bus width 8 instead 16 bit
[    0.906858] nand: No NAND device found
[    0.910620] sunxi_nand 1c03000.nand: failed to init nand chips
[    0.916528] sunxi_nand: probe of 1c03000.nand failed with error -22  
Quoted 6 lines
Quoted 4 lines

Can you try this patch? It should fix the problem [1].

[1]http://code.bulix.org/6hjww1-100494

Yes, it fixes problem. What about ONFI parameter page? Should it be ignored?

It should be ignored: your NAND is not 'ONFI compatible', the datasheet just says that it supports the' ONFI command set', which is not the same :).
The trace you're seeing here is just notifying that the core failed to detect an ONFI NAND, which is expected in your case.

Quoted 21 lines
[    0.886068] nand: Could not find valid ONFI parameter page; aborting
[    0.892571] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.898917] nand: Hynix NAND 4GiB 3,3V 8-bit
[    0.903198] nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 640
[    0.911908] Bad block table found at page 524032, version 0x01
[    0.918534] Bad block table found at page 523776, version 0x01
[    0.972112] 5 ofpart partitions found on MTD device 1c03000.nand
[    0.978116] Creating 5 MTD partitions on "1c03000.nand":
[    0.983477] 0x000000000000-0x000000200000 : "boot0"
[    0.988803] 0x000000200000-0x000000400000 : "boot0-rescue"
[    0.994692] 0x000000400000-0x000000600000 : "uboot"
[    0.999944] 0x000000600000-0x000000800000 : "uboot-rescue"
[    1.005763] 0x000000800000-0x000100000000 : "main"
Quoted 5 lines
Signature · 4 lines
-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com  
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#13 lore raw

Re: [PATCH 5/7] mtd: nand: Add Hynix H27UBG8T2BTR-BC to nand_ids table

In reply to Boris Brezillon
Quoted 30 lines · On Mon, 6 Jun 2016 22:31:38 +0200 Boris Brezillon…
Quoted 19 lines · On Mon, 6 Jun 2016 22:59:03 +0300 Aleksei Mamlin <[email protected]> wrote:
Quoted 12 lines · On Mon, 6 Jun 2016 20:55:49 +0200 Boris Brezillon…
Quoted 3 lines · On Mon, 6 Jun 2016 13:24:22 +0300 Aleksei Mamlin <[email protected]> wrote:

Add the full description of the Hynix H27UBG8T2BTR-BC NAND chip in the nand_ids table so that we can later use the NAND ECC infos and ONFI timings mode in controller drivers.

Still hoping to get this series [1] merged in 4.8, but if that's not the case, I'll apply your patch.

BTW, that would be great if you could test it on your platforms.

It seems that Hynix-specific initialization code can't handle H27UBG8T2BTR-BC chip:

Quoted 7 lines
[    0.886153] nand: Could not find valid ONFI parameter page; aborting
[    0.892665] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    0.899025] nand: Hynix 1c03000.nand
[    0.902596] nand: bus width 8 instead 16 bit
[    0.906858] nand: No NAND device found
[    0.910620] sunxi_nand 1c03000.nand: failed to init nand chips
[    0.916528] sunxi_nand: probe of 1c03000.nand failed with error -22  
Quoted 1 line

Can you try this patch? It should fix the problem [1].

Brian, I have a question regarding the extended NAND ids (not full-ids) defined in the nand_ids table. Are they really valid for all vendors?

If that's the case, why are we extracting the bus width from the id[3] since we already have this information in the options field?

Quoted 4 lines

[1]http://code.bulix.org/6hjww1-100494

Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#14 lore raw

PATCH 6/7 ARM: dts: sun4i: Enable NAND on Marsboard A10

In reply to Aleksei Mamlin

Enable the NFC and describe the NAND flash connected to this controller.

---
 arch/arm/boot/dts/sun4i-a10-marsboard.dts | 41 +++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun4i-a10-marsboard.dts +41 -0
index 8e50723..ea6e2d5 100644
@@ -150,6 +150,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};
+
 &ohci0 {
 	status = "okay";
 };
Signature · 1 line
2.7.3
Reviewed-by on v1 6/7
#15 lore raw

Re: [PATCH 6/7] ARM: dts: sun4i: Enable NAND on Marsboard A10

Quoted 3 lines · On Mon, 6 Jun 2016 13:24:23 +0300 Aleksei Mamlin <[email protected]> wrote:

Enable the NFC and describe the NAND flash connected to this controller.

Quoted 56 lines
---
 arch/arm/boot/dts/sun4i-a10-marsboard.dts | 41 +++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun4i-a10-marsboard.dts +41 -0
index 8e50723..ea6e2d5 100644
@@ -150,6 +150,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};
+
 &ohci0 {
 	status = "okay";
 };
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#16 lore raw

PATCH 7/7 ARM: dts: sun7i: Enable NAND on Wexler TAB7200

In reply to Aleksei Mamlin

Enable the NFC and describe the NAND flash connected to this controller.

---
 arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +41 -0
index 2f6b21a..42aff91 100644
@@ -159,6 +159,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};
+
 &ohci0 {
 	status = "okay";
 };
Signature · 1 line
2.7.3
Reviewed-by on v1 7/7
#17 lore raw

Re: [PATCH 7/7] ARM: dts: sun7i: Enable NAND on Wexler TAB7200

Quoted 3 lines · On Mon, 6 Jun 2016 13:24:24 +0300 Aleksei Mamlin <[email protected]> wrote:

Enable the NFC and describe the NAND flash connected to this controller.

Quoted 56 lines
---
 arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +41 -0
index 2f6b21a..42aff91 100644
@@ -159,6 +159,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};
+
 &ohci0 {
 	status = "okay";
 };
Signature · 3 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#18 lore raw

Re: [PATCH 7/7] ARM: dts: sun7i: Enable NAND on Wexler TAB7200

In reply to Aleksei Mamlin

Hi,

Quoted 45 lines · Aleksei Mamlin

Enable the NFC and describe the NAND flash connected to this controller.

---
 arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +30 -0
index 2f6b21a..42aff91 100644
@@ -159,6 +159,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {

arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts line 201

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +10 -0
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};

This feels a bit premature. The two boards you're using have an MLC NAND which is not supported yet. Until there's proper MLC support in the kernel, I'm not sure we want to enable that for end-users when we know that things will get wrong.

However, after discussing this with Boris, I appreciate that we don't have any example available because of this policy for people that want to opt-in anyway.

What we could do is to still mark the status as disabled in the DTS, with a big fat warning as comment just before, so that it requires user action, and that user will have been warned.

Would that work for you?
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160609/23129dab/attachment.sig>
#19 lore raw

Re: [PATCH 7/7] ARM: dts: sun7i: Enable NAND on Wexler TAB7200

Quoted 68 lines · On Thu, 9 Jun 2016 00:03:14 +0200 Maxime Ripard…

Hi,

Quoted 45 lines · Aleksei Mamlin

Enable the NFC and describe the NAND flash connected to this controller.

---
 arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +30 -0
index 2f6b21a..42aff91 100644
@@ -159,6 +159,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {

arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts line 201

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +10 -0
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};

This feels a bit premature. The two boards you're using have an MLC NAND which is not supported yet. Until there's proper MLC support in the kernel, I'm not sure we want to enable that for end-users when we know that things will get wrong.

However, after discussing this with Boris, I appreciate that we don't have any example available because of this policy for people that want to opt-in anyway.

Quoted 7 lines

What we could do is to still mark the status as disabled in the DTS, with a big fat warning as comment just before, so that it requires user action, and that user will have been warned.

Would that work for you?
Maxime

Let's drop this two patches with boards dts changes until we get proper MLC support in kernel.

As for examples - I'll update linux-sunxi wiki with how to enable NAND controller and describe NAND chips in DTS. People who want to add NAND support to their boards will be warned that it is risky for now.

Quoted 5 lines
Signature · 4 lines
-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Signature · 2 lines
Thanks and regards,
Aleksei Mamlin
#20 lore raw

Re: [PATCH 7/7] ARM: dts: sun7i: Enable NAND on Wexler TAB7200

Quoted 79 lines · Aleksei Mamlin
Quoted 68 lines · On Thu, 9 Jun 2016 00:03:14 +0200 Maxime Ripard…

Hi,

Quoted 45 lines · Aleksei Mamlin

Enable the NFC and describe the NAND flash connected to this controller.

---
 arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts | 41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +30 -0
index 2f6b21a..42aff91 100644
@@ -159,6 +159,47 @@
 	status = "okay";
 };
 
+&nfc {
+	pinctrl-names = "default";
+	pinctrl-0 = <&nand_pins_a>, <&nand_cs0_pins_a>, <&nand_rb0_pins_a>;
+	status = "okay";
+
+	nand at 0 {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		reg = <0>;
+		allwinner,rb = <0>;
+
+		nand-ecc-mode = "hw";
+		nand-on-flash-bbt;
+
+		boot0 at 0 {
+			label = "boot0";
+			reg = /bits/ 64 <0x0 0x200000>;
+		};
+
+		boot0-rescue at 200000 {
+			label = "boot0-rescue";
+			reg = /bits/ 64 <0x200000 0x200000>;
+		};
+
+		uboot at 400000 {
+			label = "uboot";
+			reg = /bits/ 64 <0x400000 0x200000>;
+		};
+
+		uboot-rescue at 600000 {

arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts line 201

Quoted 10 lines
arch/arm/boot/dts/sun7i-a20-wexler-tab7200.dts +10 -0
+			label = "uboot-rescue";
+			reg = /bits/ 64 <0x600000 0x200000>;
+		};
+
+		main at 800000 {
+			label = "main";
+			reg = /bits/ 64 <0x800000 0xff800000>;
+		};
+	};
+};

This feels a bit premature. The two boards you're using have an MLC NAND which is not supported yet. Until there's proper MLC support in the kernel, I'm not sure we want to enable that for end-users when we know that things will get wrong.

However, after discussing this with Boris, I appreciate that we don't have any example available because of this policy for people that want to opt-in anyway.

Quoted 7 lines

What we could do is to still mark the status as disabled in the DTS, with a big fat warning as comment just before, so that it requires user action, and that user will have been warned.

Would that work for you?
Maxime

Quoted 6 lines

Let's drop this two patches with boards dts changes until we get proper MLC support in kernel.

As for examples - I'll update linux-sunxi wiki with how to enable NAND controller and describe NAND chips in DTS. People who want to add NAND support to their boards will be warned that it is risky for now.

That works for me too.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160610/111f7567/attachment.sig>
#21 lore raw

v2 cover dts: sunxi: Add sunxi NAND Flash Controller support

In reply to Aleksei Mamlin

Hello,

This series adds the sunxi NAND Flash Controller pin definitions and nodes to dts.

Changes since v1:
- Remove patch with Hynix H27UBG8T2BTR-BC MLC NAND chip definition.
- Remove patches with NAND support on Marsboard A10 board and Wexler TAB7200.
- Enable only the pin groups that are actually used by sunxi boards.
- Enable DMA support. Depends on sunxi NFC DMA support([1], [2]), merged into linux-nand.

[1] http://lists.infradead.org/pipermail/linux-mtd/2016-April/066899.html
[2] http://lists.infradead.org/pipermail/linux-mtd/2016-April/066898.html

Boris Brezillon (4):
ARM: dts: sun4i: Add A10 NAND controller pin definitions
ARM: dts: sun4i: Add NFC node to Allwinner A10 SoC
ARM: dts: sun7i: Add A20 NAND controller pin definitions
ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

 arch/arm/boot/dts/sun4i-a10.dtsi | 65 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/sun7i-a20.dtsi | 65 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+)
Signature · 1 line
2.7.3
#22 lore raw

PATCH v2 1/4 ARM: dts: sun4i: Add A10 NAND controller pin definitions

From: Boris Brezillon <[email protected]>

Define the NAND controller pin configs.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +52 -0
index 6d9c7c70..e579bdd 100644
@@ -1033,6 +1033,58 @@
 				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
 			};
 
+			nand_pins_a: nand_base0 at 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 at 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 at 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 at 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 at 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 at 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 at 1 {
+				allwinner,pins = "PC7";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			ps20_pins_a: ps20 at 0 {
 				allwinner,pins = "PI20", "PI21";
 				allwinner,function = "ps2";
Signature · 1 line
2.7.3
#23 lore raw

Re: [PATCH v2 1/4] ARM: dts: sun4i: Add A10 NAND controller pin definitions

Hi,

Quoted 6 lines · Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Define the NAND controller pin configs.

Unfortunately, we don't have any user for it at the moment.

Please re-submit it later when we'll have some :)

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160614/90e145ec/attachment.sig>
#24 lore raw

PATCH v2 2/4 ARM: dts: sun4i: Add NFC node to Allwinner A10 SoC

In reply to Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A10 SoC.

---
 arch/arm/boot/dts/sun4i-a10.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun4i-a10.dtsi +13 -0
index e579bdd..308ed5d 100644
@@ -719,6 +719,19 @@
 			#dma-cells = <2>;
 		};
 
+		nfc: nand at 01c03000 {
+			compatible = "allwinner,sun4i-a10-nand";
+			reg = <0x01c03000 0x1000>;
+			interrupts = <37>;
+			clocks = <&ahb_gates 13>, <&nand_clk>;
+			clock-names = "ahb", "mod";
+			dmas = <&dma SUN4I_DMA_DEDICATED 3>;
+			dma-names = "rxtx";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		spi0: spi at 01c05000 {
 			compatible = "allwinner,sun4i-a10-spi";
 			reg = <0x01c05000 0x1000>;
Signature · 1 line
2.7.3
#25 lore raw

Re: [PATCH v2 2/4] ARM: dts: sun4i: Add NFC node to Allwinner A10 SoC

Quoted 6 lines · Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A10 SoC.

Applied, thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160614/31b6b5fd/attachment.sig>
#26 lore raw

PATCH v2 3/4 ARM: dts: sun7i: Add A20 NAND controller pin definitions

In reply to Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Define the NAND controller pin configs.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +52 -0
index de4231e..ad984f8 100644
@@ -1168,6 +1168,58 @@
 				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
 			};
 
+			nand_pins_a: nand_base0 at 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 at 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 at 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 at 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 at 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 at 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 at 1 {
+				allwinner,pins = "PC7";
+				allwinner,function = "nand0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
 			ps20_pins_a: ps20 at 0 {
 				allwinner,pins = "PI20", "PI21";
 				allwinner,function = "ps2";
Signature · 1 line
2.7.3
#27 lore raw

PATCH v2 4/4 ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

In reply to Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A20 SoC.

---
 arch/arm/boot/dts/sun7i-a20.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/sun7i-a20.dtsi +13 -0
index ad984f8..7d7560f 100644
@@ -798,6 +798,19 @@
 			#dma-cells = <2>;
 		};
 
+		nfc: nand at 01c03000 {
+			compatible = "allwinner,sun4i-a10-nand";
+			reg = <0x01c03000 0x1000>;
+			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;;
+			clocks = <&ahb_gates 13>, <&nand_clk>;
+			clock-names = "ahb", "mod";
+			dmas = <&dma SUN4I_DMA_DEDICATED 3>;
+			dma-names = "rxtx";
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		spi0: spi at 01c05000 {
 			compatible = "allwinner,sun4i-a10-spi";
 			reg = <0x01c05000 0x1000>;
Signature · 1 line
2.7.3
#28 lore raw

Re: [PATCH v2 4/4] ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

Quoted 6 lines · Aleksei Mamlin

From: Boris Brezillon <[email protected]>

Add NAND Flash controller node definition to the A20 SoC.

Applied, thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160614/c941bd1c/attachment.sig>
#29 lore raw

Re: [PATCH v2 4/4] ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

In reply to Aleksei Mamlin
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi,

[auto build test ERROR on mripard/sunxi/for-next]
[also build test ERROR on next-20160614]
[cannot apply to robh/for-next v4.7-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Aleksei-Mamlin/dts-sunxi-Add-sunxi-NAND-Flash-Controller-support/20160614-192539
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git sunxi/for-next
config: arm-sunxi_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

>> Error: arch/arm/boot/dts/sun7i-a20.dtsi:806.26-27 syntax error

FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 20206 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160614/c0e6ca52/attachment-0001.obj>

#30 lore raw

Re: [PATCH v2 4/4] ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

Quoted 17 lines · On Tue, 14 Jun 2016 21:11:12 +0800 kbuild test robot <[email protected]> wrote:

Hi,

[auto build test ERROR on mripard/sunxi/for-next]
[also build test ERROR on next-20160614]
[cannot apply to robh/for-next v4.7-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Aleksei-Mamlin/dts-sunxi-Add-sunxi-NAND-Flash-Controller-support/20160614-192539
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git sunxi/for-next
config: arm-sunxi_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

Quoted 5 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

Error: arch/arm/boot/dts/sun7i-a20.dtsi:806.26-27 syntax error

FATAL ERROR: Unable to parse input tree

My bad, dual semicolon at line 806. Maxime, can you fix it locally?

Quoted 3 lines

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Signature · 2 lines
Thanks and regards,
Aleksei Mamlin
#31 lore raw

Re: [PATCH v2 4/4] ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

Quoted 20 lines · Aleksei Mamlin
Quoted 17 lines · On Tue, 14 Jun 2016 21:11:12 +0800 kbuild test robot <[email protected]> wrote:

Hi,

[auto build test ERROR on mripard/sunxi/for-next]
[also build test ERROR on next-20160614]
[cannot apply to robh/for-next v4.7-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Aleksei-Mamlin/dts-sunxi-Add-sunxi-NAND-Flash-Controller-support/20160614-192539
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git sunxi/for-next
config: arm-sunxi_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

Quoted 7 lines
Quoted 5 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

Error: arch/arm/boot/dts/sun7i-a20.dtsi:806.26-27 syntax error

FATAL ERROR: Unable to parse input tree

My bad, dual semicolon at line 806. Maxime, can you fix it locally?

Already did :)

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160614/ca5b133e/attachment.sig>
#32 lore raw

Re: [PATCH v2 4/4] ARM: dts: sun7i: Add NFC node to Allwinner A20 SoC

Quoted 23 lines · On Tue, 14 Jun 2016 15:57:16 +0200 Maxime Ripard…
Quoted 22 lines · Aleksei Mamlin
Quoted 19 lines · On Tue, 14 Jun 2016 21:11:12 +0800 kbuild test robot <[email protected]> wrote:

Hi,

[auto build test ERROR on mripard/sunxi/for-next]
[also build test ERROR on next-20160614]
[cannot apply to robh/for-next v4.7-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Aleksei-Mamlin/dts-sunxi-Add-sunxi-NAND-Flash-Controller-support/20160614-192539
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git sunxi/for-next
config: arm-sunxi_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm

All errors (new ones prefixed by >>):

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

Error: arch/arm/boot/dts/sun7i-a20.dtsi:806.26-27 syntax error

FATAL ERROR: Unable to parse input tree

My bad, dual semicolon at line 806. Maxime, can you fix it locally?

Already did :)

Thanks a lot!

Quoted 8 lines

Thanks!
Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Signature · 2 lines
Thanks and regards,
Aleksei Mamlin