Lines Matching refs:host
48 static u32 esdhc_readl_fixup(struct sdhci_host *host, in esdhc_readl_fixup() argument
51 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in esdhc_readl_fixup()
73 static u16 esdhc_readw_fixup(struct sdhci_host *host, in esdhc_readw_fixup() argument
86 static u8 esdhc_readb_fixup(struct sdhci_host *host, in esdhc_readb_fixup() argument
125 static u32 esdhc_writel_fixup(struct sdhci_host *host, in esdhc_writel_fixup() argument
143 static u32 esdhc_writew_fixup(struct sdhci_host *host, in esdhc_writew_fixup() argument
146 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in esdhc_writew_fixup()
177 static u32 esdhc_writeb_fixup(struct sdhci_host *host, in esdhc_writeb_fixup() argument
200 if (host->quirks2 & SDHCI_QUIRK2_BROKEN_HOST_CONTROL) in esdhc_writeb_fixup()
219 static u32 esdhc_be_readl(struct sdhci_host *host, int reg) in esdhc_be_readl() argument
224 value = ioread32be(host->ioaddr + reg); in esdhc_be_readl()
225 ret = esdhc_readl_fixup(host, reg, value); in esdhc_be_readl()
230 static u32 esdhc_le_readl(struct sdhci_host *host, int reg) in esdhc_le_readl() argument
235 value = ioread32(host->ioaddr + reg); in esdhc_le_readl()
236 ret = esdhc_readl_fixup(host, reg, value); in esdhc_le_readl()
241 static u16 esdhc_be_readw(struct sdhci_host *host, int reg) in esdhc_be_readw() argument
247 value = ioread32be(host->ioaddr + base); in esdhc_be_readw()
248 ret = esdhc_readw_fixup(host, reg, value); in esdhc_be_readw()
252 static u16 esdhc_le_readw(struct sdhci_host *host, int reg) in esdhc_le_readw() argument
258 value = ioread32(host->ioaddr + base); in esdhc_le_readw()
259 ret = esdhc_readw_fixup(host, reg, value); in esdhc_le_readw()
263 static u8 esdhc_be_readb(struct sdhci_host *host, int reg) in esdhc_be_readb() argument
269 value = ioread32be(host->ioaddr + base); in esdhc_be_readb()
270 ret = esdhc_readb_fixup(host, reg, value); in esdhc_be_readb()
274 static u8 esdhc_le_readb(struct sdhci_host *host, int reg) in esdhc_le_readb() argument
280 value = ioread32(host->ioaddr + base); in esdhc_le_readb()
281 ret = esdhc_readb_fixup(host, reg, value); in esdhc_le_readb()
285 static void esdhc_be_writel(struct sdhci_host *host, u32 val, int reg) in esdhc_be_writel() argument
289 value = esdhc_writel_fixup(host, reg, val, 0); in esdhc_be_writel()
290 iowrite32be(value, host->ioaddr + reg); in esdhc_be_writel()
293 static void esdhc_le_writel(struct sdhci_host *host, u32 val, int reg) in esdhc_le_writel() argument
297 value = esdhc_writel_fixup(host, reg, val, 0); in esdhc_le_writel()
298 iowrite32(value, host->ioaddr + reg); in esdhc_le_writel()
301 static void esdhc_be_writew(struct sdhci_host *host, u16 val, int reg) in esdhc_be_writew() argument
307 value = ioread32be(host->ioaddr + base); in esdhc_be_writew()
308 ret = esdhc_writew_fixup(host, reg, val, value); in esdhc_be_writew()
310 iowrite32be(ret, host->ioaddr + base); in esdhc_be_writew()
313 static void esdhc_le_writew(struct sdhci_host *host, u16 val, int reg) in esdhc_le_writew() argument
319 value = ioread32(host->ioaddr + base); in esdhc_le_writew()
320 ret = esdhc_writew_fixup(host, reg, val, value); in esdhc_le_writew()
322 iowrite32(ret, host->ioaddr + base); in esdhc_le_writew()
325 static void esdhc_be_writeb(struct sdhci_host *host, u8 val, int reg) in esdhc_be_writeb() argument
331 value = ioread32be(host->ioaddr + base); in esdhc_be_writeb()
332 ret = esdhc_writeb_fixup(host, reg, val, value); in esdhc_be_writeb()
333 iowrite32be(ret, host->ioaddr + base); in esdhc_be_writeb()
336 static void esdhc_le_writeb(struct sdhci_host *host, u8 val, int reg) in esdhc_le_writeb() argument
342 value = ioread32(host->ioaddr + base); in esdhc_le_writeb()
343 ret = esdhc_writeb_fixup(host, reg, val, value); in esdhc_le_writeb()
344 iowrite32(ret, host->ioaddr + base); in esdhc_le_writeb()
354 static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask) in esdhc_of_adma_workaround() argument
356 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in esdhc_of_adma_workaround()
368 host->data->error = 0; in esdhc_of_adma_workaround()
369 dmastart = sg_dma_address(host->data->sg); in esdhc_of_adma_workaround()
370 dmanow = dmastart + host->data->bytes_xfered; in esdhc_of_adma_workaround()
376 host->data->bytes_xfered = dmanow - dmastart; in esdhc_of_adma_workaround()
377 sdhci_writel(host, dmanow, SDHCI_DMA_ADDRESS); in esdhc_of_adma_workaround()
380 static int esdhc_of_enable_dma(struct sdhci_host *host) in esdhc_of_enable_dma() argument
384 value = sdhci_readl(host, ESDHC_DMA_SYSCTL); in esdhc_of_enable_dma()
386 sdhci_writel(host, value, ESDHC_DMA_SYSCTL); in esdhc_of_enable_dma()
390 static unsigned int esdhc_of_get_max_clock(struct sdhci_host *host) in esdhc_of_get_max_clock() argument
392 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in esdhc_of_get_max_clock()
397 static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) in esdhc_of_get_min_clock() argument
399 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in esdhc_of_get_min_clock()
404 static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) in esdhc_of_set_clock() argument
406 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); in esdhc_of_set_clock()
412 host->mmc->actual_clock = 0; in esdhc_of_set_clock()
429 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); in esdhc_of_set_clock()
432 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); in esdhc_of_set_clock()
434 while (host->max_clk / pre_div / 16 > clock && pre_div < 256) in esdhc_of_set_clock()
437 while (host->max_clk / pre_div / div > clock && div < 16) in esdhc_of_set_clock()
440 dev_dbg(mmc_dev(host->mmc), "desired SD clock: %d, actual: %d\n", in esdhc_of_set_clock()
441 clock, host->max_clk / pre_div / div); in esdhc_of_set_clock()
442 host->mmc->actual_clock = host->max_clk / pre_div / div; in esdhc_of_set_clock()
446 temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL); in esdhc_of_set_clock()
450 sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL); in esdhc_of_set_clock()
454 static void esdhc_pltfm_set_bus_width(struct sdhci_host *host, int width) in esdhc_pltfm_set_bus_width() argument
458 ctrl = sdhci_readl(host, ESDHC_PROCTL); in esdhc_pltfm_set_bus_width()
473 sdhci_writel(host, ctrl, ESDHC_PROCTL); in esdhc_pltfm_set_bus_width()
476 static void esdhc_reset(struct sdhci_host *host, u8 mask) in esdhc_reset() argument
478 sdhci_reset(host, mask); in esdhc_reset()
480 sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); in esdhc_reset()
481 sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); in esdhc_reset()
488 struct sdhci_host *host = dev_get_drvdata(dev); in esdhc_of_suspend() local
490 esdhc_proctl = sdhci_readl(host, SDHCI_HOST_CONTROL); in esdhc_of_suspend()
492 return sdhci_suspend_host(host); in esdhc_of_suspend()
497 struct sdhci_host *host = dev_get_drvdata(dev); in esdhc_of_resume() local
498 int ret = sdhci_resume_host(host); in esdhc_of_resume()
502 esdhc_of_enable_dma(host); in esdhc_of_resume()
503 sdhci_writel(host, esdhc_proctl, SDHCI_HOST_CONTROL); in esdhc_of_resume()
565 static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) in esdhc_init() argument
571 pltfm_host = sdhci_priv(host); in esdhc_init()
575 host_ver = sdhci_readw(host, SDHCI_HOST_VERSION); in esdhc_init()
585 struct sdhci_host *host; in sdhci_esdhc_probe() local
592 host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata, 0); in sdhci_esdhc_probe()
594 host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata, 0); in sdhci_esdhc_probe()
596 if (IS_ERR(host)) in sdhci_esdhc_probe()
597 return PTR_ERR(host); in sdhci_esdhc_probe()
599 esdhc_init(pdev, host); in sdhci_esdhc_probe()
609 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; in sdhci_esdhc_probe()
612 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; in sdhci_esdhc_probe()
619 host->quirks2 |= SDHCI_QUIRK2_BROKEN_HOST_CONTROL; in sdhci_esdhc_probe()
623 ret = mmc_of_parse(host->mmc); in sdhci_esdhc_probe()
627 mmc_of_parse_voltage(np, &host->ocr_mask); in sdhci_esdhc_probe()
629 ret = sdhci_add_host(host); in sdhci_esdhc_probe()