Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: dw_mmc: Support setting f_min from host drivers

Host drivers may not be able to support frequencies as low as dw-mmc
supports. Unfortunately f_min isn't available when the drv_data->init
function is called, as the mmc_host struct hasn't been set up yet.

Support the host drivers saving the requested minimum frequency, so we
can later set f_min when it is available.

Signed-off-by: Peter Geis <pgwipeout@gmail.com>
Link: https://lore.kernel.org/r/20220305215835.2210388-2-pgwipeout@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Peter Geis and committed by
Ulf Hansson
c4313e75 0ffd498d

+8 -1
+6 -1
drivers/mmc/host/dw_mmc.c
··· 2898 2898 if (host->pdata->caps2) 2899 2899 mmc->caps2 = host->pdata->caps2; 2900 2900 2901 - mmc->f_min = DW_MCI_FREQ_MIN; 2901 + /* if host has set a minimum_freq, we should respect it */ 2902 + if (host->minimum_speed) 2903 + mmc->f_min = host->minimum_speed; 2904 + else 2905 + mmc->f_min = DW_MCI_FREQ_MIN; 2906 + 2902 2907 if (!mmc->f_max) 2903 2908 mmc->f_max = DW_MCI_FREQ_MAX; 2904 2909
+2
drivers/mmc/host/dw_mmc.h
··· 99 99 * @bus_hz: The rate of @mck in Hz. This forms the basis for MMC bus 100 100 * rate and timeout calculations. 101 101 * @current_speed: Configured rate of the controller. 102 + * @minimum_speed: Stored minimum rate of the controller. 102 103 * @fifoth_val: The value of FIFOTH register. 103 104 * @verid: Denote Version ID. 104 105 * @dev: Device associated with the MMC controller. ··· 202 201 203 202 u32 bus_hz; 204 203 u32 current_speed; 204 + u32 minimum_speed; 205 205 u32 fifoth_val; 206 206 u16 verid; 207 207 struct device *dev;