diff options
author | Ladislav Michl <ladis@linux-mips.org> | 2009-12-11 19:16:33 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-12-11 19:16:33 -0500 |
commit | 414f552ad872e19a7471644317a60f3cbba25ced (patch) | |
tree | 441f388dffb45868e3898893aa1b22e2a3a60f59 /arch/arm/mach-omap1/board-perseus2.c | |
parent | e2b18e3018630d80eda54508e697d613283d57ac (diff) |
omap1: Use gen_nand
Since omapnand driver never find its way into mainline, switch to gen_nand instead.
Following patch is compile tested only, but it is based on code I wrote for
NetStar board and runtime tested it there.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Imre Deak <imre.deak@nokia.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Kevin Hilman <kjh@hilman.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/board-perseus2.c')
-rw-r--r-- | arch/arm/mach-omap1/board-perseus2.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c index b9ea31289b50..1387a4f15da9 100644 --- a/arch/arm/mach-omap1/board-perseus2.c +++ b/arch/arm/mach-omap1/board-perseus2.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <mach/gpio.h> | 31 | #include <mach/gpio.h> |
32 | #include <plat/mux.h> | 32 | #include <plat/mux.h> |
33 | #include <plat/fpga.h> | 33 | #include <plat/fpga.h> |
34 | #include <plat/nand.h> | ||
35 | #include <plat/keypad.h> | 34 | #include <plat/keypad.h> |
36 | #include <plat/common.h> | 35 | #include <plat/common.h> |
37 | #include <plat/board.h> | 36 | #include <plat/board.h> |
@@ -141,8 +140,40 @@ static struct platform_device nor_device = { | |||
141 | .resource = &nor_resource, | 140 | .resource = &nor_resource, |
142 | }; | 141 | }; |
143 | 142 | ||
144 | static struct omap_nand_platform_data nand_data = { | 143 | static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl) |
145 | .options = NAND_SAMSUNG_LP_OPTIONS, | 144 | { |
145 | struct nand_chip *this = mtd->priv; | ||
146 | unsigned long mask; | ||
147 | |||
148 | if (cmd == NAND_CMD_NONE) | ||
149 | return; | ||
150 | |||
151 | mask = (ctrl & NAND_CLE) ? 0x02 : 0; | ||
152 | if (ctrl & NAND_ALE) | ||
153 | mask |= 0x04; | ||
154 | writeb(cmd, (unsigned long)this->IO_ADDR_W | mask); | ||
155 | } | ||
156 | |||
157 | #define P2_NAND_RB_GPIO_PIN 62 | ||
158 | |||
159 | static int nand_dev_ready(struct mtd_info *mtd) | ||
160 | { | ||
161 | return gpio_get_value(P2_NAND_RB_GPIO_PIN); | ||
162 | } | ||
163 | |||
164 | static const char *part_probes[] = { "cmdlinepart", NULL }; | ||
165 | |||
166 | static struct platform_nand_data nand_data = { | ||
167 | .chip = { | ||
168 | .nr_chips = 1, | ||
169 | .chip_offset = 0, | ||
170 | .options = NAND_SAMSUNG_LP_OPTIONS, | ||
171 | .part_probe_types = part_probes, | ||
172 | }, | ||
173 | .ctrl = { | ||
174 | .cmd_ctrl = nand_cmd_ctl, | ||
175 | .dev_ready = nand_dev_ready, | ||
176 | }, | ||
146 | }; | 177 | }; |
147 | 178 | ||
148 | static struct resource nand_resource = { | 179 | static struct resource nand_resource = { |
@@ -152,7 +183,7 @@ static struct resource nand_resource = { | |||
152 | }; | 183 | }; |
153 | 184 | ||
154 | static struct platform_device nand_device = { | 185 | static struct platform_device nand_device = { |
155 | .name = "omapnand", | 186 | .name = "gen_nand", |
156 | .id = 0, | 187 | .id = 0, |
157 | .dev = { | 188 | .dev = { |
158 | .platform_data = &nand_data, | 189 | .platform_data = &nand_data, |
@@ -211,13 +242,6 @@ static struct platform_device *devices[] __initdata = { | |||
211 | &lcd_device, | 242 | &lcd_device, |
212 | }; | 243 | }; |
213 | 244 | ||
214 | #define P2_NAND_RB_GPIO_PIN 62 | ||
215 | |||
216 | static int nand_dev_ready(struct omap_nand_platform_data *data) | ||
217 | { | ||
218 | return gpio_get_value(P2_NAND_RB_GPIO_PIN); | ||
219 | } | ||
220 | |||
221 | static struct omap_lcd_config perseus2_lcd_config __initdata = { | 245 | static struct omap_lcd_config perseus2_lcd_config __initdata = { |
222 | .ctrl_name = "internal", | 246 | .ctrl_name = "internal", |
223 | }; | 247 | }; |
@@ -230,7 +254,7 @@ static void __init omap_perseus2_init(void) | |||
230 | { | 254 | { |
231 | if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) | 255 | if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) |
232 | BUG(); | 256 | BUG(); |
233 | nand_data.dev_ready = nand_dev_ready; | 257 | gpio_direction_input(P2_NAND_RB_GPIO_PIN); |
234 | 258 | ||
235 | omap_cfg_reg(L3_1610_FLASH_CS2B_OE); | 259 | omap_cfg_reg(L3_1610_FLASH_CS2B_OE); |
236 | omap_cfg_reg(M8_1610_FLASH_CS2B_WE); | 260 | omap_cfg_reg(M8_1610_FLASH_CS2B_WE); |