diff options
author | Enric Balletbo i Serra <eballetbo@iseebcn.com> | 2010-02-17 17:09:26 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-02-17 20:23:20 -0500 |
commit | cddb483a74a39ed0846e6a276c4e5f4b7ac69d9c (patch) | |
tree | 575079d99a8ea1b1445e0ea982d6bc8babfa9965 /arch/arm/mach-omap2/board-igep0020.c | |
parent | 691de27f3cdb71a3bb41a5b5cf83ed85ab1b9240 (diff) |
omap3: Add support for flash on IGEP v2 board
This patch adds support for flashes on IGEP v2 boards. For now
only OneNAND is supported.
Signed-off-by: Enric Balletbo i Serra <eballetbo@iseebcn.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-igep0020.c')
-rw-r--r-- | arch/arm/mach-omap2/board-igep0020.c | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index f6899f9dc1c4..8ed935ca1efe 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <plat/gpmc.h> | 29 | #include <plat/gpmc.h> |
30 | #include <plat/usb.h> | 30 | #include <plat/usb.h> |
31 | #include <plat/display.h> | 31 | #include <plat/display.h> |
32 | #include <plat/onenand.h> | ||
32 | 33 | ||
33 | #include "mux.h" | 34 | #include "mux.h" |
34 | #include "hsmmc.h" | 35 | #include "hsmmc.h" |
@@ -41,6 +42,105 @@ | |||
41 | #define IGEP2_GPIO_LED1_RED 28 | 42 | #define IGEP2_GPIO_LED1_RED 28 |
42 | #define IGEP2_GPIO_DVI_PUP 170 | 43 | #define IGEP2_GPIO_DVI_PUP 170 |
43 | 44 | ||
45 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ | ||
46 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | ||
47 | |||
48 | #define ONENAND_MAP 0x20000000 | ||
49 | |||
50 | /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY ) | ||
51 | * Since the device is equipped with two DataRAMs, and two-plane NAND | ||
52 | * Flash memory array, these two component enables simultaneous program | ||
53 | * of 4KiB. Plane1 has only even blocks such as block0, block2, block4 | ||
54 | * while Plane2 has only odd blocks such as block1, block3, block5. | ||
55 | * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) | ||
56 | */ | ||
57 | |||
58 | static struct mtd_partition igep2_onenand_partitions[] = { | ||
59 | { | ||
60 | .name = "X-Loader", | ||
61 | .offset = 0, | ||
62 | .size = 2 * (64*(2*2048)) | ||
63 | }, | ||
64 | { | ||
65 | .name = "U-Boot", | ||
66 | .offset = MTDPART_OFS_APPEND, | ||
67 | .size = 6 * (64*(2*2048)), | ||
68 | }, | ||
69 | { | ||
70 | .name = "Environment", | ||
71 | .offset = MTDPART_OFS_APPEND, | ||
72 | .size = 2 * (64*(2*2048)), | ||
73 | }, | ||
74 | { | ||
75 | .name = "Kernel", | ||
76 | .offset = MTDPART_OFS_APPEND, | ||
77 | .size = 12 * (64*(2*2048)), | ||
78 | }, | ||
79 | { | ||
80 | .name = "File System", | ||
81 | .offset = MTDPART_OFS_APPEND, | ||
82 | .size = MTDPART_SIZ_FULL, | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static int igep2_onenand_setup(void __iomem *onenand_base, int freq) | ||
87 | { | ||
88 | /* nothing is required to be setup for onenand as of now */ | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | static struct omap_onenand_platform_data igep2_onenand_data = { | ||
93 | .parts = igep2_onenand_partitions, | ||
94 | .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), | ||
95 | .onenand_setup = igep2_onenand_setup, | ||
96 | .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ | ||
97 | }; | ||
98 | |||
99 | static struct platform_device igep2_onenand_device = { | ||
100 | .name = "omap2-onenand", | ||
101 | .id = -1, | ||
102 | .dev = { | ||
103 | .platform_data = &igep2_onenand_data, | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | void __init igep2_flash_init(void) | ||
108 | { | ||
109 | u8 cs = 0; | ||
110 | u8 onenandcs = GPMC_CS_NUM + 1; | ||
111 | |||
112 | while (cs < GPMC_CS_NUM) { | ||
113 | u32 ret = 0; | ||
114 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
115 | |||
116 | /* Check if NAND/oneNAND is configured */ | ||
117 | if ((ret & 0xC00) == 0x800) | ||
118 | /* NAND found */ | ||
119 | pr_err("IGEP v2: Unsupported NAND found\n"); | ||
120 | else { | ||
121 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); | ||
122 | if ((ret & 0x3F) == (ONENAND_MAP >> 24)) | ||
123 | /* ONENAND found */ | ||
124 | onenandcs = cs; | ||
125 | } | ||
126 | cs++; | ||
127 | } | ||
128 | if (onenandcs > GPMC_CS_NUM) { | ||
129 | pr_err("IGEP v2: Unable to find configuration in GPMC\n"); | ||
130 | return; | ||
131 | } | ||
132 | |||
133 | if (onenandcs < GPMC_CS_NUM) { | ||
134 | igep2_onenand_data.cs = onenandcs; | ||
135 | if (platform_device_register(&igep2_onenand_device) < 0) | ||
136 | pr_err("IGEP v2: Unable to register OneNAND device\n"); | ||
137 | } | ||
138 | } | ||
139 | |||
140 | #else | ||
141 | void __init igep2_flash_init(void) {} | ||
142 | #endif | ||
143 | |||
44 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 144 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
45 | 145 | ||
46 | #include <linux/smsc911x.h> | 146 | #include <linux/smsc911x.h> |
@@ -314,6 +414,7 @@ static void __init igep2_init(void) | |||
314 | usb_musb_init(); | 414 | usb_musb_init(); |
315 | usb_ehci_init(&ehci_pdata); | 415 | usb_ehci_init(&ehci_pdata); |
316 | 416 | ||
417 | igep2_flash_init(); | ||
317 | igep2_display_init(); | 418 | igep2_display_init(); |
318 | igep2_init_smsc911x(); | 419 | igep2_init_smsc911x(); |
319 | 420 | ||