diff options
-rw-r--r-- | arch/arm/plat-pxa/include/plat/pxa3xx_nand.h | 18 | ||||
-rw-r--r-- | drivers/mtd/nand/Kconfig | 7 | ||||
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 172 |
3 files changed, 25 insertions, 172 deletions
diff --git a/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h b/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h index 3478eae32d8a..01a8448e471c 100644 --- a/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h +++ b/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h | |||
@@ -30,15 +30,15 @@ struct pxa3xx_nand_cmdset { | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct pxa3xx_nand_flash { | 32 | struct pxa3xx_nand_flash { |
33 | const struct pxa3xx_nand_timing *timing; /* NAND Flash timing */ | 33 | uint32_t chip_id; |
34 | const struct pxa3xx_nand_cmdset *cmdset; | 34 | unsigned int page_per_block; /* Pages per block (PG_PER_BLK) */ |
35 | 35 | unsigned int page_size; /* Page size in bytes (PAGE_SZ) */ | |
36 | uint32_t page_per_block;/* Pages per block (PG_PER_BLK) */ | 36 | unsigned int flash_width; /* Width of Flash memory (DWIDTH_M) */ |
37 | uint32_t page_size; /* Page size in bytes (PAGE_SZ) */ | 37 | unsigned int dfc_width; /* Width of flash controller(DWIDTH_C) */ |
38 | uint32_t flash_width; /* Width of Flash memory (DWIDTH_M) */ | 38 | unsigned int num_blocks; /* Number of physical blocks in Flash */ |
39 | uint32_t dfc_width; /* Width of flash controller(DWIDTH_C) */ | 39 | |
40 | uint32_t num_blocks; /* Number of physical blocks in Flash */ | 40 | struct pxa3xx_nand_cmdset *cmdset; /* NAND command set */ |
41 | uint32_t chip_id; | 41 | struct pxa3xx_nand_timing *timing; /* NAND Flash timing */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | struct pxa3xx_nand_platform_data { | 44 | struct pxa3xx_nand_platform_data { |
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 8b4b67c8a391..a6f22f5bbef6 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig | |||
@@ -400,13 +400,6 @@ config MTD_NAND_PXA3xx | |||
400 | This enables the driver for the NAND flash device found on | 400 | This enables the driver for the NAND flash device found on |
401 | PXA3xx processors | 401 | PXA3xx processors |
402 | 402 | ||
403 | config MTD_NAND_PXA3xx_BUILTIN | ||
404 | bool "Use builtin definitions for some NAND chips (deprecated)" | ||
405 | depends on MTD_NAND_PXA3xx | ||
406 | help | ||
407 | This enables builtin definitions for some NAND chips. This | ||
408 | is deprecated in favor of platform specific data. | ||
409 | |||
410 | config MTD_NAND_CM_X270 | 403 | config MTD_NAND_CM_X270 |
411 | tristate "Support for NAND Flash on CM-X270 modules" | 404 | tristate "Support for NAND Flash on CM-X270 modules" |
412 | depends on MACH_ARMCORE | 405 | depends on MACH_ARMCORE |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 4d01cda68844..4e40de45f4be 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -176,21 +176,7 @@ MODULE_PARM_DESC(use_dma, "enable DMA for data transfering to/from NAND HW"); | |||
176 | */ | 176 | */ |
177 | static struct pxa3xx_nand_timing default_timing; | 177 | static struct pxa3xx_nand_timing default_timing; |
178 | static struct pxa3xx_nand_flash default_flash; | 178 | static struct pxa3xx_nand_flash default_flash; |
179 | 179 | static struct pxa3xx_nand_cmdset default_cmdset = { | |
180 | static struct pxa3xx_nand_cmdset smallpage_cmdset = { | ||
181 | .read1 = 0x0000, | ||
182 | .read2 = 0x0050, | ||
183 | .program = 0x1080, | ||
184 | .read_status = 0x0070, | ||
185 | .read_id = 0x0090, | ||
186 | .erase = 0xD060, | ||
187 | .reset = 0x00FF, | ||
188 | .lock = 0x002A, | ||
189 | .unlock = 0x2423, | ||
190 | .lock_status = 0x007A, | ||
191 | }; | ||
192 | |||
193 | static struct pxa3xx_nand_cmdset largepage_cmdset = { | ||
194 | .read1 = 0x3000, | 180 | .read1 = 0x3000, |
195 | .read2 = 0x0050, | 181 | .read2 = 0x0050, |
196 | .program = 0x1080, | 182 | .program = 0x1080, |
@@ -203,143 +189,23 @@ static struct pxa3xx_nand_cmdset largepage_cmdset = { | |||
203 | .lock_status = 0x007A, | 189 | .lock_status = 0x007A, |
204 | }; | 190 | }; |
205 | 191 | ||
206 | #ifdef CONFIG_MTD_NAND_PXA3xx_BUILTIN | 192 | static struct pxa3xx_nand_timing timing[] = { |
207 | static struct pxa3xx_nand_timing samsung512MbX16_timing = { | 193 | { 10, 0, 20, 40, 30, 40, 11123, 110, 10, }, |
208 | .tCH = 10, | 194 | { 10, 25, 15, 25, 15, 30, 25000, 60, 10, }, |
209 | .tCS = 0, | 195 | { 10, 35, 15, 25, 15, 25, 25000, 60, 10, }, |
210 | .tWH = 20, | ||
211 | .tWP = 40, | ||
212 | .tRH = 30, | ||
213 | .tRP = 40, | ||
214 | .tR = 11123, | ||
215 | .tWHR = 110, | ||
216 | .tAR = 10, | ||
217 | }; | ||
218 | |||
219 | static struct pxa3xx_nand_flash samsung512MbX16 = { | ||
220 | .timing = &samsung512MbX16_timing, | ||
221 | .cmdset = &smallpage_cmdset, | ||
222 | .page_per_block = 32, | ||
223 | .page_size = 512, | ||
224 | .flash_width = 16, | ||
225 | .dfc_width = 16, | ||
226 | .num_blocks = 4096, | ||
227 | .chip_id = 0x46ec, | ||
228 | }; | ||
229 | |||
230 | static struct pxa3xx_nand_flash samsung2GbX8 = { | ||
231 | .timing = &samsung512MbX16_timing, | ||
232 | .cmdset = &smallpage_cmdset, | ||
233 | .page_per_block = 64, | ||
234 | .page_size = 2048, | ||
235 | .flash_width = 8, | ||
236 | .dfc_width = 8, | ||
237 | .num_blocks = 2048, | ||
238 | .chip_id = 0xdaec, | ||
239 | }; | ||
240 | |||
241 | static struct pxa3xx_nand_flash samsung32GbX8 = { | ||
242 | .timing = &samsung512MbX16_timing, | ||
243 | .cmdset = &smallpage_cmdset, | ||
244 | .page_per_block = 128, | ||
245 | .page_size = 4096, | ||
246 | .flash_width = 8, | ||
247 | .dfc_width = 8, | ||
248 | .num_blocks = 8192, | ||
249 | .chip_id = 0xd7ec, | ||
250 | }; | 196 | }; |
251 | 197 | ||
252 | static struct pxa3xx_nand_timing micron_timing = { | 198 | static struct pxa3xx_nand_flash builtin_flash_types[] = { |
253 | .tCH = 10, | 199 | { 0x46ec, 32, 512, 16, 16, 4096, &default_cmdset, &timing[0] }, |
254 | .tCS = 25, | 200 | { 0xdaec, 64, 2048, 8, 8, 2048, &default_cmdset, &timing[0] }, |
255 | .tWH = 15, | 201 | { 0xd7ec, 128, 4096, 8, 8, 8192, &default_cmdset, &timing[0] }, |
256 | .tWP = 25, | 202 | { 0xa12c, 64, 2048, 8, 8, 1024, &default_cmdset, &timing[1] }, |
257 | .tRH = 15, | 203 | { 0xb12c, 64, 2048, 16, 16, 1024, &default_cmdset, &timing[1] }, |
258 | .tRP = 30, | 204 | { 0xdc2c, 64, 2048, 8, 8, 4096, &default_cmdset, &timing[1] }, |
259 | .tR = 25000, | 205 | { 0xcc2c, 64, 2048, 16, 16, 4096, &default_cmdset, &timing[1] }, |
260 | .tWHR = 60, | 206 | { 0xba20, 64, 2048, 16, 16, 2048, &default_cmdset, &timing[2] }, |
261 | .tAR = 10, | ||
262 | }; | 207 | }; |
263 | 208 | ||
264 | static struct pxa3xx_nand_flash micron1GbX8 = { | ||
265 | .timing = µn_timing, | ||
266 | .cmdset = &largepage_cmdset, | ||
267 | .page_per_block = 64, | ||
268 | .page_size = 2048, | ||
269 | .flash_width = 8, | ||
270 | .dfc_width = 8, | ||
271 | .num_blocks = 1024, | ||
272 | .chip_id = 0xa12c, | ||
273 | }; | ||
274 | |||
275 | static struct pxa3xx_nand_flash micron1GbX16 = { | ||
276 | .timing = µn_timing, | ||
277 | .cmdset = &largepage_cmdset, | ||
278 | .page_per_block = 64, | ||
279 | .page_size = 2048, | ||
280 | .flash_width = 16, | ||
281 | .dfc_width = 16, | ||
282 | .num_blocks = 1024, | ||
283 | .chip_id = 0xb12c, | ||
284 | }; | ||
285 | |||
286 | static struct pxa3xx_nand_flash micron4GbX8 = { | ||
287 | .timing = µn_timing, | ||
288 | .cmdset = &largepage_cmdset, | ||
289 | .page_per_block = 64, | ||
290 | .page_size = 2048, | ||
291 | .flash_width = 8, | ||
292 | .dfc_width = 8, | ||
293 | .num_blocks = 4096, | ||
294 | .chip_id = 0xdc2c, | ||
295 | }; | ||
296 | |||
297 | static struct pxa3xx_nand_flash micron4GbX16 = { | ||
298 | .timing = µn_timing, | ||
299 | .cmdset = &largepage_cmdset, | ||
300 | .page_per_block = 64, | ||
301 | .page_size = 2048, | ||
302 | .flash_width = 16, | ||
303 | .dfc_width = 16, | ||
304 | .num_blocks = 4096, | ||
305 | .chip_id = 0xcc2c, | ||
306 | }; | ||
307 | |||
308 | static struct pxa3xx_nand_timing stm2GbX16_timing = { | ||
309 | .tCH = 10, | ||
310 | .tCS = 35, | ||
311 | .tWH = 15, | ||
312 | .tWP = 25, | ||
313 | .tRH = 15, | ||
314 | .tRP = 25, | ||
315 | .tR = 25000, | ||
316 | .tWHR = 60, | ||
317 | .tAR = 10, | ||
318 | }; | ||
319 | |||
320 | static struct pxa3xx_nand_flash stm2GbX16 = { | ||
321 | .timing = &stm2GbX16_timing, | ||
322 | .cmdset = &largepage_cmdset, | ||
323 | .page_per_block = 64, | ||
324 | .page_size = 2048, | ||
325 | .flash_width = 16, | ||
326 | .dfc_width = 16, | ||
327 | .num_blocks = 2048, | ||
328 | .chip_id = 0xba20, | ||
329 | }; | ||
330 | |||
331 | static struct pxa3xx_nand_flash *builtin_flash_types[] = { | ||
332 | &samsung512MbX16, | ||
333 | &samsung2GbX8, | ||
334 | &samsung32GbX8, | ||
335 | µn1GbX8, | ||
336 | µn1GbX16, | ||
337 | µn4GbX8, | ||
338 | µn4GbX16, | ||
339 | &stm2GbX16, | ||
340 | }; | ||
341 | #endif /* CONFIG_MTD_NAND_PXA3xx_BUILTIN */ | ||
342 | |||
343 | #define NDTR0_tCH(c) (min((c), 7) << 19) | 209 | #define NDTR0_tCH(c) (min((c), 7) << 19) |
344 | #define NDTR0_tCS(c) (min((c), 7) << 16) | 210 | #define NDTR0_tCS(c) (min((c), 7) << 16) |
345 | #define NDTR0_tWH(c) (min((c), 7) << 11) | 211 | #define NDTR0_tWH(c) (min((c), 7) << 11) |
@@ -1027,11 +893,6 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
1027 | default_flash.flash_width = ndcr & NDCR_DWIDTH_M ? 16 : 8; | 893 | default_flash.flash_width = ndcr & NDCR_DWIDTH_M ? 16 : 8; |
1028 | default_flash.dfc_width = ndcr & NDCR_DWIDTH_C ? 16 : 8; | 894 | default_flash.dfc_width = ndcr & NDCR_DWIDTH_C ? 16 : 8; |
1029 | 895 | ||
1030 | if (default_flash.page_size == 2048) | ||
1031 | default_flash.cmdset = &largepage_cmdset; | ||
1032 | else | ||
1033 | default_flash.cmdset = &smallpage_cmdset; | ||
1034 | |||
1035 | /* set info fields needed to __readid */ | 896 | /* set info fields needed to __readid */ |
1036 | info->flash_info = &default_flash; | 897 | info->flash_info = &default_flash; |
1037 | info->read_id_bytes = (default_flash.page_size == 2048) ? 4 : 2; | 898 | info->read_id_bytes = (default_flash.page_size == 2048) ? 4 : 2; |
@@ -1068,6 +929,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) | |||
1068 | 929 | ||
1069 | pxa3xx_nand_detect_timing(info, &default_timing); | 930 | pxa3xx_nand_detect_timing(info, &default_timing); |
1070 | default_flash.timing = &default_timing; | 931 | default_flash.timing = &default_timing; |
932 | default_flash.cmdset = &default_cmdset; | ||
1071 | 933 | ||
1072 | return 0; | 934 | return 0; |
1073 | } | 935 | } |
@@ -1096,10 +958,9 @@ static int pxa3xx_nand_detect_flash(struct pxa3xx_nand_info *info, | |||
1096 | return 0; | 958 | return 0; |
1097 | } | 959 | } |
1098 | 960 | ||
1099 | #ifdef CONFIG_MTD_NAND_PXA3xx_BUILTIN | ||
1100 | for (i = 0; i < ARRAY_SIZE(builtin_flash_types); i++) { | 961 | for (i = 0; i < ARRAY_SIZE(builtin_flash_types); i++) { |
1101 | 962 | ||
1102 | f = builtin_flash_types[i]; | 963 | f = &builtin_flash_types[i]; |
1103 | 964 | ||
1104 | if (pxa3xx_nand_config_flash(info, f)) | 965 | if (pxa3xx_nand_config_flash(info, f)) |
1105 | continue; | 966 | continue; |
@@ -1110,7 +971,6 @@ static int pxa3xx_nand_detect_flash(struct pxa3xx_nand_info *info, | |||
1110 | if (id == f->chip_id) | 971 | if (id == f->chip_id) |
1111 | return 0; | 972 | return 0; |
1112 | } | 973 | } |
1113 | #endif | ||
1114 | 974 | ||
1115 | dev_warn(&info->pdev->dev, | 975 | dev_warn(&info->pdev->dev, |
1116 | "failed to detect configured nand flash; found %04x instead of\n", | 976 | "failed to detect configured nand flash; found %04x instead of\n", |