[U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init()

Lukasz Majewski l.majewski at samsung.com
Tue Apr 15 16:24:28 CEST 2014


Hi Mateusz,

> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.
> 
> Tested on Samsung Goni.
> 
> Signed-off-by: Mateusz Zalega <m.zalega at samsung.com>
> Tested-by: Mateusz Zalega <m.zalega at samsung.com>
> Cc: Lukasz Majewski <l.majewski at samsung.com>
> Cc: Minkyu Kang <mk7.kang at samsung.com>
> ---
>  board/samsung/common/ums.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..dec2963 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -37,8 +37,8 @@ static struct ums ums_dev = {
>  
>  static struct ums *ums_disk_init(struct mmc *mmc)
>  {
> -	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
> -	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
> +	const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
> +	const uint64_t ums_end_sector = UMS_NUM_SECTORS +
> UMS_START_SECTOR; 
>  	if (!mmc_end_sector) {
>  		error("MMC capacity is not valid");
> @@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
>  
>  struct ums *ums_init(unsigned int dev_num)
>  {
> -	struct mmc *mmc = NULL;
> +	struct mmc *mmc = find_mmc_device(dev_num);
>  
> -	mmc = find_mmc_device(dev_num);
> -	if (!mmc)
> +	if (!mmc || mmc_init(mmc))
>  		return NULL;
> -
>  	return ums_disk_init(mmc);
>  }

Acked-by: Lukasz Majewski <l.majewski at samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group


More information about the U-Boot mailing list