Lines Matching refs:host
54 void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i) in tmio_mmc_enable_mmc_irqs() argument
56 host->sdcard_irq_mask &= ~(i & TMIO_MASK_IRQ); in tmio_mmc_enable_mmc_irqs()
57 sd_ctrl_write32(host, CTL_IRQ_MASK, host->sdcard_irq_mask); in tmio_mmc_enable_mmc_irqs()
60 void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i) in tmio_mmc_disable_mmc_irqs() argument
62 host->sdcard_irq_mask |= (i & TMIO_MASK_IRQ); in tmio_mmc_disable_mmc_irqs()
63 sd_ctrl_write32(host, CTL_IRQ_MASK, host->sdcard_irq_mask); in tmio_mmc_disable_mmc_irqs()
66 static void tmio_mmc_ack_mmc_irqs(struct tmio_mmc_host *host, u32 i) in tmio_mmc_ack_mmc_irqs() argument
68 sd_ctrl_write32(host, CTL_STATUS, ~i); in tmio_mmc_ack_mmc_irqs()
71 static void tmio_mmc_init_sg(struct tmio_mmc_host *host, struct mmc_data *data) in tmio_mmc_init_sg() argument
73 host->sg_len = data->sg_len; in tmio_mmc_init_sg()
74 host->sg_ptr = data->sg; in tmio_mmc_init_sg()
75 host->sg_orig = data->sg; in tmio_mmc_init_sg()
76 host->sg_off = 0; in tmio_mmc_init_sg()
79 static int tmio_mmc_next_sg(struct tmio_mmc_host *host) in tmio_mmc_next_sg() argument
81 host->sg_ptr = sg_next(host->sg_ptr); in tmio_mmc_next_sg()
82 host->sg_off = 0; in tmio_mmc_next_sg()
83 return --host->sg_len; in tmio_mmc_next_sg()
131 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_enable_sdio_irq() local
133 if (enable && !host->sdio_irq_enabled) { in tmio_mmc_enable_sdio_irq()
136 host->sdio_irq_enabled = true; in tmio_mmc_enable_sdio_irq()
138 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL & in tmio_mmc_enable_sdio_irq()
140 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); in tmio_mmc_enable_sdio_irq()
141 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); in tmio_mmc_enable_sdio_irq()
142 } else if (!enable && host->sdio_irq_enabled) { in tmio_mmc_enable_sdio_irq()
143 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; in tmio_mmc_enable_sdio_irq()
144 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); in tmio_mmc_enable_sdio_irq()
145 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000); in tmio_mmc_enable_sdio_irq()
147 host->sdio_irq_enabled = false; in tmio_mmc_enable_sdio_irq()
153 static void tmio_mmc_set_clock(struct tmio_mmc_host *host, in tmio_mmc_set_clock() argument
159 for (clock = host->mmc->f_min, clk = 0x80000080; in tmio_mmc_set_clock()
164 if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) && in tmio_mmc_set_clock()
169 if (host->set_clk_div) in tmio_mmc_set_clock()
170 host->set_clk_div(host->pdev, (clk>>22) & 1); in tmio_mmc_set_clock()
172 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff); in tmio_mmc_set_clock()
176 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host) in tmio_mmc_clk_stop() argument
179 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) { in tmio_mmc_clk_stop()
180 sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000); in tmio_mmc_clk_stop()
184 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 & in tmio_mmc_clk_stop()
185 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); in tmio_mmc_clk_stop()
189 static void tmio_mmc_clk_start(struct tmio_mmc_host *host) in tmio_mmc_clk_start() argument
191 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 | in tmio_mmc_clk_start()
192 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); in tmio_mmc_clk_start()
196 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) { in tmio_mmc_clk_start()
197 sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100); in tmio_mmc_clk_start()
202 static void tmio_mmc_reset(struct tmio_mmc_host *host) in tmio_mmc_reset() argument
205 sd_ctrl_write16(host, CTL_RESET_SD, 0x0000); in tmio_mmc_reset()
207 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) in tmio_mmc_reset()
208 sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000); in tmio_mmc_reset()
210 sd_ctrl_write16(host, CTL_RESET_SD, 0x0001); in tmio_mmc_reset()
211 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) in tmio_mmc_reset()
212 sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001); in tmio_mmc_reset()
218 struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host, in tmio_mmc_reset_work() local
223 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_reset_work()
224 mrq = host->mrq; in tmio_mmc_reset_work()
232 || time_is_after_jiffies(host->last_req_ts + in tmio_mmc_reset_work()
234 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_reset_work()
238 dev_warn(&host->pdev->dev, in tmio_mmc_reset_work()
242 if (host->data) in tmio_mmc_reset_work()
243 host->data->error = -ETIMEDOUT; in tmio_mmc_reset_work()
244 else if (host->cmd) in tmio_mmc_reset_work()
245 host->cmd->error = -ETIMEDOUT; in tmio_mmc_reset_work()
249 host->cmd = NULL; in tmio_mmc_reset_work()
250 host->data = NULL; in tmio_mmc_reset_work()
251 host->force_pio = false; in tmio_mmc_reset_work()
253 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_reset_work()
255 tmio_mmc_reset(host); in tmio_mmc_reset_work()
258 host->mrq = NULL; in tmio_mmc_reset_work()
260 tmio_mmc_abort_dma(host); in tmio_mmc_reset_work()
261 mmc_request_done(host->mmc, mrq); in tmio_mmc_reset_work()
263 pm_runtime_mark_last_busy(mmc_dev(host->mmc)); in tmio_mmc_reset_work()
264 pm_runtime_put_autosuspend(mmc_dev(host->mmc)); in tmio_mmc_reset_work()
268 static void tmio_mmc_finish_request(struct tmio_mmc_host *host) in tmio_mmc_finish_request() argument
273 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_finish_request()
275 mrq = host->mrq; in tmio_mmc_finish_request()
277 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_finish_request()
281 host->cmd = NULL; in tmio_mmc_finish_request()
282 host->data = NULL; in tmio_mmc_finish_request()
283 host->force_pio = false; in tmio_mmc_finish_request()
285 cancel_delayed_work(&host->delayed_reset_work); in tmio_mmc_finish_request()
287 host->mrq = NULL; in tmio_mmc_finish_request()
288 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_finish_request()
291 tmio_mmc_abort_dma(host); in tmio_mmc_finish_request()
293 mmc_request_done(host->mmc, mrq); in tmio_mmc_finish_request()
295 pm_runtime_mark_last_busy(mmc_dev(host->mmc)); in tmio_mmc_finish_request()
296 pm_runtime_put_autosuspend(mmc_dev(host->mmc)); in tmio_mmc_finish_request()
301 struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host, in tmio_mmc_done_work() local
303 tmio_mmc_finish_request(host); in tmio_mmc_done_work()
320 static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd) in tmio_mmc_start_command() argument
322 struct mmc_data *data = host->data; in tmio_mmc_start_command()
328 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x001); in tmio_mmc_start_command()
343 host->cmd = cmd; in tmio_mmc_start_command()
353 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x100); in tmio_mmc_start_command()
360 if ((host->pdata->flags & TMIO_MMC_HAVE_CMD12_CTRL) && in tmio_mmc_start_command()
368 if (!host->native_hotplug) in tmio_mmc_start_command()
370 tmio_mmc_enable_mmc_irqs(host, irq_mask); in tmio_mmc_start_command()
373 sd_ctrl_write32(host, CTL_ARG_REG, cmd->arg); in tmio_mmc_start_command()
374 sd_ctrl_write16(host, CTL_SD_CMD, c); in tmio_mmc_start_command()
379 static void tmio_mmc_transfer_data(struct tmio_mmc_host *host, in tmio_mmc_transfer_data() argument
383 int is_read = host->data->flags & MMC_DATA_READ; in tmio_mmc_transfer_data()
390 sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1); in tmio_mmc_transfer_data()
392 sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1); in tmio_mmc_transfer_data()
408 *buf8 = sd_ctrl_read16(host, CTL_SD_DATA_PORT) & 0xff; in tmio_mmc_transfer_data()
410 sd_ctrl_write16(host, CTL_SD_DATA_PORT, *buf8); in tmio_mmc_transfer_data()
418 static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) in tmio_mmc_pio_irq() argument
420 struct mmc_data *data = host->data; in tmio_mmc_pio_irq()
426 if ((host->chan_tx || host->chan_rx) && !host->force_pio) { in tmio_mmc_pio_irq()
434 sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags); in tmio_mmc_pio_irq()
435 buf = (unsigned short *)(sg_virt + host->sg_off); in tmio_mmc_pio_irq()
437 count = host->sg_ptr->length - host->sg_off; in tmio_mmc_pio_irq()
442 count, host->sg_off, data->flags); in tmio_mmc_pio_irq()
445 tmio_mmc_transfer_data(host, buf, count); in tmio_mmc_pio_irq()
447 host->sg_off += count; in tmio_mmc_pio_irq()
449 tmio_mmc_kunmap_atomic(host->sg_ptr, &flags, sg_virt); in tmio_mmc_pio_irq()
451 if (host->sg_off == host->sg_ptr->length) in tmio_mmc_pio_irq()
452 tmio_mmc_next_sg(host); in tmio_mmc_pio_irq()
457 static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host) in tmio_mmc_check_bounce_buffer() argument
459 if (host->sg_ptr == &host->bounce_sg) { in tmio_mmc_check_bounce_buffer()
461 void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags); in tmio_mmc_check_bounce_buffer()
462 memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length); in tmio_mmc_check_bounce_buffer()
463 tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr); in tmio_mmc_check_bounce_buffer()
468 void tmio_mmc_do_data_irq(struct tmio_mmc_host *host) in tmio_mmc_do_data_irq() argument
470 struct mmc_data *data = host->data; in tmio_mmc_do_data_irq()
473 host->data = NULL; in tmio_mmc_do_data_irq()
476 dev_warn(&host->pdev->dev, "Spurious data end IRQ\n"); in tmio_mmc_do_data_irq()
499 if (host->chan_rx && !host->force_pio) in tmio_mmc_do_data_irq()
500 tmio_mmc_check_bounce_buffer(host); in tmio_mmc_do_data_irq()
501 dev_dbg(&host->pdev->dev, "Complete Rx request %p\n", in tmio_mmc_do_data_irq()
502 host->mrq); in tmio_mmc_do_data_irq()
504 dev_dbg(&host->pdev->dev, "Complete Tx request %p\n", in tmio_mmc_do_data_irq()
505 host->mrq); in tmio_mmc_do_data_irq()
510 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x000); in tmio_mmc_do_data_irq()
515 schedule_work(&host->done); in tmio_mmc_do_data_irq()
518 static void tmio_mmc_data_irq(struct tmio_mmc_host *host) in tmio_mmc_data_irq() argument
521 spin_lock(&host->lock); in tmio_mmc_data_irq()
522 data = host->data; in tmio_mmc_data_irq()
527 if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) { in tmio_mmc_data_irq()
528 u32 status = sd_ctrl_read32(host, CTL_STATUS); in tmio_mmc_data_irq()
539 if (host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT) { in tmio_mmc_data_irq()
548 tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND); in tmio_mmc_data_irq()
549 tasklet_schedule(&host->dma_complete); in tmio_mmc_data_irq()
551 } else if (host->chan_rx && (data->flags & MMC_DATA_READ) && !host->force_pio) { in tmio_mmc_data_irq()
552 tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND); in tmio_mmc_data_irq()
553 tasklet_schedule(&host->dma_complete); in tmio_mmc_data_irq()
555 tmio_mmc_do_data_irq(host); in tmio_mmc_data_irq()
556 tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP | TMIO_MASK_WRITEOP); in tmio_mmc_data_irq()
559 spin_unlock(&host->lock); in tmio_mmc_data_irq()
562 static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, in tmio_mmc_cmd_irq() argument
565 struct mmc_command *cmd = host->cmd; in tmio_mmc_cmd_irq()
568 spin_lock(&host->lock); in tmio_mmc_cmd_irq()
570 if (!host->cmd) { in tmio_mmc_cmd_irq()
575 host->cmd = NULL; in tmio_mmc_cmd_irq()
583 cmd->resp[i] = sd_ctrl_read32(host, addr); in tmio_mmc_cmd_irq()
603 if (host->data && !cmd->error) { in tmio_mmc_cmd_irq()
604 if (host->data->flags & MMC_DATA_READ) { in tmio_mmc_cmd_irq()
605 if (host->force_pio || !host->chan_rx) in tmio_mmc_cmd_irq()
606 tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP); in tmio_mmc_cmd_irq()
608 tasklet_schedule(&host->dma_issue); in tmio_mmc_cmd_irq()
610 if (host->force_pio || !host->chan_tx) in tmio_mmc_cmd_irq()
611 tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP); in tmio_mmc_cmd_irq()
613 tasklet_schedule(&host->dma_issue); in tmio_mmc_cmd_irq()
616 schedule_work(&host->done); in tmio_mmc_cmd_irq()
620 spin_unlock(&host->lock); in tmio_mmc_cmd_irq()
623 static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host, in tmio_mmc_card_irq_status() argument
626 *status = sd_ctrl_read32(host, CTL_STATUS); in tmio_mmc_card_irq_status()
627 *ireg = *status & TMIO_MASK_IRQ & ~host->sdcard_irq_mask; in tmio_mmc_card_irq_status()
633 sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ); in tmio_mmc_card_irq_status()
636 static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host, in __tmio_mmc_card_detect_irq() argument
639 struct mmc_host *mmc = host->mmc; in __tmio_mmc_card_detect_irq()
643 tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT | in __tmio_mmc_card_detect_irq()
648 mmc_detect_change(host->mmc, msecs_to_jiffies(100)); in __tmio_mmc_card_detect_irq()
658 struct tmio_mmc_host *host = devid; in tmio_mmc_card_detect_irq() local
660 tmio_mmc_card_irq_status(host, &ireg, &status); in tmio_mmc_card_detect_irq()
661 __tmio_mmc_card_detect_irq(host, ireg, status); in tmio_mmc_card_detect_irq()
667 static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host, in __tmio_mmc_sdcard_irq() argument
672 tmio_mmc_ack_mmc_irqs(host, in __tmio_mmc_sdcard_irq()
675 tmio_mmc_cmd_irq(host, status); in __tmio_mmc_sdcard_irq()
681 tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_RXRDY | TMIO_STAT_TXRQ); in __tmio_mmc_sdcard_irq()
682 tmio_mmc_pio_irq(host); in __tmio_mmc_sdcard_irq()
688 tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_DATAEND); in __tmio_mmc_sdcard_irq()
689 tmio_mmc_data_irq(host); in __tmio_mmc_sdcard_irq()
699 struct tmio_mmc_host *host = devid; in tmio_mmc_sdcard_irq() local
701 tmio_mmc_card_irq_status(host, &ireg, &status); in tmio_mmc_sdcard_irq()
702 __tmio_mmc_sdcard_irq(host, ireg, status); in tmio_mmc_sdcard_irq()
710 struct tmio_mmc_host *host = devid; in tmio_mmc_sdio_irq() local
711 struct mmc_host *mmc = host->mmc; in tmio_mmc_sdio_irq()
712 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_sdio_irq()
719 status = sd_ctrl_read16(host, CTL_SDIO_STATUS); in tmio_mmc_sdio_irq()
720 ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdcard_irq_mask; in tmio_mmc_sdio_irq()
726 sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status); in tmio_mmc_sdio_irq()
737 struct tmio_mmc_host *host = devid; in tmio_mmc_irq() local
742 tmio_mmc_card_irq_status(host, &ireg, &status); in tmio_mmc_irq()
743 if (__tmio_mmc_card_detect_irq(host, ireg, status)) in tmio_mmc_irq()
745 if (__tmio_mmc_sdcard_irq(host, ireg, status)) in tmio_mmc_irq()
754 static int tmio_mmc_start_data(struct tmio_mmc_host *host, in tmio_mmc_start_data() argument
757 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_start_data()
763 if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) { in tmio_mmc_start_data()
768 mmc_hostname(host->mmc), data->blksz); in tmio_mmc_start_data()
773 tmio_mmc_init_sg(host, data); in tmio_mmc_start_data()
774 host->data = data; in tmio_mmc_start_data()
777 sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz); in tmio_mmc_start_data()
778 sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks); in tmio_mmc_start_data()
780 tmio_mmc_start_dma(host, data); in tmio_mmc_start_data()
788 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_request() local
792 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_request()
794 if (host->mrq) { in tmio_mmc_request()
796 if (IS_ERR(host->mrq)) { in tmio_mmc_request()
797 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_request()
804 host->last_req_ts = jiffies; in tmio_mmc_request()
806 host->mrq = mrq; in tmio_mmc_request()
808 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_request()
813 ret = tmio_mmc_start_data(host, mrq->data); in tmio_mmc_request()
818 ret = tmio_mmc_start_command(host, mrq->cmd); in tmio_mmc_request()
820 schedule_delayed_work(&host->delayed_reset_work, in tmio_mmc_request()
826 host->force_pio = false; in tmio_mmc_request()
827 host->mrq = NULL; in tmio_mmc_request()
835 static int tmio_mmc_clk_update(struct tmio_mmc_host *host) in tmio_mmc_clk_update() argument
837 struct mmc_host *mmc = host->mmc; in tmio_mmc_clk_update()
840 if (!host->clk_enable) in tmio_mmc_clk_update()
843 ret = host->clk_enable(host->pdev, &mmc->f_max); in tmio_mmc_clk_update()
850 static void tmio_mmc_power_on(struct tmio_mmc_host *host, unsigned short vdd) in tmio_mmc_power_on() argument
852 struct mmc_host *mmc = host->mmc; in tmio_mmc_power_on()
857 if (host->set_pwr) in tmio_mmc_power_on()
858 host->set_pwr(host->pdev, 1); in tmio_mmc_power_on()
880 dev_dbg(&host->pdev->dev, "Regulators failed to power up: %d\n", in tmio_mmc_power_on()
884 static void tmio_mmc_power_off(struct tmio_mmc_host *host) in tmio_mmc_power_off() argument
886 struct mmc_host *mmc = host->mmc; in tmio_mmc_power_off()
894 if (host->set_pwr) in tmio_mmc_power_off()
895 host->set_pwr(host->pdev, 0); in tmio_mmc_power_off()
898 static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host, in tmio_mmc_set_bus_width() argument
903 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0); in tmio_mmc_set_bus_width()
906 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0); in tmio_mmc_set_bus_width()
919 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_set_ios() local
920 struct device *dev = &host->pdev->dev; in tmio_mmc_set_ios()
925 mutex_lock(&host->ios_lock); in tmio_mmc_set_ios()
927 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_set_ios()
928 if (host->mrq) { in tmio_mmc_set_ios()
929 if (IS_ERR(host->mrq)) { in tmio_mmc_set_ios()
934 host->mrq = ERR_PTR(-EINTR); in tmio_mmc_set_ios()
939 host->mrq->cmd->opcode, host->last_req_ts, jiffies); in tmio_mmc_set_ios()
941 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_set_ios()
943 mutex_unlock(&host->ios_lock); in tmio_mmc_set_ios()
947 host->mrq = ERR_PTR(-EBUSY); in tmio_mmc_set_ios()
949 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_set_ios()
953 tmio_mmc_power_off(host); in tmio_mmc_set_ios()
954 tmio_mmc_clk_stop(host); in tmio_mmc_set_ios()
957 tmio_mmc_set_clock(host, ios->clock); in tmio_mmc_set_ios()
958 tmio_mmc_power_on(host, ios->vdd); in tmio_mmc_set_ios()
959 tmio_mmc_clk_start(host); in tmio_mmc_set_ios()
960 tmio_mmc_set_bus_width(host, ios->bus_width); in tmio_mmc_set_ios()
963 tmio_mmc_set_clock(host, ios->clock); in tmio_mmc_set_ios()
964 tmio_mmc_clk_start(host); in tmio_mmc_set_ios()
965 tmio_mmc_set_bus_width(host, ios->bus_width); in tmio_mmc_set_ios()
971 if (PTR_ERR(host->mrq) == -EINTR) in tmio_mmc_set_ios()
972 dev_dbg(&host->pdev->dev, in tmio_mmc_set_ios()
976 host->mrq = NULL; in tmio_mmc_set_ios()
978 host->clk_cache = ios->clock; in tmio_mmc_set_ios()
980 mutex_unlock(&host->ios_lock); in tmio_mmc_set_ios()
988 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_get_ro() local
989 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_get_ro()
996 (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); in tmio_mmc_get_ro()
1006 struct tmio_mmc_host *host = mmc_priv(card->host); in tmio_multi_io_quirk() local
1008 if (host->multi_io_quirk) in tmio_multi_io_quirk()
1009 return host->multi_io_quirk(card, direction, blk_size); in tmio_multi_io_quirk()
1023 static int tmio_mmc_init_ocr(struct tmio_mmc_host *host) in tmio_mmc_init_ocr() argument
1025 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_init_ocr()
1026 struct mmc_host *mmc = host->mmc; in tmio_mmc_init_ocr()
1058 struct tmio_mmc_host *host; in tmio_mmc_host_alloc() local
1065 host = mmc_priv(mmc); in tmio_mmc_host_alloc()
1066 host->mmc = mmc; in tmio_mmc_host_alloc()
1067 host->pdev = pdev; in tmio_mmc_host_alloc()
1069 return host; in tmio_mmc_host_alloc()
1073 void tmio_mmc_host_free(struct tmio_mmc_host *host) in tmio_mmc_host_free() argument
1075 mmc_free_host(host->mmc); in tmio_mmc_host_free()
1216 void tmio_mmc_host_remove(struct tmio_mmc_host *host) in tmio_mmc_host_remove() argument
1218 struct platform_device *pdev = host->pdev; in tmio_mmc_host_remove()
1219 struct mmc_host *mmc = host->mmc; in tmio_mmc_host_remove()
1221 if (!host->native_hotplug) in tmio_mmc_host_remove()
1227 cancel_work_sync(&host->done); in tmio_mmc_host_remove()
1228 cancel_delayed_work_sync(&host->delayed_reset_work); in tmio_mmc_host_remove()
1229 tmio_mmc_release_dma(host); in tmio_mmc_host_remove()
1234 iounmap(host->ctl); in tmio_mmc_host_remove()
1242 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_host_runtime_suspend() local
1244 tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL); in tmio_mmc_host_runtime_suspend()
1246 if (host->clk_cache) in tmio_mmc_host_runtime_suspend()
1247 tmio_mmc_clk_stop(host); in tmio_mmc_host_runtime_suspend()
1249 if (host->clk_disable) in tmio_mmc_host_runtime_suspend()
1250 host->clk_disable(host->pdev); in tmio_mmc_host_runtime_suspend()
1259 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_host_runtime_resume() local
1261 tmio_mmc_reset(host); in tmio_mmc_host_runtime_resume()
1262 tmio_mmc_clk_update(host); in tmio_mmc_host_runtime_resume()
1264 if (host->clk_cache) { in tmio_mmc_host_runtime_resume()
1265 tmio_mmc_set_clock(host, host->clk_cache); in tmio_mmc_host_runtime_resume()
1266 tmio_mmc_clk_start(host); in tmio_mmc_host_runtime_resume()
1269 tmio_mmc_enable_dma(host, true); in tmio_mmc_host_runtime_resume()