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()
133 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_enable_sdio_irq() local
135 if (enable && !host->sdio_irq_enabled) { in tmio_mmc_enable_sdio_irq()
138 host->sdio_irq_enabled = true; in tmio_mmc_enable_sdio_irq()
140 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL & in tmio_mmc_enable_sdio_irq()
142 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001); in tmio_mmc_enable_sdio_irq()
143 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); in tmio_mmc_enable_sdio_irq()
144 } else if (!enable && host->sdio_irq_enabled) { in tmio_mmc_enable_sdio_irq()
145 host->sdio_irq_mask = TMIO_SDIO_MASK_ALL; in tmio_mmc_enable_sdio_irq()
146 sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask); in tmio_mmc_enable_sdio_irq()
147 sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000); in tmio_mmc_enable_sdio_irq()
149 host->sdio_irq_enabled = false; in tmio_mmc_enable_sdio_irq()
155 static void tmio_mmc_set_clock(struct tmio_mmc_host *host, in tmio_mmc_set_clock() argument
161 for (clock = host->mmc->f_min, clk = 0x80000080; in tmio_mmc_set_clock()
166 if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) && in tmio_mmc_set_clock()
171 if (host->set_clk_div) in tmio_mmc_set_clock()
172 host->set_clk_div(host->pdev, (clk>>22) & 1); in tmio_mmc_set_clock()
174 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & 0x1ff); in tmio_mmc_set_clock()
178 static void tmio_mmc_clk_stop(struct tmio_mmc_host *host) in tmio_mmc_clk_stop() argument
181 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) { in tmio_mmc_clk_stop()
182 sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0000); in tmio_mmc_clk_stop()
186 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 & in tmio_mmc_clk_stop()
187 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); in tmio_mmc_clk_stop()
191 static void tmio_mmc_clk_start(struct tmio_mmc_host *host) in tmio_mmc_clk_start() argument
193 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x0100 | in tmio_mmc_clk_start()
194 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); in tmio_mmc_clk_start()
198 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) { in tmio_mmc_clk_start()
199 sd_ctrl_write16(host, CTL_CLK_AND_WAIT_CTL, 0x0100); in tmio_mmc_clk_start()
204 static void tmio_mmc_reset(struct tmio_mmc_host *host) in tmio_mmc_reset() argument
207 sd_ctrl_write16(host, CTL_RESET_SD, 0x0000); in tmio_mmc_reset()
209 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) in tmio_mmc_reset()
210 sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0000); in tmio_mmc_reset()
212 sd_ctrl_write16(host, CTL_RESET_SD, 0x0001); in tmio_mmc_reset()
213 if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG) in tmio_mmc_reset()
214 sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001); in tmio_mmc_reset()
220 struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host, in tmio_mmc_reset_work() local
225 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_reset_work()
226 mrq = host->mrq; in tmio_mmc_reset_work()
234 || time_is_after_jiffies(host->last_req_ts + in tmio_mmc_reset_work()
236 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_reset_work()
240 dev_warn(&host->pdev->dev, in tmio_mmc_reset_work()
244 if (host->data) in tmio_mmc_reset_work()
245 host->data->error = -ETIMEDOUT; in tmio_mmc_reset_work()
246 else if (host->cmd) in tmio_mmc_reset_work()
247 host->cmd->error = -ETIMEDOUT; in tmio_mmc_reset_work()
251 host->cmd = NULL; in tmio_mmc_reset_work()
252 host->data = NULL; in tmio_mmc_reset_work()
253 host->force_pio = false; in tmio_mmc_reset_work()
255 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_reset_work()
257 tmio_mmc_reset(host); in tmio_mmc_reset_work()
260 host->mrq = NULL; in tmio_mmc_reset_work()
262 tmio_mmc_abort_dma(host); in tmio_mmc_reset_work()
263 mmc_request_done(host->mmc, mrq); in tmio_mmc_reset_work()
265 pm_runtime_mark_last_busy(mmc_dev(host->mmc)); in tmio_mmc_reset_work()
266 pm_runtime_put_autosuspend(mmc_dev(host->mmc)); in tmio_mmc_reset_work()
270 static void tmio_mmc_finish_request(struct tmio_mmc_host *host) in tmio_mmc_finish_request() argument
275 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_finish_request()
277 mrq = host->mrq; in tmio_mmc_finish_request()
279 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_finish_request()
283 host->cmd = NULL; in tmio_mmc_finish_request()
284 host->data = NULL; in tmio_mmc_finish_request()
285 host->force_pio = false; in tmio_mmc_finish_request()
287 cancel_delayed_work(&host->delayed_reset_work); in tmio_mmc_finish_request()
289 host->mrq = NULL; in tmio_mmc_finish_request()
290 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_finish_request()
293 tmio_mmc_abort_dma(host); in tmio_mmc_finish_request()
295 mmc_request_done(host->mmc, mrq); in tmio_mmc_finish_request()
297 pm_runtime_mark_last_busy(mmc_dev(host->mmc)); in tmio_mmc_finish_request()
298 pm_runtime_put_autosuspend(mmc_dev(host->mmc)); in tmio_mmc_finish_request()
303 struct tmio_mmc_host *host = container_of(work, struct tmio_mmc_host, in tmio_mmc_done_work() local
305 tmio_mmc_finish_request(host); in tmio_mmc_done_work()
322 static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command *cmd) in tmio_mmc_start_command() argument
324 struct mmc_data *data = host->data; in tmio_mmc_start_command()
330 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x001); in tmio_mmc_start_command()
345 host->cmd = cmd; in tmio_mmc_start_command()
355 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x100); in tmio_mmc_start_command()
362 if ((host->pdata->flags & TMIO_MMC_HAVE_CMD12_CTRL) && in tmio_mmc_start_command()
370 if (!host->native_hotplug) in tmio_mmc_start_command()
372 tmio_mmc_enable_mmc_irqs(host, irq_mask); in tmio_mmc_start_command()
375 sd_ctrl_write32(host, CTL_ARG_REG, cmd->arg); in tmio_mmc_start_command()
376 sd_ctrl_write16(host, CTL_SD_CMD, c); in tmio_mmc_start_command()
381 static void tmio_mmc_transfer_data(struct tmio_mmc_host *host, in tmio_mmc_transfer_data() argument
385 int is_read = host->data->flags & MMC_DATA_READ; in tmio_mmc_transfer_data()
392 sd_ctrl_read16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1); in tmio_mmc_transfer_data()
394 sd_ctrl_write16_rep(host, CTL_SD_DATA_PORT, buf, count >> 1); in tmio_mmc_transfer_data()
410 *buf8 = sd_ctrl_read16(host, CTL_SD_DATA_PORT) & 0xff; in tmio_mmc_transfer_data()
412 sd_ctrl_write16(host, CTL_SD_DATA_PORT, *buf8); in tmio_mmc_transfer_data()
420 static void tmio_mmc_pio_irq(struct tmio_mmc_host *host) in tmio_mmc_pio_irq() argument
422 struct mmc_data *data = host->data; in tmio_mmc_pio_irq()
428 if ((host->chan_tx || host->chan_rx) && !host->force_pio) { in tmio_mmc_pio_irq()
436 sg_virt = tmio_mmc_kmap_atomic(host->sg_ptr, &flags); in tmio_mmc_pio_irq()
437 buf = (unsigned short *)(sg_virt + host->sg_off); in tmio_mmc_pio_irq()
439 count = host->sg_ptr->length - host->sg_off; in tmio_mmc_pio_irq()
444 count, host->sg_off, data->flags); in tmio_mmc_pio_irq()
447 tmio_mmc_transfer_data(host, buf, count); in tmio_mmc_pio_irq()
449 host->sg_off += count; in tmio_mmc_pio_irq()
451 tmio_mmc_kunmap_atomic(host->sg_ptr, &flags, sg_virt); in tmio_mmc_pio_irq()
453 if (host->sg_off == host->sg_ptr->length) in tmio_mmc_pio_irq()
454 tmio_mmc_next_sg(host); in tmio_mmc_pio_irq()
459 static void tmio_mmc_check_bounce_buffer(struct tmio_mmc_host *host) in tmio_mmc_check_bounce_buffer() argument
461 if (host->sg_ptr == &host->bounce_sg) { in tmio_mmc_check_bounce_buffer()
463 void *sg_vaddr = tmio_mmc_kmap_atomic(host->sg_orig, &flags); in tmio_mmc_check_bounce_buffer()
464 memcpy(sg_vaddr, host->bounce_buf, host->bounce_sg.length); in tmio_mmc_check_bounce_buffer()
465 tmio_mmc_kunmap_atomic(host->sg_orig, &flags, sg_vaddr); in tmio_mmc_check_bounce_buffer()
470 void tmio_mmc_do_data_irq(struct tmio_mmc_host *host) in tmio_mmc_do_data_irq() argument
472 struct mmc_data *data = host->data; in tmio_mmc_do_data_irq()
475 host->data = NULL; in tmio_mmc_do_data_irq()
478 dev_warn(&host->pdev->dev, "Spurious data end IRQ\n"); in tmio_mmc_do_data_irq()
501 if (host->chan_rx && !host->force_pio) in tmio_mmc_do_data_irq()
502 tmio_mmc_check_bounce_buffer(host); in tmio_mmc_do_data_irq()
503 dev_dbg(&host->pdev->dev, "Complete Rx request %p\n", in tmio_mmc_do_data_irq()
504 host->mrq); in tmio_mmc_do_data_irq()
506 dev_dbg(&host->pdev->dev, "Complete Tx request %p\n", in tmio_mmc_do_data_irq()
507 host->mrq); in tmio_mmc_do_data_irq()
512 sd_ctrl_write16(host, CTL_STOP_INTERNAL_ACTION, 0x000); in tmio_mmc_do_data_irq()
517 schedule_work(&host->done); in tmio_mmc_do_data_irq()
520 static void tmio_mmc_data_irq(struct tmio_mmc_host *host) in tmio_mmc_data_irq() argument
523 spin_lock(&host->lock); in tmio_mmc_data_irq()
524 data = host->data; in tmio_mmc_data_irq()
529 if (host->chan_tx && (data->flags & MMC_DATA_WRITE) && !host->force_pio) { in tmio_mmc_data_irq()
530 u32 status = sd_ctrl_read32(host, CTL_STATUS); in tmio_mmc_data_irq()
541 if (host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT) { in tmio_mmc_data_irq()
550 tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND); in tmio_mmc_data_irq()
551 tasklet_schedule(&host->dma_complete); in tmio_mmc_data_irq()
553 } else if (host->chan_rx && (data->flags & MMC_DATA_READ) && !host->force_pio) { in tmio_mmc_data_irq()
554 tmio_mmc_disable_mmc_irqs(host, TMIO_STAT_DATAEND); in tmio_mmc_data_irq()
555 tasklet_schedule(&host->dma_complete); in tmio_mmc_data_irq()
557 tmio_mmc_do_data_irq(host); in tmio_mmc_data_irq()
558 tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_READOP | TMIO_MASK_WRITEOP); in tmio_mmc_data_irq()
561 spin_unlock(&host->lock); in tmio_mmc_data_irq()
564 static void tmio_mmc_cmd_irq(struct tmio_mmc_host *host, in tmio_mmc_cmd_irq() argument
567 struct mmc_command *cmd = host->cmd; in tmio_mmc_cmd_irq()
570 spin_lock(&host->lock); in tmio_mmc_cmd_irq()
572 if (!host->cmd) { in tmio_mmc_cmd_irq()
577 host->cmd = NULL; in tmio_mmc_cmd_irq()
585 cmd->resp[i] = sd_ctrl_read32(host, addr); in tmio_mmc_cmd_irq()
605 if (host->data && !cmd->error) { in tmio_mmc_cmd_irq()
606 if (host->data->flags & MMC_DATA_READ) { in tmio_mmc_cmd_irq()
607 if (host->force_pio || !host->chan_rx) in tmio_mmc_cmd_irq()
608 tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_READOP); in tmio_mmc_cmd_irq()
610 tasklet_schedule(&host->dma_issue); in tmio_mmc_cmd_irq()
612 if (host->force_pio || !host->chan_tx) in tmio_mmc_cmd_irq()
613 tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_WRITEOP); in tmio_mmc_cmd_irq()
615 tasklet_schedule(&host->dma_issue); in tmio_mmc_cmd_irq()
618 schedule_work(&host->done); in tmio_mmc_cmd_irq()
622 spin_unlock(&host->lock); in tmio_mmc_cmd_irq()
625 static void tmio_mmc_card_irq_status(struct tmio_mmc_host *host, in tmio_mmc_card_irq_status() argument
628 *status = sd_ctrl_read32(host, CTL_STATUS); in tmio_mmc_card_irq_status()
629 *ireg = *status & TMIO_MASK_IRQ & ~host->sdcard_irq_mask; in tmio_mmc_card_irq_status()
635 sd_ctrl_write32(host, CTL_STATUS, TMIO_MASK_IRQ); in tmio_mmc_card_irq_status()
638 static bool __tmio_mmc_card_detect_irq(struct tmio_mmc_host *host, in __tmio_mmc_card_detect_irq() argument
641 struct mmc_host *mmc = host->mmc; in __tmio_mmc_card_detect_irq()
645 tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT | in __tmio_mmc_card_detect_irq()
650 mmc_detect_change(host->mmc, msecs_to_jiffies(100)); in __tmio_mmc_card_detect_irq()
660 struct tmio_mmc_host *host = devid; in tmio_mmc_card_detect_irq() local
662 tmio_mmc_card_irq_status(host, &ireg, &status); in tmio_mmc_card_detect_irq()
663 __tmio_mmc_card_detect_irq(host, ireg, status); in tmio_mmc_card_detect_irq()
669 static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host, in __tmio_mmc_sdcard_irq() argument
674 tmio_mmc_ack_mmc_irqs(host, in __tmio_mmc_sdcard_irq()
677 tmio_mmc_cmd_irq(host, status); in __tmio_mmc_sdcard_irq()
683 tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_RXRDY | TMIO_STAT_TXRQ); in __tmio_mmc_sdcard_irq()
684 tmio_mmc_pio_irq(host); in __tmio_mmc_sdcard_irq()
690 tmio_mmc_ack_mmc_irqs(host, TMIO_STAT_DATAEND); in __tmio_mmc_sdcard_irq()
691 tmio_mmc_data_irq(host); in __tmio_mmc_sdcard_irq()
701 struct tmio_mmc_host *host = devid; in tmio_mmc_sdcard_irq() local
703 tmio_mmc_card_irq_status(host, &ireg, &status); in tmio_mmc_sdcard_irq()
704 __tmio_mmc_sdcard_irq(host, ireg, status); in tmio_mmc_sdcard_irq()
712 struct tmio_mmc_host *host = devid; in tmio_mmc_sdio_irq() local
713 struct mmc_host *mmc = host->mmc; in tmio_mmc_sdio_irq()
714 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_sdio_irq()
721 status = sd_ctrl_read16(host, CTL_SDIO_STATUS); in tmio_mmc_sdio_irq()
722 ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdcard_irq_mask; in tmio_mmc_sdio_irq()
728 sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status); in tmio_mmc_sdio_irq()
739 struct tmio_mmc_host *host = devid; in tmio_mmc_irq() local
744 tmio_mmc_card_irq_status(host, &ireg, &status); in tmio_mmc_irq()
745 if (__tmio_mmc_card_detect_irq(host, ireg, status)) in tmio_mmc_irq()
747 if (__tmio_mmc_sdcard_irq(host, ireg, status)) in tmio_mmc_irq()
756 static int tmio_mmc_start_data(struct tmio_mmc_host *host, in tmio_mmc_start_data() argument
759 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_start_data()
765 if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) { in tmio_mmc_start_data()
770 mmc_hostname(host->mmc), data->blksz); in tmio_mmc_start_data()
775 tmio_mmc_init_sg(host, data); in tmio_mmc_start_data()
776 host->data = data; in tmio_mmc_start_data()
779 sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz); in tmio_mmc_start_data()
780 sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks); in tmio_mmc_start_data()
782 tmio_mmc_start_dma(host, data); in tmio_mmc_start_data()
790 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_request() local
794 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_request()
796 if (host->mrq) { in tmio_mmc_request()
798 if (IS_ERR(host->mrq)) { in tmio_mmc_request()
799 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_request()
806 host->last_req_ts = jiffies; in tmio_mmc_request()
808 host->mrq = mrq; in tmio_mmc_request()
810 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_request()
815 ret = tmio_mmc_start_data(host, mrq->data); in tmio_mmc_request()
820 ret = tmio_mmc_start_command(host, mrq->cmd); in tmio_mmc_request()
822 schedule_delayed_work(&host->delayed_reset_work, in tmio_mmc_request()
828 host->force_pio = false; in tmio_mmc_request()
829 host->mrq = NULL; in tmio_mmc_request()
837 static int tmio_mmc_clk_update(struct tmio_mmc_host *host) in tmio_mmc_clk_update() argument
839 struct mmc_host *mmc = host->mmc; in tmio_mmc_clk_update()
842 if (!host->clk_enable) in tmio_mmc_clk_update()
845 ret = host->clk_enable(host->pdev, &mmc->f_max); in tmio_mmc_clk_update()
852 static void tmio_mmc_power_on(struct tmio_mmc_host *host, unsigned short vdd) in tmio_mmc_power_on() argument
854 struct mmc_host *mmc = host->mmc; in tmio_mmc_power_on()
859 if (host->set_pwr) in tmio_mmc_power_on()
860 host->set_pwr(host->pdev, 1); in tmio_mmc_power_on()
882 dev_dbg(&host->pdev->dev, "Regulators failed to power up: %d\n", in tmio_mmc_power_on()
886 static void tmio_mmc_power_off(struct tmio_mmc_host *host) in tmio_mmc_power_off() argument
888 struct mmc_host *mmc = host->mmc; in tmio_mmc_power_off()
896 if (host->set_pwr) in tmio_mmc_power_off()
897 host->set_pwr(host->pdev, 0); in tmio_mmc_power_off()
900 static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host, in tmio_mmc_set_bus_width() argument
905 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0); in tmio_mmc_set_bus_width()
908 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0); in tmio_mmc_set_bus_width()
921 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_set_ios() local
922 struct device *dev = &host->pdev->dev; in tmio_mmc_set_ios()
927 mutex_lock(&host->ios_lock); in tmio_mmc_set_ios()
929 spin_lock_irqsave(&host->lock, flags); in tmio_mmc_set_ios()
930 if (host->mrq) { in tmio_mmc_set_ios()
931 if (IS_ERR(host->mrq)) { in tmio_mmc_set_ios()
936 host->mrq = ERR_PTR(-EINTR); in tmio_mmc_set_ios()
941 host->mrq->cmd->opcode, host->last_req_ts, jiffies); in tmio_mmc_set_ios()
943 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_set_ios()
945 mutex_unlock(&host->ios_lock); in tmio_mmc_set_ios()
949 host->mrq = ERR_PTR(-EBUSY); in tmio_mmc_set_ios()
951 spin_unlock_irqrestore(&host->lock, flags); in tmio_mmc_set_ios()
955 tmio_mmc_power_off(host); in tmio_mmc_set_ios()
956 tmio_mmc_clk_stop(host); in tmio_mmc_set_ios()
959 tmio_mmc_set_clock(host, ios->clock); in tmio_mmc_set_ios()
960 tmio_mmc_power_on(host, ios->vdd); in tmio_mmc_set_ios()
961 tmio_mmc_clk_start(host); in tmio_mmc_set_ios()
962 tmio_mmc_set_bus_width(host, ios->bus_width); in tmio_mmc_set_ios()
965 tmio_mmc_set_clock(host, ios->clock); in tmio_mmc_set_ios()
966 tmio_mmc_clk_start(host); in tmio_mmc_set_ios()
967 tmio_mmc_set_bus_width(host, ios->bus_width); in tmio_mmc_set_ios()
973 if (PTR_ERR(host->mrq) == -EINTR) in tmio_mmc_set_ios()
974 dev_dbg(&host->pdev->dev, in tmio_mmc_set_ios()
978 host->mrq = NULL; in tmio_mmc_set_ios()
980 host->clk_cache = ios->clock; in tmio_mmc_set_ios()
982 mutex_unlock(&host->ios_lock); in tmio_mmc_set_ios()
990 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_get_ro() local
991 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_get_ro()
998 (sd_ctrl_read32(host, CTL_STATUS) & TMIO_STAT_WRPROTECT)); in tmio_mmc_get_ro()
1008 struct tmio_mmc_host *host = mmc_priv(card->host); in tmio_multi_io_quirk() local
1010 if (host->multi_io_quirk) in tmio_multi_io_quirk()
1011 return host->multi_io_quirk(card, direction, blk_size); in tmio_multi_io_quirk()
1025 static int tmio_mmc_init_ocr(struct tmio_mmc_host *host) in tmio_mmc_init_ocr() argument
1027 struct tmio_mmc_data *pdata = host->pdata; in tmio_mmc_init_ocr()
1028 struct mmc_host *mmc = host->mmc; in tmio_mmc_init_ocr()
1060 struct tmio_mmc_host *host; in tmio_mmc_host_alloc() local
1067 host = mmc_priv(mmc); in tmio_mmc_host_alloc()
1068 host->mmc = mmc; in tmio_mmc_host_alloc()
1069 host->pdev = pdev; in tmio_mmc_host_alloc()
1071 return host; in tmio_mmc_host_alloc()
1075 void tmio_mmc_host_free(struct tmio_mmc_host *host) in tmio_mmc_host_free() argument
1077 mmc_free_host(host->mmc); in tmio_mmc_host_free()
1219 void tmio_mmc_host_remove(struct tmio_mmc_host *host) in tmio_mmc_host_remove() argument
1221 struct platform_device *pdev = host->pdev; in tmio_mmc_host_remove()
1222 struct mmc_host *mmc = host->mmc; in tmio_mmc_host_remove()
1224 if (!host->native_hotplug) in tmio_mmc_host_remove()
1230 cancel_work_sync(&host->done); in tmio_mmc_host_remove()
1231 cancel_delayed_work_sync(&host->delayed_reset_work); in tmio_mmc_host_remove()
1232 tmio_mmc_release_dma(host); in tmio_mmc_host_remove()
1243 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_host_runtime_suspend() local
1245 tmio_mmc_disable_mmc_irqs(host, TMIO_MASK_ALL); in tmio_mmc_host_runtime_suspend()
1247 if (host->clk_cache) in tmio_mmc_host_runtime_suspend()
1248 tmio_mmc_clk_stop(host); in tmio_mmc_host_runtime_suspend()
1250 if (host->clk_disable) in tmio_mmc_host_runtime_suspend()
1251 host->clk_disable(host->pdev); in tmio_mmc_host_runtime_suspend()
1260 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_host_runtime_resume() local
1262 tmio_mmc_reset(host); in tmio_mmc_host_runtime_resume()
1263 tmio_mmc_clk_update(host); in tmio_mmc_host_runtime_resume()
1265 if (host->clk_cache) { in tmio_mmc_host_runtime_resume()
1266 tmio_mmc_set_clock(host, host->clk_cache); in tmio_mmc_host_runtime_resume()
1267 tmio_mmc_clk_start(host); in tmio_mmc_host_runtime_resume()
1270 tmio_mmc_enable_dma(host, true); in tmio_mmc_host_runtime_resume()