Commit 3218911f839b6c85acbf872ad264ea69aa4d89ad
Exists in
master
and in
7 other branches
Merge git://git.infradead.org/~dwmw2/mtd-2.6.30
* git://git.infradead.org/~dwmw2/mtd-2.6.30: jffs2: Fix corruption when flash erase/write failure mtd: MXC NAND driver fixes (v5)
Showing 2 changed files Side-by-side Diff
drivers/mtd/nand/mxc_nand.c
... | ... | @@ -831,6 +831,7 @@ |
831 | 831 | break; |
832 | 832 | |
833 | 833 | case NAND_CMD_READID: |
834 | + host->col_addr = 0; | |
834 | 835 | send_read_id(host); |
835 | 836 | break; |
836 | 837 | |
... | ... | @@ -867,6 +868,7 @@ |
867 | 868 | mtd->priv = this; |
868 | 869 | mtd->owner = THIS_MODULE; |
869 | 870 | mtd->dev.parent = &pdev->dev; |
871 | + mtd->name = "mxc_nand"; | |
870 | 872 | |
871 | 873 | /* 50 us command delay time */ |
872 | 874 | this->chip_delay = 5; |
873 | 875 | |
... | ... | @@ -882,8 +884,10 @@ |
882 | 884 | this->verify_buf = mxc_nand_verify_buf; |
883 | 885 | |
884 | 886 | host->clk = clk_get(&pdev->dev, "nfc"); |
885 | - if (IS_ERR(host->clk)) | |
887 | + if (IS_ERR(host->clk)) { | |
888 | + err = PTR_ERR(host->clk); | |
886 | 889 | goto eclk; |
890 | + } | |
887 | 891 | |
888 | 892 | clk_enable(host->clk); |
889 | 893 | host->clk_act = 1; |
... | ... | @@ -896,7 +900,7 @@ |
896 | 900 | |
897 | 901 | host->regs = ioremap(res->start, res->end - res->start + 1); |
898 | 902 | if (!host->regs) { |
899 | - err = -EIO; | |
903 | + err = -ENOMEM; | |
900 | 904 | goto eres; |
901 | 905 | } |
902 | 906 | |
903 | 907 | |
904 | 908 | |
905 | 909 | |
906 | 910 | |
907 | 911 | |
... | ... | @@ -1011,30 +1015,35 @@ |
1011 | 1015 | #ifdef CONFIG_PM |
1012 | 1016 | static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) |
1013 | 1017 | { |
1014 | - struct mtd_info *info = platform_get_drvdata(pdev); | |
1018 | + struct mtd_info *mtd = platform_get_drvdata(pdev); | |
1019 | + struct nand_chip *nand_chip = mtd->priv; | |
1020 | + struct mxc_nand_host *host = nand_chip->priv; | |
1015 | 1021 | int ret = 0; |
1016 | 1022 | |
1017 | 1023 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); |
1018 | - if (info) | |
1019 | - ret = info->suspend(info); | |
1024 | + if (mtd) { | |
1025 | + ret = mtd->suspend(mtd); | |
1026 | + /* Disable the NFC clock */ | |
1027 | + clk_disable(host->clk); | |
1028 | + } | |
1020 | 1029 | |
1021 | - /* Disable the NFC clock */ | |
1022 | - clk_disable(nfc_clk); /* FIXME */ | |
1023 | - | |
1024 | 1030 | return ret; |
1025 | 1031 | } |
1026 | 1032 | |
1027 | 1033 | static int mxcnd_resume(struct platform_device *pdev) |
1028 | 1034 | { |
1029 | - struct mtd_info *info = platform_get_drvdata(pdev); | |
1035 | + struct mtd_info *mtd = platform_get_drvdata(pdev); | |
1036 | + struct nand_chip *nand_chip = mtd->priv; | |
1037 | + struct mxc_nand_host *host = nand_chip->priv; | |
1030 | 1038 | int ret = 0; |
1031 | 1039 | |
1032 | 1040 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); |
1033 | - /* Enable the NFC clock */ | |
1034 | - clk_enable(nfc_clk); /* FIXME */ | |
1035 | 1041 | |
1036 | - if (info) | |
1037 | - info->resume(info); | |
1042 | + if (mtd) { | |
1043 | + /* Enable the NFC clock */ | |
1044 | + clk_enable(host->clk); | |
1045 | + mtd->resume(mtd); | |
1046 | + } | |
1038 | 1047 | |
1039 | 1048 | return ret; |
1040 | 1049 | } |
... | ... | @@ -1055,13 +1064,7 @@ |
1055 | 1064 | |
1056 | 1065 | static int __init mxc_nd_init(void) |
1057 | 1066 | { |
1058 | - /* Register the device driver structure. */ | |
1059 | - pr_info("MXC MTD nand Driver\n"); | |
1060 | - if (platform_driver_probe(&mxcnd_driver, mxcnd_probe) != 0) { | |
1061 | - printk(KERN_ERR "Driver register failed for mxcnd_driver\n"); | |
1062 | - return -ENODEV; | |
1063 | - } | |
1064 | - return 0; | |
1067 | + return platform_driver_probe(&mxcnd_driver, mxcnd_probe); | |
1065 | 1068 | } |
1066 | 1069 | |
1067 | 1070 | static void __exit mxc_nd_cleanup(void) |
fs/jffs2/erase.c
... | ... | @@ -480,13 +480,6 @@ |
480 | 480 | return; |
481 | 481 | |
482 | 482 | filebad: |
483 | - mutex_lock(&c->erase_free_sem); | |
484 | - spin_lock(&c->erase_completion_lock); | |
485 | - /* Stick it on a list (any list) so erase_failed can take it | |
486 | - right off again. Silly, but shouldn't happen often. */ | |
487 | - list_move(&jeb->list, &c->erasing_list); | |
488 | - spin_unlock(&c->erase_completion_lock); | |
489 | - mutex_unlock(&c->erase_free_sem); | |
490 | 483 | jffs2_erase_failed(c, jeb, bad_offset); |
491 | 484 | return; |
492 | 485 |