summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishon Vijay Abraham I2017-07-20 06:40:28 -0500
committerKishon Vijay Abraham I2017-07-20 06:40:28 -0500
commit303058087fe954b07fd1efbde7db49e9fd60777a (patch)
treea5007d6ac370ed0ca3120aaeaa802019d8927d87
parentaa0852017b9c4fe860017601320ecb4677e09055 (diff)
downloadlinux-phy-mmc_omap_sdhci_1.tar.gz
linux-phy-mmc_omap_sdhci_1.tar.xz
linux-phy-mmc_omap_sdhci_1.zip
some more cleanup in sdhci-oomap.cmmc_omap_sdhci_1
-rw-r--r--drivers/mmc/host/sdhci-omap.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c
index 6d5acc8665eb..c382fd996e0a 100644
--- a/drivers/mmc/host/sdhci-omap.c
+++ b/drivers/mmc/host/sdhci-omap.c
@@ -125,14 +125,11 @@ static void sdhci_omap_init_74_clocks(struct sdhci_host *host, u8 power_mode)
125 omap_host->power_mode = power_mode; 125 omap_host->power_mode = power_mode;
126} 126}
127 127
128#if 1 128static u16 sdhci_omap_calc_divisor(struct sdhci_pltfm_host *host,
129static u16 calc_divisor(struct sdhci_pltfm_host *host, unsigned int clock) 129 unsigned int clock)
130{ 130{
131 u16 dsor; 131 u16 dsor;
132 132
133 if (!clock)
134 return 0;
135
136 dsor = DIV_ROUND_UP(clk_get_rate(host->clk), clock); 133 dsor = DIV_ROUND_UP(clk_get_rate(host->clk), clock);
137 if (dsor > SYSCTL_CLKD_MAX) 134 if (dsor > SYSCTL_CLKD_MAX)
138 dsor = SYSCTL_CLKD_MAX; 135 dsor = SYSCTL_CLKD_MAX;
@@ -166,32 +163,16 @@ static void sdhci_omap_set_clock(struct sdhci_host *host, unsigned int clock)
166 unsigned long timeout; 163 unsigned long timeout;
167 unsigned long clkdiv; 164 unsigned long clkdiv;
168 165
169 dev_info(mmc_dev(host->mmc), "Set clock to %uHz\n", clock); 166 if (!clock)
167 return 0;
170 168
171 sdhci_omap_stop_clock(omap_host); 169 sdhci_omap_stop_clock(omap_host);
172 170
173 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL); 171 clkdiv = sdhci_omap_calc_divisor(pltfm_host, clock);
174 reg &= ~(SYSCTL_CLKD_MASK | SYSCTL_DTO_MASK); 172 sdhci_enable_clk(host, clkdiv);
175 clkdiv = calc_divisor(pltfm_host, clock);
176 reg |= (clkdiv << SYSCTL_CLKD_SHIFT) | (SYSCTL_DTO << SYSCTL_DTO_SHIFT);
177 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg);
178
179 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL);
180 reg |= SYSCTL_ICE;
181 sdhci_omap_writel(omap_host, SDHCI_OMAP_SYSCTL, reg);
182
183 /* Wait till the ICS bit is set */
184 timeout = jiffies + msecs_to_jiffies(20);
185 do {
186 reg = sdhci_omap_readl(omap_host, SDHCI_OMAP_SYSCTL);
187 if (reg & SYSCTL_ICS)
188 break;
189 cpu_relax();
190 } while (time_before(jiffies, timeout));
191 173
192 sdhci_omap_start_clock(omap_host); 174 sdhci_omap_start_clock(omap_host);
193} 175}
194#endif
195 176
196static int sdhci_omap_enable_dma(struct sdhci_host *host) 177static int sdhci_omap_enable_dma(struct sdhci_host *host)
197{ 178{
@@ -218,7 +199,6 @@ static struct sdhci_ops sdhci_omap_ops = {
218 .get_min_clock = sdhci_omap_get_min_clock, 199 .get_min_clock = sdhci_omap_get_min_clock,
219 .reset = sdhci_reset, 200 .reset = sdhci_reset,
220 .set_clock = sdhci_omap_set_clock, 201 .set_clock = sdhci_omap_set_clock,
221// .set_clock = sdhci_set_clock,
222 .set_bus_width = sdhci_omap_set_bus_width, 202 .set_bus_width = sdhci_omap_set_bus_width,
223 .set_bus_mode = sdhci_omap_set_bus_mode, 203 .set_bus_mode = sdhci_omap_set_bus_mode,
224 .set_uhs_signaling = sdhci_set_uhs_signaling, 204 .set_uhs_signaling = sdhci_set_uhs_signaling,
@@ -281,7 +261,6 @@ static int sdhci_omap_probe(struct platform_device *pdev)
281 return PTR_ERR(host);; 261 return PTR_ERR(host);;
282 } 262 }
283 263
284 printk("%s offset=%x\n", __func__, offset);
285 pltfm_host = sdhci_priv(host); 264 pltfm_host = sdhci_priv(host);
286 omap_host = sdhci_pltfm_priv(pltfm_host); 265 omap_host = sdhci_pltfm_priv(pltfm_host);
287 omap_host->base = host->ioaddr; 266 omap_host->base = host->ioaddr;
@@ -304,8 +283,6 @@ static int sdhci_omap_probe(struct platform_device *pdev)
304 goto err_of_parse; 283 goto err_of_parse;
305 } 284 }
306 285
307// clk = devm_clk_get(&pdev->dev, "mmchsdb_fck");
308// clk_prepare_enable(clk);
309 pm_runtime_enable(dev); 286 pm_runtime_enable(dev);
310 pm_runtime_get_sync(dev); 287 pm_runtime_get_sync(dev);
311 288
@@ -315,11 +292,6 @@ static int sdhci_omap_probe(struct platform_device *pdev)
315 if (ret) 292 if (ret)
316 goto err_add_host; 293 goto err_add_host;
317 294
318 /*printk("KISHON KISHON %s %x\n", __func__, readl(ioremap(0x4809C110, 0x4)));
319 writel(0x301d, ioremap(0x4809C110, 0x4));
320 printk("KISHON KISHON %s %x\n", __func__, readl(ioremap(0x4809C110, 0x4)));
321 */
322
323 return 0; 295 return 0;
324 296
325err_add_host: 297err_add_host: