aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-29 11:52:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-29 11:52:13 -0400
commit3218911f839b6c85acbf872ad264ea69aa4d89ad (patch)
treed0aefbb2f1d0ea4d2e8f59be99492c5393715184 /drivers
parentb939e414f0dbd7ac8d38da2c7e3a419728229afd (diff)
parent81e2962801bbb4e740c501ca687d5cb857929c04 (diff)
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)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/mxc_nand.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index f3548d048014..40c26080ecda 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -831,6 +831,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
831 break; 831 break;
832 832
833 case NAND_CMD_READID: 833 case NAND_CMD_READID:
834 host->col_addr = 0;
834 send_read_id(host); 835 send_read_id(host);
835 break; 836 break;
836 837
@@ -867,6 +868,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
867 mtd->priv = this; 868 mtd->priv = this;
868 mtd->owner = THIS_MODULE; 869 mtd->owner = THIS_MODULE;
869 mtd->dev.parent = &pdev->dev; 870 mtd->dev.parent = &pdev->dev;
871 mtd->name = "mxc_nand";
870 872
871 /* 50 us command delay time */ 873 /* 50 us command delay time */
872 this->chip_delay = 5; 874 this->chip_delay = 5;
@@ -882,8 +884,10 @@ static int __init mxcnd_probe(struct platform_device *pdev)
882 this->verify_buf = mxc_nand_verify_buf; 884 this->verify_buf = mxc_nand_verify_buf;
883 885
884 host->clk = clk_get(&pdev->dev, "nfc"); 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 goto eclk; 889 goto eclk;
890 }
887 891
888 clk_enable(host->clk); 892 clk_enable(host->clk);
889 host->clk_act = 1; 893 host->clk_act = 1;
@@ -896,7 +900,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
896 900
897 host->regs = ioremap(res->start, res->end - res->start + 1); 901 host->regs = ioremap(res->start, res->end - res->start + 1);
898 if (!host->regs) { 902 if (!host->regs) {
899 err = -EIO; 903 err = -ENOMEM;
900 goto eres; 904 goto eres;
901 } 905 }
902 906
@@ -1011,30 +1015,35 @@ static int __devexit mxcnd_remove(struct platform_device *pdev)
1011#ifdef CONFIG_PM 1015#ifdef CONFIG_PM
1012static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) 1016static 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 int ret = 0; 1021 int ret = 0;
1016 1022
1017 DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); 1023 DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n");
1018 if (info) 1024 if (mtd) {
1019 ret = info->suspend(info); 1025 ret = mtd->suspend(mtd);
1020 1026 /* Disable the NFC clock */
1021 /* Disable the NFC clock */ 1027 clk_disable(host->clk);
1022 clk_disable(nfc_clk); /* FIXME */ 1028 }
1023 1029
1024 return ret; 1030 return ret;
1025} 1031}
1026 1032
1027static int mxcnd_resume(struct platform_device *pdev) 1033static 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 int ret = 0; 1038 int ret = 0;
1031 1039
1032 DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); 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) 1042 if (mtd) {
1037 info->resume(info); 1043 /* Enable the NFC clock */
1044 clk_enable(host->clk);
1045 mtd->resume(mtd);
1046 }
1038 1047
1039 return ret; 1048 return ret;
1040} 1049}
@@ -1055,13 +1064,7 @@ static struct platform_driver mxcnd_driver = {
1055 1064
1056static int __init mxc_nd_init(void) 1065static int __init mxc_nd_init(void)
1057{ 1066{
1058 /* Register the device driver structure. */ 1067 return platform_driver_probe(&mxcnd_driver, mxcnd_probe);
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;
1065} 1068}
1066 1069
1067static void __exit mxc_nd_cleanup(void) 1070static void __exit mxc_nd_cleanup(void)