Lines Matching +full:mmc +full:-
1 // SPDX-License-Identifier: GPL-2.0-only
3 * WM8505/WM8650 SD/MMC Host Controller
14 #include <linux/dma-mapping.h>
25 #include <linux/mmc/host.h>
26 #include <linux/mmc/mmc.h>
27 #include <linux/mmc/sd.h>
32 #define DRIVER_NAME "wmt-sdhc"
35 /* MMC/SD controller registers */
121 /* MMC/SD DMA Controller Registers */
185 struct mmc_host *mmc; member
212 u32 reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE); in wmt_set_sd_power()
214 if (enable ^ priv->power_inverted) in wmt_set_sd_power()
219 writeb(reg_tmp, priv->sdmmc_base + SDMMC_BUSMODE); in wmt_set_sd_power()
222 static void wmt_mci_read_response(struct mmc_host *mmc) in wmt_mci_read_response() argument
229 priv = mmc_priv(mmc); in wmt_mci_read_response()
235 tmp_resp = readb(priv->sdmmc_base + SDMMC_RSP); in wmt_mci_read_response()
237 tmp_resp = readb(priv->sdmmc_base + SDMMC_RSP + in wmt_mci_read_response()
241 priv->cmd->resp[idx1] = cpu_to_be32(response); in wmt_mci_read_response()
249 reg_tmp = readb(priv->sdmmc_base + SDMMC_CTLR); in wmt_mci_start_command()
250 writeb(reg_tmp | CTLR_CMD_START, priv->sdmmc_base + SDMMC_CTLR); in wmt_mci_start_command()
253 static int wmt_mci_send_command(struct mmc_host *mmc, u8 command, u8 cmdtype, in wmt_mci_send_command() argument
259 priv = mmc_priv(mmc); in wmt_mci_send_command()
262 writeb(command, priv->sdmmc_base + SDMMC_CMD); in wmt_mci_send_command()
263 writel(arg, priv->sdmmc_base + SDMMC_ARG); in wmt_mci_send_command()
264 writeb(rsptype, priv->sdmmc_base + SDMMC_RSPTYPE); in wmt_mci_send_command()
267 reg_tmp = readb(priv->sdmmc_base + SDMMC_CTLR); in wmt_mci_send_command()
268 writeb(reg_tmp | CTLR_FIFO_RESET, priv->sdmmc_base + SDMMC_CTLR); in wmt_mci_send_command()
270 /* ensure clock enabled - VT3465 */ in wmt_mci_send_command()
274 writeb(0xFF, priv->sdmmc_base + SDMMC_STS0); in wmt_mci_send_command()
275 writeb(0xFF, priv->sdmmc_base + SDMMC_STS1); in wmt_mci_send_command()
276 writeb(0xFF, priv->sdmmc_base + SDMMC_STS2); in wmt_mci_send_command()
277 writeb(0xFF, priv->sdmmc_base + SDMMC_STS3); in wmt_mci_send_command()
280 reg_tmp = readb(priv->sdmmc_base + SDMMC_CTLR); in wmt_mci_send_command()
282 priv->sdmmc_base + SDMMC_CTLR); in wmt_mci_send_command()
289 writel(DMA_ISR_INT_STS, priv->sdmmc_base + SDDMA_ISR); in wmt_mci_disable_dma()
290 writel(0, priv->sdmmc_base + SDDMA_IER); in wmt_mci_disable_dma()
296 req = priv->req; in wmt_complete_data_request()
298 req->data->bytes_xfered = req->data->blksz * req->data->blocks; in wmt_complete_data_request()
301 if (req->data->flags & MMC_DATA_WRITE) in wmt_complete_data_request()
302 dma_unmap_sg(mmc_dev(priv->mmc), req->data->sg, in wmt_complete_data_request()
303 req->data->sg_len, DMA_TO_DEVICE); in wmt_complete_data_request()
305 dma_unmap_sg(mmc_dev(priv->mmc), req->data->sg, in wmt_complete_data_request()
306 req->data->sg_len, DMA_FROM_DEVICE); in wmt_complete_data_request()
309 if ((req->cmd->error) || (req->data->error)) in wmt_complete_data_request()
310 mmc_request_done(priv->mmc, req); in wmt_complete_data_request()
312 wmt_mci_read_response(priv->mmc); in wmt_complete_data_request()
313 if (!req->data->stop) { in wmt_complete_data_request()
314 /* single-block read/write requests end here */ in wmt_complete_data_request()
315 mmc_request_done(priv->mmc, req); in wmt_complete_data_request()
318 * we change the priv->cmd variable so the response is in wmt_complete_data_request()
322 priv->comp_cmd = &priv->cmdcomp; in wmt_complete_data_request()
323 init_completion(priv->comp_cmd); in wmt_complete_data_request()
324 priv->cmd = req->data->stop; in wmt_complete_data_request()
325 wmt_mci_send_command(priv->mmc, req->data->stop->opcode, in wmt_complete_data_request()
326 7, req->data->stop->arg, 9); in wmt_complete_data_request()
340 status = readl(priv->sdmmc_base + SDDMA_CCR) & 0x0F; in wmt_mci_dma_isr()
343 dev_err(priv->dev, "DMA Error: Status = %d\n", status); in wmt_mci_dma_isr()
344 priv->req->data->error = -ETIMEDOUT; in wmt_mci_dma_isr()
345 complete(priv->comp_dma); in wmt_mci_dma_isr()
349 priv->req->data->error = 0; in wmt_mci_dma_isr()
353 complete(priv->comp_dma); in wmt_mci_dma_isr()
355 if (priv->comp_cmd) { in wmt_mci_dma_isr()
356 if (completion_done(priv->comp_cmd)) { in wmt_mci_dma_isr()
380 status0 = readb(priv->sdmmc_base + SDMMC_STS0); in wmt_mci_regular_isr()
381 status1 = readb(priv->sdmmc_base + SDMMC_STS1); in wmt_mci_regular_isr()
382 status2 = readb(priv->sdmmc_base + SDMMC_STS2); in wmt_mci_regular_isr()
385 reg_tmp = readb(priv->sdmmc_base + SDMMC_INTMASK0); in wmt_mci_regular_isr()
387 mmc_detect_change(priv->mmc, 0); in wmt_mci_regular_isr()
388 if (priv->cmd) in wmt_mci_regular_isr()
389 priv->cmd->error = -ETIMEDOUT; in wmt_mci_regular_isr()
390 if (priv->comp_cmd) in wmt_mci_regular_isr()
391 complete(priv->comp_cmd); in wmt_mci_regular_isr()
392 if (priv->comp_dma) { in wmt_mci_regular_isr()
394 complete(priv->comp_dma); in wmt_mci_regular_isr()
396 writeb(STS0_DEVICE_INS, priv->sdmmc_base + SDMMC_STS0); in wmt_mci_regular_isr()
400 if ((!priv->req->data) || in wmt_mci_regular_isr()
401 ((priv->req->data->stop) && (priv->cmd == priv->req->data->stop))) { in wmt_mci_regular_isr()
402 /* handle non-data & stop_transmission requests */ in wmt_mci_regular_isr()
404 priv->cmd->error = 0; in wmt_mci_regular_isr()
408 priv->cmd->error = -ETIMEDOUT; in wmt_mci_regular_isr()
413 priv->comp_cmd = NULL; in wmt_mci_regular_isr()
415 if (!priv->cmd->error) in wmt_mci_regular_isr()
416 wmt_mci_read_response(priv->mmc); in wmt_mci_regular_isr()
418 priv->cmd = NULL; in wmt_mci_regular_isr()
420 mmc_request_done(priv->mmc, priv->req); in wmt_mci_regular_isr()
425 if (priv->cmd) in wmt_mci_regular_isr()
426 priv->cmd->error = 0; in wmt_mci_regular_isr()
427 if (priv->comp_cmd) in wmt_mci_regular_isr()
428 complete(priv->comp_cmd); in wmt_mci_regular_isr()
433 if (priv->cmd) in wmt_mci_regular_isr()
434 priv->cmd->error = -ETIMEDOUT; in wmt_mci_regular_isr()
435 if (priv->comp_cmd) in wmt_mci_regular_isr()
436 complete(priv->comp_cmd); in wmt_mci_regular_isr()
437 if (priv->comp_dma) { in wmt_mci_regular_isr()
439 complete(priv->comp_dma); in wmt_mci_regular_isr()
443 if (priv->comp_dma) { in wmt_mci_regular_isr()
449 if (completion_done(priv->comp_dma)) in wmt_mci_regular_isr()
454 writeb(status0, priv->sdmmc_base + SDMMC_STS0); in wmt_mci_regular_isr()
455 writeb(status1, priv->sdmmc_base + SDMMC_STS1); in wmt_mci_regular_isr()
456 writeb(status2, priv->sdmmc_base + SDMMC_STS2); in wmt_mci_regular_isr()
461 static void wmt_reset_hardware(struct mmc_host *mmc) in wmt_reset_hardware() argument
466 priv = mmc_priv(mmc); in wmt_reset_hardware()
469 reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE); in wmt_reset_hardware()
470 writeb(reg_tmp | BM_SOFT_RESET, priv->sdmmc_base + SDMMC_BUSMODE); in wmt_reset_hardware()
473 reg_tmp = readb(priv->sdmmc_base + SDMMC_CTLR); in wmt_reset_hardware()
474 writeb(reg_tmp | CTLR_FIFO_RESET, priv->sdmmc_base + SDMMC_CTLR); in wmt_reset_hardware()
477 writew(BLKL_INT_ENABLE | BLKL_GPI_CD, priv->sdmmc_base + SDMMC_BLKLEN); in wmt_reset_hardware()
480 writeb(0xFF, priv->sdmmc_base + SDMMC_STS0); in wmt_reset_hardware()
481 writeb(0xFF, priv->sdmmc_base + SDMMC_STS1); in wmt_reset_hardware()
484 writeb(INT0_CD_INT_EN | INT0_DI_INT_EN, priv->sdmmc_base + in wmt_reset_hardware()
487 INT1_CMD_RES_TOUT_INT_EN, priv->sdmmc_base + SDMMC_INTMASK1); in wmt_reset_hardware()
490 writew(8191, priv->sdmmc_base + SDMMC_DMATIMEOUT); in wmt_reset_hardware()
493 reg_tmp = readb(priv->sdmmc_base + SDMMC_STS2); in wmt_reset_hardware()
494 writeb(reg_tmp | STS2_DIS_FORCECLK, priv->sdmmc_base + SDMMC_STS2); in wmt_reset_hardware()
497 clk_set_rate(priv->clk_sdmmc, 400000); in wmt_reset_hardware()
500 static int wmt_dma_init(struct mmc_host *mmc) in wmt_dma_init() argument
504 priv = mmc_priv(mmc); in wmt_dma_init()
506 writel(DMA_GCR_SOFT_RESET, priv->sdmmc_base + SDDMA_GCR); in wmt_dma_init()
507 writel(DMA_GCR_DMA_EN, priv->sdmmc_base + SDDMA_GCR); in wmt_dma_init()
508 if ((readl(priv->sdmmc_base + SDDMA_GCR) & DMA_GCR_DMA_EN) != 0) in wmt_dma_init()
517 desc->flags = 0x40000000 | req_count; in wmt_dma_init_descriptor()
519 desc->flags |= 0x80000000; in wmt_dma_init_descriptor()
520 desc->data_buffer_addr = buffer_addr; in wmt_dma_init_descriptor()
521 desc->branch_addr = branch_addr; in wmt_dma_init_descriptor()
524 static void wmt_dma_config(struct mmc_host *mmc, u32 descaddr, u8 dir) in wmt_dma_config() argument
529 priv = mmc_priv(mmc); in wmt_dma_config()
532 writel(DMA_IER_INT_EN, priv->sdmmc_base + SDDMA_IER); in wmt_dma_config()
535 writel(descaddr, priv->sdmmc_base + SDDMA_DESPR); in wmt_dma_config()
537 writel(0x00, priv->sdmmc_base + SDDMA_CCR); in wmt_dma_config()
540 reg_tmp = readl(priv->sdmmc_base + SDDMA_CCR); in wmt_dma_config()
541 writel(reg_tmp & DMA_CCR_IF_TO_PERIPHERAL, priv->sdmmc_base + in wmt_dma_config()
544 reg_tmp = readl(priv->sdmmc_base + SDDMA_CCR); in wmt_dma_config()
545 writel(reg_tmp | DMA_CCR_PERIPHERAL_TO_IF, priv->sdmmc_base + in wmt_dma_config()
554 reg_tmp = readl(priv->sdmmc_base + SDDMA_CCR); in wmt_dma_start()
555 writel(reg_tmp | DMA_CCR_RUN, priv->sdmmc_base + SDDMA_CCR); in wmt_dma_start()
558 static void wmt_mci_request(struct mmc_host *mmc, struct mmc_request *req) in wmt_mci_request() argument
575 priv = mmc_priv(mmc); in wmt_mci_request()
576 priv->req = req; in wmt_mci_request()
580 * This is required on multi-block requests to pass the pointer to the in wmt_mci_request()
583 priv->cmd = req->cmd; in wmt_mci_request()
585 command = req->cmd->opcode; in wmt_mci_request()
586 arg = req->cmd->arg; in wmt_mci_request()
587 rsptype = mmc_resp_type(req->cmd); in wmt_mci_request()
590 /* rsptype=7 only valid for SPI commands - should be =2 for SD */ in wmt_mci_request()
597 if (!req->data) { in wmt_mci_request()
598 wmt_mci_send_command(mmc, command, cmdtype, arg, rsptype); in wmt_mci_request()
602 if (req->data) { in wmt_mci_request()
603 priv->comp_cmd = &priv->cmdcomp; in wmt_mci_request()
604 init_completion(priv->comp_cmd); in wmt_mci_request()
606 wmt_dma_init(mmc); in wmt_mci_request()
609 reg_tmp = readw(priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_request()
610 writew((reg_tmp & 0xF800) | (req->data->blksz - 1), in wmt_mci_request()
611 priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_request()
614 writew(req->data->blocks, priv->sdmmc_base + SDMMC_BLKCNT); in wmt_mci_request()
616 desc = (struct wmt_dma_descriptor *)priv->dma_desc_buffer; in wmt_mci_request()
618 if (req->data->flags & MMC_DATA_WRITE) { in wmt_mci_request()
619 sg_cnt = dma_map_sg(mmc_dev(mmc), req->data->sg, in wmt_mci_request()
620 req->data->sg_len, DMA_TO_DEVICE); in wmt_mci_request()
622 if (req->data->blocks > 1) in wmt_mci_request()
625 sg_cnt = dma_map_sg(mmc_dev(mmc), req->data->sg, in wmt_mci_request()
626 req->data->sg_len, DMA_FROM_DEVICE); in wmt_mci_request()
628 if (req->data->blocks > 1) in wmt_mci_request()
632 dma_address = priv->dma_desc_device_addr + 16; in wmt_mci_request()
635 for_each_sg(req->data->sg, sg, sg_cnt, i) { in wmt_mci_request()
638 wmt_dma_init_descriptor(desc, req->data->blksz, in wmt_mci_request()
643 offset += req->data->blksz; in wmt_mci_request()
645 if (desc_cnt == req->data->blocks) in wmt_mci_request()
649 desc--; in wmt_mci_request()
650 desc->flags |= 0x80000000; in wmt_mci_request()
652 if (req->data->flags & MMC_DATA_WRITE) in wmt_mci_request()
653 wmt_dma_config(mmc, priv->dma_desc_device_addr, in wmt_mci_request()
656 wmt_dma_config(mmc, priv->dma_desc_device_addr, in wmt_mci_request()
659 wmt_mci_send_command(mmc, command, cmdtype, arg, rsptype); in wmt_mci_request()
661 priv->comp_dma = &priv->datacomp; in wmt_mci_request()
662 init_completion(priv->comp_dma); in wmt_mci_request()
669 static void wmt_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in wmt_mci_set_ios() argument
674 priv = mmc_priv(mmc); in wmt_mci_set_ios()
676 if (ios->power_mode == MMC_POWER_UP) { in wmt_mci_set_ios()
677 wmt_reset_hardware(mmc); in wmt_mci_set_ios()
681 if (ios->power_mode == MMC_POWER_OFF) in wmt_mci_set_ios()
684 if (ios->clock != 0) in wmt_mci_set_ios()
685 clk_set_rate(priv->clk_sdmmc, ios->clock); in wmt_mci_set_ios()
687 busmode = readb(priv->sdmmc_base + SDMMC_BUSMODE); in wmt_mci_set_ios()
688 extctrl = readb(priv->sdmmc_base + SDMMC_EXTCTRL); in wmt_mci_set_ios()
693 switch (ios->bus_width) { in wmt_mci_set_ios()
705 writeb(busmode, priv->sdmmc_base + SDMMC_BUSMODE); in wmt_mci_set_ios()
706 writeb(extctrl, priv->sdmmc_base + SDMMC_EXTCTRL); in wmt_mci_set_ios()
709 static int wmt_mci_get_ro(struct mmc_host *mmc) in wmt_mci_get_ro() argument
711 struct wmt_mci_priv *priv = mmc_priv(mmc); in wmt_mci_get_ro()
713 return !(readb(priv->sdmmc_base + SDMMC_STS0) & STS0_WRITE_PROTECT); in wmt_mci_get_ro()
716 static int wmt_mci_get_cd(struct mmc_host *mmc) in wmt_mci_get_cd() argument
718 struct wmt_mci_priv *priv = mmc_priv(mmc); in wmt_mci_get_cd()
719 u32 cd = (readb(priv->sdmmc_base + SDMMC_STS0) & STS0_CD_GPI) >> 3; in wmt_mci_get_cd()
721 return !(cd ^ priv->cd_inverted); in wmt_mci_get_cd()
744 { .compatible = "wm,wm8505-sdhc", .data = &wm8505_caps },
750 struct mmc_host *mmc; in wmt_mci_probe() local
752 struct device_node *np = pdev->dev.of_node; in wmt_mci_probe()
757 wmt_caps = of_device_get_match_data(&pdev->dev); in wmt_mci_probe()
759 dev_err(&pdev->dev, "Controller capabilities data missing\n"); in wmt_mci_probe()
760 return -EFAULT; in wmt_mci_probe()
764 dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n"); in wmt_mci_probe()
765 return -EFAULT; in wmt_mci_probe()
772 dev_err(&pdev->dev, "Getting IRQs failed!\n"); in wmt_mci_probe()
773 ret = -ENXIO; in wmt_mci_probe()
777 mmc = mmc_alloc_host(sizeof(struct wmt_mci_priv), &pdev->dev); in wmt_mci_probe()
778 if (!mmc) { in wmt_mci_probe()
779 dev_err(&pdev->dev, "Failed to allocate mmc_host\n"); in wmt_mci_probe()
780 ret = -ENOMEM; in wmt_mci_probe()
784 mmc->ops = &wmt_mci_ops; in wmt_mci_probe()
785 mmc->f_min = wmt_caps->f_min; in wmt_mci_probe()
786 mmc->f_max = wmt_caps->f_max; in wmt_mci_probe()
787 mmc->ocr_avail = wmt_caps->ocr_avail; in wmt_mci_probe()
788 mmc->caps = wmt_caps->caps; in wmt_mci_probe()
790 mmc->max_seg_size = wmt_caps->max_seg_size; in wmt_mci_probe()
791 mmc->max_segs = wmt_caps->max_segs; in wmt_mci_probe()
792 mmc->max_blk_size = wmt_caps->max_blk_size; in wmt_mci_probe()
794 mmc->max_req_size = (16*512*mmc->max_segs); in wmt_mci_probe()
795 mmc->max_blk_count = mmc->max_req_size / 512; in wmt_mci_probe()
797 priv = mmc_priv(mmc); in wmt_mci_probe()
798 priv->mmc = mmc; in wmt_mci_probe()
799 priv->dev = &pdev->dev; in wmt_mci_probe()
801 priv->power_inverted = 0; in wmt_mci_probe()
802 priv->cd_inverted = 0; in wmt_mci_probe()
804 priv->power_inverted = of_property_read_bool(np, "sdon-inverted"); in wmt_mci_probe()
805 priv->cd_inverted = of_property_read_bool(np, "cd-inverted"); in wmt_mci_probe()
807 priv->sdmmc_base = of_iomap(np, 0); in wmt_mci_probe()
808 if (!priv->sdmmc_base) { in wmt_mci_probe()
809 dev_err(&pdev->dev, "Failed to map IO space\n"); in wmt_mci_probe()
810 ret = -ENOMEM; in wmt_mci_probe()
814 priv->irq_regular = regular_irq; in wmt_mci_probe()
815 priv->irq_dma = dma_irq; in wmt_mci_probe()
819 dev_err(&pdev->dev, "Register regular IRQ fail\n"); in wmt_mci_probe()
825 dev_err(&pdev->dev, "Register DMA IRQ fail\n"); in wmt_mci_probe()
830 priv->dma_desc_buffer = dma_alloc_coherent(&pdev->dev, in wmt_mci_probe()
831 mmc->max_blk_count * 16, in wmt_mci_probe()
832 &priv->dma_desc_device_addr, in wmt_mci_probe()
834 if (!priv->dma_desc_buffer) { in wmt_mci_probe()
835 dev_err(&pdev->dev, "DMA alloc fail\n"); in wmt_mci_probe()
836 ret = -EPERM; in wmt_mci_probe()
840 platform_set_drvdata(pdev, mmc); in wmt_mci_probe()
842 priv->clk_sdmmc = of_clk_get(np, 0); in wmt_mci_probe()
843 if (IS_ERR(priv->clk_sdmmc)) { in wmt_mci_probe()
844 dev_err(&pdev->dev, "Error getting clock\n"); in wmt_mci_probe()
845 ret = PTR_ERR(priv->clk_sdmmc); in wmt_mci_probe()
849 ret = clk_prepare_enable(priv->clk_sdmmc); in wmt_mci_probe()
854 wmt_reset_hardware(mmc); in wmt_mci_probe()
856 ret = mmc_add_host(mmc); in wmt_mci_probe()
860 dev_info(&pdev->dev, "WMT SDHC Controller initialized\n"); in wmt_mci_probe()
864 clk_disable_unprepare(priv->clk_sdmmc); in wmt_mci_probe()
866 clk_put(priv->clk_sdmmc); in wmt_mci_probe()
868 dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16, in wmt_mci_probe()
869 priv->dma_desc_buffer, priv->dma_desc_device_addr); in wmt_mci_probe()
875 iounmap(priv->sdmmc_base); in wmt_mci_probe()
877 mmc_free_host(mmc); in wmt_mci_probe()
884 struct mmc_host *mmc; in wmt_mci_remove() local
888 mmc = platform_get_drvdata(pdev); in wmt_mci_remove()
889 priv = mmc_priv(mmc); in wmt_mci_remove()
892 reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE); in wmt_mci_remove()
893 writel(reg_tmp | BM_SOFT_RESET, priv->sdmmc_base + SDMMC_BUSMODE); in wmt_mci_remove()
894 reg_tmp = readw(priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_remove()
895 writew(reg_tmp & ~(0xA000), priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_remove()
896 writeb(0xFF, priv->sdmmc_base + SDMMC_STS0); in wmt_mci_remove()
897 writeb(0xFF, priv->sdmmc_base + SDMMC_STS1); in wmt_mci_remove()
900 dma_free_coherent(&pdev->dev, priv->mmc->max_blk_count * 16, in wmt_mci_remove()
901 priv->dma_desc_buffer, priv->dma_desc_device_addr); in wmt_mci_remove()
903 mmc_remove_host(mmc); in wmt_mci_remove()
905 free_irq(priv->irq_regular, priv); in wmt_mci_remove()
906 free_irq(priv->irq_dma, priv); in wmt_mci_remove()
908 iounmap(priv->sdmmc_base); in wmt_mci_remove()
910 clk_disable_unprepare(priv->clk_sdmmc); in wmt_mci_remove()
911 clk_put(priv->clk_sdmmc); in wmt_mci_remove()
913 mmc_free_host(mmc); in wmt_mci_remove()
915 dev_info(&pdev->dev, "WMT MCI device removed\n"); in wmt_mci_remove()
922 struct mmc_host *mmc = dev_get_drvdata(dev); in wmt_mci_suspend() local
925 if (!mmc) in wmt_mci_suspend()
928 priv = mmc_priv(mmc); in wmt_mci_suspend()
929 reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE); in wmt_mci_suspend()
930 writeb(reg_tmp | BM_SOFT_RESET, priv->sdmmc_base + in wmt_mci_suspend()
933 reg_tmp = readw(priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_suspend()
934 writew(reg_tmp & 0x5FFF, priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_suspend()
936 writeb(0xFF, priv->sdmmc_base + SDMMC_STS0); in wmt_mci_suspend()
937 writeb(0xFF, priv->sdmmc_base + SDMMC_STS1); in wmt_mci_suspend()
939 clk_disable(priv->clk_sdmmc); in wmt_mci_suspend()
946 struct mmc_host *mmc = dev_get_drvdata(dev); in wmt_mci_resume() local
949 if (mmc) { in wmt_mci_resume()
950 priv = mmc_priv(mmc); in wmt_mci_resume()
951 clk_enable(priv->clk_sdmmc); in wmt_mci_resume()
953 reg_tmp = readb(priv->sdmmc_base + SDMMC_BUSMODE); in wmt_mci_resume()
954 writeb(reg_tmp | BM_SOFT_RESET, priv->sdmmc_base + in wmt_mci_resume()
957 reg_tmp = readw(priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_resume()
959 priv->sdmmc_base + SDMMC_BLKLEN); in wmt_mci_resume()
961 reg_tmp = readb(priv->sdmmc_base + SDMMC_INTMASK0); in wmt_mci_resume()
962 writeb(reg_tmp | INT0_DI_INT_EN, priv->sdmmc_base + in wmt_mci_resume()
996 MODULE_DESCRIPTION("Wondermedia MMC/SD Driver");