Lines Matching full:host

3  * linux/drivers/mmc/host/au1xmmc.c - AU1XX0 MMC driver
43 #include <linux/mmc/host.h>
125 /* Status flags used by the host structure */
165 static inline void IRQ_ON(struct au1xmmc_host *host, u32 mask) in IRQ_ON() argument
167 u32 val = __raw_readl(HOST_CONFIG(host)); in IRQ_ON()
169 __raw_writel(val, HOST_CONFIG(host)); in IRQ_ON()
173 static inline void FLUSH_FIFO(struct au1xmmc_host *host) in FLUSH_FIFO() argument
175 u32 val = __raw_readl(HOST_CONFIG2(host)); in FLUSH_FIFO()
177 __raw_writel(val | SD_CONFIG2_FF, HOST_CONFIG2(host)); in FLUSH_FIFO()
184 __raw_writel(val, HOST_CONFIG2(host)); in FLUSH_FIFO()
188 static inline void IRQ_OFF(struct au1xmmc_host *host, u32 mask) in IRQ_OFF() argument
190 u32 val = __raw_readl(HOST_CONFIG(host)); in IRQ_OFF()
192 __raw_writel(val, HOST_CONFIG(host)); in IRQ_OFF()
196 static inline void SEND_STOP(struct au1xmmc_host *host) in SEND_STOP() argument
200 WARN_ON(host->status != HOST_S_DATA); in SEND_STOP()
201 host->status = HOST_S_STOP; in SEND_STOP()
203 config2 = __raw_readl(HOST_CONFIG2(host)); in SEND_STOP()
204 __raw_writel(config2 | SD_CONFIG2_DF, HOST_CONFIG2(host)); in SEND_STOP()
208 __raw_writel(STOP_CMD, HOST_CMD(host)); in SEND_STOP()
212 static void au1xmmc_set_power(struct au1xmmc_host *host, int state) in au1xmmc_set_power() argument
214 if (host->platdata && host->platdata->set_power) in au1xmmc_set_power()
215 host->platdata->set_power(host->mmc, state); in au1xmmc_set_power()
220 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_card_inserted() local
222 if (host->platdata && host->platdata->card_inserted) in au1xmmc_card_inserted()
223 return !!host->platdata->card_inserted(host->mmc); in au1xmmc_card_inserted()
230 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_card_readonly() local
232 if (host->platdata && host->platdata->card_readonly) in au1xmmc_card_readonly()
233 return !!host->platdata->card_readonly(mmc); in au1xmmc_card_readonly()
238 static void au1xmmc_finish_request(struct au1xmmc_host *host) in au1xmmc_finish_request() argument
240 struct mmc_request *mrq = host->mrq; in au1xmmc_finish_request()
242 host->mrq = NULL; in au1xmmc_finish_request()
243 host->flags &= HOST_F_ACTIVE | HOST_F_DMA; in au1xmmc_finish_request()
245 host->dma.len = 0; in au1xmmc_finish_request()
246 host->dma.dir = 0; in au1xmmc_finish_request()
248 host->pio.index = 0; in au1xmmc_finish_request()
249 host->pio.offset = 0; in au1xmmc_finish_request()
250 host->pio.len = 0; in au1xmmc_finish_request()
252 host->status = HOST_S_IDLE; in au1xmmc_finish_request()
254 mmc_request_done(host->mmc, mrq); in au1xmmc_finish_request()
259 struct au1xmmc_host *host = from_work(host, t, finish_bh_work); in au1xmmc_finish_bh_work() local
260 au1xmmc_finish_request(host); in au1xmmc_finish_bh_work()
263 static int au1xmmc_send_command(struct au1xmmc_host *host, in au1xmmc_send_command() argument
303 __raw_writel(cmd->arg, HOST_CMDARG(host)); in au1xmmc_send_command()
306 __raw_writel((mmccmd | SD_CMD_GO), HOST_CMD(host)); in au1xmmc_send_command()
310 while (__raw_readl(HOST_CMD(host)) & SD_CMD_GO) in au1xmmc_send_command()
316 static void au1xmmc_data_complete(struct au1xmmc_host *host, u32 status) in au1xmmc_data_complete() argument
318 struct mmc_request *mrq = host->mrq; in au1xmmc_data_complete()
322 WARN_ON((host->status != HOST_S_DATA) && (host->status != HOST_S_STOP)); in au1xmmc_data_complete()
324 if (host->mrq == NULL) in au1xmmc_data_complete()
330 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_data_complete()
333 while ((host->flags & HOST_F_XMIT) && (status & SD_STATUS_DB)) in au1xmmc_data_complete()
334 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_data_complete()
337 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, host->dma.dir); in au1xmmc_data_complete()
341 if (host->flags & HOST_F_XMIT) in au1xmmc_data_complete()
348 __raw_writel(SD_STATUS_WC | SD_STATUS_RC, HOST_STATUS(host)); in au1xmmc_data_complete()
353 if (host->flags & (HOST_F_DMA | HOST_F_DBDMA)) { in au1xmmc_data_complete()
354 u32 chan = DMA_CHANNEL(host); in au1xmmc_data_complete()
361 (data->blocks * data->blksz) - host->pio.len; in au1xmmc_data_complete()
364 au1xmmc_finish_request(host); in au1xmmc_data_complete()
369 struct au1xmmc_host *host = from_work(host, t, data_bh_work); in au1xmmc_data_bh_work() local
371 u32 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_data_bh_work()
372 au1xmmc_data_complete(host, status); in au1xmmc_data_bh_work()
377 static void au1xmmc_send_pio(struct au1xmmc_host *host) in au1xmmc_send_pio() argument
385 data = host->mrq->data; in au1xmmc_send_pio()
387 if (!(host->flags & HOST_F_XMIT)) in au1xmmc_send_pio()
391 sg = &data->sg[host->pio.index]; in au1xmmc_send_pio()
392 sg_ptr = kmap_local_page(sg_page(sg)) + sg->offset + host->pio.offset; in au1xmmc_send_pio()
395 sg_len = data->sg[host->pio.index].length - host->pio.offset; in au1xmmc_send_pio()
398 max = (sg_len > host->pio.len) ? host->pio.len : sg_len; in au1xmmc_send_pio()
403 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_send_pio()
410 __raw_writel((unsigned long)val, HOST_TXPORT(host)); in au1xmmc_send_pio()
415 host->pio.len -= count; in au1xmmc_send_pio()
416 host->pio.offset += count; in au1xmmc_send_pio()
419 host->pio.index++; in au1xmmc_send_pio()
420 host->pio.offset = 0; in au1xmmc_send_pio()
423 if (host->pio.len == 0) { in au1xmmc_send_pio()
424 IRQ_OFF(host, SD_CONFIG_TH); in au1xmmc_send_pio()
426 if (host->flags & HOST_F_STOP) in au1xmmc_send_pio()
427 SEND_STOP(host); in au1xmmc_send_pio()
429 queue_work(system_bh_wq, &host->data_bh_work); in au1xmmc_send_pio()
433 static void au1xmmc_receive_pio(struct au1xmmc_host *host) in au1xmmc_receive_pio() argument
441 data = host->mrq->data; in au1xmmc_receive_pio()
443 if (!(host->flags & HOST_F_RECV)) in au1xmmc_receive_pio()
446 max = host->pio.len; in au1xmmc_receive_pio()
448 if (host->pio.index < host->dma.len) { in au1xmmc_receive_pio()
449 sg = &data->sg[host->pio.index]; in au1xmmc_receive_pio()
450 sg_ptr = kmap_local_page(sg_page(sg)) + sg->offset + host->pio.offset; in au1xmmc_receive_pio()
453 sg_len = sg_dma_len(&data->sg[host->pio.index]) - host->pio.offset; in au1xmmc_receive_pio()
464 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_receive_pio()
470 DBG("RX CRC Error [%d + %d].\n", host->pdev->id, in au1xmmc_receive_pio()
471 host->pio.len, count); in au1xmmc_receive_pio()
476 DBG("RX Overrun [%d + %d]\n", host->pdev->id, in au1xmmc_receive_pio()
477 host->pio.len, count); in au1xmmc_receive_pio()
481 DBG("RX Underrun [%d + %d]\n", host->pdev->id, in au1xmmc_receive_pio()
482 host->pio.len, count); in au1xmmc_receive_pio()
486 val = __raw_readl(HOST_RXPORT(host)); in au1xmmc_receive_pio()
494 host->pio.len -= count; in au1xmmc_receive_pio()
495 host->pio.offset += count; in au1xmmc_receive_pio()
498 host->pio.index++; in au1xmmc_receive_pio()
499 host->pio.offset = 0; in au1xmmc_receive_pio()
502 if (host->pio.len == 0) { in au1xmmc_receive_pio()
503 /* IRQ_OFF(host, SD_CONFIG_RA | SD_CONFIG_RF); */ in au1xmmc_receive_pio()
504 IRQ_OFF(host, SD_CONFIG_NE); in au1xmmc_receive_pio()
506 if (host->flags & HOST_F_STOP) in au1xmmc_receive_pio()
507 SEND_STOP(host); in au1xmmc_receive_pio()
509 queue_work(system_bh_wq, &host->data_bh_work); in au1xmmc_receive_pio()
516 static void au1xmmc_cmd_complete(struct au1xmmc_host *host, u32 status) in au1xmmc_cmd_complete() argument
518 struct mmc_request *mrq = host->mrq; in au1xmmc_cmd_complete()
523 if (!host->mrq) in au1xmmc_cmd_complete()
531 r[0] = __raw_readl(host->iobase + SD_RESP3); in au1xmmc_cmd_complete()
532 r[1] = __raw_readl(host->iobase + SD_RESP2); in au1xmmc_cmd_complete()
533 r[2] = __raw_readl(host->iobase + SD_RESP1); in au1xmmc_cmd_complete()
534 r[3] = __raw_readl(host->iobase + SD_RESP0); in au1xmmc_cmd_complete()
553 cmd->resp[0] = __raw_readl(host->iobase + SD_RESP0); in au1xmmc_cmd_complete()
561 trans = host->flags & (HOST_F_XMIT | HOST_F_RECV); in au1xmmc_cmd_complete()
564 IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA | SD_CONFIG_RF); in au1xmmc_cmd_complete()
565 queue_work(system_bh_wq, &host->finish_bh_work); in au1xmmc_cmd_complete()
569 host->status = HOST_S_DATA; in au1xmmc_cmd_complete()
571 if ((host->flags & (HOST_F_DMA | HOST_F_DBDMA))) { in au1xmmc_cmd_complete()
572 u32 channel = DMA_CHANNEL(host); in au1xmmc_cmd_complete()
576 if (host->flags & HOST_F_RECV) { in au1xmmc_cmd_complete()
580 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_cmd_complete()
587 static void au1xmmc_set_clock(struct au1xmmc_host *host, int rate) in au1xmmc_set_clock() argument
589 unsigned int pbus = clk_get_rate(host->clk); in au1xmmc_set_clock()
593 config = __raw_readl(HOST_CONFIG(host)); in au1xmmc_set_clock()
598 __raw_writel(config, HOST_CONFIG(host)); in au1xmmc_set_clock()
602 static int au1xmmc_prepare_data(struct au1xmmc_host *host, in au1xmmc_prepare_data() argument
608 host->flags |= HOST_F_RECV; in au1xmmc_prepare_data()
610 host->flags |= HOST_F_XMIT; in au1xmmc_prepare_data()
612 if (host->mrq->stop) in au1xmmc_prepare_data()
613 host->flags |= HOST_F_STOP; in au1xmmc_prepare_data()
615 host->dma.dir = DMA_BIDIRECTIONAL; in au1xmmc_prepare_data()
617 host->dma.len = dma_map_sg(mmc_dev(host->mmc), data->sg, in au1xmmc_prepare_data()
618 data->sg_len, host->dma.dir); in au1xmmc_prepare_data()
620 if (host->dma.len == 0) in au1xmmc_prepare_data()
623 __raw_writel(data->blksz - 1, HOST_BLKSIZE(host)); in au1xmmc_prepare_data()
625 if (host->flags & (HOST_F_DMA | HOST_F_DBDMA)) { in au1xmmc_prepare_data()
627 u32 channel = DMA_CHANNEL(host); in au1xmmc_prepare_data()
631 for (i = 0; i < host->dma.len; i++) { in au1xmmc_prepare_data()
638 if (i == host->dma.len - 1) in au1xmmc_prepare_data()
641 if (host->flags & HOST_F_XMIT) { in au1xmmc_prepare_data()
655 host->pio.index = 0; in au1xmmc_prepare_data()
656 host->pio.offset = 0; in au1xmmc_prepare_data()
657 host->pio.len = datalen; in au1xmmc_prepare_data()
659 if (host->flags & HOST_F_XMIT) in au1xmmc_prepare_data()
660 IRQ_ON(host, SD_CONFIG_TH); in au1xmmc_prepare_data()
662 IRQ_ON(host, SD_CONFIG_NE); in au1xmmc_prepare_data()
663 /* IRQ_ON(host, SD_CONFIG_RA | SD_CONFIG_RF); */ in au1xmmc_prepare_data()
669 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in au1xmmc_prepare_data()
670 host->dma.dir); in au1xmmc_prepare_data()
677 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_request() local
681 WARN_ON(host->status != HOST_S_IDLE); in au1xmmc_request()
683 host->mrq = mrq; in au1xmmc_request()
684 host->status = HOST_S_CMD; in au1xmmc_request()
689 au1xmmc_finish_request(host); in au1xmmc_request()
694 FLUSH_FIFO(host); in au1xmmc_request()
695 ret = au1xmmc_prepare_data(host, mrq->data); in au1xmmc_request()
699 ret = au1xmmc_send_command(host, mrq->cmd, mrq->data); in au1xmmc_request()
703 au1xmmc_finish_request(host); in au1xmmc_request()
707 static void au1xmmc_reset_controller(struct au1xmmc_host *host) in au1xmmc_reset_controller() argument
710 __raw_writel(SD_ENABLE_CE, HOST_ENABLE(host)); in au1xmmc_reset_controller()
714 __raw_writel(SD_ENABLE_R | SD_ENABLE_CE, HOST_ENABLE(host)); in au1xmmc_reset_controller()
718 __raw_writel(~0, HOST_STATUS(host)); in au1xmmc_reset_controller()
721 __raw_writel(0, HOST_BLKSIZE(host)); in au1xmmc_reset_controller()
722 __raw_writel(0x001fffff, HOST_TIMEOUT(host)); in au1xmmc_reset_controller()
725 __raw_writel(SD_CONFIG2_EN, HOST_CONFIG2(host)); in au1xmmc_reset_controller()
728 __raw_writel(SD_CONFIG2_EN | SD_CONFIG2_FF, HOST_CONFIG2(host)); in au1xmmc_reset_controller()
732 __raw_writel(SD_CONFIG2_EN, HOST_CONFIG2(host)); in au1xmmc_reset_controller()
736 __raw_writel(AU1XMMC_INTERRUPTS, HOST_CONFIG(host)); in au1xmmc_reset_controller()
743 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_set_ios() local
747 au1xmmc_set_power(host, 0); in au1xmmc_set_ios()
749 au1xmmc_set_power(host, 1); in au1xmmc_set_ios()
752 if (ios->clock && ios->clock != host->clock) { in au1xmmc_set_ios()
753 au1xmmc_set_clock(host, ios->clock); in au1xmmc_set_ios()
754 host->clock = ios->clock; in au1xmmc_set_ios()
757 config2 = __raw_readl(HOST_CONFIG2(host)); in au1xmmc_set_ios()
770 __raw_writel(config2, HOST_CONFIG2(host)); in au1xmmc_set_ios()
780 struct au1xmmc_host *host = dev_id; in au1xmmc_irq() local
783 status = __raw_readl(HOST_STATUS(host)); in au1xmmc_irq()
789 mmc_signal_sdio_irq(host->mmc); in au1xmmc_irq()
791 if (host->mrq && (status & STATUS_TIMEOUT)) { in au1xmmc_irq()
793 host->mrq->cmd->error = -ETIMEDOUT; in au1xmmc_irq()
795 host->mrq->data->error = -ETIMEDOUT; in au1xmmc_irq()
798 IRQ_OFF(host, SD_CONFIG_NE | SD_CONFIG_TH); in au1xmmc_irq()
800 /* IRQ_OFF(host, SD_CONFIG_TH | SD_CONFIG_RA | SD_CONFIG_RF); */ in au1xmmc_irq()
801 queue_work(system_bh_wq, &host->finish_bh_work); in au1xmmc_irq()
806 if (!(host->flags & HOST_F_DMA) && (status & SD_STATUS_NE)) in au1xmmc_irq()
807 au1xmmc_receive_pio(host); in au1xmmc_irq()
809 au1xmmc_data_complete(host, status); in au1xmmc_irq()
810 /* queue_work(system_bh_wq, &host->data_bh_work); */ in au1xmmc_irq()
815 if (host->status == HOST_S_CMD) in au1xmmc_irq()
816 au1xmmc_cmd_complete(host, status); in au1xmmc_irq()
818 } else if (!(host->flags & HOST_F_DMA)) { in au1xmmc_irq()
819 if ((host->flags & HOST_F_XMIT) && (status & STATUS_DATA_OUT)) in au1xmmc_irq()
820 au1xmmc_send_pio(host); in au1xmmc_irq()
821 else if ((host->flags & HOST_F_RECV) && (status & STATUS_DATA_IN)) in au1xmmc_irq()
822 au1xmmc_receive_pio(host); in au1xmmc_irq()
825 DBG("Unhandled status %8.8x\n", host->pdev->id, in au1xmmc_irq()
829 __raw_writel(status, HOST_STATUS(host)); in au1xmmc_irq()
849 struct au1xmmc_host *host = (struct au1xmmc_host *)dev_id; in au1xmmc_dbdma_callback() local
852 if (!host->mrq) in au1xmmc_dbdma_callback()
855 if (host->flags & HOST_F_STOP) in au1xmmc_dbdma_callback()
856 SEND_STOP(host); in au1xmmc_dbdma_callback()
858 queue_work(system_bh_wq, &host->data_bh_work); in au1xmmc_dbdma_callback()
861 static int au1xmmc_dbdma_init(struct au1xmmc_host *host) in au1xmmc_dbdma_init() argument
866 res = platform_get_resource(host->pdev, IORESOURCE_DMA, 0); in au1xmmc_dbdma_init()
871 res = platform_get_resource(host->pdev, IORESOURCE_DMA, 1); in au1xmmc_dbdma_init()
879 host->tx_chan = au1xxx_dbdma_chan_alloc(memid, txid, in au1xmmc_dbdma_init()
880 au1xmmc_dbdma_callback, (void *)host); in au1xmmc_dbdma_init()
881 if (!host->tx_chan) { in au1xmmc_dbdma_init()
882 dev_err(&host->pdev->dev, "cannot allocate TX DMA\n"); in au1xmmc_dbdma_init()
886 host->rx_chan = au1xxx_dbdma_chan_alloc(rxid, memid, in au1xmmc_dbdma_init()
887 au1xmmc_dbdma_callback, (void *)host); in au1xmmc_dbdma_init()
888 if (!host->rx_chan) { in au1xmmc_dbdma_init()
889 dev_err(&host->pdev->dev, "cannot allocate RX DMA\n"); in au1xmmc_dbdma_init()
890 au1xxx_dbdma_chan_free(host->tx_chan); in au1xmmc_dbdma_init()
894 au1xxx_dbdma_set_devwidth(host->tx_chan, 8); in au1xmmc_dbdma_init()
895 au1xxx_dbdma_set_devwidth(host->rx_chan, 8); in au1xmmc_dbdma_init()
897 au1xxx_dbdma_ring_alloc(host->tx_chan, AU1XMMC_DESCRIPTOR_COUNT); in au1xmmc_dbdma_init()
898 au1xxx_dbdma_ring_alloc(host->rx_chan, AU1XMMC_DESCRIPTOR_COUNT); in au1xmmc_dbdma_init()
901 host->flags |= HOST_F_DMA | HOST_F_DBDMA; in au1xmmc_dbdma_init()
906 static void au1xmmc_dbdma_shutdown(struct au1xmmc_host *host) in au1xmmc_dbdma_shutdown() argument
908 if (host->flags & HOST_F_DMA) { in au1xmmc_dbdma_shutdown()
909 host->flags &= ~HOST_F_DMA; in au1xmmc_dbdma_shutdown()
910 au1xxx_dbdma_chan_free(host->tx_chan); in au1xmmc_dbdma_shutdown()
911 au1xxx_dbdma_chan_free(host->rx_chan); in au1xmmc_dbdma_shutdown()
917 struct au1xmmc_host *host = mmc_priv(mmc); in au1xmmc_enable_sdio_irq() local
920 IRQ_ON(host, SD_CONFIG_SI); in au1xmmc_enable_sdio_irq()
922 IRQ_OFF(host, SD_CONFIG_SI); in au1xmmc_enable_sdio_irq()
936 struct au1xmmc_host *host; in au1xmmc_probe() local
947 host = mmc_priv(mmc); in au1xmmc_probe()
948 host->mmc = mmc; in au1xmmc_probe()
949 host->platdata = pdev->dev.platform_data; in au1xmmc_probe()
950 host->pdev = pdev; in au1xmmc_probe()
959 host->ioarea = request_mem_region(r->start, resource_size(r), in au1xmmc_probe()
961 if (!host->ioarea) { in au1xmmc_probe()
966 host->iobase = ioremap(r->start, 0x3c); in au1xmmc_probe()
967 if (!host->iobase) { in au1xmmc_probe()
972 host->irq = platform_get_irq(pdev, 0); in au1xmmc_probe()
973 if (host->irq < 0) { in au1xmmc_probe()
974 ret = host->irq; in au1xmmc_probe()
1003 if (host->ioarea->start == AU1100_SD0_PHYS_ADDR) in au1xmmc_probe()
1008 ret = request_irq(host->irq, au1xmmc_irq, iflag, DRIVER_NAME, host); in au1xmmc_probe()
1014 host->clk = clk_get(&pdev->dev, ALCHEMY_PERIPH_CLK); in au1xmmc_probe()
1015 if (IS_ERR(host->clk)) { in au1xmmc_probe()
1017 ret = PTR_ERR(host->clk); in au1xmmc_probe()
1021 ret = clk_prepare_enable(host->clk); in au1xmmc_probe()
1027 host->status = HOST_S_IDLE; in au1xmmc_probe()
1030 if (host->platdata && host->platdata->cd_setup) { in au1xmmc_probe()
1031 ret = host->platdata->cd_setup(mmc, 1); in au1xmmc_probe()
1040 if (host->platdata) in au1xmmc_probe()
1041 mmc->caps &= ~(host->platdata->mask_host_caps); in au1xmmc_probe()
1043 INIT_WORK(&host->data_bh_work, au1xmmc_data_bh_work); in au1xmmc_probe()
1045 INIT_WORK(&host->finish_bh_work, au1xmmc_finish_bh_work); in au1xmmc_probe()
1048 ret = au1xmmc_dbdma_init(host); in au1xmmc_probe()
1054 if (host->platdata && host->platdata->led) { in au1xmmc_probe()
1055 struct led_classdev *led = host->platdata->led; in au1xmmc_probe()
1065 au1xmmc_reset_controller(host); in au1xmmc_probe()
1069 dev_err(&pdev->dev, "cannot add mmc host\n"); in au1xmmc_probe()
1073 platform_set_drvdata(pdev, host); in au1xmmc_probe()
1076 " (mode=%s)\n", pdev->id, host->iobase, in au1xmmc_probe()
1077 host->flags & HOST_F_DMA ? "dma" : "pio"); in au1xmmc_probe()
1083 if (host->platdata && host->platdata->led) in au1xmmc_probe()
1084 led_classdev_unregister(host->platdata->led); in au1xmmc_probe()
1087 __raw_writel(0, HOST_ENABLE(host)); in au1xmmc_probe()
1088 __raw_writel(0, HOST_CONFIG(host)); in au1xmmc_probe()
1089 __raw_writel(0, HOST_CONFIG2(host)); in au1xmmc_probe()
1092 if (host->flags & HOST_F_DBDMA) in au1xmmc_probe()
1093 au1xmmc_dbdma_shutdown(host); in au1xmmc_probe()
1095 cancel_work_sync(&host->data_bh_work); in au1xmmc_probe()
1096 cancel_work_sync(&host->finish_bh_work); in au1xmmc_probe()
1098 if (host->platdata && host->platdata->cd_setup && in au1xmmc_probe()
1100 host->platdata->cd_setup(mmc, 0); in au1xmmc_probe()
1102 clk_disable_unprepare(host->clk); in au1xmmc_probe()
1104 clk_put(host->clk); in au1xmmc_probe()
1106 free_irq(host->irq, host); in au1xmmc_probe()
1108 iounmap((void *)host->iobase); in au1xmmc_probe()
1110 release_resource(host->ioarea); in au1xmmc_probe()
1111 kfree(host->ioarea); in au1xmmc_probe()
1120 struct au1xmmc_host *host = platform_get_drvdata(pdev); in au1xmmc_remove() local
1122 if (host) { in au1xmmc_remove()
1123 mmc_remove_host(host->mmc); in au1xmmc_remove()
1126 if (host->platdata && host->platdata->led) in au1xmmc_remove()
1127 led_classdev_unregister(host->platdata->led); in au1xmmc_remove()
1130 if (host->platdata && host->platdata->cd_setup && in au1xmmc_remove()
1131 !(host->mmc->caps & MMC_CAP_NEEDS_POLL)) in au1xmmc_remove()
1132 host->platdata->cd_setup(host->mmc, 0); in au1xmmc_remove()
1134 __raw_writel(0, HOST_ENABLE(host)); in au1xmmc_remove()
1135 __raw_writel(0, HOST_CONFIG(host)); in au1xmmc_remove()
1136 __raw_writel(0, HOST_CONFIG2(host)); in au1xmmc_remove()
1139 cancel_work_sync(&host->data_bh_work); in au1xmmc_remove()
1140 cancel_work_sync(&host->finish_bh_work); in au1xmmc_remove()
1142 if (host->flags & HOST_F_DBDMA) in au1xmmc_remove()
1143 au1xmmc_dbdma_shutdown(host); in au1xmmc_remove()
1145 au1xmmc_set_power(host, 0); in au1xmmc_remove()
1147 clk_disable_unprepare(host->clk); in au1xmmc_remove()
1148 clk_put(host->clk); in au1xmmc_remove()
1150 free_irq(host->irq, host); in au1xmmc_remove()
1151 iounmap((void *)host->iobase); in au1xmmc_remove()
1152 release_resource(host->ioarea); in au1xmmc_remove()
1153 kfree(host->ioarea); in au1xmmc_remove()
1155 mmc_free_host(host->mmc); in au1xmmc_remove()
1162 struct au1xmmc_host *host = platform_get_drvdata(pdev); in au1xmmc_suspend() local
1164 __raw_writel(0, HOST_CONFIG2(host)); in au1xmmc_suspend()
1165 __raw_writel(0, HOST_CONFIG(host)); in au1xmmc_suspend()
1166 __raw_writel(0xffffffff, HOST_STATUS(host)); in au1xmmc_suspend()
1167 __raw_writel(0, HOST_ENABLE(host)); in au1xmmc_suspend()
1175 struct au1xmmc_host *host = platform_get_drvdata(pdev); in au1xmmc_resume() local
1177 au1xmmc_reset_controller(host); in au1xmmc_resume()