aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-10-04 03:28:29 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-15 08:37:47 -0500
commit41863f730ff8aad86c038aabee1292d1b04c8876 (patch)
treee23f3dca11dd7378b2d752537fa6644debc777e0 /arch/arm
parent30f9f2fb7ba032665c8cea7694c815f18ed47a34 (diff)
ARM: nomadik: switch over to using the FSMC driver
The Nomadik NAND driver is really just a subset of the existing FSMC driver, so let's switch over to using that driver instead, since it handles more variants of this chip. The callbacks for setting up the chip is doing stuff now handled by the FSMC driver. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Alessandro Rubini <rubini@unipv.it> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/configs/nhk8815_defconfig2
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c64
-rw-r--r--arch/arm/mach-nomadik/include/mach/fsmc.h29
3 files changed, 29 insertions, 66 deletions
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index 240b25eea565..86cfd2959c47 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -57,7 +57,7 @@ CONFIG_MTD_CHAR=y
57CONFIG_MTD_BLOCK=y 57CONFIG_MTD_BLOCK=y
58CONFIG_MTD_NAND=y 58CONFIG_MTD_NAND=y
59CONFIG_MTD_NAND_ECC_SMC=y 59CONFIG_MTD_NAND_ECC_SMC=y
60CONFIG_MTD_NAND_NOMADIK=y 60CONFIG_MTD_NAND_FSMC=y
61CONFIG_MTD_ONENAND=y 61CONFIG_MTD_ONENAND=y
62CONFIG_MTD_ONENAND_VERIFY_WRITE=y 62CONFIG_MTD_ONENAND_VERIFY_WRITE=y
63CONFIG_MTD_ONENAND_GENERIC=y 63CONFIG_MTD_ONENAND_GENERIC=y
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index bfa1eab91f41..a105d1b79758 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -19,6 +19,7 @@
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
21#include <linux/mtd/nand.h> 21#include <linux/mtd/nand.h>
22#include <linux/mtd/fsmc.h>
22#include <linux/mtd/onenand.h> 23#include <linux/mtd/onenand.h>
23#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
24#include <linux/i2c.h> 25#include <linux/i2c.h>
@@ -36,7 +37,6 @@
36#include <plat/mtu.h> 37#include <plat/mtu.h>
37#include <plat/pincfg.h> 38#include <plat/pincfg.h>
38 39
39#include <linux/platform_data/mtd-nomadik-nand.h>
40#include <mach/fsmc.h> 40#include <mach/fsmc.h>
41 41
42#include "cpu-8815.h" 42#include "cpu-8815.h"
@@ -48,36 +48,18 @@
48/* These addresses span 16MB, so use three individual pages */ 48/* These addresses span 16MB, so use three individual pages */
49static struct resource nhk8815_nand_resources[] = { 49static struct resource nhk8815_nand_resources[] = {
50 { 50 {
51 .name = "nand_addr", 51 .name = "nand_data",
52 .start = NAND_IO_ADDR, 52 .start = 0x40000000,
53 .end = NAND_IO_ADDR + 0xfff, 53 .end = 0x40000000 + SZ_16K - 1,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .name = "nand_cmd",
57 .start = NAND_IO_CMD,
58 .end = NAND_IO_CMD + 0xfff,
59 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
60 }, { 55 }, {
61 .name = "nand_data", 56 .name = "fsmc_regs",
62 .start = NAND_IO_DATA, 57 .start = NOMADIK_FSMC_BASE,
63 .end = NAND_IO_DATA + 0xfff, 58 .end = NOMADIK_FSMC_BASE + SZ_4K - 1,
64 .flags = IORESOURCE_MEM, 59 .flags = IORESOURCE_MEM,
65 } 60 },
66}; 61};
67 62
68static int nhk8815_nand_init(void)
69{
70 /* FSMC setup for nand chip select (8-bit nand in 8815NHK) */
71 writel(0x0000000E, FSMC_PCR(0));
72 writel(0x000D0A00, FSMC_PMEM(0));
73 writel(0x00100A00, FSMC_PATT(0));
74
75 /* enable access to the chip select area */
76 writel(readl(FSMC_PCR(0)) | 0x04, FSMC_PCR(0));
77
78 return 0;
79}
80
81/* 63/*
82 * These partitions are the same as those used in the 2.6.20 release 64 * These partitions are the same as those used in the 2.6.20 release
83 * shipped by the vendor; the first two partitions are mandated 65 * shipped by the vendor; the first two partitions are mandated
@@ -111,20 +93,30 @@ static struct mtd_partition nhk8815_partitions[] = {
111 } 93 }
112}; 94};
113 95
114static struct nomadik_nand_platform_data nhk8815_nand_data = { 96static struct fsmc_nand_timings nhk8815_nand_timings = {
115 .parts = nhk8815_partitions, 97 .thiz = 0,
116 .nparts = ARRAY_SIZE(nhk8815_partitions), 98 .thold = 0x10,
117 .options = NAND_COPYBACK | NAND_CACHEPRG | NAND_NO_PADDING, 99 .twait = 0x0A,
118 .init = nhk8815_nand_init, 100 .tset = 0,
101};
102
103static struct fsmc_nand_platform_data nhk8815_nand_platform_data = {
104 .nand_timings = &nhk8815_nand_timings,
105 .partitions = nhk8815_partitions,
106 .nr_partitions = ARRAY_SIZE(nhk8815_partitions),
107 .width = FSMC_NAND_BW8,
108 .ale_off = 0x1000000,
109 .cle_off = 0x800000,
119}; 110};
120 111
121static struct platform_device nhk8815_nand_device = { 112static struct platform_device nhk8815_nand_device = {
122 .name = "nomadik_nand", 113 .name = "fsmc-nand",
123 .dev = { 114 .id = -1,
124 .platform_data = &nhk8815_nand_data, 115 .resource = nhk8815_nand_resources,
116 .num_resources = ARRAY_SIZE(nhk8815_nand_resources),
117 .dev = {
118 .platform_data = &nhk8815_nand_platform_data,
125 }, 119 },
126 .resource = nhk8815_nand_resources,
127 .num_resources = ARRAY_SIZE(nhk8815_nand_resources),
128}; 120};
129 121
130/* These are the partitions for the OneNand device, different from above */ 122/* These are the partitions for the OneNand device, different from above */
diff --git a/arch/arm/mach-nomadik/include/mach/fsmc.h b/arch/arm/mach-nomadik/include/mach/fsmc.h
deleted file mode 100644
index 8c2c05183685..000000000000
--- a/arch/arm/mach-nomadik/include/mach/fsmc.h
+++ /dev/null
@@ -1,29 +0,0 @@
1
2/* Definitions for the Nomadik FSMC "Flexible Static Memory controller" */
3
4#ifndef __ASM_ARCH_FSMC_H
5#define __ASM_ARCH_FSMC_H
6
7#include <mach/hardware.h>
8/*
9 * Register list
10 */
11
12/* bus control reg. and bus timing reg. for CS0..CS3 */
13#define FSMC_BCR(x) (NOMADIK_FSMC_VA + (x << 3))
14#define FSMC_BTR(x) (NOMADIK_FSMC_VA + (x << 3) + 0x04)
15
16/* PC-card and NAND:
17 * PCR = control register
18 * PMEM = memory timing
19 * PATT = attribute timing
20 * PIO = I/O timing
21 * PECCR = ECC result
22 */
23#define FSMC_PCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x00)
24#define FSMC_PMEM(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x08)
25#define FSMC_PATT(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x0c)
26#define FSMC_PIO(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x10)
27#define FSMC_PECCR(x) (NOMADIK_FSMC_VA + ((2 + x) << 5) + 0x14)
28
29#endif /* __ASM_ARCH_FSMC_H */