Re: [PATCH linux dev-5.4 2/2] mmc: sdhci-of-aspeed: Prevent clock divider of zero

Andrew Jeffery andrew at aj.id.au
Thu Jul 9 21:56:11 AEST 2020



On Thu, 9 Jul 2020, at 05:54, Eddie James wrote:
> The Aspeed specification forbids a clock divider of zero, which will be
> calculated if the parent clock is equal to the desired clock. Testing
> confirmed this broke the host controller.
> 
> Signed-off-by: Eddie James <eajames at linux.ibm.com>
> ---
>  drivers/mmc/host/sdhci-of-aspeed.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c 
> b/drivers/mmc/host/sdhci-of-aspeed.c
> index 8962f6664381..5aa72e80cae9 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -74,6 +74,10 @@ static void aspeed_sdhci_set_clock(struct sdhci_host 
> *host, unsigned int clock)
>  	}
>  	div >>= 1;
>  
> +	/* Aspeed forbids a clock div of 0 */
> +	if (!div)
> +		div = 1;
> +

Nah, the search loop needs to initialise with div = 2. The current implementation is busted.


More information about the openbmc mailing list