diff options
Diffstat (limited to 'arch/arm/mach-orion5x/ts78xx-setup.c')
-rw-r--r-- | arch/arm/mach-orion5x/ts78xx-setup.c | 78 |
1 files changed, 75 insertions, 3 deletions
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c index c1c1cd04bdd..8554707d20a 100644 --- a/arch/arm/mach-orion5x/ts78xx-setup.c +++ b/arch/arm/mach-orion5x/ts78xx-setup.c | |||
@@ -191,6 +191,60 @@ static int ts78xx_ts_nand_dev_ready(struct mtd_info *mtd) | |||
191 | return readb(TS_NAND_CTRL) & 0x20; | 191 | return readb(TS_NAND_CTRL) & 0x20; |
192 | } | 192 | } |
193 | 193 | ||
194 | static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd, | ||
195 | const uint8_t *buf, int len) | ||
196 | { | ||
197 | struct nand_chip *chip = mtd->priv; | ||
198 | void __iomem *io_base = chip->IO_ADDR_W; | ||
199 | unsigned long off = ((unsigned long)buf & 3); | ||
200 | int sz; | ||
201 | |||
202 | if (off) { | ||
203 | sz = min_t(int, 4 - off, len); | ||
204 | writesb(io_base, buf, sz); | ||
205 | buf += sz; | ||
206 | len -= sz; | ||
207 | } | ||
208 | |||
209 | sz = len >> 2; | ||
210 | if (sz) { | ||
211 | u32 *buf32 = (u32 *)buf; | ||
212 | writesl(io_base, buf32, sz); | ||
213 | buf += sz << 2; | ||
214 | len -= sz << 2; | ||
215 | } | ||
216 | |||
217 | if (len) | ||
218 | writesb(io_base, buf, len); | ||
219 | } | ||
220 | |||
221 | static void ts78xx_ts_nand_read_buf(struct mtd_info *mtd, | ||
222 | uint8_t *buf, int len) | ||
223 | { | ||
224 | struct nand_chip *chip = mtd->priv; | ||
225 | void __iomem *io_base = chip->IO_ADDR_R; | ||
226 | unsigned long off = ((unsigned long)buf & 3); | ||
227 | int sz; | ||
228 | |||
229 | if (off) { | ||
230 | sz = min_t(int, 4 - off, len); | ||
231 | readsb(io_base, buf, sz); | ||
232 | buf += sz; | ||
233 | len -= sz; | ||
234 | } | ||
235 | |||
236 | sz = len >> 2; | ||
237 | if (sz) { | ||
238 | u32 *buf32 = (u32 *)buf; | ||
239 | readsl(io_base, buf32, sz); | ||
240 | buf += sz << 2; | ||
241 | len -= sz << 2; | ||
242 | } | ||
243 | |||
244 | if (len) | ||
245 | readsb(io_base, buf, len); | ||
246 | } | ||
247 | |||
194 | const char *ts_nand_part_probes[] = { "cmdlinepart", NULL }; | 248 | const char *ts_nand_part_probes[] = { "cmdlinepart", NULL }; |
195 | 249 | ||
196 | static struct mtd_partition ts78xx_ts_nand_parts[] = { | 250 | static struct mtd_partition ts78xx_ts_nand_parts[] = { |
@@ -233,6 +287,8 @@ static struct platform_nand_data ts78xx_ts_nand_data = { | |||
233 | */ | 287 | */ |
234 | .cmd_ctrl = ts78xx_ts_nand_cmd_ctrl, | 288 | .cmd_ctrl = ts78xx_ts_nand_cmd_ctrl, |
235 | .dev_ready = ts78xx_ts_nand_dev_ready, | 289 | .dev_ready = ts78xx_ts_nand_dev_ready, |
290 | .write_buf = ts78xx_ts_nand_write_buf, | ||
291 | .read_buf = ts78xx_ts_nand_read_buf, | ||
236 | }, | 292 | }, |
237 | }; | 293 | }; |
238 | 294 | ||
@@ -334,14 +390,29 @@ static void ts78xx_fpga_supports(void) | |||
334 | case TS7800_REV_3: | 390 | case TS7800_REV_3: |
335 | case TS7800_REV_4: | 391 | case TS7800_REV_4: |
336 | case TS7800_REV_5: | 392 | case TS7800_REV_5: |
393 | case TS7800_REV_6: | ||
394 | case TS7800_REV_7: | ||
395 | case TS7800_REV_8: | ||
396 | case TS7800_REV_9: | ||
337 | ts78xx_fpga.supports.ts_rtc.present = 1; | 397 | ts78xx_fpga.supports.ts_rtc.present = 1; |
338 | ts78xx_fpga.supports.ts_nand.present = 1; | 398 | ts78xx_fpga.supports.ts_nand.present = 1; |
339 | ts78xx_fpga.supports.ts_rng.present = 1; | 399 | ts78xx_fpga.supports.ts_rng.present = 1; |
340 | break; | 400 | break; |
341 | default: | 401 | default: |
342 | ts78xx_fpga.supports.ts_rtc.present = 0; | 402 | /* enable devices if magic matches */ |
343 | ts78xx_fpga.supports.ts_nand.present = 0; | 403 | switch ((ts78xx_fpga.id >> 8) & 0xffffff) { |
344 | ts78xx_fpga.supports.ts_rng.present = 0; | 404 | case TS7800_FPGA_MAGIC: |
405 | printk(KERN_WARNING "TS-7800 FPGA: unrecognized revision 0x%.2x\n", | ||
406 | ts78xx_fpga.id & 0xff); | ||
407 | ts78xx_fpga.supports.ts_rtc.present = 1; | ||
408 | ts78xx_fpga.supports.ts_nand.present = 1; | ||
409 | ts78xx_fpga.supports.ts_rng.present = 1; | ||
410 | break; | ||
411 | default: | ||
412 | ts78xx_fpga.supports.ts_rtc.present = 0; | ||
413 | ts78xx_fpga.supports.ts_nand.present = 0; | ||
414 | ts78xx_fpga.supports.ts_rng.present = 0; | ||
415 | } | ||
345 | } | 416 | } |
346 | } | 417 | } |
347 | 418 | ||
@@ -553,6 +624,7 @@ MACHINE_START(TS78XX, "Technologic Systems TS-78xx SBC") | |||
553 | .boot_params = 0x00000100, | 624 | .boot_params = 0x00000100, |
554 | .init_machine = ts78xx_init, | 625 | .init_machine = ts78xx_init, |
555 | .map_io = ts78xx_map_io, | 626 | .map_io = ts78xx_map_io, |
627 | .init_early = orion5x_init_early, | ||
556 | .init_irq = orion5x_init_irq, | 628 | .init_irq = orion5x_init_irq, |
557 | .timer = &orion5x_timer, | 629 | .timer = &orion5x_timer, |
558 | MACHINE_END | 630 | MACHINE_END |