Message ID | 20181107035758.11029-2-anarsoul@gmail.com |
---|---|
State | Superseded |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Series | sunxi-mmc: enable new clock mode on A64 | expand |
On Wed, Nov 7, 2018 at 11:59 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote: > > A64 doesn't have a mode switch in CCM, so introduce new > MMC_SUNXI_HAS_NEW_MODE_SWITCH option to support new clock mode on A64 > > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> > Tested-by: Zhaofeng Li <hello@zhaofeng.li> This patch isn't strictly necessary. See https://elixir.bootlin.com/linux/v4.20-rc1/source/drivers/mmc/host/sunxi-mmc.c#L831 If the switch doesn't exist, changes to that bit are ignored. ChenYu
On Tue, Nov 6, 2018 at 8:13 PM Chen-Yu Tsai <wens@csie.org> wrote: > > On Wed, Nov 7, 2018 at 11:59 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote: > > > > A64 doesn't have a mode switch in CCM, so introduce new > > MMC_SUNXI_HAS_NEW_MODE_SWITCH option to support new clock mode on A64 > > > > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> > > Tested-by: Zhaofeng Li <hello@zhaofeng.li> > > This patch isn't strictly necessary. See > > https://elixir.bootlin.com/linux/v4.20-rc1/source/drivers/mmc/host/sunxi-mmc.c#L831 > > If the switch doesn't exist, changes to that bit are ignored. CCM_MMC_CTRL_MODE_SEL_NEW is not defined on A64, so it won't compile unless we define it on A64 which seems to be redundant. > > ChenYu
On Wed, Nov 7, 2018 at 12:21 PM Vasily Khoruzhick <anarsoul@gmail.com> wrote: > > On Tue, Nov 6, 2018 at 8:13 PM Chen-Yu Tsai <wens@csie.org> wrote: > > > > On Wed, Nov 7, 2018 at 11:59 AM Vasily Khoruzhick <anarsoul@gmail.com> wrote: > > > > > > A64 doesn't have a mode switch in CCM, so introduce new > > > MMC_SUNXI_HAS_NEW_MODE_SWITCH option to support new clock mode on A64 > > > > > > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com> > > > Tested-by: Zhaofeng Li <hello@zhaofeng.li> > > > > This patch isn't strictly necessary. See > > > > https://elixir.bootlin.com/linux/v4.20-rc1/source/drivers/mmc/host/sunxi-mmc.c#L831 > > > > If the switch doesn't exist, changes to that bit are ignored. > > CCM_MMC_CTRL_MODE_SEL_NEW is not defined on A64, so it won't compile > unless we define it on A64 which seems to be redundant. OK. That makes sense then. You should mention that in the commit message, as that is exactly the reason why this patch is needed. On the other hand, having hardware device registers defined at the arch level is kind of hard to keep track of. ChenYu
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 560dc9b25d..66fff6c6d3 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -230,6 +230,7 @@ config MACH_SUN8I_A83T select PHY_SUN4I_USB select SUNXI_GEN_SUN6I select MMC_SUNXI_HAS_NEW_MODE + select MMC_SUNXI_HAS_MODE_SWITCH select SUPPORT_SPL config MACH_SUN8I_H3 diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 27246ee465..3f7458d409 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -569,6 +569,10 @@ config MMC_SUNXI_HAS_NEW_MODE bool depends on MMC_SUNXI +config MMC_SUNXI_HAS_MODE_SWITCH + bool + depends on MMC_SUNXI + config GENERIC_ATMEL_MCI bool "Atmel Multimedia Card Interface support" depends on DM_MMC && BLK && ARCH_AT91 diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index 147eb9b4d5..b3526f5e3f 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -176,7 +176,9 @@ static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) if (new_mode) { #ifdef CONFIG_MMC_SUNXI_HAS_NEW_MODE +#ifdef CONFIG_MMC_SUNXI_HAS_MODE_SWITCH val = CCM_MMC_CTRL_MODE_SEL_NEW; +#endif setbits_le32(&priv->reg->ntsr, SUNXI_MMC_NTSR_MODE_SEL_NEW); #endif } else if (!calibrate) {