Lines Matching +full:sdmmc +full:- +full:3 +full:v3

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * drivers/mmc/host/via-sdmmc.c - VIA SD/MMC Card Reader driver
9 #include <linux/dma-mapping.h>
61 * Bit 0 -Bit 10 : Block length. So, the maximum block length should be 2048.
62 * Bit 11 - Bit 13 : Reserved.
65 * Bit 16 - Bit 31 : Block count. So, the maximun block count should be 65536.
84 * CRDIE : Command-Response transfer Done Interrupt Enable
85 * CRTOIE : Command-Response response TimeOut Interrupt Enable
86 * ASCRDIE : Auto Stop Command-Response transfer Done Interrupt Enable
120 * CRD : Command-Response transfer Done interrupt status
121 * CRTO : Command-Response response TimeOut interrupt status
122 * ASCRDIE : Auto Stop Command-Response transfer Done interrupt status
182 /* 0x38-0xFF reserved */
204 /*0x14-0xFF reserved*/
210 /*0x0 - 0x1 reserved*/
214 * 0 : Soft reset all the controller and it will be de-asserted automatically
215 * 1 : Soft reset is de-asserted
219 * 3V3 : Pad power select
255 /*0xB-0xFF reserved*/
334 void __iomem *addrbase = host->sdhc_mmiobase; in via_print_sdchc()
353 void __iomem *addrbase = host->pcictrl_mmiobase; in via_print_pcictrl()
370 pm_pcictrl_reg = &(host->pm_pcictrl_reg); in via_save_pcictrlreg()
371 addrbase = host->pcictrl_mmiobase; in via_save_pcictrlreg()
373 pm_pcictrl_reg->pciclkgat_reg = readb(addrbase + VIA_CRDR_PCICLKGATT); in via_save_pcictrlreg()
374 pm_pcictrl_reg->pciclkgat_reg |= in via_save_pcictrlreg()
376 pm_pcictrl_reg->pcisdclk_reg = readb(addrbase + VIA_CRDR_PCISDCCLK); in via_save_pcictrlreg()
377 pm_pcictrl_reg->pcidmaclk_reg = readb(addrbase + VIA_CRDR_PCIDMACLK); in via_save_pcictrlreg()
378 pm_pcictrl_reg->pciintctrl_reg = readb(addrbase + VIA_CRDR_PCIINTCTRL); in via_save_pcictrlreg()
379 pm_pcictrl_reg->pciintstatus_reg = in via_save_pcictrlreg()
381 pm_pcictrl_reg->pcitmoctrl_reg = readb(addrbase + VIA_CRDR_PCITMOCTRL); in via_save_pcictrlreg()
389 pm_pcictrl_reg = &(host->pm_pcictrl_reg); in via_restore_pcictrlreg()
390 addrbase = host->pcictrl_mmiobase; in via_restore_pcictrlreg()
392 writeb(pm_pcictrl_reg->pciclkgat_reg, addrbase + VIA_CRDR_PCICLKGATT); in via_restore_pcictrlreg()
393 writeb(pm_pcictrl_reg->pcisdclk_reg, addrbase + VIA_CRDR_PCISDCCLK); in via_restore_pcictrlreg()
394 writeb(pm_pcictrl_reg->pcidmaclk_reg, addrbase + VIA_CRDR_PCIDMACLK); in via_restore_pcictrlreg()
395 writeb(pm_pcictrl_reg->pciintctrl_reg, addrbase + VIA_CRDR_PCIINTCTRL); in via_restore_pcictrlreg()
396 writeb(pm_pcictrl_reg->pciintstatus_reg, in via_restore_pcictrlreg()
398 writeb(pm_pcictrl_reg->pcitmoctrl_reg, addrbase + VIA_CRDR_PCITMOCTRL); in via_restore_pcictrlreg()
406 pm_sdhc_reg = &(host->pm_sdhc_reg); in via_save_sdcreg()
407 addrbase = host->sdhc_mmiobase; in via_save_sdcreg()
409 pm_sdhc_reg->sdcontrol_reg = readl(addrbase + VIA_CRDR_SDCTRL); in via_save_sdcreg()
410 pm_sdhc_reg->sdcmdarg_reg = readl(addrbase + VIA_CRDR_SDCARG); in via_save_sdcreg()
411 pm_sdhc_reg->sdbusmode_reg = readl(addrbase + VIA_CRDR_SDBUSMODE); in via_save_sdcreg()
412 pm_sdhc_reg->sdblklen_reg = readl(addrbase + VIA_CRDR_SDBLKLEN); in via_save_sdcreg()
413 pm_sdhc_reg->sdcurblkcnt_reg = readl(addrbase + VIA_CRDR_SDCURBLKCNT); in via_save_sdcreg()
414 pm_sdhc_reg->sdintmask_reg = readl(addrbase + VIA_CRDR_SDINTMASK); in via_save_sdcreg()
415 pm_sdhc_reg->sdstatus_reg = readl(addrbase + VIA_CRDR_SDSTATUS); in via_save_sdcreg()
416 pm_sdhc_reg->sdrsptmo_reg = readl(addrbase + VIA_CRDR_SDRSPTMO); in via_save_sdcreg()
417 pm_sdhc_reg->sdclksel_reg = readl(addrbase + VIA_CRDR_SDCLKSEL); in via_save_sdcreg()
418 pm_sdhc_reg->sdextctrl_reg = readl(addrbase + VIA_CRDR_SDEXTCTRL); in via_save_sdcreg()
426 pm_sdhc_reg = &(host->pm_sdhc_reg); in via_restore_sdcreg()
427 addrbase = host->sdhc_mmiobase; in via_restore_sdcreg()
429 writel(pm_sdhc_reg->sdcontrol_reg, addrbase + VIA_CRDR_SDCTRL); in via_restore_sdcreg()
430 writel(pm_sdhc_reg->sdcmdarg_reg, addrbase + VIA_CRDR_SDCARG); in via_restore_sdcreg()
431 writel(pm_sdhc_reg->sdbusmode_reg, addrbase + VIA_CRDR_SDBUSMODE); in via_restore_sdcreg()
432 writel(pm_sdhc_reg->sdblklen_reg, addrbase + VIA_CRDR_SDBLKLEN); in via_restore_sdcreg()
433 writel(pm_sdhc_reg->sdcurblkcnt_reg, addrbase + VIA_CRDR_SDCURBLKCNT); in via_restore_sdcreg()
434 writel(pm_sdhc_reg->sdintmask_reg, addrbase + VIA_CRDR_SDINTMASK); in via_restore_sdcreg()
435 writel(pm_sdhc_reg->sdstatus_reg, addrbase + VIA_CRDR_SDSTATUS); in via_restore_sdcreg()
436 writel(pm_sdhc_reg->sdrsptmo_reg, addrbase + VIA_CRDR_SDRSPTMO); in via_restore_sdcreg()
437 writel(pm_sdhc_reg->sdclksel_reg, addrbase + VIA_CRDR_SDCLKSEL); in via_restore_sdcreg()
438 writel(pm_sdhc_reg->sdextctrl_reg, addrbase + VIA_CRDR_SDEXTCTRL); in via_restore_sdcreg()
443 if (sdhost->quirks & VIA_CRDR_QUIRK_300MS_PWRDELAY) in via_pwron_sleep()
446 msleep(3); in via_pwron_sleep()
461 addrbase = host->ddma_mmiobase; in via_set_ddma()
469 /* FIXME: don't brute-force 8MHz but use PIO at 375kHz !! */ in via_set_ddma()
470 addrbase = host->pcictrl_mmiobase; in via_set_ddma()
472 dev_info(host->mmc->parent, "forcing card speed to 8MHz\n"); in via_set_ddma()
484 WARN_ON(host->data); in via_sdc_preparedata()
487 BUG_ON(data->blksz > host->mmc->max_blk_size); in via_sdc_preparedata()
488 BUG_ON(data->blocks > host->mmc->max_blk_count); in via_sdc_preparedata()
490 host->data = data; in via_sdc_preparedata()
492 count = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in via_sdc_preparedata()
493 ((data->flags & MMC_DATA_READ) ? in via_sdc_preparedata()
497 via_set_ddma(host, sg_dma_address(data->sg), sg_dma_len(data->sg), in via_sdc_preparedata()
498 (data->flags & MMC_DATA_WRITE) ? 1 : 0, 1); in via_sdc_preparedata()
500 addrbase = host->sdhc_mmiobase; in via_sdc_preparedata()
502 blk_reg = data->blksz - 1; in via_sdc_preparedata()
504 blk_reg |= (data->blocks) << 16; in via_sdc_preparedata()
512 void __iomem *addrbase = host->sdhc_mmiobase; in via_sdc_get_response()
518 if (cmd->flags & MMC_RSP_136) { in via_sdc_get_response()
519 cmd->resp[0] = ((u8) (dwdata1)) | in via_sdc_get_response()
524 cmd->resp[1] = ((u8) (dwdata2)) | in via_sdc_get_response()
529 cmd->resp[2] = ((u8) (dwdata3)) | in via_sdc_get_response()
534 cmd->resp[3] = 0xff | in via_sdc_get_response()
540 cmd->resp[0] = ((dwdata0 & 0xff) << 24) | in via_sdc_get_response()
545 cmd->resp[1] = ((dwdata1 & 0xff) << 24) | in via_sdc_get_response()
559 WARN_ON(host->cmd); in via_sdc_send_command()
561 data = cmd->data; in via_sdc_send_command()
562 host->cmd = cmd; in via_sdc_send_command()
564 timeout_ms = cmd->busy_timeout ? cmd->busy_timeout : VIA_CMD_TIMEOUT_MS; in via_sdc_send_command()
565 mod_timer(&host->timer, jiffies + msecs_to_jiffies(timeout_ms)); in via_sdc_send_command()
568 cmdctrl = cmd->opcode << 8; in via_sdc_send_command()
588 pr_err("%s: cmd->flag is not valid\n", mmc_hostname(host->mmc)); in via_sdc_send_command()
592 if (!(cmd->data)) in via_sdc_send_command()
598 if (data->blocks > 1) { in via_sdc_send_command()
599 if (data->flags & MMC_DATA_WRITE) { in via_sdc_send_command()
606 if (data->flags & MMC_DATA_WRITE) { in via_sdc_send_command()
615 if (cmd == host->mrq->stop) in via_sdc_send_command()
620 addrbase = host->sdhc_mmiobase; in via_sdc_send_command()
621 writel(cmd->arg, addrbase + VIA_CRDR_SDCARG); in via_sdc_send_command()
629 BUG_ON(!host->data); in via_sdc_finish_data()
631 data = host->data; in via_sdc_finish_data()
632 host->data = NULL; in via_sdc_finish_data()
634 if (data->error) in via_sdc_finish_data()
635 data->bytes_xfered = 0; in via_sdc_finish_data()
637 data->bytes_xfered = data->blocks * data->blksz; in via_sdc_finish_data()
639 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in via_sdc_finish_data()
640 ((data->flags & MMC_DATA_READ) ? in via_sdc_finish_data()
643 if (data->stop) in via_sdc_finish_data()
644 via_sdc_send_command(host, data->stop); in via_sdc_finish_data()
646 tasklet_schedule(&host->finish_tasklet); in via_sdc_finish_data()
651 via_sdc_get_response(host, host->cmd); in via_sdc_finish_command()
653 host->cmd->error = 0; in via_sdc_finish_command()
655 if (!host->cmd->data) in via_sdc_finish_command()
656 tasklet_schedule(&host->finish_tasklet); in via_sdc_finish_command()
658 host->cmd = NULL; in via_sdc_finish_command()
670 spin_lock_irqsave(&host->lock, flags); in via_sdc_request()
672 addrbase = host->pcictrl_mmiobase; in via_sdc_request()
675 status = readw(host->sdhc_mmiobase + VIA_CRDR_SDSTATUS); in via_sdc_request()
677 writew(status, host->sdhc_mmiobase + VIA_CRDR_SDSTATUS); in via_sdc_request()
679 WARN_ON(host->mrq != NULL); in via_sdc_request()
680 host->mrq = mrq; in via_sdc_request()
682 status = readw(host->sdhc_mmiobase + VIA_CRDR_SDSTATUS); in via_sdc_request()
683 if (!(status & VIA_CRDR_SDSTS_SLOTG) || host->reject) { in via_sdc_request()
684 host->mrq->cmd->error = -ENOMEDIUM; in via_sdc_request()
685 tasklet_schedule(&host->finish_tasklet); in via_sdc_request()
687 via_sdc_send_command(host, mrq->cmd); in via_sdc_request()
690 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_request()
699 spin_lock_irqsave(&host->lock, flags); in via_sdc_set_power()
701 host->power = (1 << power); in via_sdc_set_power()
703 gatt = readb(host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sdc_set_power()
704 if (host->power == MMC_VDD_165_195) in via_sdc_set_power()
712 writeb(gatt, host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sdc_set_power()
714 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_set_power()
729 spin_lock_irqsave(&host->lock, flags); in via_sdc_set_ios()
731 addrbase = host->sdhc_mmiobase; in via_sdc_set_ios()
735 if (ios->bus_width == MMC_BUS_WIDTH_1) in via_sdc_set_ios()
740 if (ios->power_mode == MMC_POWER_OFF) in via_sdc_set_ios()
745 if (ios->timing == MMC_TIMING_SD_HS) in via_sdc_set_ios()
753 if (ios->clock >= 48000000) in via_sdc_set_ios()
755 else if (ios->clock >= 33000000) in via_sdc_set_ios()
757 else if (ios->clock >= 24000000) in via_sdc_set_ios()
759 else if (ios->clock >= 16000000) in via_sdc_set_ios()
761 else if (ios->clock >= 12000000) in via_sdc_set_ios()
763 else if (ios->clock >= 8000000) in via_sdc_set_ios()
768 addrbase = host->pcictrl_mmiobase; in via_sdc_set_ios()
772 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_set_ios()
774 if (ios->power_mode != MMC_POWER_OFF) in via_sdc_set_ios()
775 via_sdc_set_power(host, ios->vdd, 1); in via_sdc_set_ios()
777 via_sdc_set_power(host, ios->vdd, 0); in via_sdc_set_ios()
788 spin_lock_irqsave(&host->lock, flags); in via_sdc_get_ro()
790 status = readw(host->sdhc_mmiobase + VIA_CRDR_SDSTATUS); in via_sdc_get_ro()
792 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_get_ro()
808 spin_lock_irqsave(&host->lock, flags); in via_reset_pcictrl()
813 spin_unlock_irqrestore(&host->lock, flags); in via_reset_pcictrl()
816 if (host->power == MMC_VDD_165_195) in via_reset_pcictrl()
820 writeb(gatt, host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_reset_pcictrl()
823 writeb(gatt, host->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_reset_pcictrl()
824 msleep(3); in via_reset_pcictrl()
826 spin_lock_irqsave(&host->lock, flags); in via_reset_pcictrl()
831 spin_unlock_irqrestore(&host->lock, flags); in via_reset_pcictrl()
838 if (!host->cmd) { in via_sdc_cmd_isr()
841 mmc_hostname(host->mmc), intmask); in via_sdc_cmd_isr()
846 host->cmd->error = -ETIMEDOUT; in via_sdc_cmd_isr()
848 host->cmd->error = -EILSEQ; in via_sdc_cmd_isr()
850 if (host->cmd->error) in via_sdc_cmd_isr()
851 tasklet_schedule(&host->finish_tasklet); in via_sdc_cmd_isr()
860 if (!host->data) in via_sdc_data_isr()
864 host->data->error = -ETIMEDOUT; in via_sdc_data_isr()
866 host->data->error = -EILSEQ; in via_sdc_data_isr()
882 spin_lock(&sdhost->lock); in via_sdc_isr()
884 addrbase = sdhost->pcictrl_mmiobase; in via_sdc_isr()
891 addrbase = sdhost->sdhc_mmiobase; in via_sdc_isr()
904 schedule_work(&sdhost->carddet_work); in via_sdc_isr()
922 mmc_hostname(sdhost->mmc), sd_status); in via_sdc_isr()
929 spin_unlock(&sdhost->lock); in via_sdc_isr()
941 spin_lock_irqsave(&sdhost->lock, flags); in via_sdc_timeout()
943 if (sdhost->mrq) { in via_sdc_timeout()
945 "cmd:0x%x\n", mmc_hostname(sdhost->mmc), in via_sdc_timeout()
946 sdhost->mrq->cmd->opcode); in via_sdc_timeout()
948 if (sdhost->data) { in via_sdc_timeout()
950 sdhost->ddma_mmiobase + VIA_CRDR_DMACTRL); in via_sdc_timeout()
951 sdhost->data->error = -ETIMEDOUT; in via_sdc_timeout()
954 if (sdhost->cmd) in via_sdc_timeout()
955 sdhost->cmd->error = -ETIMEDOUT; in via_sdc_timeout()
957 sdhost->mrq->cmd->error = -ETIMEDOUT; in via_sdc_timeout()
958 tasklet_schedule(&sdhost->finish_tasklet); in via_sdc_timeout()
962 spin_unlock_irqrestore(&sdhost->lock, flags); in via_sdc_timeout()
971 spin_lock_irqsave(&host->lock, flags); in via_sdc_tasklet_finish()
973 del_timer(&host->timer); in via_sdc_tasklet_finish()
974 mrq = host->mrq; in via_sdc_tasklet_finish()
975 host->mrq = NULL; in via_sdc_tasklet_finish()
976 host->cmd = NULL; in via_sdc_tasklet_finish()
977 host->data = NULL; in via_sdc_tasklet_finish()
979 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_tasklet_finish()
981 mmc_request_done(host->mmc, mrq); in via_sdc_tasklet_finish()
993 addrbase = host->ddma_mmiobase; in via_sdc_card_detect()
996 spin_lock_irqsave(&host->lock, flags); in via_sdc_card_detect()
998 addrbase = host->pcictrl_mmiobase; in via_sdc_card_detect()
1001 addrbase = host->sdhc_mmiobase; in via_sdc_card_detect()
1004 if (host->mrq) { in via_sdc_card_detect()
1006 mmc_hostname(host->mmc)); in via_sdc_card_detect()
1007 host->mrq->cmd->error = -ENOMEDIUM; in via_sdc_card_detect()
1008 tasklet_schedule(&host->finish_tasklet); in via_sdc_card_detect()
1011 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_card_detect()
1015 spin_lock_irqsave(&host->lock, flags); in via_sdc_card_detect()
1018 spin_unlock_irqrestore(&host->lock, flags); in via_sdc_card_detect()
1023 mmc_detect_change(host->mmc, msecs_to_jiffies(500)); in via_sdc_card_detect()
1028 struct mmc_host *mmc = host->mmc; in via_init_mmc_host()
1033 timer_setup(&host->timer, via_sdc_timeout, 0); in via_init_mmc_host()
1035 spin_lock_init(&host->lock); in via_init_mmc_host()
1037 mmc->f_min = VIA_CRDR_MIN_CLOCK; in via_init_mmc_host()
1038 mmc->f_max = VIA_CRDR_MAX_CLOCK; in via_init_mmc_host()
1039 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; in via_init_mmc_host()
1040 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED; in via_init_mmc_host()
1041 mmc->ops = &via_sdc_ops; in via_init_mmc_host()
1044 mmc->max_segs = 1; in via_init_mmc_host()
1046 mmc->max_blk_size = VIA_CRDR_MAX_BLOCK_LENGTH; in via_init_mmc_host()
1047 mmc->max_blk_count = VIA_CRDR_MAX_BLOCK_COUNT; in via_init_mmc_host()
1049 mmc->max_seg_size = mmc->max_blk_size * mmc->max_blk_count; in via_init_mmc_host()
1050 mmc->max_req_size = mmc->max_seg_size; in via_init_mmc_host()
1052 INIT_WORK(&host->carddet_work, via_sdc_card_detect); in via_init_mmc_host()
1054 tasklet_setup(&host->finish_tasklet, via_sdc_tasklet_finish); in via_init_mmc_host()
1056 addrbase = host->sdhc_mmiobase; in via_init_mmc_host()
1087 ": VIA SDMMC controller found at %s [%04x:%04x] (rev %x)\n", in via_sd_probe()
1088 pci_name(pcidev), (int)pcidev->vendor, (int)pcidev->device, in via_sd_probe()
1089 (int)pcidev->revision); in via_sd_probe()
1102 mmc = mmc_alloc_host(sizeof(struct via_crdr_mmc_host), &pcidev->dev); in via_sd_probe()
1104 ret = -ENOMEM; in via_sd_probe()
1109 sdhost->mmc = mmc; in via_sd_probe()
1110 dev_set_drvdata(&pcidev->dev, sdhost); in via_sd_probe()
1114 sdhost->mmiobase = ioremap(base, len); in via_sd_probe()
1115 if (!sdhost->mmiobase) { in via_sd_probe()
1116 ret = -ENOMEM; in via_sd_probe()
1120 sdhost->sdhc_mmiobase = in via_sd_probe()
1121 sdhost->mmiobase + VIA_CRDR_SDC_OFF; in via_sd_probe()
1122 sdhost->ddma_mmiobase = in via_sd_probe()
1123 sdhost->mmiobase + VIA_CRDR_DDMA_OFF; in via_sd_probe()
1124 sdhost->pcictrl_mmiobase = in via_sd_probe()
1125 sdhost->mmiobase + VIA_CRDR_PCICTRL_OFF; in via_sd_probe()
1127 sdhost->power = MMC_VDD_165_195; in via_sd_probe()
1130 writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sd_probe()
1133 writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sd_probe()
1134 msleep(3); in via_sd_probe()
1139 request_irq(pcidev->irq, via_sdc_isr, IRQF_SHARED, DRV_NAME, in via_sd_probe()
1145 sdhost->pcictrl_mmiobase + VIA_CRDR_PCIINTCTRL); in via_sd_probe()
1147 sdhost->pcictrl_mmiobase + VIA_CRDR_PCITMOCTRL); in via_sd_probe()
1149 /* device-specific quirks */ in via_sd_probe()
1150 if (pcidev->subsystem_vendor == PCI_VENDOR_ID_LENOVO && in via_sd_probe()
1151 pcidev->subsystem_device == 0x3891) in via_sd_probe()
1152 sdhost->quirks = VIA_CRDR_QUIRK_300MS_PWRDELAY; in via_sd_probe()
1161 iounmap(sdhost->mmiobase); in via_sd_probe()
1178 spin_lock_irqsave(&sdhost->lock, flags); in via_sd_remove()
1181 sdhost->reject = 1; in via_sd_remove()
1184 writeb(0x0, sdhost->pcictrl_mmiobase + VIA_CRDR_PCIINTCTRL); in via_sd_remove()
1186 if (sdhost->mrq) { in via_sd_remove()
1188 "transfer\n", mmc_hostname(sdhost->mmc)); in via_sd_remove()
1192 sdhost->ddma_mmiobase + VIA_CRDR_DMACTRL); in via_sd_remove()
1193 sdhost->mrq->cmd->error = -ENOMEDIUM; in via_sd_remove()
1194 if (sdhost->mrq->stop) in via_sd_remove()
1195 sdhost->mrq->stop->error = -ENOMEDIUM; in via_sd_remove()
1196 tasklet_schedule(&sdhost->finish_tasklet); in via_sd_remove()
1198 spin_unlock_irqrestore(&sdhost->lock, flags); in via_sd_remove()
1200 mmc_remove_host(sdhost->mmc); in via_sd_remove()
1202 free_irq(pcidev->irq, sdhost); in via_sd_remove()
1204 del_timer_sync(&sdhost->timer); in via_sd_remove()
1206 tasklet_kill(&sdhost->finish_tasklet); in via_sd_remove()
1209 gatt = readb(sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sd_remove()
1211 writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sd_remove()
1213 iounmap(sdhost->mmiobase); in via_sd_remove()
1214 mmc_free_host(sdhost->mmc); in via_sd_remove()
1219 ": VIA SDMMC controller at %s [%04x:%04x] has been removed\n", in via_sd_remove()
1220 pci_name(pcidev), (int)pcidev->vendor, (int)pcidev->device); in via_sd_remove()
1230 pm_sdhcreg = &(host->pm_sdhc_reg); in via_init_sdc_pm()
1231 addrbase = host->sdhc_mmiobase; in via_init_sdc_pm()
1246 writel(pm_sdhcreg->sdcontrol_reg, addrbase + VIA_CRDR_SDCTRL); in via_init_sdc_pm()
1247 writel(pm_sdhcreg->sdcmdarg_reg, addrbase + VIA_CRDR_SDCARG); in via_init_sdc_pm()
1248 writel(pm_sdhcreg->sdintmask_reg, addrbase + VIA_CRDR_SDINTMASK); in via_init_sdc_pm()
1249 writel(pm_sdhcreg->sdrsptmo_reg, addrbase + VIA_CRDR_SDRSPTMO); in via_init_sdc_pm()
1250 writel(pm_sdhcreg->sdclksel_reg, addrbase + VIA_CRDR_SDCLKSEL); in via_init_sdc_pm()
1251 writel(pm_sdhcreg->sdextctrl_reg, addrbase + VIA_CRDR_SDEXTCTRL); in via_init_sdc_pm()
1264 spin_lock_irqsave(&host->lock, flags); in via_sd_suspend()
1267 spin_unlock_irqrestore(&host->lock, flags); in via_sd_suspend()
1282 if (sdhost->power == MMC_VDD_165_195) in via_sd_resume()
1286 writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sd_resume()
1289 writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT); in via_sd_resume()
1290 msleep(3); in via_sd_resume()