diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2012-11-17 08:57:19 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-11-21 12:57:44 -0500 |
commit | e377ca1e32f66378cc6d0562851bfc51126865ea (patch) | |
tree | 132588c9d007c6fbc47ca52e0c2b05f77181f5d0 | |
parent | 87c37b51ade7d1296ab99ed8f237637bed7779c7 (diff) |
ARM: clps711x: p720t: Special driver for handling NAND memory is removed
This patch provide migration to using "gpio-nand" driver instead of using
special driver for handling NAND memory.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | arch/arm/mach-clps711x/include/mach/hardware.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-clps711x/p720t.c | 50 | ||||
-rw-r--r-- | drivers/mtd/nand/Kconfig | 6 | ||||
-rw-r--r-- | drivers/mtd/nand/Makefile | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/spia.c | 176 |
5 files changed, 51 insertions, 185 deletions
diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h index 4e273f2a5cb1..6acf714031e2 100644 --- a/arch/arm/mach-clps711x/include/mach/hardware.h +++ b/arch/arm/mach-clps711x/include/mach/hardware.h | |||
@@ -67,6 +67,9 @@ | |||
67 | #define CLPS711X_SRAM_BASE CS6_PHYS_BASE | 67 | #define CLPS711X_SRAM_BASE CS6_PHYS_BASE |
68 | #define CLPS711X_SRAM_SIZE (48 * 1024) | 68 | #define CLPS711X_SRAM_SIZE (48 * 1024) |
69 | 69 | ||
70 | #define CLPS711X_SDRAM0_BASE (0xc0000000) | ||
71 | #define CLPS711X_SDRAM1_BASE (0xd0000000) | ||
72 | |||
70 | #if defined (CONFIG_ARCH_EDB7211) | 73 | #if defined (CONFIG_ARCH_EDB7211) |
71 | 74 | ||
72 | /* The extra 8 lines of the keyboard matrix are wired to chip select 3 */ | 75 | /* The extra 8 lines of the keyboard matrix are wired to chip select 3 */ |
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index 34c8ee9ebb5e..e25f10ed5606 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/leds.h> | 27 | #include <linux/leds.h> |
28 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
29 | #include <linux/mtd/partitions.h> | ||
30 | #include <linux/mtd/nand-gpio.h> | ||
29 | 31 | ||
30 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
31 | #include <asm/pgtable.h> | 33 | #include <asm/pgtable.h> |
@@ -41,7 +43,50 @@ | |||
41 | 43 | ||
42 | #include "common.h" | 44 | #include "common.h" |
43 | 45 | ||
44 | #define GPIO_USERLED CLPS711X_GPIO(3, 0) | 46 | #define P720T_USERLED CLPS711X_GPIO(3, 0) |
47 | #define P720T_NAND_CLE CLPS711X_GPIO(4, 0) | ||
48 | #define P720T_NAND_ALE CLPS711X_GPIO(4, 1) | ||
49 | #define P720T_NAND_NCE CLPS711X_GPIO(4, 2) | ||
50 | |||
51 | #define P720T_NAND_BASE (CLPS711X_SDRAM1_BASE) | ||
52 | |||
53 | static struct resource p720t_nand_resource[] __initdata = { | ||
54 | DEFINE_RES_MEM(P720T_NAND_BASE, SZ_4), | ||
55 | }; | ||
56 | |||
57 | static struct mtd_partition p720t_nand_parts[] __initdata = { | ||
58 | { | ||
59 | .name = "Flash partition 1", | ||
60 | .offset = 0, | ||
61 | .size = SZ_2M, | ||
62 | }, | ||
63 | { | ||
64 | .name = "Flash partition 2", | ||
65 | .offset = MTDPART_OFS_APPEND, | ||
66 | .size = MTDPART_SIZ_FULL, | ||
67 | }, | ||
68 | }; | ||
69 | |||
70 | static struct gpio_nand_platdata p720t_nand_pdata __initdata = { | ||
71 | .gpio_rdy = -1, | ||
72 | .gpio_nce = P720T_NAND_NCE, | ||
73 | .gpio_ale = P720T_NAND_ALE, | ||
74 | .gpio_cle = P720T_NAND_CLE, | ||
75 | .gpio_nwp = -1, | ||
76 | .chip_delay = 15, | ||
77 | .parts = p720t_nand_parts, | ||
78 | .num_parts = ARRAY_SIZE(p720t_nand_parts), | ||
79 | }; | ||
80 | |||
81 | static struct platform_device p720t_nand_pdev __initdata = { | ||
82 | .name = "gpio-nand", | ||
83 | .id = -1, | ||
84 | .resource = p720t_nand_resource, | ||
85 | .num_resources = ARRAY_SIZE(p720t_nand_resource), | ||
86 | .dev = { | ||
87 | .platform_data = &p720t_nand_pdata, | ||
88 | }, | ||
89 | }; | ||
45 | 90 | ||
46 | static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) | 91 | static void p720t_lcd_power_set(struct plat_lcd_data *pd, unsigned int power) |
47 | { | 92 | { |
@@ -127,7 +172,7 @@ static struct gpio_led p720t_gpio_leds[] = { | |||
127 | { | 172 | { |
128 | .name = "User LED", | 173 | .name = "User LED", |
129 | .default_trigger = "heartbeat", | 174 | .default_trigger = "heartbeat", |
130 | .gpio = GPIO_USERLED, | 175 | .gpio = P720T_USERLED, |
131 | }, | 176 | }, |
132 | }; | 177 | }; |
133 | 178 | ||
@@ -138,6 +183,7 @@ static struct gpio_led_platform_data p720t_gpio_led_pdata __initdata = { | |||
138 | 183 | ||
139 | static void __init p720t_init(void) | 184 | static void __init p720t_init(void) |
140 | { | 185 | { |
186 | platform_device_register(&p720t_nand_pdev); | ||
141 | platform_device_register_data(&platform_bus, "platform-lcd", 0, | 187 | platform_device_register_data(&platform_bus, "platform-lcd", 0, |
142 | &p720t_lcd_power_pdata, | 188 | &p720t_lcd_power_pdata, |
143 | sizeof(p720t_lcd_power_pdata)); | 189 | sizeof(p720t_lcd_power_pdata)); |
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index e6e0a82cbaaf..531807dec6b3 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -79,12 +79,6 @@ config MTD_NAND_GPIO | |||
79 | help | 79 | help |
80 | This enables a GPIO based NAND flash driver. | 80 | This enables a GPIO based NAND flash driver. |
81 | 81 | ||
82 | config MTD_NAND_SPIA | ||
83 | tristate "NAND Flash device on SPIA board" | ||
84 | depends on ARCH_P720T | ||
85 | help | ||
86 | If you had to ask, you don't have one. Say 'N'. | ||
87 | |||
88 | config MTD_NAND_AMS_DELTA | 82 | config MTD_NAND_AMS_DELTA |
89 | tristate "NAND Flash device on Amstrad E3" | 83 | tristate "NAND Flash device on Amstrad E3" |
90 | depends on MACH_AMS_DELTA | 84 | depends on MACH_AMS_DELTA |
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 0b1fca24866c..6c7f2b3ca8ae 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile | |||
@@ -9,7 +9,6 @@ obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o | |||
9 | obj-$(CONFIG_MTD_SM_COMMON) += sm_common.o | 9 | obj-$(CONFIG_MTD_SM_COMMON) += sm_common.o |
10 | 10 | ||
11 | obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o | 11 | obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o |
12 | obj-$(CONFIG_MTD_NAND_SPIA) += spia.o | ||
13 | obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o | 12 | obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o |
14 | obj-$(CONFIG_MTD_NAND_DENALI) += denali.o | 13 | obj-$(CONFIG_MTD_NAND_DENALI) += denali.o |
15 | obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o | 14 | obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o |
diff --git a/drivers/mtd/nand/spia.c b/drivers/mtd/nand/spia.c deleted file mode 100644 index bef76cd7c24c..000000000000 --- a/drivers/mtd/nand/spia.c +++ /dev/null | |||
@@ -1,176 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/mtd/nand/spia.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) | ||
5 | * | ||
6 | * | ||
7 | * 10-29-2001 TG change to support hardwarespecific access | ||
8 | * to controllines (due to change in nand.c) | ||
9 | * page_cache added | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | * | ||
15 | * Overview: | ||
16 | * This is a device driver for the NAND flash device found on the | ||
17 | * SPIA board which utilizes the Toshiba TC58V64AFT part. This is | ||
18 | * a 64Mibit (8MiB x 8 bits) NAND flash device. | ||
19 | */ | ||
20 | |||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/module.h> | ||
25 | #include <linux/mtd/mtd.h> | ||
26 | #include <linux/mtd/nand.h> | ||
27 | #include <linux/mtd/partitions.h> | ||
28 | #include <asm/io.h> | ||
29 | |||
30 | /* | ||
31 | * MTD structure for SPIA board | ||
32 | */ | ||
33 | static struct mtd_info *spia_mtd = NULL; | ||
34 | |||
35 | /* | ||
36 | * Values specific to the SPIA board (used with EP7212 processor) | ||
37 | */ | ||
38 | #define SPIA_IO_BASE 0xd0000000 /* Start of EP7212 IO address space */ | ||
39 | #define SPIA_FIO_BASE 0xf0000000 /* Address where flash is mapped */ | ||
40 | #define SPIA_PEDR 0x0080 /* | ||
41 | * IO offset to Port E data register | ||
42 | * where the CLE, ALE and NCE pins | ||
43 | * are wired to. | ||
44 | */ | ||
45 | #define SPIA_PEDDR 0x00c0 /* | ||
46 | * IO offset to Port E data direction | ||
47 | * register so we can control the IO | ||
48 | * lines. | ||
49 | */ | ||
50 | |||
51 | /* | ||
52 | * Module stuff | ||
53 | */ | ||
54 | |||
55 | static int spia_io_base = SPIA_IO_BASE; | ||
56 | static int spia_fio_base = SPIA_FIO_BASE; | ||
57 | static int spia_pedr = SPIA_PEDR; | ||
58 | static int spia_peddr = SPIA_PEDDR; | ||
59 | |||
60 | module_param(spia_io_base, int, 0); | ||
61 | module_param(spia_fio_base, int, 0); | ||
62 | module_param(spia_pedr, int, 0); | ||
63 | module_param(spia_peddr, int, 0); | ||
64 | |||
65 | /* | ||
66 | * Define partitions for flash device | ||
67 | */ | ||
68 | static const struct mtd_partition partition_info[] = { | ||
69 | { | ||
70 | .name = "SPIA flash partition 1", | ||
71 | .offset = 0, | ||
72 | .size = 2 * 1024 * 1024}, | ||
73 | { | ||
74 | .name = "SPIA flash partition 2", | ||
75 | .offset = 2 * 1024 * 1024, | ||
76 | .size = 6 * 1024 * 1024} | ||
77 | }; | ||
78 | |||
79 | #define NUM_PARTITIONS 2 | ||
80 | |||
81 | /* | ||
82 | * hardware specific access to control-lines | ||
83 | * | ||
84 | * ctrl: | ||
85 | * NAND_CNE: bit 0 -> bit 2 | ||
86 | * NAND_CLE: bit 1 -> bit 0 | ||
87 | * NAND_ALE: bit 2 -> bit 1 | ||
88 | */ | ||
89 | static void spia_hwcontrol(struct mtd_info *mtd, int cmd) | ||
90 | { | ||
91 | struct nand_chip *chip = mtd->priv; | ||
92 | |||
93 | if (ctrl & NAND_CTRL_CHANGE) { | ||
94 | void __iomem *addr = spia_io_base + spia_pedr; | ||
95 | unsigned char bits; | ||
96 | |||
97 | bits = (ctrl & NAND_CNE) << 2; | ||
98 | bits |= (ctrl & NAND_CLE | NAND_ALE) >> 1; | ||
99 | writeb((readb(addr) & ~0x7) | bits, addr); | ||
100 | } | ||
101 | |||
102 | if (cmd != NAND_CMD_NONE) | ||
103 | writeb(cmd, chip->IO_ADDR_W); | ||
104 | } | ||
105 | |||
106 | /* | ||
107 | * Main initialization routine | ||
108 | */ | ||
109 | static int __init spia_init(void) | ||
110 | { | ||
111 | struct nand_chip *this; | ||
112 | |||
113 | /* Allocate memory for MTD device structure and private data */ | ||
114 | spia_mtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip), GFP_KERNEL); | ||
115 | if (!spia_mtd) { | ||
116 | printk("Unable to allocate SPIA NAND MTD device structure.\n"); | ||
117 | return -ENOMEM; | ||
118 | } | ||
119 | |||
120 | /* Get pointer to private data */ | ||
121 | this = (struct nand_chip *)(&spia_mtd[1]); | ||
122 | |||
123 | /* Initialize structures */ | ||
124 | memset(spia_mtd, 0, sizeof(struct mtd_info)); | ||
125 | memset(this, 0, sizeof(struct nand_chip)); | ||
126 | |||
127 | /* Link the private data with the MTD structure */ | ||
128 | spia_mtd->priv = this; | ||
129 | spia_mtd->owner = THIS_MODULE; | ||
130 | |||
131 | /* | ||
132 | * Set GPIO Port E control register so that the pins are configured | ||
133 | * to be outputs for controlling the NAND flash. | ||
134 | */ | ||
135 | (*(volatile unsigned char *)(spia_io_base + spia_peddr)) = 0x07; | ||
136 | |||
137 | /* Set address of NAND IO lines */ | ||
138 | this->IO_ADDR_R = (void __iomem *)spia_fio_base; | ||
139 | this->IO_ADDR_W = (void __iomem *)spia_fio_base; | ||
140 | /* Set address of hardware control function */ | ||
141 | this->cmd_ctrl = spia_hwcontrol; | ||
142 | /* 15 us command delay time */ | ||
143 | this->chip_delay = 15; | ||
144 | |||
145 | /* Scan to find existence of the device */ | ||
146 | if (nand_scan(spia_mtd, 1)) { | ||
147 | kfree(spia_mtd); | ||
148 | return -ENXIO; | ||
149 | } | ||
150 | |||
151 | /* Register the partitions */ | ||
152 | mtd_device_register(spia_mtd, partition_info, NUM_PARTITIONS); | ||
153 | |||
154 | /* Return happy */ | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | module_init(spia_init); | ||
159 | |||
160 | /* | ||
161 | * Clean up routine | ||
162 | */ | ||
163 | static void __exit spia_cleanup(void) | ||
164 | { | ||
165 | /* Release resources, unregister device */ | ||
166 | nand_release(spia_mtd); | ||
167 | |||
168 | /* Free the MTD device structure */ | ||
169 | kfree(spia_mtd); | ||
170 | } | ||
171 | |||
172 | module_exit(spia_cleanup); | ||
173 | |||
174 | MODULE_LICENSE("GPL"); | ||
175 | MODULE_AUTHOR("Steven J. Hill <sjhill@realitydiluted.com"); | ||
176 | MODULE_DESCRIPTION("Board-specific glue layer for NAND flash on SPIA board"); | ||