diff options
Diffstat (limited to 'drivers/mtd/nand/mxc_nand.c')
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index da41ea82941a..76beea40d2cf 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -842,6 +842,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
842 | break; | 842 | break; |
843 | 843 | ||
844 | case NAND_CMD_READID: | 844 | case NAND_CMD_READID: |
845 | host->col_addr = 0; | ||
845 | send_read_id(host); | 846 | send_read_id(host); |
846 | break; | 847 | break; |
847 | 848 | ||
@@ -878,6 +879,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
878 | mtd->priv = this; | 879 | mtd->priv = this; |
879 | mtd->owner = THIS_MODULE; | 880 | mtd->owner = THIS_MODULE; |
880 | mtd->dev.parent = &pdev->dev; | 881 | mtd->dev.parent = &pdev->dev; |
882 | mtd->name = "mxc_nand"; | ||
881 | 883 | ||
882 | /* 50 us command delay time */ | 884 | /* 50 us command delay time */ |
883 | this->chip_delay = 5; | 885 | this->chip_delay = 5; |
@@ -893,8 +895,10 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
893 | this->verify_buf = mxc_nand_verify_buf; | 895 | this->verify_buf = mxc_nand_verify_buf; |
894 | 896 | ||
895 | host->clk = clk_get(&pdev->dev, "nfc"); | 897 | host->clk = clk_get(&pdev->dev, "nfc"); |
896 | if (IS_ERR(host->clk)) | 898 | if (IS_ERR(host->clk)) { |
899 | err = PTR_ERR(host->clk); | ||
897 | goto eclk; | 900 | goto eclk; |
901 | } | ||
898 | 902 | ||
899 | clk_enable(host->clk); | 903 | clk_enable(host->clk); |
900 | host->clk_act = 1; | 904 | host->clk_act = 1; |
@@ -907,7 +911,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) | |||
907 | 911 | ||
908 | host->regs = ioremap(res->start, res->end - res->start + 1); | 912 | host->regs = ioremap(res->start, res->end - res->start + 1); |
909 | if (!host->regs) { | 913 | if (!host->regs) { |
910 | err = -EIO; | 914 | err = -ENOMEM; |
911 | goto eres; | 915 | goto eres; |
912 | } | 916 | } |
913 | 917 | ||
@@ -1053,25 +1057,35 @@ static int __devexit mxcnd_remove(struct platform_device *pdev) | |||
1053 | #ifdef CONFIG_PM | 1057 | #ifdef CONFIG_PM |
1054 | static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) | 1058 | static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) |
1055 | { | 1059 | { |
1056 | struct mtd_info *info = platform_get_drvdata(pdev); | 1060 | struct mtd_info *mtd = platform_get_drvdata(pdev); |
1061 | struct nand_chip *nand_chip = mtd->priv; | ||
1062 | struct mxc_nand_host *host = nand_chip->priv; | ||
1057 | int ret = 0; | 1063 | int ret = 0; |
1058 | 1064 | ||
1059 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); | 1065 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND suspend\n"); |
1060 | 1066 | if (mtd) { | |
1061 | /* Disable the NFC clock */ | 1067 | ret = mtd->suspend(mtd); |
1062 | clk_disable(nfc_clk); /* FIXME */ | 1068 | /* Disable the NFC clock */ |
1069 | clk_disable(host->clk); | ||
1070 | } | ||
1063 | 1071 | ||
1064 | return ret; | 1072 | return ret; |
1065 | } | 1073 | } |
1066 | 1074 | ||
1067 | static int mxcnd_resume(struct platform_device *pdev) | 1075 | static int mxcnd_resume(struct platform_device *pdev) |
1068 | { | 1076 | { |
1069 | struct mtd_info *info = platform_get_drvdata(pdev); | 1077 | struct mtd_info *mtd = platform_get_drvdata(pdev); |
1078 | struct nand_chip *nand_chip = mtd->priv; | ||
1079 | struct mxc_nand_host *host = nand_chip->priv; | ||
1070 | int ret = 0; | 1080 | int ret = 0; |
1071 | 1081 | ||
1072 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); | 1082 | DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND : NAND resume\n"); |
1073 | /* Enable the NFC clock */ | 1083 | |
1074 | clk_enable(nfc_clk); /* FIXME */ | 1084 | if (mtd) { |
1085 | /* Enable the NFC clock */ | ||
1086 | clk_enable(host->clk); | ||
1087 | mtd->resume(mtd); | ||
1088 | } | ||
1075 | 1089 | ||
1076 | return ret; | 1090 | return ret; |
1077 | } | 1091 | } |
@@ -1092,13 +1106,7 @@ static struct platform_driver mxcnd_driver = { | |||
1092 | 1106 | ||
1093 | static int __init mxc_nd_init(void) | 1107 | static int __init mxc_nd_init(void) |
1094 | { | 1108 | { |
1095 | /* Register the device driver structure. */ | 1109 | return platform_driver_probe(&mxcnd_driver, mxcnd_probe); |
1096 | pr_info("MXC MTD nand Driver\n"); | ||
1097 | if (platform_driver_probe(&mxcnd_driver, mxcnd_probe) != 0) { | ||
1098 | printk(KERN_ERR "Driver register failed for mxcnd_driver\n"); | ||
1099 | return -ENODEV; | ||
1100 | } | ||
1101 | return 0; | ||
1102 | } | 1110 | } |
1103 | 1111 | ||
1104 | static void __exit mxc_nd_cleanup(void) | 1112 | static void __exit mxc_nd_cleanup(void) |