diff options
author | Sudhakar Rajashekhara <sudhakar.raj@ti.com> | 2009-08-13 16:21:11 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-08-26 04:55:56 -0400 |
commit | 38beb929f2c33a37bf3af6103c064a9edfbe242b (patch) | |
tree | b4393295180b2b40ebc3e00c5b42aa61b06f2cd2 /arch/arm | |
parent | 700691f27ed9b0891cece9032e4de8c0b482c625 (diff) |
davinci: Add NAND flash support for DA850/OMAP-L138
This patch adds platform data for the 512MB NAND Flash
found on DA850/OMAP-L138 EVM. Currently it supports
only 1-bit ECC.
Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-davinci/board-da850-evm.c | 85 | ||||
-rw-r--r-- | arch/arm/mach-davinci/da850.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/mux.h | 16 |
4 files changed, 135 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index eb998ce6d465..62d37cb6f29d 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
@@ -18,6 +18,10 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <linux/i2c/at24.h> | 19 | #include <linux/i2c/at24.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/mtd/mtd.h> | ||
23 | #include <linux/mtd/nand.h> | ||
24 | #include <linux/mtd/partitions.h> | ||
21 | 25 | ||
22 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
23 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
@@ -26,6 +30,7 @@ | |||
26 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
27 | #include <mach/cp_intc.h> | 31 | #include <mach/cp_intc.h> |
28 | #include <mach/da8xx.h> | 32 | #include <mach/da8xx.h> |
33 | #include <mach/nand.h> | ||
29 | 34 | ||
30 | #define DA850_EVM_PHY_MASK 0x1 | 35 | #define DA850_EVM_PHY_MASK 0x1 |
31 | #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ | 36 | #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ |
@@ -36,6 +41,74 @@ | |||
36 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) | 41 | #define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) |
37 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) | 42 | #define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) |
38 | 43 | ||
44 | /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash | ||
45 | * (128K blocks). It may be used instead of the (default) SPI flash | ||
46 | * to boot, using TI's tools to install the secondary boot loader | ||
47 | * (UBL) and U-Boot. | ||
48 | */ | ||
49 | struct mtd_partition da850_evm_nandflash_partition[] = { | ||
50 | { | ||
51 | .name = "u-boot env", | ||
52 | .offset = 0, | ||
53 | .size = SZ_128K, | ||
54 | .mask_flags = MTD_WRITEABLE, | ||
55 | }, | ||
56 | { | ||
57 | .name = "UBL", | ||
58 | .offset = MTDPART_OFS_APPEND, | ||
59 | .size = SZ_128K, | ||
60 | .mask_flags = MTD_WRITEABLE, | ||
61 | }, | ||
62 | { | ||
63 | .name = "u-boot", | ||
64 | .offset = MTDPART_OFS_APPEND, | ||
65 | .size = 4 * SZ_128K, | ||
66 | .mask_flags = MTD_WRITEABLE, | ||
67 | }, | ||
68 | { | ||
69 | .name = "kernel", | ||
70 | .offset = 0x200000, | ||
71 | .size = SZ_2M, | ||
72 | .mask_flags = 0, | ||
73 | }, | ||
74 | { | ||
75 | .name = "filesystem", | ||
76 | .offset = MTDPART_OFS_APPEND, | ||
77 | .size = MTDPART_SIZ_FULL, | ||
78 | .mask_flags = 0, | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | static struct davinci_nand_pdata da850_evm_nandflash_data = { | ||
83 | .parts = da850_evm_nandflash_partition, | ||
84 | .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), | ||
85 | .ecc_mode = NAND_ECC_HW, | ||
86 | .options = NAND_USE_FLASH_BBT, | ||
87 | }; | ||
88 | |||
89 | static struct resource da850_evm_nandflash_resource[] = { | ||
90 | { | ||
91 | .start = DA8XX_AEMIF_CS3_BASE, | ||
92 | .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1, | ||
93 | .flags = IORESOURCE_MEM, | ||
94 | }, | ||
95 | { | ||
96 | .start = DA8XX_AEMIF_CTL_BASE, | ||
97 | .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, | ||
98 | .flags = IORESOURCE_MEM, | ||
99 | }, | ||
100 | }; | ||
101 | |||
102 | static struct platform_device da850_evm_nandflash_device = { | ||
103 | .name = "davinci_nand", | ||
104 | .id = 1, | ||
105 | .dev = { | ||
106 | .platform_data = &da850_evm_nandflash_data, | ||
107 | }, | ||
108 | .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), | ||
109 | .resource = da850_evm_nandflash_resource, | ||
110 | }; | ||
111 | |||
39 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { | 112 | static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { |
40 | .bus_freq = 100, /* kHz */ | 113 | .bus_freq = 100, /* kHz */ |
41 | .bus_delay = 0, /* usec */ | 114 | .bus_delay = 0, /* usec */ |
@@ -45,6 +118,10 @@ static struct davinci_uart_config da850_evm_uart_config __initdata = { | |||
45 | .enabled_uarts = 0x7, | 118 | .enabled_uarts = 0x7, |
46 | }; | 119 | }; |
47 | 120 | ||
121 | static struct platform_device *da850_evm_devices[] __initdata = { | ||
122 | &da850_evm_nandflash_device, | ||
123 | }; | ||
124 | |||
48 | /* davinci da850 evm audio machine driver */ | 125 | /* davinci da850 evm audio machine driver */ |
49 | static u8 da850_iis_serializer_direction[] = { | 126 | static u8 da850_iis_serializer_direction[] = { |
50 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, | 127 | INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, |
@@ -120,6 +197,14 @@ static __init void da850_evm_init(void) | |||
120 | struct davinci_soc_info *soc_info = &davinci_soc_info; | 197 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
121 | int ret; | 198 | int ret; |
122 | 199 | ||
200 | ret = da8xx_pinmux_setup(da850_nand_pins); | ||
201 | if (ret) | ||
202 | pr_warning("da850_evm_init: nand mux setup failed: %d\n", | ||
203 | ret); | ||
204 | |||
205 | platform_add_devices(da850_evm_devices, | ||
206 | ARRAY_SIZE(da850_evm_devices)); | ||
207 | |||
123 | ret = da8xx_register_edma(); | 208 | ret = da8xx_register_edma(); |
124 | if (ret) | 209 | if (ret) |
125 | pr_warning("da850_evm_init: edma registration failed: %d\n", | 210 | pr_warning("da850_evm_init: edma registration failed: %d\n", |
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 9debd57deb71..db4209413450 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c | |||
@@ -310,6 +310,13 @@ static struct clk mmcsd_clk = { | |||
310 | .lpsc = DA8XX_LPSC0_MMC_SD, | 310 | .lpsc = DA8XX_LPSC0_MMC_SD, |
311 | }; | 311 | }; |
312 | 312 | ||
313 | static struct clk aemif_clk = { | ||
314 | .name = "aemif", | ||
315 | .parent = &pll0_sysclk3, | ||
316 | .lpsc = DA8XX_LPSC0_EMIF25, | ||
317 | .flags = ALWAYS_ENABLED, | ||
318 | }; | ||
319 | |||
313 | static struct davinci_clk da850_clks[] = { | 320 | static struct davinci_clk da850_clks[] = { |
314 | CLK(NULL, "ref", &ref_clk), | 321 | CLK(NULL, "ref", &ref_clk), |
315 | CLK(NULL, "pll0", &pll0_clk), | 322 | CLK(NULL, "pll0", &pll0_clk), |
@@ -350,6 +357,7 @@ static struct davinci_clk da850_clks[] = { | |||
350 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), | 357 | CLK("davinci-mcasp.0", NULL, &mcasp_clk), |
351 | CLK("da8xx_lcdc.0", NULL, &lcdc_clk), | 358 | CLK("da8xx_lcdc.0", NULL, &lcdc_clk), |
352 | CLK("davinci_mmc.0", NULL, &mmcsd_clk), | 359 | CLK("davinci_mmc.0", NULL, &mmcsd_clk), |
360 | CLK(NULL, "aemif", &aemif_clk), | ||
353 | CLK(NULL, NULL, NULL), | 361 | CLK(NULL, NULL, NULL), |
354 | }; | 362 | }; |
355 | 363 | ||
@@ -448,6 +456,21 @@ static const struct mux_config da850_pins[] = { | |||
448 | MUX_CFG(DA850, MMCSD0_DAT_3, 10, 20, 15, 2, false) | 456 | MUX_CFG(DA850, MMCSD0_DAT_3, 10, 20, 15, 2, false) |
449 | MUX_CFG(DA850, MMCSD0_CLK, 10, 0, 15, 2, false) | 457 | MUX_CFG(DA850, MMCSD0_CLK, 10, 0, 15, 2, false) |
450 | MUX_CFG(DA850, MMCSD0_CMD, 10, 4, 15, 2, false) | 458 | MUX_CFG(DA850, MMCSD0_CMD, 10, 4, 15, 2, false) |
459 | /* EMIF2.5/EMIFA function */ | ||
460 | MUX_CFG(DA850, EMA_D_7, 9, 0, 15, 1, false) | ||
461 | MUX_CFG(DA850, EMA_D_6, 9, 4, 15, 1, false) | ||
462 | MUX_CFG(DA850, EMA_D_5, 9, 8, 15, 1, false) | ||
463 | MUX_CFG(DA850, EMA_D_4, 9, 12, 15, 1, false) | ||
464 | MUX_CFG(DA850, EMA_D_3, 9, 16, 15, 1, false) | ||
465 | MUX_CFG(DA850, EMA_D_2, 9, 20, 15, 1, false) | ||
466 | MUX_CFG(DA850, EMA_D_1, 9, 24, 15, 1, false) | ||
467 | MUX_CFG(DA850, EMA_D_0, 9, 28, 15, 1, false) | ||
468 | MUX_CFG(DA850, EMA_A_1, 12, 24, 15, 1, false) | ||
469 | MUX_CFG(DA850, EMA_A_2, 12, 20, 15, 1, false) | ||
470 | MUX_CFG(DA850, NEMA_CS_3, 7, 4, 15, 1, false) | ||
471 | MUX_CFG(DA850, NEMA_CS_4, 7, 8, 15, 1, false) | ||
472 | MUX_CFG(DA850, NEMA_WE, 7, 16, 15, 1, false) | ||
473 | MUX_CFG(DA850, NEMA_OE, 7, 20, 15, 1, false) | ||
451 | /* GPIO function */ | 474 | /* GPIO function */ |
452 | MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) | 475 | MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) |
453 | MUX_CFG(DA850, GPIO8_10, 18, 28, 15, 8, false) | 476 | MUX_CFG(DA850, GPIO8_10, 18, 28, 15, 8, false) |
@@ -514,6 +537,14 @@ const short da850_mmcsd0_pins[] __initdata = { | |||
514 | -1 | 537 | -1 |
515 | }; | 538 | }; |
516 | 539 | ||
540 | const short da850_nand_pins[] __initdata = { | ||
541 | DA850_EMA_D_7, DA850_EMA_D_6, DA850_EMA_D_5, DA850_EMA_D_4, | ||
542 | DA850_EMA_D_3, DA850_EMA_D_2, DA850_EMA_D_1, DA850_EMA_D_0, | ||
543 | DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4, | ||
544 | DA850_NEMA_WE, DA850_NEMA_OE, | ||
545 | -1 | ||
546 | }; | ||
547 | |||
517 | /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ | 548 | /* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ |
518 | static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { | 549 | static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { |
519 | [IRQ_DA8XX_COMMTX] = 7, | 550 | [IRQ_DA8XX_COMMTX] = 7, |
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 0af141ffc3b4..77e5d2398e21 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h | |||
@@ -40,6 +40,8 @@ | |||
40 | #define DA8XX_PSC1_BASE 0x01e27000 | 40 | #define DA8XX_PSC1_BASE 0x01e27000 |
41 | #define DA8XX_LCD_CNTRL_BASE 0x01e13000 | 41 | #define DA8XX_LCD_CNTRL_BASE 0x01e13000 |
42 | #define DA8XX_MMCSD0_BASE 0x01c40000 | 42 | #define DA8XX_MMCSD0_BASE 0x01c40000 |
43 | #define DA8XX_AEMIF_CS3_BASE 0x62000000 | ||
44 | #define DA8XX_AEMIF_CTL_BASE 0x68000000 | ||
43 | 45 | ||
44 | #define PINMUX0 0x00 | 46 | #define PINMUX0 0x00 |
45 | #define PINMUX1 0x04 | 47 | #define PINMUX1 0x04 |
@@ -110,6 +112,7 @@ extern const short da850_cpgmac_pins[]; | |||
110 | extern const short da850_mcasp_pins[]; | 112 | extern const short da850_mcasp_pins[]; |
111 | extern const short da850_lcdcntl_pins[]; | 113 | extern const short da850_lcdcntl_pins[]; |
112 | extern const short da850_mmcsd0_pins[]; | 114 | extern const short da850_mmcsd0_pins[]; |
115 | extern const short da850_nand_pins[]; | ||
113 | 116 | ||
114 | int da8xx_pinmux_setup(const short pins[]); | 117 | int da8xx_pinmux_setup(const short pins[]); |
115 | 118 | ||
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h index b2335640c222..ee6f29db4452 100644 --- a/arch/arm/mach-davinci/include/mach/mux.h +++ b/arch/arm/mach-davinci/include/mach/mux.h | |||
@@ -806,6 +806,22 @@ enum davinci_da850_index { | |||
806 | DA850_MMCSD0_CLK, | 806 | DA850_MMCSD0_CLK, |
807 | DA850_MMCSD0_CMD, | 807 | DA850_MMCSD0_CMD, |
808 | 808 | ||
809 | /* EMIF2.5/EMIFA function */ | ||
810 | DA850_EMA_D_7, | ||
811 | DA850_EMA_D_6, | ||
812 | DA850_EMA_D_5, | ||
813 | DA850_EMA_D_4, | ||
814 | DA850_EMA_D_3, | ||
815 | DA850_EMA_D_2, | ||
816 | DA850_EMA_D_1, | ||
817 | DA850_EMA_D_0, | ||
818 | DA850_EMA_A_1, | ||
819 | DA850_EMA_A_2, | ||
820 | DA850_NEMA_CS_3, | ||
821 | DA850_NEMA_CS_4, | ||
822 | DA850_NEMA_WE, | ||
823 | DA850_NEMA_OE, | ||
824 | |||
809 | /* GPIO function */ | 825 | /* GPIO function */ |
810 | DA850_GPIO2_15, | 826 | DA850_GPIO2_15, |
811 | DA850_GPIO8_10, | 827 | DA850_GPIO8_10, |