aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/s3c2410.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 13:20:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 13:20:31 -0500
commita8e98d6d51a3eb7bb061b1625193a129c8bd094f (patch)
tree0fa58b6e11e37023b024e55b8f0e7e01438706d4 /drivers/mtd/nand/s3c2410.c
parentf0f1b3364ae7f48084bdf2837fb979ff59622523 (diff)
parentf9f7dd222364a6428d2ad99a515935dd1dd89d18 (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/s3c2410.c')
-rw-r--r--drivers/mtd/nand/s3c2410.c48
1 files changed, 33 insertions, 15 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 2bd0737572c6..9260ad947524 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -120,6 +120,8 @@ struct s3c2410_nand_info {
120 int sel_bit; 120 int sel_bit;
121 int mtd_count; 121 int mtd_count;
122 122
123 unsigned long save_nfconf;
124
123 enum s3c_cpu_type cpu_type; 125 enum s3c_cpu_type cpu_type;
124}; 126};
125 127
@@ -364,23 +366,21 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
364 ((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) { 366 ((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
365 /* calculate the bit position of the error */ 367 /* calculate the bit position of the error */
366 368
367 bit = (diff2 >> 2) & 1; 369 bit = ((diff2 >> 3) & 1) |
368 bit |= (diff2 >> 3) & 2; 370 ((diff2 >> 4) & 2) |
369 bit |= (diff2 >> 4) & 4; 371 ((diff2 >> 5) & 4);
370 372
371 /* calculate the byte position of the error */ 373 /* calculate the byte position of the error */
372 374
373 byte = (diff1 << 1) & 0x80; 375 byte = ((diff2 << 7) & 0x100) |
374 byte |= (diff1 << 2) & 0x40; 376 ((diff1 << 0) & 0x80) |
375 byte |= (diff1 << 3) & 0x20; 377 ((diff1 << 1) & 0x40) |
376 byte |= (diff1 << 4) & 0x10; 378 ((diff1 << 2) & 0x20) |
377 379 ((diff1 << 3) & 0x10) |
378 byte |= (diff0 >> 3) & 0x08; 380 ((diff0 >> 4) & 0x08) |
379 byte |= (diff0 >> 2) & 0x04; 381 ((diff0 >> 3) & 0x04) |
380 byte |= (diff0 >> 1) & 0x02; 382 ((diff0 >> 2) & 0x02) |
381 byte |= (diff0 >> 0) & 0x01; 383 ((diff0 >> 1) & 0x01);
382
383 byte |= (diff2 << 8) & 0x100;
384 384
385 dev_dbg(info->device, "correcting error bit %d, byte %d\n", 385 dev_dbg(info->device, "correcting error bit %d, byte %d\n",
386 bit, byte); 386 bit, byte);
@@ -399,7 +399,7 @@ static int s3c2410_nand_correct_data(struct mtd_info *mtd, u_char *dat,
399 if ((diff0 & ~(1<<fls(diff0))) == 0) 399 if ((diff0 & ~(1<<fls(diff0))) == 0)
400 return 1; 400 return 1;
401 401
402 return 0; 402 return -1;
403} 403}
404 404
405/* ECC functions 405/* ECC functions
@@ -810,6 +810,16 @@ static int s3c24xx_nand_suspend(struct platform_device *dev, pm_message_t pm)
810 struct s3c2410_nand_info *info = platform_get_drvdata(dev); 810 struct s3c2410_nand_info *info = platform_get_drvdata(dev);
811 811
812 if (info) { 812 if (info) {
813 info->save_nfconf = readl(info->regs + S3C2410_NFCONF);
814
815 /* For the moment, we must ensure nFCE is high during
816 * the time we are suspended. This really should be
817 * handled by suspending the MTDs we are using, but
818 * that is currently not the case. */
819
820 writel(info->save_nfconf | info->sel_bit,
821 info->regs + S3C2410_NFCONF);
822
813 if (!allow_clk_stop(info)) 823 if (!allow_clk_stop(info))
814 clk_disable(info->clk); 824 clk_disable(info->clk);
815 } 825 }
@@ -820,11 +830,19 @@ static int s3c24xx_nand_suspend(struct platform_device *dev, pm_message_t pm)
820static int s3c24xx_nand_resume(struct platform_device *dev) 830static int s3c24xx_nand_resume(struct platform_device *dev)
821{ 831{
822 struct s3c2410_nand_info *info = platform_get_drvdata(dev); 832 struct s3c2410_nand_info *info = platform_get_drvdata(dev);
833 unsigned long nfconf;
823 834
824 if (info) { 835 if (info) {
825 clk_enable(info->clk); 836 clk_enable(info->clk);
826 s3c2410_nand_inithw(info, dev); 837 s3c2410_nand_inithw(info, dev);
827 838
839 /* Restore the state of the nFCE line. */
840
841 nfconf = readl(info->regs + S3C2410_NFCONF);
842 nfconf &= ~info->sel_bit;
843 nfconf |= info->save_nfconf & info->sel_bit;
844 writel(nfconf, info->regs + S3C2410_NFCONF);
845
828 if (allow_clk_stop(info)) 846 if (allow_clk_stop(info))
829 clk_disable(info->clk); 847 clk_disable(info->clk);
830 } 848 }