On 10/19/2017 11:46 PM, patrice.chot...@st.com wrote:
> From: Patrice Chotard <patrice.chot...@st.com>
> 
> Allow to get "bus-width" property from device tree
> 
> Signed-off-by: Patrice Chotard <patrice.chot...@st.com>
> ---
>  drivers/mmc/arm_pl180_mmci.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index 61dbbfb..6ee77b1 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -405,6 +405,7 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
>       struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
>       struct mmc *mmc = &pdata->mmc;
>       struct pl180_mmc_host *host = mmc->priv;
> +     u32 bus_width;
>       int ret;
>  
>       strcpy(host->name, "MMC");
> @@ -417,6 +418,22 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
>       host->clock_min = 400000;
>       host->clock_max = dev_read_u32_default(dev, "max-frequency", 48000000);
>       host->version2 = dev_get_driver_data(dev);
> +
> +     bus_width = dev_read_u32_default(dev, "bus-width", 1);
> +     switch (bus_width) {
> +     case 8:
> +             host->caps |= MMC_MODE_8BIT;
> +             /* Hosts capable of 8-bit transfers can also do 4 bits */
> +     case 4:
> +             host->caps |= MMC_MODE_4BIT;
> +             break;
> +     case 1:
> +             break;
> +     default:
> +             dev_err(dev, "Invalid bus-width value %u\n", bus_width);

Doesn't need to return -EINVAL..It can be run with 1bit BUSWIDTH.
I think that it's enough to display the error message.

> +             return -EINVAL;
> +     }
> +
>       ret = arm_pl180_mmci_init(host, &mmc);
>       if (ret) {
>               dev_err(dev, "arm_pl180_mmci init failed\n");
> 

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to