mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-29 08:00:26 +09:00
rockchip: mmc: Move all DT decoding to ofdata_to_platdata()
It is more correct to avoid touching the device tree in the probe() method. Update the driver to work this way. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
9ca7e6720e
commit
6809b04f48
@ -26,6 +26,9 @@ struct rockchip_mmc_plat {
|
|||||||
struct rockchip_dwmmc_priv {
|
struct rockchip_dwmmc_priv {
|
||||||
struct clk clk;
|
struct clk clk;
|
||||||
struct dwmci_host host;
|
struct dwmci_host host;
|
||||||
|
int fifo_depth;
|
||||||
|
bool fifo_mode;
|
||||||
|
u32 minmax[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq)
|
static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq)
|
||||||
@ -61,6 +64,16 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
|
|||||||
else
|
else
|
||||||
host->dev_index = 1;
|
host->dev_index = 1;
|
||||||
|
|
||||||
|
priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
|
||||||
|
"fifo-depth", 0);
|
||||||
|
if (priv->fifo_depth < 0)
|
||||||
|
return -EINVAL;
|
||||||
|
priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev->of_offset,
|
||||||
|
"fifo-mode");
|
||||||
|
if (fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
|
||||||
|
"clock-freq-min-max", priv->minmax, 2))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,28 +84,17 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
|
|||||||
struct rockchip_dwmmc_priv *priv = dev_get_priv(dev);
|
struct rockchip_dwmmc_priv *priv = dev_get_priv(dev);
|
||||||
struct dwmci_host *host = &priv->host;
|
struct dwmci_host *host = &priv->host;
|
||||||
struct udevice *pwr_dev __maybe_unused;
|
struct udevice *pwr_dev __maybe_unused;
|
||||||
u32 minmax[2];
|
|
||||||
int ret;
|
int ret;
|
||||||
int fifo_depth;
|
|
||||||
|
|
||||||
ret = clk_get_by_index(dev, 0, &priv->clk);
|
ret = clk_get_by_index(dev, 0, &priv->clk);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
|
|
||||||
"clock-freq-min-max", minmax, 2))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
fifo_depth = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
|
|
||||||
"fifo-depth", 0);
|
|
||||||
if (fifo_depth < 0)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
host->fifoth_val = MSIZE(0x2) |
|
host->fifoth_val = MSIZE(0x2) |
|
||||||
RX_WMARK(fifo_depth / 2 - 1) | TX_WMARK(fifo_depth / 2);
|
RX_WMARK(priv->fifo_depth / 2 - 1) |
|
||||||
|
TX_WMARK(priv->fifo_depth / 2);
|
||||||
|
|
||||||
if (fdtdec_get_bool(gd->fdt_blob, dev->of_offset, "fifo-mode"))
|
host->fifo_mode = priv->fifo_mode;
|
||||||
host->fifo_mode = true;
|
|
||||||
|
|
||||||
#ifdef CONFIG_PWRSEQ
|
#ifdef CONFIG_PWRSEQ
|
||||||
/* Enable power if needed */
|
/* Enable power if needed */
|
||||||
@ -105,7 +107,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
dwmci_setup_cfg(&plat->cfg, dev->name, host->buswidth, host->caps,
|
dwmci_setup_cfg(&plat->cfg, dev->name, host->buswidth, host->caps,
|
||||||
minmax[1], minmax[0]);
|
priv->minmax[1], priv->minmax[0]);
|
||||||
host->mmc = &plat->mmc;
|
host->mmc = &plat->mmc;
|
||||||
host->mmc->priv = &priv->host;
|
host->mmc->priv = &priv->host;
|
||||||
host->mmc->dev = dev;
|
host->mmc->dev = dev;
|
||||||
|
Loading…
Reference in New Issue
Block a user