public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] fix dw-mmc-rockchip rk356x clock rates
@ 2022-03-05 21:58 Peter Geis
  2022-03-05 21:58 ` [PATCH v3 1/2] mmc: host: dw_mmc: support setting f_min from host drivers Peter Geis
  2022-03-05 21:58 ` [PATCH v3 2/2] mmc: host: dw-mmc-rockchip: fix handling invalid clock rates Peter Geis
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Geis @ 2022-03-05 21:58 UTC (permalink / raw)
  Cc: robin.murphy, linux-rockchip, Peter Geis, Jaehoon Chung,
	Ulf Hansson, Heiko Stuebner, linux-mmc, linux-arm-kernel,
	linux-kernel

cc: Jaehoon Chung <jh80.chung@samsung.com>
cc: Ulf Hansson <ulf.hansson@linaro.org>
cc: Heiko Stuebner <heiko@sntech.de>
cc: linux-mmc@vger.kernel.org
cc: linux-arm-kernel@lists.infradead.org
cc: linux-rockchip@lists.infradead.org
cc: linux-kernel@vger.kernel.org

While lighting off support for the SoQuartz module, it was discoved the
dw-mmc-rockchip driver has tremendous log spam when the cd-broken flag
is enabled and no card is inserted.
The SoQuart requires the cd-broken flag as the CM4 module pinout it
follows has no card-detect pin.
These errors occur during card initialization on all rk356x chips, but
are amplified by cd-broken as the function is called multiple times each
poll cycle.

It was discovered the lowest possible clock rate the rk356x cru can
provide for the ciu clock in the default configuration is 750khz. There 
is an internal clock divider that makes the final minimum clock 375khz.
We could hardcode this, but it is possible it could change if the
default clock configuration changes.

To fix this, we must make two changes:
First, the dw-mmc core needs to be updated to allow a host driver to
save its requested minimum frequency. This is necessary as the mmc_host
struct isn't available when the host drivers initialization code is
called. The dw-mmc core can then apply the f_min later when the struct
is available.
Second, the dw-mmc-rockchip driver is extended to test the frequencies
mmc core will use during card initialization. It finds the lowest
supported frequency from the cru and saves it for later use by dw-mmc
core.


Changelog:
v3:
- add support in dw_mmc core for saving the minimum frequency (fixes
  setting f_min)
- add test for the lowest supported frequency to avoid clamping configs
  that don't have an error

v2:
- change from muting the error to attempting to fix the underlying issue
  by setting f_min in driver initialization

Peter Geis (2):
  mmc: host: dw_mmc: support setting f_min from host drivers
  mmc: host: dw-mmc-rockchip: fix handling invalid clock rates

 drivers/mmc/host/dw_mmc-rockchip.c | 27 +++++++++++++++++++++++----
 drivers/mmc/host/dw_mmc.c          |  7 ++++++-
 drivers/mmc/host/dw_mmc.h          |  2 ++
 3 files changed, 31 insertions(+), 5 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-07 12:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-05 21:58 [PATCH v3 0/2] fix dw-mmc-rockchip rk356x clock rates Peter Geis
2022-03-05 21:58 ` [PATCH v3 1/2] mmc: host: dw_mmc: support setting f_min from host drivers Peter Geis
2022-03-07 12:17   ` Ulf Hansson
2022-03-05 21:58 ` [PATCH v3 2/2] mmc: host: dw-mmc-rockchip: fix handling invalid clock rates Peter Geis
2022-03-07 12:17   ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox