linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] DaVinci: da850: Add NOR flash DT node support
@ 2013-01-29  5:19 Kumar, Anil
  2013-01-29  5:19 ` [PATCH 1/2] ARM: davinci: da850 evm: add norflash DT node Kumar, Anil
  2013-01-29  5:19 ` [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash Kumar, Anil
  0 siblings, 2 replies; 4+ messages in thread
From: Kumar, Anil @ 2013-01-29  5:19 UTC (permalink / raw)
  To: linux-arm-kernel

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(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ARM: davinci: da850 evm: add norflash DT node
  2013-01-29  5:19 [PATCH 0/2] DaVinci: da850: Add NOR flash DT node support Kumar, Anil
@ 2013-01-29  5:19 ` Kumar, Anil
  2013-01-29  5:19 ` [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash Kumar, Anil
  1 sibling, 0 replies; 4+ messages in thread
From: Kumar, Anil @ 2013-01-29  5:19 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
---
: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(-)

diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index 087ba28..95ffeca 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -28,4 +28,29 @@
 			status = "okay";
 		};
 	};
+	norflash_cs2 at 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 at 0 {
+			label = "bootloaders_env";
+			reg = <0 0x80000>;
+		};
+
+		kernel at 80000 {
+			label = "kernel";
+			reg = <0x80000 0x200000>;
+		};
+
+		filesystem at 280000 {
+			label = "filesystem";
+			reg = <0x280000 0x580000>;
+		};
+	};
 };
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 160ebac..036b02a 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -38,6 +38,47 @@
 			pinctrl-single,register-width = <32>;
 			pinctrl-single,function-mask = <0xffffffff>;
 			status = "disabled";
+
+			norflash_cs2_pins: pinmux_norflash_pins{
+				pinctrl-single,bits = <
+					/* EMA_BA[1] */
+					0x14 0x01000000 0x0f000000
+					/* EMA_CLK, EMA_WAIT[1] */
+					0x18 0x01000001 0x0f00000f
+					/* EMA_OE, EMA_WE, EMA_CS[2] */
+					0x1c 0x00110001 0x00ff000f
+					/*
+					 * EMA_D[0], EMA_D[1], EMA_D[2],
+					 * EMA_D[3], EMA_D[4], EMA_D[5],
+					 * EMA_D[6], EMA_D[7]
+					 */
+					0x24 0x11111111 0xffffffff
+					/*
+					 * EMA_D[8], EMA_D[9], EMA_D[10],
+					 * EMA_D[11], EMA_D[12], EMA_D[13],
+					 * EMA_D[14], EMA_D[15]
+					 */
+					0x20 0x11111111 0xffffffff
+					/*
+					 * EMA_A[0], EMA_A[1], EMA_A[2],
+					 * EMA_A[3], EMA_A[4], EMA_A[5],
+					 * EMA_A[6], EMA_A[7]
+					 */
+					0x30 0x11111111 0xffffffff
+					/*
+					 * EMA_A[8], EMA_A[9], EMA_A[10],
+					 * EMA_A[11], EMA_A[12], EMA_A[13],
+					 * EMA_A[14], EMA_A[15]
+					 */
+					0x2c 0x11111111 0xffffffff
+					/*
+					 * EMA_A[16], EMA_A[17], EMA_A[18],
+					 * EMA_A[19], EMA_A[20], EMA_A[21],
+					 * EMA_A[22]
+					 */
+					0x28 0x11111110 0xfffffff0
+				>;
+			};
 		};
 		serial0: serial at 1c42000 {
 			compatible = "ns16550a";
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash
  2013-01-29  5:19 [PATCH 0/2] DaVinci: da850: Add NOR flash DT node support Kumar, Anil
  2013-01-29  5:19 ` [PATCH 1/2] ARM: davinci: da850 evm: add norflash DT node Kumar, Anil
@ 2013-01-29  5:19 ` Kumar, Anil
  2013-01-29  8:02   ` Heiko Schocher
  1 sibling, 1 reply; 4+ messages in thread
From: Kumar, Anil @ 2013-01-29  5:19 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
---
: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(-)

diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 37c27af..540e284 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -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 = {
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash
  2013-01-29  5:19 ` [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash Kumar, Anil
@ 2013-01-29  8:02   ` Heiko Schocher
  0 siblings, 0 replies; 4+ messages in thread
From: Heiko Schocher @ 2013-01-29  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Kumar,

On 29.01.2013 06:19, Kumar, Anil wrote:
> Configure 16 bit data bus width for CS2(aemif) to use the norflash on
> DA850.
> 
> Signed-off-by: Kumar, Anil <anilkumar.v@ti.com>
> ---
> :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(-)
> 
> diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
> index 37c27af..540e284 100644
> --- a/arch/arm/mach-davinci/da8xx-dt.c
> +++ b/arch/arm/mach-davinci/da8xx-dt.c
> @@ -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?

> +
> +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 ...

> +
> +	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 = {
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-29  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29  5:19 [PATCH 0/2] DaVinci: da850: Add NOR flash DT node support Kumar, Anil
2013-01-29  5:19 ` [PATCH 1/2] ARM: davinci: da850 evm: add norflash DT node Kumar, Anil
2013-01-29  5:19 ` [PATCH 2/2] ARM: davinci: da850: configure CS2(aemif) for norflash Kumar, Anil
2013-01-29  8:02   ` Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).