Re: [PATCH master 1/3] mci: core: fix fallback when eMMC DDR52 is not possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23.04.24 08:44, Sascha Hauer wrote:
> On Tue, Apr 23, 2024 at 08:22:04AM +0200, Ahmad Fatoum wrote:
>> mci_mmc_select_hs_ddr() will try DDR52 and if that fails, revert to
>> SDR operation. In that case, it returns the bus width, which would
>> be forwarded as if it were an error code:
>>
>>   WARNING: mmc2: Card's startup fails with 3
>>
>> Fix this by translating successful return values to 0 in
>> mci_startup_mmc().
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
>> ---
>>  drivers/mci/mci-core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
>> index 1d383e6449e9..57b4c5b99c9c 100644
>> --- a/drivers/mci/mci-core.c
>> +++ b/drivers/mci/mci-core.c
>> @@ -1566,7 +1566,7 @@ static int mci_startup_mmc(struct mci *mci)
>>  		}
>>  	}
>>  
>> -	return ret;
>> +	return ret >= MMC_BUS_WIDTH_1 ? 0 : ret;
>>  }
> 
> Can we do it like below instead? It makes clear where a MMC_BUS_WIDTH_x
> return value is expected.

mci_mmc_select_hs_ddr() may return MMC_BUS_WIDTH_*, which isn't addressed
by your patch.

> 
> Sascha
> 
> 
> ----------------------------------8<---------------------------
> 
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index 083d2f4ed1..da892a5f84 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1558,8 +1558,12 @@ static int mci_startup_mmc(struct mci *mci)
>  
>  		/* find out maximum bus width and then try DDR if supported */
>  		ret = mci_mmc_select_bus_width(mci);
> -		if (ret > MMC_BUS_WIDTH_1 && mci->tran_speed == 52000000)
> -			ret = mci_mmc_select_hs_ddr(mci);
> +		if (ret > MMC_BUS_WIDTH_1) {
> +			ret = 0;
> +
> +			if (mci->tran_speed == 52000000)
> +				ret = mci_mmc_select_hs_ddr(mci);
> +		}
>  
>  		if (ret < 0) {
>  			dev_warn(&mci->dev, "Changing MMC bus width failed: %d\n", ret);
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux