[PATCH RFC v7 6/6] HACK mmc: mxcmmc: enable clocks for the MPC512x

2014-02-12 Thread Alexander Popov
From: Gerhard Sittig g...@denx.de

QD HACK to enable SD card support without correct COMMON_CLK support,
best viewed with 'git diff -w -b', NOT acceptable for mainline (NAKed)

Signed-off-by: Gerhard Sittig g...@denx.de
[ a13xp0p0...@gmail.com: resolve little patch conflict ]
---
 drivers/mmc/host/mxcmmc.c | 42 --
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index f7199c8..ddefa60 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -1123,20 +1123,29 @@ static int mxcmci_probe(struct platform_device *pdev)
host-res = r;
host-irq = irq;
 
-   host-clk_ipg = devm_clk_get(pdev-dev, ipg);
-   if (IS_ERR(host-clk_ipg)) {
-   ret = PTR_ERR(host-clk_ipg);
-   goto out_iounmap;
-   }
+   if (!is_mpc512x_mmc(host)) {
+   host-clk_ipg = devm_clk_get(pdev-dev, ipg);
+   if (IS_ERR(host-clk_ipg)) {
+   ret = PTR_ERR(host-clk_ipg);
+   goto out_iounmap;
+   }
 
-   host-clk_per = devm_clk_get(pdev-dev, per);
-   if (IS_ERR(host-clk_per)) {
-   ret = PTR_ERR(host-clk_per);
-   goto out_iounmap;
+   host-clk_per = devm_clk_get(pdev-dev, per);
+   if (IS_ERR(host-clk_per)) {
+   ret = PTR_ERR(host-clk_per);
+   goto out_iounmap;
+   }
+   } else {
+   host-clk_per = devm_clk_get(pdev-dev, sdhc_clk);
+   if (IS_ERR(host-clk_per)) {
+   ret = PTR_ERR(host-clk_per);
+   goto out_iounmap;
+   }
}
 
clk_prepare_enable(host-clk_per);
-   clk_prepare_enable(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_prepare_enable(host-clk_ipg);
 
mxcmci_softreset(host);
 
@@ -1206,7 +1215,8 @@ out_free_dma:
dma_release_channel(host-dma);
 out_clk_put:
clk_disable_unprepare(host-clk_per);
-   clk_disable_unprepare(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_disable_unprepare(host-clk_ipg);
 out_iounmap:
iounmap(host-base);
 out_free:
@@ -1236,7 +1246,8 @@ static int mxcmci_remove(struct platform_device *pdev)
dma_release_channel(host-dma);
 
clk_disable_unprepare(host-clk_per);
-   clk_disable_unprepare(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_disable_unprepare(host-clk_ipg);
 
release_mem_region(host-res-start, resource_size(host-res));
 
@@ -1252,7 +1263,9 @@ static int mxcmci_suspend(struct device *dev)
struct mxcmci_host *host = mmc_priv(mmc);
 
clk_disable_unprepare(host-clk_per);
-   clk_disable_unprepare(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_disable_unprepare(host-clk_ipg);
+
return 0;
 }
 
@@ -1262,7 +1275,8 @@ static int mxcmci_resume(struct device *dev)
struct mxcmci_host *host = mmc_priv(mmc);
 
clk_prepare_enable(host-clk_per);
-   clk_prepare_enable(host-clk_ipg);
+   if (host-clk_ipg)
+   clk_prepare_enable(host-clk_ipg);
return 0;
 }
 
-- 
1.8.4.2

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH RFC v7 6/6] HACK mmc: mxcmmc: enable clocks for the MPC512x

2014-02-12 Thread Gerhard Sittig
[ removed DT from Cc: ]

On Wed, Feb 12, 2014 at 17:25 +0400, Alexander Popov wrote:
 
 QD HACK to enable SD card support without correct COMMON_CLK support,
 best viewed with 'git diff -w -b', NOT acceptable for mainline (NAKed)

This one has become obsolete, v3.14-rc1 comes with proper
COMMON_CLK support.


virtually yours
Gerhard Sittig
-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev