Lines Matching +full:mmc +full:-

1 // SPDX-License-Identifier: GPL-2.0+
3 * Amlogic Meson6/Meson8/Meson8b/Meson8m2 SDHC MMC host controller driver.
10 #include <linux/dma-mapping.h>
21 #include <linux/mmc/host.h>
22 #include <linux/mmc/mmc.h>
23 #include <linux/mmc/sdio.h>
24 #include <linux/mmc/slot-gpio.h>
26 #include "meson-mx-sdhc.h"
38 void (*init_hw)(struct mmc_host *mmc);
39 void (*set_pdma)(struct mmc_host *mmc);
40 void (*wait_before_send)(struct mmc_host *mmc);
45 struct mmc_host *mmc; member
70 regmap_write(host->regmap, MESON_SDHC_SRST, MESON_SDHC_SRST_MAIN_CTRL | in meson_mx_sdhc_reset()
76 regmap_write(host->regmap, MESON_SDHC_SRST, 0); in meson_mx_sdhc_reset()
80 static void meson_mx_sdhc_clear_fifo(struct mmc_host *mmc) in meson_mx_sdhc_clear_fifo() argument
82 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_clear_fifo()
85 regmap_read(host->regmap, MESON_SDHC_STAT, &stat); in meson_mx_sdhc_clear_fifo()
90 regmap_write(host->regmap, MESON_SDHC_SRST, MESON_SDHC_SRST_RXFIFO | in meson_mx_sdhc_clear_fifo()
94 regmap_read(host->regmap, MESON_SDHC_STAT, &stat); in meson_mx_sdhc_clear_fifo()
97 dev_warn(mmc_dev(host->mmc), in meson_mx_sdhc_clear_fifo()
103 static void meson_mx_sdhc_wait_cmd_ready(struct mmc_host *mmc) in meson_mx_sdhc_wait_cmd_ready() argument
105 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_wait_cmd_ready()
109 ret = regmap_read_poll_timeout(host->regmap, MESON_SDHC_STAT, stat, in meson_mx_sdhc_wait_cmd_ready()
114 dev_warn(mmc_dev(mmc), in meson_mx_sdhc_wait_cmd_ready()
116 host->cmd->opcode); in meson_mx_sdhc_wait_cmd_ready()
120 ret = regmap_read_poll_timeout(host->regmap, MESON_SDHC_ESTA, esta, in meson_mx_sdhc_wait_cmd_ready()
125 dev_warn(mmc_dev(mmc), in meson_mx_sdhc_wait_cmd_ready()
127 host->cmd->opcode); in meson_mx_sdhc_wait_cmd_ready()
132 static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc, in meson_mx_sdhc_start_cmd() argument
135 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_start_cmd()
140 host->cmd = cmd; in meson_mx_sdhc_start_cmd()
146 send = FIELD_PREP(MESON_SDHC_SEND_CMD_INDEX, cmd->opcode); in meson_mx_sdhc_start_cmd()
148 if (cmd->data) { in meson_mx_sdhc_start_cmd()
151 cmd->data->blocks - 1); in meson_mx_sdhc_start_cmd()
153 if (cmd->data->blksz < MESON_SDHC_MAX_BLK_SIZE) in meson_mx_sdhc_start_cmd()
154 pack_len = cmd->data->blksz; in meson_mx_sdhc_start_cmd()
158 if (cmd->data->flags & MMC_DATA_WRITE) in meson_mx_sdhc_start_cmd()
167 if (host->platform->hardware_flush_all_cmds || in meson_mx_sdhc_start_cmd()
168 cmd->data->flags & MMC_DATA_WRITE) in meson_mx_sdhc_start_cmd()
183 manual_stop = cmd->data->blocks > 1 && in meson_mx_sdhc_start_cmd()
184 cmd->opcode == SD_IO_RW_EXTENDED; in meson_mx_sdhc_start_cmd()
191 regmap_update_bits(host->regmap, MESON_SDHC_MISC, in meson_mx_sdhc_start_cmd()
195 if (cmd->opcode == MMC_STOP_TRANSMISSION) in meson_mx_sdhc_start_cmd()
198 if (cmd->flags & MMC_RSP_PRESENT) in meson_mx_sdhc_start_cmd()
201 if (cmd->flags & MMC_RSP_136) { in meson_mx_sdhc_start_cmd()
206 if (!(cmd->flags & MMC_RSP_CRC)) in meson_mx_sdhc_start_cmd()
209 if (cmd->flags & MMC_RSP_BUSY) in meson_mx_sdhc_start_cmd()
213 regmap_write(host->regmap, MESON_SDHC_ICTL, ictl); in meson_mx_sdhc_start_cmd()
214 regmap_write(host->regmap, MESON_SDHC_ISTA, MESON_SDHC_ISTA_ALL_IRQS); in meson_mx_sdhc_start_cmd()
216 regmap_write(host->regmap, MESON_SDHC_ARGU, cmd->arg); in meson_mx_sdhc_start_cmd()
218 regmap_update_bits(host->regmap, MESON_SDHC_CTRL, in meson_mx_sdhc_start_cmd()
222 if (cmd->data) in meson_mx_sdhc_start_cmd()
223 regmap_write(host->regmap, MESON_SDHC_ADDR, in meson_mx_sdhc_start_cmd()
224 sg_dma_address(cmd->data->sg)); in meson_mx_sdhc_start_cmd()
226 meson_mx_sdhc_wait_cmd_ready(mmc); in meson_mx_sdhc_start_cmd()
228 if (cmd->data) in meson_mx_sdhc_start_cmd()
229 host->platform->set_pdma(mmc); in meson_mx_sdhc_start_cmd()
231 if (host->platform->wait_before_send) in meson_mx_sdhc_start_cmd()
232 host->platform->wait_before_send(mmc); in meson_mx_sdhc_start_cmd()
234 regmap_write(host->regmap, MESON_SDHC_SEND, send); in meson_mx_sdhc_start_cmd()
237 static void meson_mx_sdhc_disable_clks(struct mmc_host *mmc) in meson_mx_sdhc_disable_clks() argument
239 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_disable_clks()
241 if (!host->bulk_clks_enabled) in meson_mx_sdhc_disable_clks()
244 clk_bulk_disable_unprepare(MESON_SDHC_NUM_BULK_CLKS, host->bulk_clks); in meson_mx_sdhc_disable_clks()
246 host->bulk_clks_enabled = false; in meson_mx_sdhc_disable_clks()
249 static int meson_mx_sdhc_enable_clks(struct mmc_host *mmc) in meson_mx_sdhc_enable_clks() argument
251 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_enable_clks()
254 if (host->bulk_clks_enabled) in meson_mx_sdhc_enable_clks()
258 host->bulk_clks); in meson_mx_sdhc_enable_clks()
262 host->bulk_clks_enabled = true; in meson_mx_sdhc_enable_clks()
267 static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios) in meson_mx_sdhc_set_clk() argument
269 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_set_clk()
273 meson_mx_sdhc_disable_clks(mmc); in meson_mx_sdhc_set_clk()
275 if (ios->clock) { in meson_mx_sdhc_set_clk()
276 ret = clk_set_rate(host->sd_clk, ios->clock); in meson_mx_sdhc_set_clk()
278 dev_warn(mmc_dev(mmc), in meson_mx_sdhc_set_clk()
279 "Failed to set MMC clock to %uHz: %d\n", in meson_mx_sdhc_set_clk()
280 ios->clock, host->error); in meson_mx_sdhc_set_clk()
284 ret = meson_mx_sdhc_enable_clks(mmc); in meson_mx_sdhc_set_clk()
288 mmc->actual_clock = clk_get_rate(host->sd_clk); in meson_mx_sdhc_set_clk()
294 regmap_read(host->regmap, MESON_SDHC_CLKC, &val); in meson_mx_sdhc_set_clk()
296 regmap_update_bits(host->regmap, MESON_SDHC_CLK2, in meson_mx_sdhc_set_clk()
301 mmc->actual_clock = 0; in meson_mx_sdhc_set_clk()
307 static void meson_mx_sdhc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in meson_mx_sdhc_set_ios() argument
309 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_set_ios()
310 unsigned short vdd = ios->vdd; in meson_mx_sdhc_set_ios()
312 switch (ios->power_mode) { in meson_mx_sdhc_set_ios()
318 if (!IS_ERR(mmc->supply.vmmc)) { in meson_mx_sdhc_set_ios()
319 host->error = mmc_regulator_set_ocr(mmc, in meson_mx_sdhc_set_ios()
320 mmc->supply.vmmc, in meson_mx_sdhc_set_ios()
322 if (host->error) in meson_mx_sdhc_set_ios()
332 host->error = meson_mx_sdhc_set_clk(mmc, ios); in meson_mx_sdhc_set_ios()
333 if (host->error) in meson_mx_sdhc_set_ios()
336 switch (ios->bus_width) { in meson_mx_sdhc_set_ios()
338 regmap_update_bits(host->regmap, MESON_SDHC_CTRL, in meson_mx_sdhc_set_ios()
344 regmap_update_bits(host->regmap, MESON_SDHC_CTRL, in meson_mx_sdhc_set_ios()
350 regmap_update_bits(host->regmap, MESON_SDHC_CTRL, in meson_mx_sdhc_set_ios()
356 dev_err(mmc_dev(mmc), "unsupported bus width: %d\n", in meson_mx_sdhc_set_ios()
357 ios->bus_width); in meson_mx_sdhc_set_ios()
358 host->error = -EINVAL; in meson_mx_sdhc_set_ios()
363 static int meson_mx_sdhc_map_dma(struct mmc_host *mmc, struct mmc_request *mrq) in meson_mx_sdhc_map_dma() argument
365 struct mmc_data *data = mrq->data; in meson_mx_sdhc_map_dma()
371 dma_len = dma_map_sg(mmc_dev(mmc), data->sg, data->sg_len, in meson_mx_sdhc_map_dma()
374 dev_err(mmc_dev(mmc), "dma_map_sg failed\n"); in meson_mx_sdhc_map_dma()
375 return -ENOMEM; in meson_mx_sdhc_map_dma()
381 static void meson_mx_sdhc_request(struct mmc_host *mmc, struct mmc_request *mrq) in meson_mx_sdhc_request() argument
383 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_request()
384 struct mmc_command *cmd = mrq->cmd; in meson_mx_sdhc_request()
386 if (!host->error) in meson_mx_sdhc_request()
387 host->error = meson_mx_sdhc_map_dma(mmc, mrq); in meson_mx_sdhc_request()
389 if (host->error) { in meson_mx_sdhc_request()
390 cmd->error = host->error; in meson_mx_sdhc_request()
391 mmc_request_done(mmc, mrq); in meson_mx_sdhc_request()
395 host->mrq = mrq; in meson_mx_sdhc_request()
397 meson_mx_sdhc_start_cmd(mmc, mrq->cmd); in meson_mx_sdhc_request()
400 static int meson_mx_sdhc_card_busy(struct mmc_host *mmc) in meson_mx_sdhc_card_busy() argument
402 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_card_busy()
405 regmap_read(host->regmap, MESON_SDHC_STAT, &stat); in meson_mx_sdhc_card_busy()
409 static bool meson_mx_sdhc_tuning_point_matches(struct mmc_host *mmc, in meson_mx_sdhc_tuning_point_matches() argument
416 ret = mmc_send_tuning(mmc, opcode, NULL); in meson_mx_sdhc_tuning_point_matches()
424 static int meson_mx_sdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) in meson_mx_sdhc_execute_tuning() argument
426 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_execute_tuning()
435 regmap_read(host->regmap, MESON_SDHC_CLK2, &val); in meson_mx_sdhc_execute_tuning()
438 regmap_read(host->regmap, MESON_SDHC_CLKC, &val); in meson_mx_sdhc_execute_tuning()
442 regmap_update_bits(host->regmap, MESON_SDHC_CLK2, in meson_mx_sdhc_execute_tuning()
447 if (meson_mx_sdhc_tuning_point_matches(mmc, opcode)) { in meson_mx_sdhc_execute_tuning()
451 dev_dbg(mmc_dev(mmc), in meson_mx_sdhc_execute_tuning()
462 dev_dbg(mmc_dev(mmc), in meson_mx_sdhc_execute_tuning()
463 "New best RX phase window: %u - %u\n", in meson_mx_sdhc_execute_tuning()
482 regmap_update_bits(host->regmap, MESON_SDHC_CLK2, in meson_mx_sdhc_execute_tuning()
488 return -EIO; in meson_mx_sdhc_execute_tuning()
490 dev_dbg(mmc_dev(mmc), "Tuned RX clock phase to %u\n", new_phase); in meson_mx_sdhc_execute_tuning()
506 struct mmc_request *mrq = host->mrq; in meson_mx_sdhc_request_done()
507 struct mmc_host *mmc = host->mmc; in meson_mx_sdhc_request_done() local
510 regmap_update_bits(host->regmap, MESON_SDHC_ICTL, in meson_mx_sdhc_request_done()
512 regmap_update_bits(host->regmap, MESON_SDHC_ISTA, in meson_mx_sdhc_request_done()
515 host->mrq = NULL; in meson_mx_sdhc_request_done()
516 host->cmd = NULL; in meson_mx_sdhc_request_done()
518 mmc_request_done(mmc, mrq); in meson_mx_sdhc_request_done()
525 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_read_response()
528 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_read_response()
532 regmap_read(host->regmap, MESON_SDHC_ARGU, &val); in meson_mx_sdhc_read_response()
540 struct mmc_command *cmd = host->cmd; in meson_mx_sdhc_irq()
543 regmap_read(host->regmap, MESON_SDHC_ICTL, &ictl); in meson_mx_sdhc_irq()
544 regmap_read(host->regmap, MESON_SDHC_ISTA, &ista); in meson_mx_sdhc_irq()
551 cmd->error = -EIO; in meson_mx_sdhc_irq()
553 cmd->error = -EILSEQ; in meson_mx_sdhc_irq()
555 cmd->error = -ETIMEDOUT; in meson_mx_sdhc_irq()
557 if (cmd->data) { in meson_mx_sdhc_irq()
559 cmd->data->error = -EILSEQ; in meson_mx_sdhc_irq()
561 cmd->data->error = -ETIMEDOUT; in meson_mx_sdhc_irq()
564 if (cmd->error || (cmd->data && cmd->data->error)) in meson_mx_sdhc_irq()
565 dev_dbg(mmc_dev(host->mmc), "CMD%d error, ISTA: 0x%08x\n", in meson_mx_sdhc_irq()
566 cmd->opcode, ista); in meson_mx_sdhc_irq()
577 cmd = host->cmd; in meson_mx_sdhc_irq_thread()
581 if (cmd->data && !cmd->data->error) { in meson_mx_sdhc_irq_thread()
582 if (!host->platform->hardware_flush_all_cmds && in meson_mx_sdhc_irq_thread()
583 cmd->data->flags & MMC_DATA_READ) { in meson_mx_sdhc_irq_thread()
584 meson_mx_sdhc_wait_cmd_ready(host->mmc); in meson_mx_sdhc_irq_thread()
596 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, val, in meson_mx_sdhc_irq_thread()
600 dma_unmap_sg(mmc_dev(host->mmc), cmd->data->sg, in meson_mx_sdhc_irq_thread()
601 cmd->data->sg_len, mmc_get_dma_dir(cmd->data)); in meson_mx_sdhc_irq_thread()
603 cmd->data->bytes_xfered = cmd->data->blksz * cmd->data->blocks; in meson_mx_sdhc_irq_thread()
606 meson_mx_sdhc_wait_cmd_ready(host->mmc); in meson_mx_sdhc_irq_thread()
608 if (cmd->flags & MMC_RSP_136) { in meson_mx_sdhc_irq_thread()
609 cmd->resp[0] = meson_mx_sdhc_read_response(host, 4); in meson_mx_sdhc_irq_thread()
610 cmd->resp[1] = meson_mx_sdhc_read_response(host, 3); in meson_mx_sdhc_irq_thread()
611 cmd->resp[2] = meson_mx_sdhc_read_response(host, 2); in meson_mx_sdhc_irq_thread()
612 cmd->resp[3] = meson_mx_sdhc_read_response(host, 1); in meson_mx_sdhc_irq_thread()
614 cmd->resp[0] = meson_mx_sdhc_read_response(host, 0); in meson_mx_sdhc_irq_thread()
617 if (cmd->error == -EIO || cmd->error == -ETIMEDOUT) in meson_mx_sdhc_irq_thread()
619 else if (cmd->data) in meson_mx_sdhc_irq_thread()
626 meson_mx_sdhc_clear_fifo(host->mmc); in meson_mx_sdhc_irq_thread()
633 static void meson_mx_sdhc_init_hw_meson8(struct mmc_host *mmc) in meson_mx_sdhc_init_hw_meson8() argument
635 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_init_hw_meson8()
637 regmap_write(host->regmap, MESON_SDHC_MISC, in meson_mx_sdhc_init_hw_meson8()
642 regmap_write(host->regmap, MESON_SDHC_ENHC, in meson_mx_sdhc_init_hw_meson8()
649 static void meson_mx_sdhc_set_pdma_meson8(struct mmc_host *mmc) in meson_mx_sdhc_set_pdma_meson8() argument
651 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_set_pdma_meson8()
653 if (host->cmd->data->flags & MMC_DATA_WRITE) in meson_mx_sdhc_set_pdma_meson8()
654 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_set_pdma_meson8()
662 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_set_pdma_meson8()
669 if (host->cmd->data->flags & MMC_DATA_WRITE) in meson_mx_sdhc_set_pdma_meson8()
670 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_set_pdma_meson8()
675 static void meson_mx_sdhc_wait_before_send_meson8(struct mmc_host *mmc) in meson_mx_sdhc_wait_before_send_meson8() argument
677 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_wait_before_send_meson8()
681 ret = regmap_read_poll_timeout(host->regmap, MESON_SDHC_ESTA, val, in meson_mx_sdhc_wait_before_send_meson8()
686 dev_warn(mmc_dev(mmc), in meson_mx_sdhc_wait_before_send_meson8()
689 if (host->cmd->data && host->cmd->data->flags & MMC_DATA_WRITE) { in meson_mx_sdhc_wait_before_send_meson8()
690 ret = regmap_read_poll_timeout(host->regmap, MESON_SDHC_STAT, in meson_mx_sdhc_wait_before_send_meson8()
695 dev_warn(mmc_dev(mmc), in meson_mx_sdhc_wait_before_send_meson8()
700 static void meson_mx_sdhc_init_hw_meson8m2(struct mmc_host *mmc) in meson_mx_sdhc_init_hw_meson8m2() argument
702 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_init_hw_meson8m2()
704 regmap_write(host->regmap, MESON_SDHC_MISC, in meson_mx_sdhc_init_hw_meson8m2()
709 regmap_write(host->regmap, MESON_SDHC_ENHC, in meson_mx_sdhc_init_hw_meson8m2()
716 static void meson_mx_sdhc_set_pdma_meson8m2(struct mmc_host *mmc) in meson_mx_sdhc_set_pdma_meson8m2() argument
718 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_set_pdma_meson8m2()
720 regmap_update_bits(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_set_pdma_meson8m2()
724 static void meson_mx_sdhc_init_hw(struct mmc_host *mmc) in meson_mx_sdhc_init_hw() argument
726 struct meson_mx_sdhc_host *host = mmc_priv(mmc); in meson_mx_sdhc_init_hw()
730 regmap_write(host->regmap, MESON_SDHC_CTRL, in meson_mx_sdhc_init_hw()
737 * start with a valid divider and enable the memory (un-setting in meson_mx_sdhc_init_hw()
740 regmap_write(host->regmap, MESON_SDHC_CLKC, MESON_SDHC_CLKC_CLK_DIV); in meson_mx_sdhc_init_hw()
742 regmap_write(host->regmap, MESON_SDHC_CLK2, in meson_mx_sdhc_init_hw()
745 regmap_write(host->regmap, MESON_SDHC_PDMA, in meson_mx_sdhc_init_hw()
753 host->platform->init_hw(mmc); in meson_mx_sdhc_init_hw()
756 regmap_write(host->regmap, MESON_SDHC_ICTL, 0); in meson_mx_sdhc_init_hw()
757 regmap_write(host->regmap, MESON_SDHC_ISTA, MESON_SDHC_ISTA_ALL_IRQS); in meson_mx_sdhc_init_hw()
767 struct device *dev = &pdev->dev; in meson_mx_sdhc_probe()
769 struct mmc_host *mmc; in meson_mx_sdhc_probe() local
773 mmc = mmc_alloc_host(sizeof(*host), dev); in meson_mx_sdhc_probe()
774 if (!mmc) in meson_mx_sdhc_probe()
775 return -ENOMEM; in meson_mx_sdhc_probe()
777 ret = devm_add_action_or_reset(dev, meason_mx_mmc_free_host, mmc); in meson_mx_sdhc_probe()
783 host = mmc_priv(mmc); in meson_mx_sdhc_probe()
784 host->mmc = mmc; in meson_mx_sdhc_probe()
788 host->platform = device_get_match_data(dev); in meson_mx_sdhc_probe()
789 if (!host->platform) in meson_mx_sdhc_probe()
790 return -EINVAL; in meson_mx_sdhc_probe()
796 host->regmap = devm_regmap_init_mmio(dev, base, in meson_mx_sdhc_probe()
798 if (IS_ERR(host->regmap)) in meson_mx_sdhc_probe()
799 return PTR_ERR(host->regmap); in meson_mx_sdhc_probe()
801 host->pclk = devm_clk_get(dev, "pclk"); in meson_mx_sdhc_probe()
802 if (IS_ERR(host->pclk)) in meson_mx_sdhc_probe()
803 return PTR_ERR(host->pclk); in meson_mx_sdhc_probe()
806 ret = clk_prepare_enable(host->pclk); in meson_mx_sdhc_probe()
812 meson_mx_sdhc_init_hw(mmc); in meson_mx_sdhc_probe()
814 ret = meson_mx_sdhc_register_clkc(dev, base, host->bulk_clks); in meson_mx_sdhc_probe()
818 host->sd_clk = host->bulk_clks[1].clk; in meson_mx_sdhc_probe()
821 ret = mmc_regulator_get_supply(mmc); in meson_mx_sdhc_probe()
825 mmc->max_req_size = SZ_128K; in meson_mx_sdhc_probe()
826 mmc->max_seg_size = mmc->max_req_size; in meson_mx_sdhc_probe()
827 mmc->max_blk_count = FIELD_GET(MESON_SDHC_SEND_TOTAL_PACK, ~0); in meson_mx_sdhc_probe()
828 mmc->max_blk_size = MESON_SDHC_MAX_BLK_SIZE; in meson_mx_sdhc_probe()
829 mmc->max_busy_timeout = 30 * MSEC_PER_SEC; in meson_mx_sdhc_probe()
830 mmc->f_min = clk_round_rate(host->sd_clk, 1); in meson_mx_sdhc_probe()
831 mmc->f_max = clk_round_rate(host->sd_clk, ULONG_MAX); in meson_mx_sdhc_probe()
832 mmc->max_current_180 = 300; in meson_mx_sdhc_probe()
833 mmc->max_current_330 = 300; in meson_mx_sdhc_probe()
834 mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_HW_RESET; in meson_mx_sdhc_probe()
835 mmc->ops = &meson_mx_sdhc_ops; in meson_mx_sdhc_probe()
837 ret = mmc_of_parse(mmc); in meson_mx_sdhc_probe()
853 ret = mmc_add_host(mmc); in meson_mx_sdhc_probe()
860 clk_disable_unprepare(host->pclk); in meson_mx_sdhc_probe()
868 mmc_remove_host(host->mmc); in meson_mx_sdhc_remove()
870 meson_mx_sdhc_disable_clks(host->mmc); in meson_mx_sdhc_remove()
872 clk_disable_unprepare(host->pclk); in meson_mx_sdhc_remove()
890 .compatible = "amlogic,meson8-sdhc",
894 .compatible = "amlogic,meson8b-sdhc",
898 .compatible = "amlogic,meson8m2-sdhc",
909 .name = "meson-mx-sdhc",