dm: rockchip: mmc: Allow use of CONFIG_BLK
Allow driver model to be used for block devices in the rockchip mmc driver. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
5e6ff810c3
commit
f6e41d17ab
|
|
@ -18,6 +18,11 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
struct rockchip_mmc_plat {
|
||||||
|
struct mmc_config cfg;
|
||||||
|
struct mmc mmc;
|
||||||
|
};
|
||||||
|
|
||||||
struct rockchip_dwmmc_priv {
|
struct rockchip_dwmmc_priv {
|
||||||
struct udevice *clk;
|
struct udevice *clk;
|
||||||
int periph;
|
int periph;
|
||||||
|
|
@ -62,6 +67,9 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)
|
||||||
|
|
||||||
static int rockchip_dwmmc_probe(struct udevice *dev)
|
static int rockchip_dwmmc_probe(struct udevice *dev)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_BLK
|
||||||
|
struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
|
||||||
|
#endif
|
||||||
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
|
struct mmc_uclass_priv *upriv = dev_get_uclass_priv(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;
|
||||||
|
|
@ -100,16 +108,37 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_BLK
|
||||||
|
dwmci_setup_cfg(&plat->cfg, dev->name, host->buswidth, host->caps,
|
||||||
|
minmax[1], minmax[0]);
|
||||||
|
host->mmc = &plat->mmc;
|
||||||
|
#else
|
||||||
ret = add_dwmci(host, minmax[1], minmax[0]);
|
ret = add_dwmci(host, minmax[1], minmax[0]);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
host->mmc->priv = &priv->host;
|
||||||
host->mmc->dev = dev;
|
host->mmc->dev = dev;
|
||||||
upriv->mmc = host->mmc;
|
upriv->mmc = host->mmc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rockchip_dwmmc_bind(struct udevice *dev)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_BLK
|
||||||
|
struct rockchip_mmc_plat *plat = dev_get_platdata(dev);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = dwmci_bind(dev, &plat->mmc, &plat->cfg);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct udevice_id rockchip_dwmmc_ids[] = {
|
static const struct udevice_id rockchip_dwmmc_ids[] = {
|
||||||
{ .compatible = "rockchip,rk3288-dw-mshc" },
|
{ .compatible = "rockchip,rk3288-dw-mshc" },
|
||||||
{ }
|
{ }
|
||||||
|
|
@ -120,8 +149,10 @@ U_BOOT_DRIVER(rockchip_dwmmc_drv) = {
|
||||||
.id = UCLASS_MMC,
|
.id = UCLASS_MMC,
|
||||||
.of_match = rockchip_dwmmc_ids,
|
.of_match = rockchip_dwmmc_ids,
|
||||||
.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata,
|
.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata,
|
||||||
|
.bind = rockchip_dwmmc_bind,
|
||||||
.probe = rockchip_dwmmc_probe,
|
.probe = rockchip_dwmmc_probe,
|
||||||
.priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv),
|
.priv_auto_alloc_size = sizeof(struct rockchip_dwmmc_priv),
|
||||||
|
.platdata_auto_alloc_size = sizeof(struct rockchip_mmc_plat),
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_PWRSEQ
|
#ifdef CONFIG_PWRSEQ
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue