diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 13:20:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 13:20:31 -0500 |
commit | a8e98d6d51a3eb7bb061b1625193a129c8bd094f (patch) | |
tree | 0fa58b6e11e37023b024e55b8f0e7e01438706d4 /drivers/mtd/nand/bf5xx_nand.c | |
parent | f0f1b3364ae7f48084bdf2837fb979ff59622523 (diff) | |
parent | f9f7dd222364a6428d2ad99a515935dd1dd89d18 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (120 commits)
[MTD] Fix mtdoops.c compilation
[MTD] [NOR] fix startup lock when using multiple nor flash chips
[MTD] [DOC200x] eccbuf is statically defined and always evaluate to true
[MTD] Fix maps/physmap.c compilation with CONFIG_PM
[MTD] onenand: Add panic_write function to the onenand driver
[MTD] mtdoops: Use the panic_write function when present
[MTD] Add mtd panic_write function pointer
[MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support.
[MTD] physmap.c: Add support for multiple resources
[MTD] [NAND] Fix misparenthesization introduced by commit 78b65179...
[MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes
[MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver
[MTD] [NAND] Remove unused variable in plat_nand_remove
[MTD] Unlocking all Intel flash that is locked on power up.
[MTD] [NAND] at91_nand: Make mtdparts option can override board info
[MTD] mtdoops: Various minor cleanups
[MTD] mtdoops: Ensure sequential write to the buffer
[MTD] mtdoops: Perform write operations in a workqueue
[MTD] mtdoops: Add further error return code checking
[MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c
...
Diffstat (limited to 'drivers/mtd/nand/bf5xx_nand.c')
-rw-r--r-- | drivers/mtd/nand/bf5xx_nand.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c index a52f3a737c39..747042ab094a 100644 --- a/drivers/mtd/nand/bf5xx_nand.c +++ b/drivers/mtd/nand/bf5xx_nand.c | |||
@@ -74,7 +74,22 @@ static int hardware_ecc = 1; | |||
74 | static int hardware_ecc; | 74 | static int hardware_ecc; |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | static unsigned short bfin_nfc_pin_req[] = {P_NAND_CE, P_NAND_RB, 0}; | 77 | static unsigned short bfin_nfc_pin_req[] = |
78 | {P_NAND_CE, | ||
79 | P_NAND_RB, | ||
80 | P_NAND_D0, | ||
81 | P_NAND_D1, | ||
82 | P_NAND_D2, | ||
83 | P_NAND_D3, | ||
84 | P_NAND_D4, | ||
85 | P_NAND_D5, | ||
86 | P_NAND_D6, | ||
87 | P_NAND_D7, | ||
88 | P_NAND_WE, | ||
89 | P_NAND_RE, | ||
90 | P_NAND_CLE, | ||
91 | P_NAND_ALE, | ||
92 | 0}; | ||
78 | 93 | ||
79 | /* | 94 | /* |
80 | * Data structures for bf5xx nand flash controller driver | 95 | * Data structures for bf5xx nand flash controller driver |
@@ -278,7 +293,6 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd, | |||
278 | u16 ecc0, ecc1; | 293 | u16 ecc0, ecc1; |
279 | u32 code[2]; | 294 | u32 code[2]; |
280 | u8 *p; | 295 | u8 *p; |
281 | int bytes = 3, i; | ||
282 | 296 | ||
283 | /* first 4 bytes ECC code for 256 page size */ | 297 | /* first 4 bytes ECC code for 256 page size */ |
284 | ecc0 = bfin_read_NFC_ECC0(); | 298 | ecc0 = bfin_read_NFC_ECC0(); |
@@ -288,19 +302,24 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd, | |||
288 | 302 | ||
289 | dev_dbg(info->device, "returning ecc 0x%08x\n", code[0]); | 303 | dev_dbg(info->device, "returning ecc 0x%08x\n", code[0]); |
290 | 304 | ||
305 | /* first 3 bytes in ecc_code for 256 page size */ | ||
306 | p = (u8 *) code; | ||
307 | memcpy(ecc_code, p, 3); | ||
308 | |||
291 | /* second 4 bytes ECC code for 512 page size */ | 309 | /* second 4 bytes ECC code for 512 page size */ |
292 | if (page_size == 512) { | 310 | if (page_size == 512) { |
293 | ecc0 = bfin_read_NFC_ECC2(); | 311 | ecc0 = bfin_read_NFC_ECC2(); |
294 | ecc1 = bfin_read_NFC_ECC3(); | 312 | ecc1 = bfin_read_NFC_ECC3(); |
295 | code[1] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11); | 313 | code[1] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11); |
296 | bytes = 6; | 314 | |
315 | /* second 3 bytes in ecc_code for second 256 | ||
316 | * bytes of 512 page size | ||
317 | */ | ||
318 | p = (u8 *) (code + 1); | ||
319 | memcpy((ecc_code + 3), p, 3); | ||
297 | dev_dbg(info->device, "returning ecc 0x%08x\n", code[1]); | 320 | dev_dbg(info->device, "returning ecc 0x%08x\n", code[1]); |
298 | } | 321 | } |
299 | 322 | ||
300 | p = (u8 *)code; | ||
301 | for (i = 0; i < bytes; i++) | ||
302 | ecc_code[i] = p[i]; | ||
303 | |||
304 | return 0; | 323 | return 0; |
305 | } | 324 | } |
306 | 325 | ||
@@ -507,12 +526,13 @@ static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info) | |||
507 | 526 | ||
508 | init_completion(&info->dma_completion); | 527 | init_completion(&info->dma_completion); |
509 | 528 | ||
529 | #ifdef CONFIG_BF54x | ||
510 | /* Setup DMAC1 channel mux for NFC which shared with SDH */ | 530 | /* Setup DMAC1 channel mux for NFC which shared with SDH */ |
511 | val = bfin_read_DMAC1_PERIMUX(); | 531 | val = bfin_read_DMAC1_PERIMUX(); |
512 | val &= 0xFFFE; | 532 | val &= 0xFFFE; |
513 | bfin_write_DMAC1_PERIMUX(val); | 533 | bfin_write_DMAC1_PERIMUX(val); |
514 | SSYNC(); | 534 | SSYNC(); |
515 | 535 | #endif | |
516 | /* Request NFC DMA channel */ | 536 | /* Request NFC DMA channel */ |
517 | ret = request_dma(CH_NFC, "BF5XX NFC driver"); | 537 | ret = request_dma(CH_NFC, "BF5XX NFC driver"); |
518 | if (ret < 0) { | 538 | if (ret < 0) { |
@@ -744,9 +764,6 @@ static int bf5xx_nand_resume(struct platform_device *dev) | |||
744 | { | 764 | { |
745 | struct bf5xx_nand_info *info = platform_get_drvdata(dev); | 765 | struct bf5xx_nand_info *info = platform_get_drvdata(dev); |
746 | 766 | ||
747 | if (info) | ||
748 | bf5xx_nand_hw_init(info); | ||
749 | |||
750 | return 0; | 767 | return 0; |
751 | } | 768 | } |
752 | 769 | ||