[U-Boot] [PATCH] mmc: init mmc block devices on probe

Jaehoon Chung jh80.chung at samsung.com
Thu Feb 9 05:34:14 UTC 2017


On 01/25/2017 06:00 PM, Fiach Antaw wrote:
> MMC devices accessed exclusively via the driver model were not
> being initialized before being exposed as block devices, causing
> issues in scenarios where the MMC device is first accessed via the
> uclass block interface.
> 
> Signed-off-by: Fiach Antaw <fiach.antaw at uqconnect.edu.au>

Applied on u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

> 
> ---
> 
>  drivers/mmc/mmc-uclass.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
> index 2fe5d61..a1c31a5 100644
> --- a/drivers/mmc/mmc-uclass.c
> +++ b/drivers/mmc/mmc-uclass.c
> @@ -247,6 +247,17 @@ static int mmc_select_hwpart(struct udevice *bdev, int hwpart)
>  	return mmc_switch_part(mmc, hwpart);
>  }
>  
> +static int mmc_blk_probe(struct udevice *dev)
> +{
> +	struct blk_desc *block_dev = dev_get_uclass_platdata(dev);
> +	int dev_num = block_dev->devnum;
> +	struct mmc *mmc = find_mmc_device(dev_num);
> +
> +	if (!mmc)
> +		return -ENODEV;
> +	return mmc_init(mmc);
> +}
> +
>  static const struct blk_ops mmc_blk_ops = {
>  	.read	= mmc_bread,
>  #ifndef CONFIG_SPL_BUILD
> @@ -260,6 +271,7 @@ U_BOOT_DRIVER(mmc_blk) = {
>  	.name		= "mmc_blk",
>  	.id		= UCLASS_BLK,
>  	.ops		= &mmc_blk_ops,
> +	.probe		= mmc_blk_probe,
>  };
>  #endif /* CONFIG_BLK */
>  
> 



More information about the U-Boot mailing list