Skip to contentSkip to conversation

arm: mvebu: Add support for NAND interface on A-38x

PATCH New Chris Packham 2 participants 7 messages Aug 22, 2016 – Aug 26, 2016

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

PATCH 1/2 arm: mvebu: Add support for NAND interface on A-38x

From: Chris Packham <[email protected]>

The NAND interface on the Armada-38x series is similar to that on the Armada-XP. The key difference is that the NAND ECC clock ratio is provided via the DFX Server registers instead of the Core Clock.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

---
I haven't got access to any Armada-375 docs so I wasn't sure if I should include it in the condition. For now it'll fall back to using the same clock control register as the Armada-XP.

 arch/arm/mach-mvebu/cpu.c              | 9 ++++++++-
 arch/arm/mach-mvebu/include/mach/soc.h | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/mach-mvebu/cpu.c +8 -1
index fd66f59..5eb2a39 100644
@@ -452,8 +452,15 @@ int arch_cpu_init(void)
 
 u32 mvebu_get_nand_clock(void)
 {
+	u32 reg;
+
+	if (mvebu_soc_family() == MVEBU_SOC_A38X)
+		reg = MVEBU_DFX_DIV_CLK_CTRL(1);
+	else
+		reg = MVEBU_CORE_DIV_CLK_CTRL(1);
+
 	return CONFIG_SYS_MVEBU_PLL_CLOCK /
-		((readl(MVEBU_CORE_DIV_CLK_CTRL(1)) &
+		((readl(reg) &
 		  NAND_ECC_DIVCKL_RATIO_MASK) >> NAND_ECC_DIVCKL_RATIO_OFFS);
 }
 
arch/arm/mach-mvebu/include/mach/soc.h +2 -0
index 13c9f29..6342cdc 100644
@@ -73,6 +73,7 @@
 #define MVEBU_NAND_BASE		(MVEBU_REGISTER(0xd0000))
 #define MVEBU_SDIO_BASE		(MVEBU_REGISTER(0xd8000))
 #define MVEBU_LCD_BASE		(MVEBU_REGISTER(0xe0000))
+#define MVEBU_DFX_BASE		(MVEBU_REGISTER(0xe4000))
 
 #define SOC_COHERENCY_FABRIC_CTRL_REG	(MVEBU_REGISTER(0x20200))
 #define MBUS_ERR_PROP_EN	(1 << 8)
@@ -92,6 +93,7 @@
 #define SPI_PUP_EN		BIT(5)
 
 #define MVEBU_CORE_DIV_CLK_CTRL(i)	(MVEBU_CLOCK_BASE + ((i) * 0x8))
+#define MVEBU_DFX_DIV_CLK_CTRL(i)	(MVEBU_DFX_BASE + 0x250 + ((i) * 0x4))
 #define NAND_ECC_DIVCKL_RATIO_OFFS	8
 #define NAND_ECC_DIVCKL_RATIO_MASK	(0x3F << NAND_ECC_DIVCKL_RATIO_OFFS)
 
Signature · 1 line
2.9.2.518.ged577c6.dirty
#1 lore raw

PATCH 2/2 arm: mvebu: Define NAND interface pins for A-38x

From: Chris Packham <[email protected]>

Add pin control settings for the NAND flash interface. This interface is multiplexed with the device bus interface to the function is "dev" not "nand" as one might expect.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

---
I don't think this is strictly necessary. A quick scan of boards that use this family of processor all seem to set their MPP configurations manually.

Another issue is that technically on the Armada-385 there are 4 possible CE pins. The board I'm looking at happens to use CE#0 (mpp25) but mpp26, mpp27 and mpp6 are all potentially available. I guess if any boards actually use them they can add them to their pin specification. At the very least such boards would need to update the num-cs property anyway.

 arch/arm/dts/armada-38x.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/dts/armada-38x.dtsi +8 -0
index dc8a1a6..9ecba8a 100644
@@ -258,6 +258,14 @@
 					marvell,function = "i2c0";
 				};
 
+				nand_pins: nand-pins {
+					marvell,pins = "mpp22", "mpp34", "mpp23", "mpp33",
+						       "mpp38", "mpp28", "mpp40", "mpp42",
+						       "mpp35", "mpp36", "mpp25", "mpp30",
+						       "mpp32";
+					marvell,function = "dev";
+				};
+
 				mdio_pins: mdio-pins {
 					marvell,pins = "mpp4", "mpp5";
 					marvell,function = "ge";
Signature · 1 line
2.9.2.518.ged577c6.dirty
#2 lore raw

PATCH 2/2 arm: mvebu: Define NAND interface pins for A-38x

Hi Chris,

Quoted 6 lines · Chris Packham

From: Chris Packham <[email protected]>

Add pin control settings for the NAND flash interface. This interface is multiplexed with the device bus interface to the function is "dev" not "nand" as one might expect.

Quoted 7 lines
Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

---
I don't think this is strictly necessary. A quick scan of boards that use this family of processor all seem to set their MPP configurations manually.

Correct. Unfortunately we don't have a pin-ctrl driver for AXP / A38x in U-Boot yet. Such a driver would be very welcome though. ;)

Quoted 5 lines

Another issue is that technically on the Armada-385 there are 4 possible CE pins. The board I'm looking at happens to use CE#0 (mpp25) but mpp26, mpp27 and mpp6 are all potentially available. I guess if any boards actually use them they can add them to their pin specification. At the very least such boards would need to update the num-cs property anyway.

How is this handled in the kernel? I would very much like to see these changes in the dts in sync with the kernel as much as possible. Does the kernel also use "dev" instead of "nand" here?

Thanks,
Stefan

#3 lore raw

PATCH 2/2 arm: mvebu: Define NAND interface pins for A-38x

Quoted 22 lines · Stefan Roese

Hi Chris,

Quoted 7 lines · Chris Packham

From: Chris Packham <[email protected]>

Add pin control settings for the NAND flash interface. This interface is multiplexed with the device bus interface to the function is "dev" not "nand" as one might expect.

Quoted 7 lines
Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

---
I don't think this is strictly necessary. A quick scan of boards that use this family of processor all seem to set their MPP configurations manually.

Correct. Unfortunately we don't have a pin-ctrl driver for AXP / A38x in U-Boot yet. Such a driver would be very welcome though. ;)

Quoted 8 lines
Quoted 5 lines

Another issue is that technically on the Armada-385 there are 4 possible CE pins. The board I'm looking at happens to use CE#0 (mpp25) but mpp26, mpp27 and mpp6 are all potentially available. I guess if any boards actually use them they can add them to their pin specification. At the very least such boards would need to update the num-cs property anyway.

How is this handled in the kernel?

I haven't seen anything in the kernel yet that uses these chip selects.

Quoted 3 lines

I would very much like to see
these changes in the dts in sync with the kernel as much as possible. Does the kernel also use "dev" instead of "nand" here?

Yes I based this on
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/armada-39x.dtsi
I haven't got round to porting the kernel to my board so I imagine a similar change will be required to armada-38x.dtsi in the kernel.

Quoted 3 lines

Thanks,
Stefan

#4 lore raw

PATCH 2/2 arm: mvebu: Define NAND interface pins for A-38x

Hi Stefan,

Quoted 34 lines · Chris Packham
Quoted 22 lines · Stefan Roese

Hi Chris,

Quoted 7 lines · Chris Packham

From: Chris Packham <[email protected]>

Add pin control settings for the NAND flash interface. This interface is multiplexed with the device bus interface to the function is "dev" not "nand" as one might expect.

Quoted 7 lines
Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

---
I don't think this is strictly necessary. A quick scan of boards that use this family of processor all seem to set their MPP configurations manually.

Correct. Unfortunately we don't have a pin-ctrl driver for AXP / A38x in U-Boot yet. Such a driver would be very welcome though. ;)

Quoted 8 lines
Quoted 5 lines

Another issue is that technically on the Armada-385 there are 4 possible CE pins. The board I'm looking at happens to use CE#0 (mpp25) but mpp26, mpp27 and mpp6 are all potentially available. I guess if any boards actually use them they can add them to their pin specification. At the very least such boards would need to update the num-cs property anyway.

How is this handled in the kernel?

I haven't seen anything in the kernel yet that uses these chip selects.

Quoted 9 lines
Quoted 3 lines

I would very much like to see
these changes in the dts in sync with the kernel as much as possible. Does the kernel also use "dev" instead of "nand" here?

Yes I based this on
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/armada-39x.dtsi
I haven't got round to porting the kernel to my board so I imagine a similar change will be required to armada-38x.dtsi in the kernel.

I've sent a kernel patch for the armada-38x[1] so perhaps we should just drop this one and sync up if/when the kernel patch is accepted.

[1] - http://lists.infradead.org/pipermail/linux-arm-kernel/2016-August/451027.html

#5 lore raw

PATCH 2/2 arm: mvebu: Define NAND interface pins for A-38x

Hi Chris,

Quoted 45 lines · Chris Packham
Quoted 34 lines · Chris Packham
Quoted 22 lines · Stefan Roese

Hi Chris,

Quoted 7 lines · Chris Packham

From: Chris Packham <[email protected]>

Add pin control settings for the NAND flash interface. This interface is multiplexed with the device bus interface to the function is "dev" not "nand" as one might expect.

Quoted 7 lines
Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

---
I don't think this is strictly necessary. A quick scan of boards that use this family of processor all seem to set their MPP configurations manually.

Correct. Unfortunately we don't have a pin-ctrl driver for AXP / A38x in U-Boot yet. Such a driver would be very welcome though. ;)

Quoted 8 lines
Quoted 5 lines

Another issue is that technically on the Armada-385 there are 4 possible CE pins. The board I'm looking at happens to use CE#0 (mpp25) but mpp26, mpp27 and mpp6 are all potentially available. I guess if any boards actually use them they can add them to their pin specification. At the very least such boards would need to update the num-cs property anyway.

How is this handled in the kernel?

I haven't seen anything in the kernel yet that uses these chip selects.

Quoted 9 lines
Quoted 3 lines

I would very much like to see
these changes in the dts in sync with the kernel as much as possible. Does the kernel also use "dev" instead of "nand" here?

Yes I based this on
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/armada-39x.dtsi
I haven't got round to porting the kernel to my board so I imagine a similar change will be required to armada-38x.dtsi in the kernel.

Quoted 4 lines

I've sent a kernel patch for the armada-38x[1] so perhaps we should just drop this one and sync up if/when the kernel patch is accepted.

[1] - http://lists.infradead.org/pipermail/linux-arm-kernel/2016-August/451027.html

Yes, this is better. I'll drop the patch for now and will make sure that we sync with the kernel at some later time. Perhaps we even have a pinctrl driver for A38x at that time... ;)

Thanks,
Stefan

#6 lore raw

PATCH 1/2 arm: mvebu: Add support for NAND interface on A-38x

In reply to Chris Packham
Quoted 9 lines · Chris Packham

From: Chris Packham <[email protected]>

The NAND interface on the Armada-38x series is similar to that on the Armada-XP. The key difference is that the NAND ECC clock ratio is provided via the DFX Server registers instead of the Core Clock.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>

Applied to u-boot-marvell/master.

Thanks,
Stefan