aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-imx.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-03-07 03:30:22 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2012-04-25 11:03:36 -0400
commitaa29d840e3138fdf9459cc1e0101d6f25f8a48f4 (patch)
tree141c115078175641ce30192d5f68d95dec9fc54c /drivers/spi/spi-imx.c
parent7560e3f3581ed415828d3f431b8622fa38c2d133 (diff)
spi i.MX: do not depend on grouped clocks
the current i.MX clock support groups together unrelated clocks to a single clock which is then used by the driver. This can't be accomplished with the generic clock framework so we instead request the individual clocks in the driver. For i.MX there are generally three different clocks: ipg: bus clock (needed to access registers) ahb: dma relevant clock, sometimes referred to as hclk in the datasheet per: bit clock, pixel clock This patch changes the driver to request the individual clocks. Currently all clk_get will get the same clock until the SoCs are converted to the generic clock framework Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/spi/spi-imx.c')
-rw-r--r--drivers/spi/spi-imx.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 570f22053be8..4b6688630b9c 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -85,7 +85,8 @@ struct spi_imx_data {
85 struct completion xfer_done; 85 struct completion xfer_done;
86 void __iomem *base; 86 void __iomem *base;
87 int irq; 87 int irq;
88 struct clk *clk; 88 struct clk *clk_per;
89 struct clk *clk_ipg;
89 unsigned long spi_clk; 90 unsigned long spi_clk;
90 91
91 unsigned int count; 92 unsigned int count;
@@ -845,15 +846,22 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
845 goto out_iounmap; 846 goto out_iounmap;
846 } 847 }
847 848
848 spi_imx->clk = clk_get(&pdev->dev, NULL); 849 spi_imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
849 if (IS_ERR(spi_imx->clk)) { 850 if (IS_ERR(spi_imx->clk_ipg)) {
850 dev_err(&pdev->dev, "unable to get clock\n"); 851 ret = PTR_ERR(spi_imx->clk_ipg);
851 ret = PTR_ERR(spi_imx->clk);
852 goto out_free_irq; 852 goto out_free_irq;
853 } 853 }
854 854
855 clk_enable(spi_imx->clk); 855 spi_imx->clk_per = devm_clk_get(&pdev->dev, "per");
856 spi_imx->spi_clk = clk_get_rate(spi_imx->clk); 856 if (IS_ERR(spi_imx->clk_per)) {
857 ret = PTR_ERR(spi_imx->clk_per);
858 goto out_free_irq;
859 }
860
861 clk_prepare_enable(spi_imx->clk_per);
862 clk_prepare_enable(spi_imx->clk_ipg);
863
864 spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
857 865
858 spi_imx->devtype_data->reset(spi_imx); 866 spi_imx->devtype_data->reset(spi_imx);
859 867
@@ -871,8 +879,8 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
871 return ret; 879 return ret;
872 880
873out_clk_put: 881out_clk_put:
874 clk_disable(spi_imx->clk); 882 clk_disable_unprepare(spi_imx->clk_per);
875 clk_put(spi_imx->clk); 883 clk_disable_unprepare(spi_imx->clk_ipg);
876out_free_irq: 884out_free_irq:
877 free_irq(spi_imx->irq, spi_imx); 885 free_irq(spi_imx->irq, spi_imx);
878out_iounmap: 886out_iounmap:
@@ -900,8 +908,8 @@ static int __devexit spi_imx_remove(struct platform_device *pdev)
900 spi_bitbang_stop(&spi_imx->bitbang); 908 spi_bitbang_stop(&spi_imx->bitbang);
901 909
902 writel(0, spi_imx->base + MXC_CSPICTRL); 910 writel(0, spi_imx->base + MXC_CSPICTRL);
903 clk_disable(spi_imx->clk); 911 clk_disable_unprepare(spi_imx->clk_per);
904 clk_put(spi_imx->clk); 912 clk_disable_unprepare(spi_imx->clk_ipg);
905 free_irq(spi_imx->irq, spi_imx); 913 free_irq(spi_imx->irq, spi_imx);
906 iounmap(spi_imx->base); 914 iounmap(spi_imx->base);
907 915