aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorDavid A. Griego <dgriego@mvista.com>2009-09-18 17:15:18 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:34 -0500
commit733975a314e4ddd374676cd300e207dd44eeafd2 (patch)
tree8dcba86945139ce858ab24921f5f0a1266ecd613 /arch/arm/mach-davinci
parentca6a272a4f1c2b81ec062f39cdc02ce7aed26d14 (diff)
davinci: Add NAND support for DA830/OMAP-L137 EVM platform
Add support for NAND flash parts on the DA830/OMAP-L137 EVM User Interface board. This includes overriding the default bad block tables used by the davinci_nand driver. Signed-off-by: David A. Griego <dgriego@mvista.com> Signed-off-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/Kconfig5
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c131
2 files changed, 136 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 43bb9587b571..89548287ca0f 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -122,6 +122,11 @@ config DA830_UI_LCD
122 Say Y here to use the LCD as a framebuffer or simple character 122 Say Y here to use the LCD as a framebuffer or simple character
123 display. 123 display.
124 124
125config DA830_UI_NAND
126 bool "NAND flash"
127 help
128 Say Y here to use the NAND flash. Do not forget to setup
129 the switch correctly.
125endchoice 130endchoice
126 131
127config MACH_DAVINCI_DA850_EVM 132config MACH_DAVINCI_DA850_EVM
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index ccf66c755a7f..ea9bc25e9288 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -14,21 +14,28 @@
14#include <linux/console.h> 14#include <linux/console.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/gpio.h> 16#include <linux/gpio.h>
17#include <linux/platform_device.h>
17#include <linux/i2c.h> 18#include <linux/i2c.h>
18#include <linux/i2c/pcf857x.h> 19#include <linux/i2c/pcf857x.h>
19#include <linux/i2c/at24.h> 20#include <linux/i2c/at24.h>
21#include <linux/mtd/mtd.h>
22#include <linux/mtd/partitions.h>
20 23
21#include <asm/mach-types.h> 24#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
23 26
24#include <mach/cp_intc.h> 27#include <mach/cp_intc.h>
25#include <mach/mux.h> 28#include <mach/mux.h>
29#include <mach/nand.h>
26#include <mach/da8xx.h> 30#include <mach/da8xx.h>
27#include <mach/usb.h> 31#include <mach/usb.h>
28 32
29#define DA830_EVM_PHY_MASK 0x0 33#define DA830_EVM_PHY_MASK 0x0
30#define DA830_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ 34#define DA830_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
31 35
36#define DA830_EMIF25_ASYNC_DATA_CE3_BASE 0x62000000
37#define DA830_EMIF25_CONTROL_BASE 0x68000000
38
32static struct at24_platform_data da830_evm_i2c_eeprom_info = { 39static struct at24_platform_data da830_evm_i2c_eeprom_info = {
33 .byte_len = SZ_256K / 8, 40 .byte_len = SZ_256K / 8,
34 .page_size = 64, 41 .page_size = 64,
@@ -313,6 +320,118 @@ static inline void da830_evm_init_mmc(void)
313 } 320 }
314} 321}
315 322
323#ifdef CONFIG_DA830_UI_NAND
324static struct mtd_partition da830_evm_nand_partitions[] = {
325 /* bootloader (U-Boot, etc) in first sector */
326 [0] = {
327 .name = "bootloader",
328 .offset = 0,
329 .size = SZ_128K,
330 .mask_flags = MTD_WRITEABLE, /* force read-only */
331 },
332 /* bootloader params in the next sector */
333 [1] = {
334 .name = "params",
335 .offset = MTDPART_OFS_APPEND,
336 .size = SZ_128K,
337 .mask_flags = MTD_WRITEABLE, /* force read-only */
338 },
339 /* kernel */
340 [2] = {
341 .name = "kernel",
342 .offset = MTDPART_OFS_APPEND,
343 .size = SZ_2M,
344 .mask_flags = 0,
345 },
346 /* file system */
347 [3] = {
348 .name = "filesystem",
349 .offset = MTDPART_OFS_APPEND,
350 .size = MTDPART_SIZ_FULL,
351 .mask_flags = 0,
352 }
353};
354
355/* flash bbt decriptors */
356static uint8_t da830_evm_nand_bbt_pattern[] = { 'B', 'b', 't', '0' };
357static uint8_t da830_evm_nand_mirror_pattern[] = { '1', 't', 'b', 'B' };
358
359static struct nand_bbt_descr da830_evm_nand_bbt_main_descr = {
360 .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
361 NAND_BBT_WRITE | NAND_BBT_2BIT |
362 NAND_BBT_VERSION | NAND_BBT_PERCHIP,
363 .offs = 2,
364 .len = 4,
365 .veroffs = 16,
366 .maxblocks = 4,
367 .pattern = da830_evm_nand_bbt_pattern
368};
369
370static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = {
371 .options = NAND_BBT_LASTBLOCK | NAND_BBT_CREATE |
372 NAND_BBT_WRITE | NAND_BBT_2BIT |
373 NAND_BBT_VERSION | NAND_BBT_PERCHIP,
374 .offs = 2,
375 .len = 4,
376 .veroffs = 16,
377 .maxblocks = 4,
378 .pattern = da830_evm_nand_mirror_pattern
379};
380
381static struct davinci_nand_pdata da830_evm_nand_pdata = {
382 .parts = da830_evm_nand_partitions,
383 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions),
384 .ecc_mode = NAND_ECC_HW,
385 .ecc_bits = 4,
386 .options = NAND_USE_FLASH_BBT,
387 .bbt_td = &da830_evm_nand_bbt_main_descr,
388 .bbt_md = &da830_evm_nand_bbt_mirror_descr,
389};
390
391static struct resource da830_evm_nand_resources[] = {
392 [0] = { /* First memory resource is NAND I/O window */
393 .start = DA830_EMIF25_ASYNC_DATA_CE3_BASE,
394 .end = DA830_EMIF25_ASYNC_DATA_CE3_BASE + PAGE_SIZE - 1,
395 .flags = IORESOURCE_MEM,
396 },
397 [1] = { /* Second memory resource is AEMIF control registers */
398 .start = DA830_EMIF25_CONTROL_BASE,
399 .end = DA830_EMIF25_CONTROL_BASE + SZ_32K - 1,
400 .flags = IORESOURCE_MEM,
401 },
402};
403
404static struct platform_device da830_evm_nand_device = {
405 .name = "davinci_nand",
406 .id = 1,
407 .dev = {
408 .platform_data = &da830_evm_nand_pdata,
409 },
410 .num_resources = ARRAY_SIZE(da830_evm_nand_resources),
411 .resource = da830_evm_nand_resources,
412};
413#endif
414
415static struct platform_device *da830_evm_devices[] __initdata = {
416#ifdef CONFIG_DA830_UI_NAND
417 &da830_evm_nand_device,
418#endif
419};
420
421/*
422 * UI board NAND/NOR flashes only use 8-bit data bus.
423 */
424static const short da830_evm_emif25_pins[] = {
425 DA830_EMA_D_0, DA830_EMA_D_1, DA830_EMA_D_2, DA830_EMA_D_3,
426 DA830_EMA_D_4, DA830_EMA_D_5, DA830_EMA_D_6, DA830_EMA_D_7,
427 DA830_EMA_A_0, DA830_EMA_A_1, DA830_EMA_A_2, DA830_EMA_A_3,
428 DA830_EMA_A_4, DA830_EMA_A_5, DA830_EMA_A_6, DA830_EMA_A_7,
429 DA830_EMA_A_8, DA830_EMA_A_9, DA830_EMA_A_10, DA830_EMA_A_11,
430 DA830_EMA_A_12, DA830_EMA_BA_0, DA830_EMA_BA_1, DA830_NEMA_WE,
431 DA830_NEMA_CS_2, DA830_NEMA_CS_3, DA830_NEMA_OE, DA830_EMA_WAIT_0,
432 -1
433};
434
316static __init void da830_evm_init(void) 435static __init void da830_evm_init(void)
317{ 436{
318 struct davinci_soc_info *soc_info = &davinci_soc_info; 437 struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -367,6 +486,7 @@ static __init void da830_evm_init(void)
367 486
368 da830_evm_init_mmc(); 487 da830_evm_init_mmc();
369 488
489#ifdef CONFIG_DA830_UI
370#ifdef CONFIG_DA830_UI_LCD 490#ifdef CONFIG_DA830_UI_LCD
371 ret = da8xx_pinmux_setup(da830_lcdcntl_pins); 491 ret = da8xx_pinmux_setup(da830_lcdcntl_pins);
372 if (ret) 492 if (ret)
@@ -376,6 +496,17 @@ static __init void da830_evm_init(void)
376 ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata); 496 ret = da8xx_register_lcdc(&sharp_lcd035q3dg01_pdata);
377 if (ret) 497 if (ret)
378 pr_warning("da830_evm_init: lcd setup failed: %d\n", ret); 498 pr_warning("da830_evm_init: lcd setup failed: %d\n", ret);
499#else /* Must be NAND or NOR */
500 ret = da8xx_pinmux_setup(da830_evm_emif25_pins);
501 if (ret)
502 pr_warning("da830_evm_init: emif25 mux setup failed: %d\n",
503 ret);
504
505 ret = platform_add_devices(da830_evm_devices,
506 ARRAY_SIZE(da830_evm_devices));
507 if (ret)
508 pr_warning("da830_evm_init: EVM devices not added\n");
509#endif
379#endif 510#endif
380 511
381 ret = da8xx_register_rtc(); 512 ret = da8xx_register_rtc();