Skip to contentSkip to conversation

davinci: Platform support for OMAP-L137/AM17x NOR flash driver

PATCH Superseded Savinay Dharmappa 2 participants 2 messages Nov 19, 2010

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 2/2 davinci: Platform support for OMAP-L137/AM17x NOR flash driver

From: Aleksey Makarov <[email protected]>

Adds platform support for OMAP-L137/AM17x NOR flash driver.

Also, configures chip select 3 to control NOR flash's upper address lines.

---
Since v2:
a. Added signoff from Sergei Shtylyov.
b. Removed resource member from the da830_evm_nor structure
and used a local member inside the da830_evm_nor_init() function.
c. Fixed few commenting/indenting issues.

 arch/arm/mach-davinci/Kconfig           |    8 +
 arch/arm/mach-davinci/board-da830-evm.c |  218 +++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/Kconfig +8 -0
index b77b860..89cc62e 100644
@@ -142,6 +142,14 @@ config DA830_UI_NAND
 	help
 	  Say Y here to use the NAND flash. Do not forget to setup
 	  the switch correctly.
+
+config DA830_UI_NOR
+        bool "NOR flash"
+        help
+          Configure this option to specify the that AEMIF CE2/CE3 will be used to
+          communicate to the NOR flash. Do not forget to setup the switch SW1
+          on UI card correctly.
+
 endchoice
 
 config MACH_DAVINCI_DA850_EVM
arch/arm/mach-davinci/board-da830-evm.c +218 -0

236 lines not on this page · raw message

Signature · 1 line
1.5.6
#1 lore raw

Hello.

Quoted 10 lines · Savinay Dharmappa

From: Aleksey Makarov <[email protected]>

Adds platform support for OMAP-L137/AM17x NOR flash driver.

Also, configures chip select 3 to control NOR flash's upper address lines.

[...]

Quoted 14 lines
arch/arm/mach-davinci/board-da830-evm.c +2 -0
index b52a3a1..c807c1b 100644
@@ -20,6 +20,8 @@
  #include<linux/i2c/at24.h>
  #include<linux/mtd/mtd.h>
  #include<linux/mtd/partitions.h>
+#include<linux/mtd/latch-addr-flash.h>
+#include<linux/clk.h>
 
  #include<asm/mach-types.h>
  #include<asm/mach/arch.h>

arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 437

Quoted 7 lines
arch/arm/mach-davinci/board-da830-evm.c +4 -0
@@ -429,6 +431,220 @@ static inline void da830_evm_init_nand(int mux_mode)
  static inline void da830_evm_init_nand(int mux_mode) { }
  #endif
 
+#ifdef CONFIG_DA830_UI_NOR
+/*
+ * Number of lines going to the NOR flash that are latched using
+ * AEMIF address lines B_EMIF_BA0-B_EMIF_A12 on CS2.

You still left the words about latching the low address bytes...

arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 446

Quoted 9 lines
arch/arm/mach-davinci/board-da830-evm.c +9 -0
+ */
+#define NOR_WINDOW_SIZE_LOG2     15
+#define NOR_WINDOW_SIZE         (1<<  NOR_WINDOW_SIZE_LOG2)
+
+static struct {
+	struct clk *clk;
+	struct {
+		void __iomem *addr;
+	} latch, aemif;

Don't need a structure here anymore.

arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode)

Quoted 5 lines
arch/arm/mach-davinci/board-da830-evm.c +5 -0
+static void da830_evm_nor_set_window(unsigned long offset, void *data)
+{
+	/*
+	 * CS2 and CS3 address lines are used to address NOR flash. Address
+	 * line

Only "lines".

Quoted 1 line

A0-A14 going to

Rather "from"...

arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode)

Quoted 4 lines

the NOR flash are connected to AEMIF address

arch/arm/mach-davinci/board-da830-evm.c +3 -0
+	 * lines B_EMIF_BA0-B_EMIF_A12 on CS2. Address lines A15-A23 of the
+	 * NOR flash are connected to AEMIF address lines B_EMIF_A0-B_EMIF_A6
+	 * on CS3.

They are not connected but latched from B_EMIF_A0-B_EMIF_A6 on CS3.

Quoted 30 lines
arch/arm/mach-davinci/board-da830-evm.c +30 -0
+	/* Setup AEMIF -- timings, etc. */
+
+	/* Set maximum wait cycles */
+	davinci_aemif_setup_timing(&da830_evm_norflash_timing,
+						da830_evm_nor.aemif.addr, cs);
+
+	davinci_aemif_setup_timing(&da830_evm_norflash_timing,
+					da830_evm_nor.aemif.addr, cs + 1);
+
+	/* Setup the window to access the latch */
+	res = request_mem_region(DA8XX_AEMIF_CS3_BASE, PAGE_SIZE,
+				"DA830 UI NOR address latch");
+	if (res == NULL) {
+		pr_err("%s: could not request address latch region\n",
+			__func__);
+		goto err_aemif_ioremap;
+	}
+
+	da830_evm_nor.latch.addr =
+		ioremap_nocache(DA8XX_AEMIF_CS3_BASE, PAGE_SIZE);
+	if (da830_evm_nor.latch.addr == NULL) {
+		pr_err("%s: could not remap address latch region\n", __func__);
+		goto err_latch_region;
+	}
+	return 0;
+
+err_latch_region:
+	release_mem_region(DA8XX_AEMIF_CS3_BASE, PAGE_SIZE);
+
+err_aemif_ioremap:

arch/arm/mach-davinci/board-da830-evm.c static inline void da830_evm_init_nand(int mux_mode) · line 553

Quoted 10 lines
arch/arm/mach-davinci/board-da830-evm.c +10 -0
+	iounmap(da830_evm_nor.aemif.addr);
+
+err_aemif_region:
+	release_mem_region(DA8XX_AEMIF_CTL_BASE, SZ_32K);
+
+err_clk:
+	clk_disable(da830_evm_nor.clk);
+	clk_put(da830_evm_nor.clk);
+
+	return -EBUSY;

You should return -ENOMEM for ioremap() failures...

WBR, Sergei