mmc: sdhi: implement tmio-mmc clock enable-update and disable callbacks
Instead of delivering one static clock frequency value, read from the hardware during probing, enable the tmio-mmc driver to re-read the frequency dynamically. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
parent
8c102a9646
commit
56c4928793
|
@ -39,6 +39,27 @@ struct sh_mobile_sdhi {
|
||||||
struct tmio_mmc_dma dma_priv;
|
struct tmio_mmc_dma dma_priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int sh_mobile_sdhi_clk_enable(struct platform_device *pdev, unsigned int *f)
|
||||||
|
{
|
||||||
|
struct mmc_host *mmc = dev_get_drvdata(&pdev->dev);
|
||||||
|
struct tmio_mmc_host *host = mmc_priv(mmc);
|
||||||
|
struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data);
|
||||||
|
int ret = clk_enable(priv->clk);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
*f = clk_get_rate(priv->clk);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sh_mobile_sdhi_clk_disable(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct mmc_host *mmc = dev_get_drvdata(&pdev->dev);
|
||||||
|
struct tmio_mmc_host *host = mmc_priv(mmc);
|
||||||
|
struct sh_mobile_sdhi *priv = container_of(host->pdata, struct sh_mobile_sdhi, mmc_data);
|
||||||
|
clk_disable(priv->clk);
|
||||||
|
}
|
||||||
|
|
||||||
static void sh_mobile_sdhi_set_pwr(struct platform_device *pdev, int state)
|
static void sh_mobile_sdhi_set_pwr(struct platform_device *pdev, int state)
|
||||||
{
|
{
|
||||||
struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
|
struct sh_mobile_sdhi_info *p = pdev->dev.platform_data;
|
||||||
|
@ -132,9 +153,10 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
|
||||||
goto eclkget;
|
goto eclkget;
|
||||||
}
|
}
|
||||||
|
|
||||||
mmc_data->hclk = clk_get_rate(priv->clk);
|
|
||||||
mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
|
mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
|
||||||
mmc_data->get_cd = sh_mobile_sdhi_get_cd;
|
mmc_data->get_cd = sh_mobile_sdhi_get_cd;
|
||||||
|
mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
|
||||||
|
mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
|
||||||
mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
|
mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
|
||||||
if (p) {
|
if (p) {
|
||||||
mmc_data->flags = p->tmio_flags;
|
mmc_data->flags = p->tmio_flags;
|
||||||
|
|
Loading…
Reference in New Issue