Lines Matching full:host
2 * linux/drivers/mmc/host/au1xmmc.c - AU1XX0 MMC driver
45 #include <linux/mmc/host.h>
126 /* Status flags used by the host structure */
166 static inline void IRQ_ON(struct au1xmmc_host *host, u32 mask) in IRQ_ON() argument
168 u32 val = __raw_readl(HOST_CONFIG(host)); in IRQ_ON()
170 __raw_writel(val, HOST_CONFIG(host)); in IRQ_ON()
174 static inline void FLUSH_FIFO(struct au1xmmc_host *host) in FLUSH_FIFO() argument
176 u32 val = __raw_readl(HOST_CONFIG2(host)); in FLUSH_FIFO()
178 __raw_writel(val | SD_CONFIG2_FF, HOST_CONFIG2(host)); in FLUSH_FIFO()
185 __raw_writel(val, HOST_CONFIG2(host)); in FLUSH_FIFO()
189 static inline void IRQ_OFF(struct au1xmmc_host *host, u32 mask) in IRQ_OFF() argument
191 u32 val = __raw_readl(HOST_CONFIG(host)); in IRQ_OFF()
193 __raw_writel(val, HOST_CONFIG(host)); in IRQ_OFF()
197 static inline void SEND_STOP(struct au1xmmc_host *host) in SEND_STOP() argument
201 WARN_ON(host->status != HOST_S_DATA); in SEND_STOP()
202 host->status = HOST_S_STOP; in SEND_STOP()
204 config2 = __raw_readl(HOST_CONFIG2(host)); in SEND_STOP()
205 __raw_writel(config2 | SD_CONFIG2_DF, HOST_CONFIG2(host)); in SEND_STOP()
209 __raw_writel(STOP_CMD, HOST_CMD(host)); in SEND_STOP()
213 static void au1xmmc_set_power(struct au1xmmc_host *host, int state) in au1xmmc_set_power() argument
215 if (host->platdata && host->platdata->set_power) in au1xmmc_set_power()
216 host->platdata->set_power(host->mmc, state); in au1xmmc_set_power()
221 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_card_inserted() local
223 if (host->platdata && host->platdata->card_inserted) in au1xmmc_card_inserted()
224 return !!host->platdata->card_inserted(host->mmc); in au1xmmc_card_inserted()
231 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_card_readonly() local
233 if (host->platdata && host->platdata->card_readonly) in au1xmmc_card_readonly()
234 return !!host->platdata->card_readonly(mmc); in au1xmmc_card_readonly()
239 static void au1xmmc_finish_request(struct au1xmmc_host *host) in au1xmmc_finish_request() argument
241 struct mmc_request *mrq = host->mrq; in au1xmmc_finish_request()
243 host->mrq = NULL; in au1xmmc_finish_request()
244 host->flags &= HOST_F_ACTIVE | HOST_F_DMA; in au1xmmc_finish_request()
246 host->dma.len = 0; in au1xmmc_finish_request()
247 host->dma.dir = 0; in au1xmmc_finish_request()
249 host->pio.index = 0; in au1xmmc_finish_request()
250 host->pio.offset = 0; in au1xmmc_finish_request()
251 host->pio.len = 0; in au1xmmc_finish_request()
253 host->status = HOST_S_IDLE; in au1xmmc_finish_request()
255 mmc_request_done(host->mmc, mrq); in au1xmmc_finish_request()
260 struct au1xmmc_host *host = (struct au1xmmc_host *) param; in au1xmmc_tasklet_finish() local
261 au1xmmc_finish_request(host); in au1xmmc_tasklet_finish()
264 static int au1xmmc_send_command(struct au1xmmc_host *host, int wait, in au1xmmc_send_command() argument
304 __raw_writel(cmd->arg, HOST_CMDARG(host)); in au1xmmc_send_command()
308 IRQ_OFF(host, SD_CONFIG_CR); in au1xmmc_send_command()
310 __raw_writel((mmccmd | SD_CMD_GO), HOST_CMD(host)); in au1xmmc_send_command()
314 while (__raw_readl(HOST_CMD(host)) & SD_CMD_GO) in au1xmmc_send_command()
319 u32 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_send_command()
322 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_send_command()
325 __raw_writel(SD_STATUS_CR, HOST_STATUS(host)); in au1xmmc_send_command()
327 IRQ_ON(host, SD_CONFIG_CR); in au1xmmc_send_command()
333 static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) in au1xmmc_data_complete() argument
335 struct mmc_request *mrq = host->mrq; in au1xmmc_data_complete()
339 WARN_ON((host->status != HOST_S_DATA) && (host->status != HOST_S_STOP)); in au1xmmc_data_complete()
341 if (host->mrq == NULL) in au1xmmc_data_complete()
347 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_data_complete()
350 while ((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB)) in au1xmmc_data_complete()
351 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_data_complete()
354 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir); in au1xmmc_data_complete()
358 if (host->flags & HOST_F_XMIT) in au1xmmc_data_complete()
365 __raw_writel(SD_STATUS_WC | SD_STATUS_RC, HOST_STATUS(host)); in au1xmmc_data_complete()
370 if (host->flags & (HOST_F_DMA | HOST_F_DBDMA)) { in au1xmmc_data_complete()
371 u32 chan = DMA_CHANNEL(host); in au1xmmc_data_complete()
378 (data->blocks * data->blksz) - host->pio.len; in au1xmmc_data_complete()
381 au1xmmc_finish_request(host); in au1xmmc_data_complete()
386 struct au1xmmc_host *host = (struct au1xmmc_host *)param; in au1xmmc_tasklet_data() local
388 u32 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_tasklet_data()
389 au1xmmc_data_complete(host, status); in au1xmmc_tasklet_data()
394 static void au1xmmc_send_pio(struct au1xmmc_host *host) in au1xmmc_send_pio() argument
402 data = host->mrq->data; in au1xmmc_send_pio()
404 if (!(host->flags & HOST_F_XMIT)) in au1xmmc_send_pio()
408 sg = &data->sg[host->pio.index]; in au1xmmc_send_pio()
409 sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset; in au1xmmc_send_pio()
412 sg_len = data->sg[host->pio.index].length - host->pio.offset; in au1xmmc_send_pio()
415 max = (sg_len > host->pio.len) ? host->pio.len : sg_len; in au1xmmc_send_pio()
420 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_send_pio()
427 __raw_writel((unsigned long)val, HOST_TXPORT(host)); in au1xmmc_send_pio()
432 host->pio.len -= count; in au1xmmc_send_pio()
433 host->pio.offset += count; in au1xmmc_send_pio()
436 host->pio.index++; in au1xmmc_send_pio()
437 host->pio.offset = 0; in au1xmmc_send_pio()
440 if (host->pio.len == 0) { in au1xmmc_send_pio()
441 IRQ_OFF(host, SD_CONFIG_TH); in au1xmmc_send_pio()
443 if (host->flags & HOST_F_STOP) in au1xmmc_send_pio()
444 SEND_STOP(host); in au1xmmc_send_pio()
446 tasklet_schedule(&host->data_task); in au1xmmc_send_pio()
450 static void au1xmmc_receive_pio(struct au1xmmc_host *host) in au1xmmc_receive_pio() argument
458 data = host->mrq->data; in au1xmmc_receive_pio()
460 if (!(host->flags & HOST_F_RECV)) in au1xmmc_receive_pio()
463 max = host->pio.len; in au1xmmc_receive_pio()
465 if (host->pio.index < host->dma.len) { in au1xmmc_receive_pio()
466 sg = &data->sg[host->pio.index]; in au1xmmc_receive_pio()
467 sg_ptr = kmap_atomic(sg_page(sg)) + sg->offset + host->pio.offset; in au1xmmc_receive_pio()
470 sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset; in au1xmmc_receive_pio()
481 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_receive_pio()
487 DBG("RX CRC Error [%d + %d].\n", host->pdev->id, in au1xmmc_receive_pio()
488 host->pio.len, count); in au1xmmc_receive_pio()
493 DBG("RX Overrun [%d + %d]\n", host->pdev->id, in au1xmmc_receive_pio()
494 host->pio.len, count); in au1xmmc_receive_pio()
498 DBG("RX Underrun [%d + %d]\n", host->pdev->id, in au1xmmc_receive_pio()
499 host->pio.len, count); in au1xmmc_receive_pio()
503 val = __raw_readl(HOST_RXPORT(host)); in au1xmmc_receive_pio()
511 host->pio.len -= count; in au1xmmc_receive_pio()
512 host->pio.offset += count; in au1xmmc_receive_pio()
515 host->pio.index++; in au1xmmc_receive_pio()
516 host->pio.offset = 0; in au1xmmc_receive_pio()
519 if (host->pio.len == 0) { in au1xmmc_receive_pio()
520 /* IRQ_OFF(host, SD_CONFIG_RA | SD_CONFIG_RF); */ in au1xmmc_receive_pio()
521 IRQ_OFF(host, SD_CONFIG_NE); in au1xmmc_receive_pio()
523 if (host->flags & HOST_F_STOP) in au1xmmc_receive_pio()
524 SEND_STOP(host); in au1xmmc_receive_pio()
526 tasklet_schedule(&host->data_task); in au1xmmc_receive_pio()
533 static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status) in au1xmmc_cmd_complete() argument
535 struct mmc_request *mrq = host->mrq; in au1xmmc_cmd_complete()
540 if (!host->mrq) in au1xmmc_cmd_complete()
548 r[0] = __raw_readl(host->iobase + SD_RESP3); in au1xmmc_cmd_complete()
549 r[1] = __raw_readl(host->iobase + SD_RESP2); in au1xmmc_cmd_complete()
550 r[2] = __raw_readl(host->iobase + SD_RESP1); in au1xmmc_cmd_complete()
551 r[3] = __raw_readl(host->iobase + SD_RESP0); in au1xmmc_cmd_complete()
570 cmd->resp[0] = __raw_readl(host->iobase + SD_RESP0); in au1xmmc_cmd_complete()
578 trans = host->flags & (HOST_F_XMIT | HOST_F_RECV); in au1xmmc_cmd_complete()
581 IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA | SD_CONFIG_RF); in au1xmmc_cmd_complete()
582 tasklet_schedule(&host->finish_task); in au1xmmc_cmd_complete()
586 host->status = HOST_S_DATA; in au1xmmc_cmd_complete()
588 if ((host->flags & (HOST_F_DMA | HOST_F_DBDMA))) { in au1xmmc_cmd_complete()
589 u32 channel = DMA_CHANNEL(host); in au1xmmc_cmd_complete()
593 if (host->flags & HOST_F_RECV) { in au1xmmc_cmd_complete()
597 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_cmd_complete()
604 static void au1xmmc_set_clock(struct au1xmmc_host *host, int rate) in au1xmmc_set_clock() argument
606 unsigned int pbus = clk_get_rate(host->clk); in au1xmmc_set_clock()
610 config = __raw_readl(HOST_CONFIG(host)); in au1xmmc_set_clock()
615 __raw_writel(config, HOST_CONFIG(host)); in au1xmmc_set_clock()
619 static int au1xmmc_prepare_data(struct au1xmmc_host *host, in au1xmmc_prepare_data() argument
625 host->flags |= HOST_F_RECV; in au1xmmc_prepare_data()
627 host->flags |= HOST_F_XMIT; in au1xmmc_prepare_data()
629 if (host->mrq->stop) in au1xmmc_prepare_data()
630 host->flags |= HOST_F_STOP; in au1xmmc_prepare_data()
632 host->dma.dir = DMA_BIDIRECTIONAL; in au1xmmc_prepare_data()
634 host->dma.len = dma_map_sg(mmc_dev(host->mmc), data->sg, in au1xmmc_prepare_data()
635 data->sg_len, host->dma.dir); in au1xmmc_prepare_data()
637 if (host->dma.len == 0) in au1xmmc_prepare_data()
640 __raw_writel(data->blksz - 1, HOST_BLKSIZE(host)); in au1xmmc_prepare_data()
642 if (host->flags & (HOST_F_DMA | HOST_F_DBDMA)) { in au1xmmc_prepare_data()
644 u32 channel = DMA_CHANNEL(host); in au1xmmc_prepare_data()
648 for (i = 0; i < host->dma.len; i++) { in au1xmmc_prepare_data()
655 if (i == host->dma.len - 1) in au1xmmc_prepare_data()
658 if (host->flags & HOST_F_XMIT) { in au1xmmc_prepare_data()
672 host->pio.index = 0; in au1xmmc_prepare_data()
673 host->pio.offset = 0; in au1xmmc_prepare_data()
674 host->pio.len = datalen; in au1xmmc_prepare_data()
676 if (host->flags & HOST_F_XMIT) in au1xmmc_prepare_data()
677 IRQ_ON(host, SD_CONFIG_TH); in au1xmmc_prepare_data()
679 IRQ_ON(host, SD_CONFIG_NE); in au1xmmc_prepare_data()
680 /* IRQ_ON(host, SD_CONFIG_RA | SD_CONFIG_RF); */ in au1xmmc_prepare_data()
686 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in au1xmmc_prepare_data()
687 host->dma.dir); in au1xmmc_prepare_data()
694 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_request() local
698 WARN_ON(host->status != HOST_S_IDLE); in au1xmmc_request()
700 host->mrq = mrq; in au1xmmc_request()
701 host->status = HOST_S_CMD; in au1xmmc_request()
706 au1xmmc_finish_request(host); in au1xmmc_request()
711 FLUSH_FIFO(host); in au1xmmc_request()
712 ret = au1xmmc_prepare_data(host, mrq->data); in au1xmmc_request()
716 ret = au1xmmc_send_command(host, 0, mrq->cmd, mrq->data); in au1xmmc_request()
720 au1xmmc_finish_request(host); in au1xmmc_request()
724 static void au1xmmc_reset_controller(struct au1xmmc_host *host) in au1xmmc_reset_controller() argument
727 __raw_writel(SD_ENABLE_CE, HOST_ENABLE(host)); in au1xmmc_reset_controller()
731 __raw_writel(SD_ENABLE_R | SD_ENABLE_CE, HOST_ENABLE(host)); in au1xmmc_reset_controller()
735 __raw_writel(~0, HOST_STATUS(host)); in au1xmmc_reset_controller()
738 __raw_writel(0, HOST_BLKSIZE(host)); in au1xmmc_reset_controller()
739 __raw_writel(0x001fffff, HOST_TIMEOUT(host)); in au1xmmc_reset_controller()
742 __raw_writel(SD_CONFIG2_EN, HOST_CONFIG2(host)); in au1xmmc_reset_controller()
745 __raw_writel(SD_CONFIG2_EN | SD_CONFIG2_FF, HOST_CONFIG2(host)); in au1xmmc_reset_controller()
749 __raw_writel(SD_CONFIG2_EN, HOST_CONFIG2(host)); in au1xmmc_reset_controller()
753 __raw_writel(AU1XMMC_INTERRUPTS, HOST_CONFIG(host)); in au1xmmc_reset_controller()
760 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_set_ios() local
764 au1xmmc_set_power(host, 0); in au1xmmc_set_ios()
766 au1xmmc_set_power(host, 1); in au1xmmc_set_ios()
769 if (ios->clock && ios->clock != host->clock) { in au1xmmc_set_ios()
770 au1xmmc_set_clock(host, ios->clock); in au1xmmc_set_ios()
771 host->clock = ios->clock; in au1xmmc_set_ios()
774 config2 = __raw_readl(HOST_CONFIG2(host)); in au1xmmc_set_ios()
787 __raw_writel(config2, HOST_CONFIG2(host)); in au1xmmc_set_ios()
797 struct au1xmmc_host *host = dev_id; in au1xmmc_irq() local
800 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_irq()
806 mmc_signal_sdio_irq(host->mmc); in au1xmmc_irq()
808 if (host->mrq && (status & STATUS_TIMEOUT)) { in au1xmmc_irq()
810 host->mrq->cmd->error = -ETIMEDOUT; in au1xmmc_irq()
812 host->mrq->data->error = -ETIMEDOUT; in au1xmmc_irq()
815 IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH); in au1xmmc_irq()
817 /* IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA | SD_CONFIG_RF); */ in au1xmmc_irq()
818 tasklet_schedule(&host->finish_task); in au1xmmc_irq()
823 if (!(host->flags & HOST_F_DMA) && (status & SD_STATUS_NE)) in au1xmmc_irq()
824 au1xmmc_receive_pio(host); in au1xmmc_irq()
826 au1xmmc_data_complete(host, status); in au1xmmc_irq()
827 /* tasklet_schedule(&host->data_task); */ in au1xmmc_irq()
832 if (host->status == HOST_S_CMD) in au1xmmc_irq()
833 au1xmmc_cmd_complete(host, status); in au1xmmc_irq()
835 } else if (!(host->flags & HOST_F_DMA)) { in au1xmmc_irq()
836 if ((host->flags & HOST_F_XMIT) && (status & STATUS_DATA_OUT)) in au1xmmc_irq()
837 au1xmmc_send_pio(host); in au1xmmc_irq()
838 else if ((host->flags & HOST_F_RECV) && (status & STATUS_DATA_IN)) in au1xmmc_irq()
839 au1xmmc_receive_pio(host); in au1xmmc_irq()
842 DBG("Unhandled status %8.8x\n", host->pdev->id, in au1xmmc_irq()
846 __raw_writel(status, HOST_STATUS(host)); in au1xmmc_irq()
866 struct au1xmmc_host *host = (struct au1xmmc_host *)dev_id; in au1xmmc_dbdma_callback() local
869 if (!host->mrq) in au1xmmc_dbdma_callback()
872 if (host->flags & HOST_F_STOP) in au1xmmc_dbdma_callback()
873 SEND_STOP(host); in au1xmmc_dbdma_callback()
875 tasklet_schedule(&host->data_task); in au1xmmc_dbdma_callback()
878 static int au1xmmc_dbdma_init(struct au1xmmc_host *host) in au1xmmc_dbdma_init() argument
883 res = platform_get_resource(host->pdev, IORESOURCE_DMA, 0); in au1xmmc_dbdma_init()
888 res = platform_get_resource(host->pdev, IORESOURCE_DMA, 1); in au1xmmc_dbdma_init()
896 host->tx_chan = au1xxx_dbdma_chan_alloc(memid, txid, in au1xmmc_dbdma_init()
897 au1xmmc_dbdma_callback, (void *)host); in au1xmmc_dbdma_init()
898 if (!host->tx_chan) { in au1xmmc_dbdma_init()
899 dev_err(&host->pdev->dev, "cannot allocate TX DMA\n"); in au1xmmc_dbdma_init()
903 host->rx_chan = au1xxx_dbdma_chan_alloc(rxid, memid, in au1xmmc_dbdma_init()
904 au1xmmc_dbdma_callback, (void *)host); in au1xmmc_dbdma_init()
905 if (!host->rx_chan) { in au1xmmc_dbdma_init()
906 dev_err(&host->pdev->dev, "cannot allocate RX DMA\n"); in au1xmmc_dbdma_init()
907 au1xxx_dbdma_chan_free(host->tx_chan); in au1xmmc_dbdma_init()
911 au1xxx_dbdma_set_devwidth(host->tx_chan, 8); in au1xmmc_dbdma_init()
912 au1xxx_dbdma_set_devwidth(host->rx_chan, 8); in au1xmmc_dbdma_init()
914 au1xxx_dbdma_ring_alloc(host->tx_chan, AU1XMMC_DESCRIPTOR_COUNT); in au1xmmc_dbdma_init()
915 au1xxx_dbdma_ring_alloc(host->rx_chan, AU1XMMC_DESCRIPTOR_COUNT); in au1xmmc_dbdma_init()
918 host->flags |= HOST_F_DMA | HOST_F_DBDMA; in au1xmmc_dbdma_init()
923 static void au1xmmc_dbdma_shutdown(struct au1xmmc_host *host) in au1xmmc_dbdma_shutdown() argument
925 if (host->flags & HOST_F_DMA) { in au1xmmc_dbdma_shutdown()
926 host->flags &= ~HOST_F_DMA; in au1xmmc_dbdma_shutdown()
927 au1xxx_dbdma_chan_free(host->tx_chan); in au1xmmc_dbdma_shutdown()
928 au1xxx_dbdma_chan_free(host->rx_chan); in au1xmmc_dbdma_shutdown()
934 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_enable_sdio_irq() local
937 IRQ_ON(host, SD_CONFIG_SI); in au1xmmc_enable_sdio_irq()
939 IRQ_OFF(host, SD_CONFIG_SI); in au1xmmc_enable_sdio_irq()
953 struct au1xmmc_host *host; in au1xmmc_probe() local
964 host = mmc_priv(mmc); in au1xmmc_probe()
965 host->mmc = mmc; in au1xmmc_probe()
966 host->platdata = pdev->dev.platform_data; in au1xmmc_probe()
967 host->pdev = pdev; in au1xmmc_probe()
976 host->ioarea = request_mem_region(r->start, resource_size(r), in au1xmmc_probe()
978 if (!host->ioarea) { in au1xmmc_probe()
983 host->iobase = ioremap(r->start, 0x3c); in au1xmmc_probe()
984 if (!host->iobase) { in au1xmmc_probe()
994 host->irq = r->start; in au1xmmc_probe()
1021 if (host->ioarea->start == AU1100_SD0_PHYS_ADDR) in au1xmmc_probe()
1026 ret = request_irq(host->irq, au1xmmc_irq, iflag, DRIVER_NAME, host); in au1xmmc_probe()
1032 host->clk = clk_get(&pdev->dev, ALCHEMY_PERIPH_CLK); in au1xmmc_probe()
1033 if (IS_ERR(host->clk)) { in au1xmmc_probe()
1035 ret = PTR_ERR(host->clk); in au1xmmc_probe()
1039 ret = clk_prepare_enable(host->clk); in au1xmmc_probe()
1045 host->status = HOST_S_IDLE; in au1xmmc_probe()
1048 if (host->platdata && host->platdata->cd_setup) { in au1xmmc_probe()
1049 ret = host->platdata->cd_setup(mmc, 1); in au1xmmc_probe()
1058 if (host->platdata) in au1xmmc_probe()
1059 mmc->caps &= ~(host->platdata->mask_host_caps); in au1xmmc_probe()
1061 tasklet_init(&host->data_task, au1xmmc_tasklet_data, in au1xmmc_probe()
1062 (unsigned long)host); in au1xmmc_probe()
1064 tasklet_init(&host->finish_task, au1xmmc_tasklet_finish, in au1xmmc_probe()
1065 (unsigned long)host); in au1xmmc_probe()
1068 ret = au1xmmc_dbdma_init(host); in au1xmmc_probe()
1074 if (host->platdata && host->platdata->led) { in au1xmmc_probe()
1075 struct led_classdev *led = host->platdata->led; in au1xmmc_probe()
1085 au1xmmc_reset_controller(host); in au1xmmc_probe()
1089 dev_err(&pdev->dev, "cannot add mmc host\n"); in au1xmmc_probe()
1093 platform_set_drvdata(pdev, host); in au1xmmc_probe()
1096 " (mode=%s)\n", pdev->id, host->iobase, in au1xmmc_probe()
1097 host->flags & HOST_F_DMA ? "dma" : "pio"); in au1xmmc_probe()
1103 if (host->platdata && host->platdata->led) in au1xmmc_probe()
1104 led_classdev_unregister(host->platdata->led); in au1xmmc_probe()
1107 __raw_writel(0, HOST_ENABLE(host)); in au1xmmc_probe()
1108 __raw_writel(0, HOST_CONFIG(host)); in au1xmmc_probe()
1109 __raw_writel(0, HOST_CONFIG2(host)); in au1xmmc_probe()
1112 if (host->flags & HOST_F_DBDMA) in au1xmmc_probe()
1113 au1xmmc_dbdma_shutdown(host); in au1xmmc_probe()
1115 tasklet_kill(&host->data_task); in au1xmmc_probe()
1116 tasklet_kill(&host->finish_task); in au1xmmc_probe()
1118 if (host->platdata && host->platdata->cd_setup && in au1xmmc_probe()
1120 host->platdata->cd_setup(mmc, 0); in au1xmmc_probe()
1122 clk_disable_unprepare(host->clk); in au1xmmc_probe()
1123 clk_put(host->clk); in au1xmmc_probe()
1125 free_irq(host->irq, host); in au1xmmc_probe()
1127 iounmap((void *)host->iobase); in au1xmmc_probe()
1129 release_resource(host->ioarea); in au1xmmc_probe()
1130 kfree(host->ioarea); in au1xmmc_probe()
1139 struct au1xmmc_host *host = platform_get_drvdata(pdev); in au1xmmc_remove() local
1141 if (host) { in au1xmmc_remove()
1142 mmc_remove_host(host->mmc); in au1xmmc_remove()
1145 if (host->platdata && host->platdata->led) in au1xmmc_remove()
1146 led_classdev_unregister(host->platdata->led); in au1xmmc_remove()
1149 if (host->platdata && host->platdata->cd_setup && in au1xmmc_remove()
1150 !(host->mmc->caps & MMC_CAP_NEEDS_POLL)) in au1xmmc_remove()
1151 host->platdata->cd_setup(host->mmc, 0); in au1xmmc_remove()
1153 __raw_writel(0, HOST_ENABLE(host)); in au1xmmc_remove()
1154 __raw_writel(0, HOST_CONFIG(host)); in au1xmmc_remove()
1155 __raw_writel(0, HOST_CONFIG2(host)); in au1xmmc_remove()
1158 tasklet_kill(&host->data_task); in au1xmmc_remove()
1159 tasklet_kill(&host->finish_task); in au1xmmc_remove()
1161 if (host->flags & HOST_F_DBDMA) in au1xmmc_remove()
1162 au1xmmc_dbdma_shutdown(host); in au1xmmc_remove()
1164 au1xmmc_set_power(host, 0); in au1xmmc_remove()
1166 clk_disable_unprepare(host->clk); in au1xmmc_remove()
1167 clk_put(host->clk); in au1xmmc_remove()
1169 free_irq(host->irq, host); in au1xmmc_remove()
1170 iounmap((void *)host->iobase); in au1xmmc_remove()
1171 release_resource(host->ioarea); in au1xmmc_remove()
1172 kfree(host->ioarea); in au1xmmc_remove()
1174 mmc_free_host(host->mmc); in au1xmmc_remove()
1182 struct au1xmmc_host *host = platform_get_drvdata(pdev); in au1xmmc_suspend() local
1184 __raw_writel(0, HOST_CONFIG2(host)); in au1xmmc_suspend()
1185 __raw_writel(0, HOST_CONFIG(host)); in au1xmmc_suspend()
1186 __raw_writel(0xffffffff, HOST_STATUS(host)); in au1xmmc_suspend()
1187 __raw_writel(0, HOST_ENABLE(host)); in au1xmmc_suspend()
1195 struct au1xmmc_host *host = platform_get_drvdata(pdev); in au1xmmc_resume() local
1197 au1xmmc_reset_controller(host); in au1xmmc_resume()