Skip to contentSkip to conversation

DaVinci: da850: Add NOR flash DT node support

PATCH Superseded Kumar, Anil 2 participants 4 messages Jan 29, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover DaVinci: da850: Add NOR flash DT node support

Add NOR flash DT node support for DA850 EVM and related pin mux. Configure 16 bit data bus width for CS2(aemif) to use the norflash on DA850.

This series is based on top of 3.8-rc4 and the following patches.

-drivers/pinctrl: grab default handles from device core
https://patchwork.kernel.org/patch/1862231/
-ARM: davinci: da850: add pinctrl driver DT entries

Tested on DA850 EVM.

Kumar, Anil (2):
ARM: davinci: da850 evm: add norflash DT node
ARM: davinci: da850: configure CS2(aemif) for norflash

 arch/arm/boot/dts/da850-evm.dts  |   25 +++++++++++++++++++++++
 arch/arm/boot/dts/da850.dtsi     |   41 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-davinci/da8xx-dt.c |   17 +++++++++++++++
 3 files changed, 83 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/2 ARM: davinci: da850 evm: add norflash DT node

Add norflash DT node on DA850 EVM and related pin mux.

---
:100644 100644 087ba28... 95ffeca... M arch/arm/boot/dts/da850-evm.dts
:100644 100644 160ebac... 036b02a... M arch/arm/boot/dts/da850.dtsi

 arch/arm/boot/dts/da850-evm.dts |   25 +++++++++++++++++++++++
 arch/arm/boot/dts/da850.dtsi    |   41 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)
arch/arm/boot/dts/da850-evm.dts +25 -0
index 087ba28..95ffeca 100644
@@ -28,4 +28,29 @@
 			status = "okay";
 		};
 	};
+	norflash_cs2@60000000 {
+		compatible = "intel,PC28F640P30T85", "cfi-flash";
+		reg = <0x60000000 0x1FFFFFF>;
+		bank-width = <2>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		linux,mtd-name = "physmap-flash";
+		pinctrl-names = "default";
+		pinctrl-0 = <&norflash_cs2_pins>;
+
+		bootloaders_env@0 {
+			label = "bootloaders_env";
+			reg = <0 0x80000>;
+		};
+
+		kernel@80000 {
+			label = "kernel";
+			reg = <0x80000 0x200000>;
+		};
+
+		filesystem@280000 {
+			label = "filesystem";
+			reg = <0x280000 0x580000>;
+		};
+	};
 };
arch/arm/boot/dts/da850.dtsi +41 -0

47 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/2 ARM: davinci: da850: configure CS2(aemif) for norflash

In reply to Kumar, Anil

Configure 16 bit data bus width for CS2(aemif) to use the norflash on DA850.

---
:100644 100644 37c27af... 540e284... M arch/arm/mach-davinci/da8xx-dt.c

 arch/arm/mach-davinci/da8xx-dt.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da8xx-dt.c +17 -0
index 37c27af..540e284 100644
@@ -38,12 +38,29 @@ static void __init da8xx_init_irq(void)
 }
 
 #ifdef CONFIG_ARCH_DAVINCI_DA850
+#define DA8XX_AEMIF_CE2CFG_OFFSET       0x10
+#define DA8XX_AEMIF_ASIZE_16BIT         0x1
+
+static void __init da8xx_init_nor(void)
+{
+	void __iomem *aemif_addr;
+
+	aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
+
+	/* Configure data bus width of CS2 to 16 bit */
+	writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
+			DA8XX_AEMIF_ASIZE_16BIT,
+			aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);
+
+	iounmap(aemif_addr);
+}
 
 static void __init da850_init_machine(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
 	da8xx_uart_clk_enable();
+	da8xx_init_nor();
 }
 
 static const char *da850_boards_compat[] __initdata = {
Signature · 1 line
1.7.4.1
#3 lore raw

Re: [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash

Hello Kumar,

Quoted 14 lines · Anil

Configure 16 bit data bus width for CS2(aemif) to use the norflash on DA850.

---
:100644 100644 37c27af... 540e284... M arch/arm/mach-davinci/da8xx-dt.c

 arch/arm/mach-davinci/da8xx-dt.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da8xx-dt.c +0 -0
index 37c27af..540e284 100644

arch/arm/mach-davinci/da8xx-dt.c static void __init da8xx_init_irq(void) · line 42

Quoted 5 lines
arch/arm/mach-davinci/da8xx-dt.c +2 -0
@@ -38,12 +38,29 @@ static void __init da8xx_init_irq(void)
 }
 
 #ifdef CONFIG_ARCH_DAVINCI_DA850
+#define DA8XX_AEMIF_CE2CFG_OFFSET       0x10
+#define DA8XX_AEMIF_ASIZE_16BIT         0x1

Hmm... I am not really happy with such defines, because different boards need maybe different settings, and this should be catched by the device tree ... Couldn't we add this infos in the device tree? I tried such an approach here:

First post and some discussion:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2011-December/010030.html

Nori suggested here
https://lists.ozlabs.org/pipermail/devicetree-discuss/2011-December/011330.html
to move such an driver out of arch/arm and IIRC it was suggested to move it into the mfd framework. I currently not know, if there was such a sort of patches, to get this in the mfd subsystem, but I think, this CS settings should be done like the pinmux settings ...

My last posted version of this patch:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-March/013036.html

Maybe it is worth to discuss this again?

arch/arm/mach-davinci/da8xx-dt.c static void __init da8xx_init_irq(void) · line 53

Quoted 11 lines
arch/arm/mach-davinci/da8xx-dt.c +11 -0
+
+static void __init da8xx_init_nor(void)
+{
+	void __iomem *aemif_addr;
+
+	aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K);
+
+	/* Configure data bus width of CS2 to 16 bit */
+	writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) |
+			DA8XX_AEMIF_ASIZE_16BIT,
+			aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET);

I vote for avoiding such board specific code in a generic approach ...

Quoted 4 lines
arch/arm/mach-davinci/da8xx-dt.c +3 -0
+
+	iounmap(aemif_addr);
+}

arch/arm/mach-davinci/da8xx-dt.c static void __init da8xx_init_irq(void) · line 66

Quoted 10 lines
arch/arm/mach-davinci/da8xx-dt.c +1 -0
 
 static void __init da850_init_machine(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
 	da8xx_uart_clk_enable();
+	da8xx_init_nor();
 }
 
 static const char *da850_boards_compat[] __initdata = {

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany