mirror of
https://gitee.com/open-loongarch/linux-6.12.git
synced 2026-10-28 05:57:12 +08:00
mmc: loongson: support setup clk stable delay time
Changelog: 龙芯mmc驱动支持设置时钟稳定的延时时间 Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
@@ -726,14 +726,16 @@ static void ls2k_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
||||
/* Set the power state */
|
||||
mci_con = readl(host->base + SDICON);
|
||||
u32 dll;
|
||||
u32 clk_stable_delay;
|
||||
int ret;
|
||||
|
||||
clk_stable_delay = host->clk_need_stable ? 100 : 1;
|
||||
ls2k_mci_disable_irq(host, true);
|
||||
switch (ios->power_mode) {
|
||||
case MMC_POWER_ON:
|
||||
case MMC_POWER_UP:
|
||||
writel(SDICON_RESET, host->base + SDICON);
|
||||
mdelay(100);
|
||||
mdelay(clk_stable_delay);
|
||||
writel(0x3, host->base + SDICON);
|
||||
if (host->pdata->version >= LOONGSON_SDIO_EMMC_VER_1_1)
|
||||
writel(SDIINT_CLEARALL, host->base + SDIINTMSK);
|
||||
@@ -765,7 +767,7 @@ static void ls2k_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
||||
ret = of_property_read_u32(pdev->dev.of_node, "dll", &dll);
|
||||
if (ret == 0)
|
||||
ls2k_mci_set_dll(host, dll);
|
||||
mdelay(100);
|
||||
mdelay(clk_stable_delay);
|
||||
ls2k_mci_enable_irq(host, true);
|
||||
}
|
||||
|
||||
@@ -983,6 +985,14 @@ static int ls2k_mci_probe(struct platform_device *pdev)
|
||||
device_property_read_u64(&pdev->dev, "clock-frequency", (u64 *)&host->clk_rate);
|
||||
}
|
||||
|
||||
host->clk_need_stable = 1;
|
||||
if (dev_fwnode(&pdev->dev)) {
|
||||
if (device_property_read_u32(&pdev->dev, "clk-need-stable", (u32 *)&host->clk_need_stable))
|
||||
host->clk_need_stable = 1;
|
||||
}
|
||||
host->clk_need_stable = !!(host->clk_need_stable);
|
||||
dev_info(&pdev->dev, "clk_need_stable: %d\n", host->clk_need_stable);
|
||||
|
||||
mmc->ops = &ls2k_mci_ops;
|
||||
mmc->ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34;
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ struct ls2k_mci_host {
|
||||
#endif
|
||||
struct dma_chan *chan;
|
||||
unsigned int app_cmd;
|
||||
unsigned int clk_need_stable;
|
||||
};
|
||||
|
||||
struct ls2k_mci_pdata {
|
||||
|
||||
Reference in New Issue
Block a user