Message ID | 1430397081.5802.41.camel@xylophone.i.decadent.org.uk (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Geert Uytterhoeven |
Headers | show |
On 04/30/2015 03:31 PM, Ben Hutchings wrote: > From: Shinobu Uehara <shinobu.uehara.xc@renesas.com> > It is necessary to stop the SD clock before using > the actual clock in case of SDHI controller. > Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com> > Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> > --- > drivers/mmc/host/sh_mobile_sdhi.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c > index 6906a905cd54..92a58c6007fe 100644 > --- a/drivers/mmc/host/sh_mobile_sdhi.c > +++ b/drivers/mmc/host/sh_mobile_sdhi.c > @@ -136,6 +136,18 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev) > clk_disable_unprepare(priv->clk); > } > > +static void sh_mobile_sdhi_set_clk_div(struct platform_device *pdev, int clk) > +{ > + struct mmc_host *mmc = dev_get_drvdata(&pdev->dev); > + struct tmio_mmc_host *host = mmc_priv(mmc); > + > + if (clk == true) { 'clk' is *int*. Perhaps, should be just *if* (clk)? > + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 & > + sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); > + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x00ff); > + } > +} > + > static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host) > { > int timeout = 1000; [...] WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, 2015-04-30 at 19:34 +0300, Sergei Shtylyov wrote: > On 04/30/2015 03:31 PM, Ben Hutchings wrote: > > > From: Shinobu Uehara <shinobu.uehara.xc@renesas.com> > > > It is necessary to stop the SD clock before using > > the actual clock in case of SDHI controller. > > > Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com> > > Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> > > --- > > drivers/mmc/host/sh_mobile_sdhi.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c > > index 6906a905cd54..92a58c6007fe 100644 > > --- a/drivers/mmc/host/sh_mobile_sdhi.c > > +++ b/drivers/mmc/host/sh_mobile_sdhi.c > > @@ -136,6 +136,18 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev) > > clk_disable_unprepare(priv->clk); > > } > > > > +static void sh_mobile_sdhi_set_clk_div(struct platform_device *pdev, int clk) > > +{ > > + struct mmc_host *mmc = dev_get_drvdata(&pdev->dev); > > + struct tmio_mmc_host *host = mmc_priv(mmc); > > + > > + if (clk == true) { > > 'clk' is *int*. Perhaps, should be just *if* (clk)? clk is either 0 or 1 and should maybe be bool. But you're right, regardless of its type, it doesn't make sense to compare with true. Ben. > > + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 & > > + sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); > > + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x00ff); > > + } > > +} > > + > > static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host) > > { > > int timeout = 1000; > [...] > > WBR, Sergei > -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2015-05-06 at 02:05 +0100, Ben Hutchings wrote: > On Thu, 2015-04-30 at 19:34 +0300, Sergei Shtylyov wrote: > > On 04/30/2015 03:31 PM, Ben Hutchings wrote: > > > > > From: Shinobu Uehara <shinobu.uehara.xc@renesas.com> > > > > > It is necessary to stop the SD clock before using > > > the actual clock in case of SDHI controller. > > > > > Signed-off-by: Shinobu Uehara <shinobu.uehara.xc@renesas.com> > > > Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> > > > --- > > > drivers/mmc/host/sh_mobile_sdhi.c | 14 ++++++++++++++ > > > 1 file changed, 14 insertions(+) > > > > > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c > > > index 6906a905cd54..92a58c6007fe 100644 > > > --- a/drivers/mmc/host/sh_mobile_sdhi.c > > > +++ b/drivers/mmc/host/sh_mobile_sdhi.c > > > @@ -136,6 +136,18 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev) > > > clk_disable_unprepare(priv->clk); > > > } > > > > > > +static void sh_mobile_sdhi_set_clk_div(struct platform_device *pdev, int clk) > > > +{ > > > + struct mmc_host *mmc = dev_get_drvdata(&pdev->dev); > > > + struct tmio_mmc_host *host = mmc_priv(mmc); > > > + > > > + if (clk == true) { > > > > 'clk' is *int*. Perhaps, should be just *if* (clk)? > > clk is either 0 or 1 and should maybe be bool. But you're right, > regardless of its type, it doesn't make sense to compare with true. [...] Anyway, I think this is redundant with: commit b30d6958a014812158d9729a3e0b6d448f6e8968 Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Date: Sun Aug 24 20:02:16 2014 -0700 mmc: tmio: remove SCLKEN bit setting from tmio_mmc_set_clock() commit da29fe2bf573f0ae56fdc2e790387cb73fc8c6f8 Author: Shinobu Uehara <shinobu.uehara.xc@renesas.com> Date: Sun Aug 24 20:03:00 2014 -0700 mmc: tmio: add actual clock support as option so I will probably just drop it. Ben. -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 6906a905cd54..92a58c6007fe 100644 --- a/drivers/mmc/host/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c @@ -136,6 +136,18 @@ static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev) clk_disable_unprepare(priv->clk); } +static void sh_mobile_sdhi_set_clk_div(struct platform_device *pdev, int clk) +{ + struct mmc_host *mmc = dev_get_drvdata(&pdev->dev); + struct tmio_mmc_host *host = mmc_priv(mmc); + + if (clk == true) { + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~0x0100 & + sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, 0x00ff); + } +} + static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host) { int timeout = 1000; @@ -234,6 +246,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev) goto eprobe; } + host->set_clk_div = sh_mobile_sdhi_set_clk_div; + host->dma = dma_priv; host->write16_hook = sh_mobile_sdhi_write16_hook; host->clk_enable = sh_mobile_sdhi_clk_enable;