[PATCH 4/4] mmc: arm_pl180_mmci: Add configuration for ST-Ericsson Ux500v2

Patrice CHOTARD patrice.chotard at foss.st.com
Thu Jul 8 12:09:53 CEST 2021


Hi Stephan

On 7/6/21 4:54 PM, Stephan Gerhold wrote:
> For the eMMC on ST-Ericsson Ux500v2 we need slightly different
> configuration values. Use the existing switch statement to match
> the peripheral ID of Ux500v2 (0x10480180) and override the necessary
> values to make the eMMC work on devices with ST-Ericsson Ux500.
> 
> Cc: Linus Walleij <linus.walleij at linaro.org>
> Signed-off-by: Stephan Gerhold <stephan at gerhold.net>
> ---
> 
>  drivers/mmc/arm_pl180_mmci.c | 22 +++++++++++++++-------
>  drivers/mmc/arm_pl180_mmci.h |  1 +
>  2 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
> index 809b86570a..f99b5f997e 100644
> --- a/drivers/mmc/arm_pl180_mmci.c
> +++ b/drivers/mmc/arm_pl180_mmci.c
> @@ -443,22 +443,30 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
>  			    SDI_CLKCR_HWFC_EN;
>  	host->clock_in = clk_get_rate(&clk);
>  
> +	cfg->name = dev->name;
> +	cfg->voltages = VOLTAGE_WINDOW_SD;
> +	cfg->host_caps = 0;
> +	cfg->f_min = host->clock_in / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1));
> +	cfg->f_max = MMC_CLOCK_MAX;
> +	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
> +
>  	periphid = dev_read_u32_default(dev, "arm,primecell-periphid", 0);
>  	switch (periphid) {
>  	case STM32_MMCI_ID: /* stm32 variant */
>  		host->version2 = false;
>  		break;
> +	case UX500V2_MMCI_ID:
> +		host->pwr_init = SDI_PWR_OPD | SDI_PWR_PWRCTRL_ON;
> +		host->clkdiv_init = SDI_CLKCR_CLKDIV_INIT_V2 | SDI_CLKCR_CLKEN |
> +				    SDI_CLKCR_HWFC_EN;
> +		cfg->voltages = VOLTAGE_WINDOW_MMC;
> +		cfg->f_min = host->clock_in / (2 + SDI_CLKCR_CLKDIV_INIT_V2);
> +		host->version2 = true;
> +		break;
>  	default:
>  		host->version2 = true;
>  	}
>  
> -	cfg->name = dev->name;
> -	cfg->voltages = VOLTAGE_WINDOW_SD;
> -	cfg->host_caps = 0;
> -	cfg->f_min = host->clock_in / (2 * (SDI_CLKCR_CLKDIV_INIT_V1 + 1));
> -	cfg->f_max = MMC_CLOCK_MAX;
> -	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
> -
>  	gpio_request_by_name(dev, "cd-gpios", 0, &host->cd_gpio, GPIOD_IS_IN);
>  
>  	ret = mmc_of_parse(dev, cfg);
> diff --git a/drivers/mmc/arm_pl180_mmci.h b/drivers/mmc/arm_pl180_mmci.h
> index 61ee96a112..15c29beadb 100644
> --- a/drivers/mmc/arm_pl180_mmci.h
> +++ b/drivers/mmc/arm_pl180_mmci.h
> @@ -142,6 +142,7 @@
>  #define SDI_FIFO_BURST_SIZE	8
>  
>  #define STM32_MMCI_ID		0x00880180
> +#define UX500V2_MMCI_ID		0x10480180
>  
>  struct sdi_registers {
>  	u32 power;		/* 0x00*/
> 
Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>
Tested-by: Patrice Chotard <patrice.chotard at foss.st.com> on stm32f769-disco

Thanks
Patrice


More information about the U-Boot mailing list