Message ID | 1447741231-27673-16-git-send-email-hl@rock-chips.com |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Hi Lin, On 16 November 2015 at 23:20, Lin Huang <hl@rock-chips.com> wrote: > emmc and sdcard have different register address, use non-removeable property > to disginuish them. distinguish (also please fix commit subject) > > Signed-off-by: Lin Huang <hl@rock-chips.com> > --- > drivers/mmc/rockchip_dw_mmc.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c > index f11c8e0..8502dfc 100644 > --- a/drivers/mmc/rockchip_dw_mmc.c > +++ b/drivers/mmc/rockchip_dw_mmc.c > @@ -50,8 +50,10 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) > host->get_mmc_clk = rockchip_dwmmc_get_mmc_clk; > host->priv = dev; > > - /* TODO(sjg@chromium.org): Remove the need for this hack */ > - host->dev_index = (ulong)host->ioaddr == 0xff0f0000 ? 0 : 1; > + /* use non-removeable as sdcard and emmc as judgement */ > + if (fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, "non-removable") > + == -FDT_ERR_NOTFOUND) Should be fdtdec_get_bool(), right? > + host->dev_index = 1; > > return 0; > } > -- > 1.9.1 > Regards, Simon
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index f11c8e0..8502dfc 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -50,8 +50,10 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) host->get_mmc_clk = rockchip_dwmmc_get_mmc_clk; host->priv = dev; - /* TODO(sjg@chromium.org): Remove the need for this hack */ - host->dev_index = (ulong)host->ioaddr == 0xff0f0000 ? 0 : 1; + /* use non-removeable as sdcard and emmc as judgement */ + if (fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset, "non-removable") + == -FDT_ERR_NOTFOUND) + host->dev_index = 1; return 0; }
emmc and sdcard have different register address, use non-removeable property to disginuish them. Signed-off-by: Lin Huang <hl@rock-chips.com> --- drivers/mmc/rockchip_dw_mmc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)