Skip to contentSkip to conversation

mtd: atmel_nand: move the hsmc_clk from nfc node to nand node

PATCH New Josh Wu 3 participants 6 messages Feb 10, 2015 – Feb 26, 2015

Subsystems (5)
lore
Share & tools
lore

Josh Wu

author
#0 lore raw

PATCH 1/3 mtd: atmel_nand: move the hsmc_clk from nfc node to nand node

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled. But if HSMC clock is controlled by NFC, so disable NFC will also disable the HSMC clock. then, it will make the PMECC fail to work.

So the solution is move the HSMC clock out of NFC to nand node. When nand driver probed, it will check whether the chip has HSMC, if yes then it will require a HSMC clock.

---

 .../devicetree/bindings/mtd/atmel-nand.txt         |  4 +-
 drivers/mtd/nand/atmel_nand.c                      | 49 ++++++++++++----------
 2 files changed, 28 insertions(+), 25 deletions(-)
Documentation/devicetree/bindings/mtd/atmel-nand.txt +2 -2
index 7d4c8eb..955a793 100644
@@ -12,6 +12,7 @@ Required properties:
 - atmel,nand-cmd-offset : offset for the command latch.
 - #address-cells, #size-cells : Must be present if the device has sub-nodes
   representing partitions.
+- clocks: phandle to the peripheral clock
 
 - gpios : specifies the gpio pins to control the NAND device. detect is an
   optional gpio and may be set to 0 if not present.
@@ -38,7 +39,6 @@ Optional properties:
     - reg : should specify the address and size used for NFC command registers,
             NFC registers and NFC Sram. NFC Sram address and size can be absent
             if don't want to use it.
-    - clocks: phandle to the peripheral clock
   - Optional properties:
     - atmel,write-by-sram: boolean to enable NFC write by sram.
 
@@ -95,13 +95,13 @@ nand0: nand at 40000000 {
 	compatible = "atmel,at91rm9200-nand";
 	#address-cells = <1>;
 	#size-cells = <1>;
+	clocks = <&hsmc_clk>
 	ranges;
         ...
         nfc at 70000000 {
 		compatible = "atmel,sama5d3-nfc";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		clocks = <&hsmc_clk>
 		reg = <
 			0x70000000 0x10000000	/* NFC Command Registers */
 			0xffffc000 0x00000070	/* NFC HSMC regs */
drivers/mtd/nand/atmel_nand.c +26 -23

117 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/3 ARM: at91: sama5/dts: move hsmc_clk out of nfc node

In sama5d3, sama5d4 chips, pmecc will use the hsmc clock. As pmecc is part of HSMC. So move out hsmc_clk from nfc node to nand node.

---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 arch/arm/boot/dts/sama5d4.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/sama5d3.dtsi +1 -1
index 5f4144d..c0c3597 100644
@@ -1413,6 +1413,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand0_ale_cle>;
+			clocks = <&hsmc_clk>;
 			atmel,pmecc-lookup-table-offset = <0x0 0x8000>;
 			status = "disabled";
 
@@ -1425,7 +1426,6 @@
 					0xffffc000 0x00000070	/* NFC HSMC regs */
 					0x00200000 0x00100000	/* NFC SRAM banks */
 					>;
-				clocks = <&hsmc_clk>;
 			};
 		};
 	};
arch/arm/boot/dts/sama5d4.dtsi +1 -1
index c3b07d9..9b2139a 100644
@@ -281,6 +281,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand>;
+			clocks = <&hsmc_clk>;
 			status = "disabled";
 
 			nfc at 90000000 {
@@ -292,7 +293,6 @@
 					0xfc05c000 0x00000070	/* NFC HSMC regs */
 					0x00100000 0x00100000	/* NFC SRAM banks */
                                          >;
-				clocks = <&hsmc_clk>;
 				atmel,write-by-sram;
 			};
 		};
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH 3/3 ARM: at91: sama5d3/dts: add sama5d3 compatiable string for nand

In reply to Josh Wu

As we introduce a new "atmel,sama5d3-nand" compatible string for sama5d3, Apply it for sama5d3 chip.

---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d3.dtsi +1 -1
index c0c3597..7b6c36f 100644
@@ -1398,7 +1398,7 @@
 		};
 
 		nand0: nand at 60000000 {
-			compatible = "atmel,at91rm9200-nand";
+			compatible = "atmel,sama5d3-nand", "atmel,at91rm9200-nand";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
Signature · 1 line
1.9.1
#3 lore raw

PATCH 1/3 mtd: atmel_nand: move the hsmc_clk from nfc node to nand node

In reply to Josh Wu

Hi Josh,

Quoted 11 lines · On Tue, 10 Feb 2015 14:14:43 +0800 Josh Wu <[email protected]> wrote:

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled. But if HSMC clock is controlled by NFC, so disable NFC will also disable the HSMC clock. then, it will make the PMECC fail to work.

So the solution is move the HSMC clock out of NFC to nand node. When nand driver probed, it will check whether the chip has HSMC, if yes then it will require a HSMC clock.

Do you plan to use the NAND chip without the NFC (I mean, is there a reason for not using the NFC to access the NAND ?) ?
If you don't, why don't you just wait for the NFC before probing the NAND chip it is attached to, so that the hmsc clk is properly claimed.

I'm not convinced that moving a clk reference out of the controller node can address the fact that the nand/nand-controller DT representation is inappropriate (your embedding controller specific information in your NAND chip definition).
I think we should reconsider this problem with a controller/chip approach:
- which parts are representing the NAND controller: the PMECC engine, the NFC if available, ...
- which parts are representing the NAND chip: the EBI mem range, the R/B pin, the ALE/CLE information, ...

And of course, we should take the EBI/SMC rework into account ;-).

Best Regards,

Boris

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

PATCH 1/3 mtd: atmel_nand: move the hsmc_clk from nfc node to nand node

Quoted 16 lines · Boris Brezillon

Hi Josh,

Quoted 8 lines · On Tue, 10 Feb 2015 14:14:43 +0800 Josh Wu <[email protected]> wrote:

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled. But if HSMC clock is controlled by NFC, so disable NFC will also disable the HSMC clock. then, it will make the PMECC fail to work.

Quoted 8 lines
Quoted 3 lines

So the solution is move the HSMC clock out of NFC to nand node. When nand driver probed, it will check whether the chip has HSMC, if yes then it will require a HSMC clock.

Do you plan to use the NAND chip without the NFC (I mean, is there a reason for not using the NFC to access the NAND ?) ?
If you don't, why don't you just wait for the NFC before probing the NAND chip it is attached to, so that the hmsc clk is properly claimed.

you can as you can have 2 Nand on the d3 but only 1 NFC

Best Regards,
J.

Quoted 28 lines

I'm not convinced that moving a clk reference out of the controller node can address the fact that the nand/nand-controller DT representation is inappropriate (your embedding controller specific information in your NAND chip definition).
I think we should reconsider this problem with a controller/chip approach:
- which parts are representing the NAND controller: the PMECC engine, the NFC if available, ...
- which parts are representing the NAND chip: the EBI mem range, the R/B pin, the ALE/CLE information, ...

And of course, we should take the EBI/SMC rework into account ;-).

Best Regards,

Boris

Signature · 8 lines
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#5 lore raw

PATCH 1/3 mtd: atmel_nand: move the hsmc_clk from nfc node to nand node

Hi Jean-Christophe,

Quoted 20 lines · On Thu, 26 Feb 2015 19:49:09 +0800 Jean-Christophe PLAGNIOL-VILLARD…
Quoted 20 lines · Boris Brezillon

Hi Josh,

Quoted 11 lines · On Tue, 10 Feb 2015 14:14:43 +0800 Josh Wu <[email protected]> wrote:

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled. But if HSMC clock is controlled by NFC, so disable NFC will also disable the HSMC clock. then, it will make the PMECC fail to work.

So the solution is move the HSMC clock out of NFC to nand node. When nand driver probed, it will check whether the chip has HSMC, if yes then it will require a HSMC clock.

Quoted 5 lines
Quoted 4 lines

Do you plan to use the NAND chip without the NFC (I mean, is there a reason for not using the NFC to access the NAND ?) ?
If you don't, why don't you just wait for the NFC before probing the NAND chip it is attached to, so that the hmsc clk is properly claimed.

you can as you can have 2 Nand on the d3 but only 1 NFC

I don't get your point ?
You can control several NAND chips with the same NFC.

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