mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
mmc: dw_mmc: remove partial thunder boot
In preparation for adding new driver to support starting decompress ramdisk. And make the hclk_mmc is available before accessing the registers. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com> Change-Id: Icbd51f2798367430443bae9af5656891b93ac3bd
This commit is contained in:
@@ -3234,60 +3234,6 @@ int dw_mci_probe(struct dw_mci *host)
|
||||
int width, i, ret = 0;
|
||||
u32 fifo_size;
|
||||
|
||||
#if defined(CONFIG_ROCKCHIP_THUNDER_BOOT) && defined(CONFIG_ROCKCHIP_HW_DECOMPRESS)
|
||||
struct resource idmac, ramdisk_src, ramdisk_dst;
|
||||
struct device_node *dma, *rds, *rdd;
|
||||
struct device *dev = host->dev;
|
||||
u32 intr;
|
||||
|
||||
if (host->slot->mmc->caps2 & MMC_CAP2_NO_SD &&
|
||||
host->slot->mmc->caps2 & MMC_CAP2_NO_SDIO) {
|
||||
if (readl_poll_timeout(host->regs + SDMMC_STATUS,
|
||||
fifo_size,
|
||||
!(fifo_size & (BIT(10) | GENMASK(7, 4))),
|
||||
0, 500 * USEC_PER_MSEC))
|
||||
dev_err(dev, "Controller is occupied!\n");
|
||||
|
||||
if (readl_poll_timeout(host->regs + SDMMC_IDSTS,
|
||||
fifo_size, !(fifo_size & GENMASK(16, 13)),
|
||||
0, 500 * USEC_PER_MSEC))
|
||||
dev_err(dev, "DMA is still running!\n");
|
||||
|
||||
intr = mci_readl(host, RINTSTS);
|
||||
if (intr & DW_MCI_CMD_ERROR_FLAGS || intr & DW_MCI_DATA_ERROR_FLAGS) {
|
||||
WARN_ON(1);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Release idmac descriptor */
|
||||
dma = of_parse_phandle(dev->of_node, "memory-region-idamc", 0);
|
||||
if (dma) {
|
||||
ret = of_address_to_resource(dma, 0, &idmac);
|
||||
if (ret >= 0)
|
||||
free_reserved_area(phys_to_virt(idmac.start),
|
||||
phys_to_virt(idmac.start) + resource_size(&idmac),
|
||||
-1, NULL);
|
||||
}
|
||||
|
||||
/* Parse ramdisk addr and help start decompressing */
|
||||
rds = of_parse_phandle(dev->of_node, "memory-region-src", 0);
|
||||
rdd = of_parse_phandle(dev->of_node, "memory-region-dst", 0);
|
||||
if (rds && rdd) {
|
||||
if (of_address_to_resource(rds, 0, &ramdisk_src) >= 0 &&
|
||||
of_address_to_resource(rdd, 0, &ramdisk_dst) >= 0)
|
||||
/*
|
||||
* Decompress HW driver will free reserved area of
|
||||
* memory-region-src.
|
||||
*/
|
||||
ret = rk_decom_start(GZIP_MOD, ramdisk_src.start,
|
||||
ramdisk_dst.start,
|
||||
resource_size(&ramdisk_dst));
|
||||
if (ret < 0)
|
||||
dev_err(dev, "fail to start decom\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!host->pdata) {
|
||||
host->pdata = dw_mci_parse_dt(host);
|
||||
if (IS_ERR(host->pdata))
|
||||
@@ -3306,6 +3252,24 @@ int dw_mci_probe(struct dw_mci *host)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ROCKCHIP_THUNDER_BOOT
|
||||
if (host->slot->mmc->caps2 & MMC_CAP2_NO_SD &&
|
||||
host->slot->mmc->caps2 & MMC_CAP2_NO_SDIO) {
|
||||
if (readl_poll_timeout(host->regs + SDMMC_STATUS,
|
||||
fifo_size,
|
||||
!(fifo_size & (BIT(10) | GENMASK(7, 4))),
|
||||
0, 500 * USEC_PER_MSEC))
|
||||
dev_err(host->dev, "Controller is occupied!\n");
|
||||
|
||||
if (readl_poll_timeout(host->regs + SDMMC_IDSTS,
|
||||
fifo_size, !(fifo_size & GENMASK(16, 13)),
|
||||
0, 500 * USEC_PER_MSEC))
|
||||
dev_err(host->dev, "DMA is still running!\n");
|
||||
|
||||
BUG_ON(mci_readl(host, RINTSTS) & DW_MCI_ERROR_FLAGS);
|
||||
}
|
||||
#endif
|
||||
|
||||
host->ciu_clk = devm_clk_get(host->dev, "ciu");
|
||||
if (IS_ERR(host->ciu_clk)) {
|
||||
dev_dbg(host->dev, "ciu clock not available\n");
|
||||
|
||||
Reference in New Issue
Block a user