]> git.itanic.dy.fi Git - linux-stable/commit
mmc: tmio: move tmio_mmc_set_clock() to platform hook
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 23 Aug 2018 04:44:16 +0000 (13:44 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 14:31:46 +0000 (16:31 +0200)
commitee9780d7e7ad73ff30b1b49dd6535d88878d90d3
tree8c02f9ede0d1d19c79f559847861f87479dcbfd6
parente1036bf905f9ec7b01fd5ee946a9a94f9671ee83
mmc: tmio: move tmio_mmc_set_clock() to platform hook

[ Upstream commit 0196c8db8363f7627df6f78615271ae0ba430500 ]

tmio_mmc_set_clock() is full of quirks because different SoC vendors
extended this in different ways.

The original IP defines the divisor range 1/2 ... 1/512.

 bit 7 is set:    1/512
 bit 6 is set:    1/256
   ...
 bit 0 is set:    1/4
 all bits clear:  1/2

It is platform-dependent how to achieve the 1/1 clock.

I guess the TMIO-MFD variant uses the clock selector outside of this IP,
as far as I see tmio_core_mmc_clk_div() in drivers/mfd/tmio_core.c

I guess bit[7:0]=0xff is Renesas-specific extension.

Socionext (and Panasonic) uses bit 10 (CLKSEL) for 1/1.  Also, newer
versions of UniPhier SoC variants use bit 16 for 1/1024.

host->clk_update() is only used by the Renesas variants, whereas
host->set_clk_div() is only used by the TMIO-MFD variants.

To cope with this mess, promote tmio_mmc_set_clock() to a new
platform hook ->set_clock(), and melt the old two hooks into it.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Stable-dep-of: 71150ac12558 ("mmc: bcm2835: fix deferred probing")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mmc/host/renesas_sdhi_core.c
drivers/mmc/host/tmio_mmc.c
drivers/mmc/host/tmio_mmc.h
drivers/mmc/host/tmio_mmc_core.c