Skip to contentSkip to conversation

ARM: dts: arria10: update NAND clocking

PATCH Superseded Dinh Nguyen 3 participants 9 messages Jul 9, 2018 – Jul 23, 2018 Device tree bindings

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +11 -2
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
 						clk-gate = <0xC8 11>;
 					};
 
-					nand_clk: nand_clk {
+					nand_x_clk: nand_x_clk {
 						#clock-cells = <0>;
 						compatible = "altr,socfpga-a10-gate-clk";
 						clocks = <&l4_mp_clk>;
 						clk-gate = <0xC8 10>;
 					};
 
+					nand_clk: nand_clk {
+						#clock-cells = <0>;
+						compatible = "altr,socfpga-a10-gate-clk";
+						clocks = <&nand_x_clk>;
+						fixed-divider = <4>;
+						clk-gate = <0xC8 10>;
+					};
+
 					spi_m_clk: spi_m_clk {
 						#clock-cells = <0>;
 						compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
 			reg-names = "nand_data", "denali_reg";
 			interrupts = <0 99 4>;
 			dma-mask = <0xffffffff>;
-			clocks = <&nand_clk>;
+			clocks = <&nand_clk>, <&nand_x_clk>;
+			clock-names = "nand", "nand_x";
 			status = "disabled";
 		};
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 ARM: dts: socfpga: update NAND clocking for c5/a5

The nand_x_clk is derived from the nand_clk. Also, update the NAND dts property with the correct clocks property.

---
 arch/arm/boot/dts/socfpga.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga.dtsi +3 -2
index b38f8c2..ae432b9 100644
@@ -486,7 +486,7 @@
 					nand_clk: nand_clk {
 						#clock-cells = <0>;
 						compatible = "altr,socfpga-gate-clk";
-						clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
+						clocks = <&nand_x_clk>;
 						clk-gate = <0xa0 10>;
 						fixed-divider = <4>;
 					};
@@ -754,7 +754,8 @@
 			reg-names = "nand_data", "denali_reg";
 			interrupts = <0x0 0x90 0x4>;
 			dma-mask = <0xffffffff>;
-			clocks = <&nand_x_clk>;
+			clocks = <&nand_clk>, <&nand_x_clk>;
+			clock-names = "nand", "nand_x";
 			status = "disabled";
 		};
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

In reply to Dinh Nguyen

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 39 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 6 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

SOCFPGA has HW ECC engine.

I suggested to add ECC clock, and Richard agreed.
https://lkml.org/lkml/2018/6/22/573

Quoted 10 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +0 -1
                        status = "disabled";
                };
 
--

2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

Quoted 41 lines · Masahiro Yamada

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 40 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
Quoted 9 lines

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 5 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

I don't see any mentions of an ECC clock in any of the SoCFPGA documentation for the NAND IP.

Dinh

#4 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

2018-07-10 22:35 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 54 lines · Masahiro Yamada
Quoted 41 lines

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 40 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
Quoted 9 lines

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 5 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

Quoted 2 lines

I don't see any mentions of an ECC clock in any of the SoCFPGA documentation for the NAND IP.

I'd like you to check the IP documentation published by Denali (or Cadence),
not published by Altera.

Is it available for you?

In my SoCs, the same clock signal (nand-clk-200m) is connected to clk_x and ecc_clk, like this:

                                         -------------
--------------                           | DENALI IP |
|            |                           |           |
| clk        |---(nand-clk-50m)--------->| clk       |
| controller |                           |           |
|            |---(nand-clk-200m)-------->| clk_x     |
--------------?                      |   |           |
                                     --->| ecc_clk   |
                                         |           |
                                         -------------

Some clock lines are often tied-up,
but such low-level information does not appear in user documents.
I talked to a hardware engineer to get this information.

I guess the situation is similar for your case, but I do not have information enough to argue this.

Signature · 2 lines
Best Regards
Masahiro Yamada
#5 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

Hi Masahiro,

Quoted 90 lines · Masahiro Yamada

2018-07-10 22:35 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 54 lines · Masahiro Yamada
Quoted 41 lines

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 40 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
Quoted 9 lines

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 5 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

Quoted 2 lines

I don't see any mentions of an ECC clock in any of the SoCFPGA documentation for the NAND IP.

I'd like you to check the IP documentation published by Denali (or Cadence),
not published by Altera.

Is it available for you?

In my SoCs, the same clock signal (nand-clk-200m) is connected to clk_x and ecc_clk, like this:

                                         -------------
--------------                           | DENALI IP |
|            |                           |           |
| clk        |---(nand-clk-50m)--------->| clk       |
| controller |                           |           |
|            |---(nand-clk-200m)-------->| clk_x     |
--------------?                      |   |           |
                                     --->| ecc_clk   |
                                         |           |
                                         -------------

Some clock lines are often tied-up,
but such low-level information does not appear in user documents.
I talked to a hardware engineer to get this information.

Quoted 3 lines

I guess the situation is similar for your case, but I do not have information enough to argue this.

I don't disagree with this representation. But after asking around, I'm getting the impression that the ECC clock is not exposed to the clock manager. This implies that the clock is always turned on and there doesn't seem to be any software control for it. I tested ECC with this patch and it looks to be working correctly, without any ecc clock representation.

I'm not sure if I should expose a dummy ecc_clk to satisfy the binding?

Dinh

#6 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

2018-07-11 23:51 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 98 lines

Hi Masahiro,

Quoted 90 lines · Masahiro Yamada

2018-07-10 22:35 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 54 lines · Masahiro Yamada
Quoted 41 lines

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 40 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
Quoted 9 lines

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 5 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

Quoted 2 lines

I don't see any mentions of an ECC clock in any of the SoCFPGA documentation for the NAND IP.

I'd like you to check the IP documentation published by Denali (or Cadence),
not published by Altera.

Is it available for you?

In my SoCs, the same clock signal (nand-clk-200m) is connected to clk_x and ecc_clk, like this:

                                         -------------
--------------                           | DENALI IP |
|            |                           |           |
| clk        |---(nand-clk-50m)--------->| clk       |
| controller |                           |           |
|            |---(nand-clk-200m)-------->| clk_x     |
--------------?                      |   |           |
                                     --->| ecc_clk   |
                                         |           |
                                         -------------

Some clock lines are often tied-up,
but such low-level information does not appear in user documents.
I talked to a hardware engineer to get this information.

Quoted 3 lines

I guess the situation is similar for your case, but I do not have information enough to argue this.

Quoted 8 lines

I don't disagree with this representation. But after asking around, I'm getting the impression that the ECC clock is not exposed to the clock manager. This implies that the clock is always turned on and there doesn't seem to be any software control for it. I tested ECC with this patch and it looks to be working correctly, without any ecc clock representation.

I'm not sure if I should expose a dummy ecc_clk to satisfy the binding?

DT should represent the real HW.
If the Denali IP in SOCFPGA needs ecc_clk input,
DT should describe it.

I do not have knowledge about the SOCFPGA internals. I do not know which is correct:

- The Denali IP in SOCFPGA needs ecc_clk,
but there is no software control for it.

- The Denali IP in SOCFPGA does not need ecc_clk.

Quoted 5 lines

Dinh
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#7 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

Quoted 86 lines · Masahiro Yamada

2018-07-11 23:51 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 85 lines

Hi Masahiro,

Quoted 81 lines · Masahiro Yamada

2018-07-10 22:35 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 54 lines · Masahiro Yamada
Quoted 41 lines

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 40 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
Quoted 9 lines

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 5 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

Quoted 2 lines

I don't see any mentions of an ECC clock in any of the SoCFPGA documentation for the NAND IP.

I'd like you to check the IP documentation published by Denali (or Cadence),
not published by Altera.

Is it available for you?

In my SoCs, the same clock signal (nand-clk-200m) is connected to clk_x and ecc_clk, like this:

                                         -------------
--------------                           | DENALI IP |
|            |                           |           |
| clk        |---(nand-clk-50m)--------->| clk       |
| controller |                           |           |
|            |---(nand-clk-200m)-------->| clk_x     |
--------------?                      |   |           |
                                     --->| ecc_clk   |
                                         |           |
                                         -------------

Here's a diagram of the clocking for the NAND IP on SOCFPGA.

                                      -------------
--------------                        | DENALI IP    |
|            |                        |              |
| clk        |                        | |-->clk(/4)  |
| controller |                        | |            |
|            |---(nand_clk)-------------|-->clk_x    |
-------------                         | |	     |
                                      | |-->ecc_clk  |
                                      |              |
                                      ---------------
Quoted 1 line

From the clock controller, it provides a single 200MHz clock to the NAND

IP. Inside the NAND IP, there is a /4 for the clk. The 200MHz clock is used for the clk_x and ecc_clk.

The nand-clk is the only clock that can be gated.

Quoted 28 lines
Quoted 13 lines
Quoted 9 lines

Some clock lines are often tied-up,
but such low-level information does not appear in user documents.
I talked to a hardware engineer to get this information.

Quoted 3 lines

I guess the situation is similar for your case, but I do not have information enough to argue this.

Quoted 8 lines

I don't disagree with this representation. But after asking around, I'm getting the impression that the ECC clock is not exposed to the clock manager. This implies that the clock is always turned on and there doesn't seem to be any software control for it. I tested ECC with this patch and it looks to be working correctly, without any ecc clock representation.

I'm not sure if I should expose a dummy ecc_clk to satisfy the binding?

DT should represent the real HW.
If the Denali IP in SOCFPGA needs ecc_clk input,
DT should describe it.

Quoted 8 lines

I do not have knowledge about the SOCFPGA internals. I do not know which is correct:

- The Denali IP in SOCFPGA needs ecc_clk,
but there is no software control for it.

- The Denali IP in SOCFPGA does not need ecc_clk.

So should I be representing the clocks even though it doesn't come from the clock controller?

Dinh

#8 lore raw

PATCH 1/2 ARM: dts: arria10: update NAND clocking

2018-07-21 8:16 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 103 lines · Masahiro Yamada
Quoted 86 lines

2018-07-11 23:51 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 85 lines

Hi Masahiro,

Quoted 81 lines · Masahiro Yamada

2018-07-10 22:35 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 54 lines · Masahiro Yamada
Quoted 41 lines

2018-07-10 7:41 GMT+09:00 Dinh Nguyen <[email protected]>:

Quoted 40 lines

The NAND IP needs 2 clocks(nand_x_clk and nand_clk). This patch adds a nand_x_clk, which is derived from the nand_clk, but has a fixed divider of 4.

Update the NAND node to use the additional clock.

---
 arch/arm/boot/dts/socfpga_arria10.dtsi | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga_arria10.dtsi +9 -1
index a4dcb68..558b5ea 100644
@@ -377,13 +377,21 @@
                                                clk-gate = <0xC8 11>;
                                        };
 
-                                       nand_clk: nand_clk {
+                                       nand_x_clk: nand_x_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
                                                clocks = <&l4_mp_clk>;
                                                clk-gate = <0xC8 10>;
                                        };
 
+                                       nand_clk: nand_clk {
+                                               #clock-cells = <0>;
+                                               compatible = "altr,socfpga-a10-gate-clk";
+                                               clocks = <&nand_x_clk>;
+                                               fixed-divider = <4>;
+                                               clk-gate = <0xC8 10>;
+                                       };
+
                                        spi_m_clk: spi_m_clk {
                                                #clock-cells = <0>;
                                                compatible = "altr,socfpga-a10-gate-clk";
@@ -650,7 +658,8 @@
                        reg-names = "nand_data", "denali_reg";
Quoted 9 lines

arch/arm/boot/dts/socfpga_arria10.dtsi line 662

Quoted 5 lines
arch/arm/boot/dts/socfpga_arria10.dtsi +2 -1
                        interrupts = <0 99 4>;
                        dma-mask = <0xffffffff>;
-                       clocks = <&nand_clk>;
+                       clocks = <&nand_clk>, <&nand_x_clk>;
+                       clock-names = "nand", "nand_x";

Doesn't SOCFPGA really need the ECC clock?

Quoted 2 lines

I don't see any mentions of an ECC clock in any of the SoCFPGA documentation for the NAND IP.

I'd like you to check the IP documentation published by Denali (or Cadence),
not published by Altera.

Is it available for you?

In my SoCs, the same clock signal (nand-clk-200m) is connected to clk_x and ecc_clk, like this:

                                         -------------
--------------                           | DENALI IP |
|            |                           |           |
| clk        |---(nand-clk-50m)--------->| clk       |
| controller |                           |           |
|            |---(nand-clk-200m)-------->| clk_x     |
--------------?                      |   |           |
                                     --->| ecc_clk   |
                                         |           |
                                         -------------

Here's a diagram of the clocking for the NAND IP on SOCFPGA.

                                      -------------
--------------                        | DENALI IP    |
|            |                        |              |
| clk        |                        | |-->clk(/4)  |
| controller |                        | |            |
|            |---(nand_clk)-------------|-->clk_x    |
-------------                         | |            |
                                      | |-->ecc_clk  |
                                      |              |
                                      ---------------
Quoted 5 lines

From the clock controller, it provides a single 200MHz clock to the NAND IP. Inside the NAND IP, there is a /4 for the clk. The 200MHz clock is used for the clk_x and ecc_clk.

The nand-clk is the only clock that can be gated.

The Denali IP does not contain the divisor in it.

My best guess is Altera implemented a simple
wrapper with the 1/4 divisor, like this?

----------------------------
| Wrapper |
| ------------- |
| | DENALI IP | |
| | | |
| |-(1/4)-->| clk | |
| | | | |

---(nand_clk)--|--|-------->| clk_x     | |
               |  |         |           | |
               |  |-------->| ecc_clk   | |
               |            |           | |
               |            ------------- |
               ----------------------------
Quoted 31 lines
Quoted 31 lines
Quoted 13 lines
Quoted 9 lines

Some clock lines are often tied-up,
but such low-level information does not appear in user documents.
I talked to a hardware engineer to get this information.

Quoted 3 lines

I guess the situation is similar for your case, but I do not have information enough to argue this.

Quoted 8 lines

I don't disagree with this representation. But after asking around, I'm getting the impression that the ECC clock is not exposed to the clock manager. This implies that the clock is always turned on and there doesn't seem to be any software control for it. I tested ECC with this patch and it looks to be working correctly, without any ecc clock representation.

I'm not sure if I should expose a dummy ecc_clk to satisfy the binding?

DT should represent the real HW.
If the Denali IP in SOCFPGA needs ecc_clk input,
DT should describe it.

I do not have knowledge about the SOCFPGA internals. I do not know which is correct:

Quoted 8 lines
Quoted 5 lines

- The Denali IP in SOCFPGA needs ecc_clk,
but there is no software control for it.

- The Denali IP in SOCFPGA does not need ecc_clk.

So should I be representing the clocks even though it doesn't come from the clock controller?

Anyway, you know the same clock is connected to nand_x to ecc_clk.

So, there is no problem for adding "ecc" as well, right?

Signature · 2 lines
Best Regards
Masahiro Yamada