aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-03-21 05:44:04 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-04-18 12:50:05 -0400
commit3c803a9a676c30e87b49f9cfcfd29713bc438552 (patch)
tree759e87c32381b60e127e38e2ffb0f5a74f0d1fc9 /arch/sh/boards
parentb8808786e85a71afb1a169b5f059666c666f08d8 (diff)
sh: MigoR NAND flash support using gen_flash
Add NAND flash support to the MigoR board by giving board specific data to the gen_nand platform driver. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/renesas/migor/setup.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/sh/boards/renesas/migor/setup.c b/arch/sh/boards/renesas/migor/setup.c
index 44d9b5675ec9..bc7a4cec1277 100644
--- a/arch/sh/boards/renesas/migor/setup.c
+++ b/arch/sh/boards/renesas/migor/setup.c
@@ -12,6 +12,7 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/input.h> 13#include <linux/input.h>
14#include <linux/mtd/physmap.h> 14#include <linux/mtd/physmap.h>
15#include <linux/mtd/nand.h>
15#include <asm/machvec.h> 16#include <asm/machvec.h>
16#include <asm/io.h> 17#include <asm/io.h>
17#include <asm/sh_keysc.h> 18#include <asm/sh_keysc.h>
@@ -122,10 +123,77 @@ static struct platform_device migor_nor_flash_device = {
122 }, 123 },
123}; 124};
124 125
126static struct mtd_partition migor_nand_flash_partitions[] = {
127 {
128 .name = "nanddata1",
129 .offset = 0x0,
130 .size = 512 * 1024 * 1024,
131 },
132 {
133 .name = "nanddata2",
134 .offset = MTDPART_OFS_APPEND,
135 .size = 512 * 1024 * 1024,
136 },
137};
138
139static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
140 unsigned int ctrl)
141{
142 struct nand_chip *chip = mtd->priv;
143
144 if (cmd == NAND_CMD_NONE)
145 return;
146
147 if (ctrl & NAND_CLE)
148 writeb(cmd, chip->IO_ADDR_W + 0x00400000);
149 else if (ctrl & NAND_ALE)
150 writeb(cmd, chip->IO_ADDR_W + 0x00800000);
151 else
152 writeb(cmd, chip->IO_ADDR_W);
153}
154
155static int migor_nand_flash_ready(struct mtd_info *mtd)
156{
157 return ctrl_inb(PORT_PADR) & 0x02; /* PTA1 */
158}
159
160struct platform_nand_data migor_nand_flash_data = {
161 .chip = {
162 .nr_chips = 1,
163 .partitions = migor_nand_flash_partitions,
164 .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions),
165 .chip_delay = 20,
166 .part_probe_types = (const char *[]) { "cmdlinepart", NULL },
167 },
168 .ctrl = {
169 .dev_ready = migor_nand_flash_ready,
170 .cmd_ctrl = migor_nand_flash_cmd_ctl,
171 },
172};
173
174static struct resource migor_nand_flash_resources[] = {
175 [0] = {
176 .name = "NAND Flash",
177 .start = 0x18000000,
178 .end = 0x18ffffff,
179 .flags = IORESOURCE_MEM,
180 },
181};
182
183static struct platform_device migor_nand_flash_device = {
184 .name = "gen_nand",
185 .resource = migor_nand_flash_resources,
186 .num_resources = ARRAY_SIZE(migor_nand_flash_resources),
187 .dev = {
188 .platform_data = &migor_nand_flash_data,
189 }
190};
191
125static struct platform_device *migor_devices[] __initdata = { 192static struct platform_device *migor_devices[] __initdata = {
126 &smc91x_eth_device, 193 &smc91x_eth_device,
127 &sh_keysc_device, 194 &sh_keysc_device,
128 &migor_nor_flash_device, 195 &migor_nor_flash_device,
196 &migor_nand_flash_device,
129}; 197};
130 198
131static int __init migor_devices_setup(void) 199static int __init migor_devices_setup(void)
@@ -146,6 +214,11 @@ static void __init migor_setup(char **cmdline_p)
146 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA); 214 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
147 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC); 215 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
148 ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00004000, MSTPCR2); 216 ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00004000, MSTPCR2);
217
218 /* NAND Flash */
219 ctrl_outw(ctrl_inw(PORT_PXCR) & 0x0fff, PORT_PXCR);
220 ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x00000600) | 0x00000200,
221 BSC_CS6ABCR);
149} 222}
150 223
151static struct sh_machine_vector mv_migor __initmv = { 224static struct sh_machine_vector mv_migor __initmv = {