aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChaithrika U S <chaithrika@ti.com>2010-05-26 17:41:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:39 -0400
commit06de845f72eeb169ea624f17396cd41d03384940 (patch)
tree48a77b4e2672551f05eee479355da1de7c88b1b9
parente632c45ad040a54058db577981cdc3f4b316da55 (diff)
davinci: mmc: add a function to control reset state of the controller
Add a helper function which will aid in changing the reset status of the controller. Signed-off-by: Chaithrika U S <chaithrika@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com> Cc: Vipin Bhandari <vipin.bhandari@ti.com> Cc: Sudhakar Rajashekhara <sudhakar.raj@ti.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/mmc/host/davinci_mmc.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 547d29c31b40..56afe0a00f56 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -909,19 +909,26 @@ static void mmc_davinci_cmd_done(struct mmc_davinci_host *host,
909 } 909 }
910} 910}
911 911
912static void 912static inline void mmc_davinci_reset_ctrl(struct mmc_davinci_host *host,
913davinci_abort_data(struct mmc_davinci_host *host, struct mmc_data *data) 913 int val)
914{ 914{
915 u32 temp; 915 u32 temp;
916 916
917 /* reset command and data state machines */
918 temp = readl(host->base + DAVINCI_MMCCTL); 917 temp = readl(host->base + DAVINCI_MMCCTL);
919 writel(temp | MMCCTL_CMDRST | MMCCTL_DATRST, 918 if (val) /* reset */
920 host->base + DAVINCI_MMCCTL); 919 temp |= MMCCTL_CMDRST | MMCCTL_DATRST;
920 else /* enable */
921 temp &= ~(MMCCTL_CMDRST | MMCCTL_DATRST);
921 922
922 temp &= ~(MMCCTL_CMDRST | MMCCTL_DATRST);
923 udelay(10);
924 writel(temp, host->base + DAVINCI_MMCCTL); 923 writel(temp, host->base + DAVINCI_MMCCTL);
924 udelay(10);
925}
926
927static void
928davinci_abort_data(struct mmc_davinci_host *host, struct mmc_data *data)
929{
930 mmc_davinci_reset_ctrl(host, 1);
931 mmc_davinci_reset_ctrl(host, 0);
925} 932}
926 933
927static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) 934static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
@@ -1125,15 +1132,8 @@ static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host)
1125#endif 1132#endif
1126static void __init init_mmcsd_host(struct mmc_davinci_host *host) 1133static void __init init_mmcsd_host(struct mmc_davinci_host *host)
1127{ 1134{
1128 /* DAT line portion is diabled and in reset state */
1129 writel(readl(host->base + DAVINCI_MMCCTL) | MMCCTL_DATRST,
1130 host->base + DAVINCI_MMCCTL);
1131
1132 /* CMD line portion is diabled and in reset state */
1133 writel(readl(host->base + DAVINCI_MMCCTL) | MMCCTL_CMDRST,
1134 host->base + DAVINCI_MMCCTL);
1135 1135
1136 udelay(10); 1136 mmc_davinci_reset_ctrl(host, 1);
1137 1137
1138 writel(0, host->base + DAVINCI_MMCCLK); 1138 writel(0, host->base + DAVINCI_MMCCLK);
1139 writel(MMCCLK_CLKEN, host->base + DAVINCI_MMCCLK); 1139 writel(MMCCLK_CLKEN, host->base + DAVINCI_MMCCLK);
@@ -1141,12 +1141,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
1141 writel(0x1FFF, host->base + DAVINCI_MMCTOR); 1141 writel(0x1FFF, host->base + DAVINCI_MMCTOR);
1142 writel(0xFFFF, host->base + DAVINCI_MMCTOD); 1142 writel(0xFFFF, host->base + DAVINCI_MMCTOD);
1143 1143
1144 writel(readl(host->base + DAVINCI_MMCCTL) & ~MMCCTL_DATRST, 1144 mmc_davinci_reset_ctrl(host, 0);
1145 host->base + DAVINCI_MMCCTL);
1146 writel(readl(host->base + DAVINCI_MMCCTL) & ~MMCCTL_CMDRST,
1147 host->base + DAVINCI_MMCCTL);
1148
1149 udelay(10);
1150} 1145}
1151 1146
1152static int __init davinci_mmcsd_probe(struct platform_device *pdev) 1147static int __init davinci_mmcsd_probe(struct platform_device *pdev)