diff options
Diffstat (limited to 'drivers/spi/spi-imx.c')
-rw-r--r-- | drivers/spi/spi-imx.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 69c9a6601f45..47877d687614 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -86,7 +86,8 @@ struct spi_imx_data { | |||
86 | struct completion xfer_done; | 86 | struct completion xfer_done; |
87 | void __iomem *base; | 87 | void __iomem *base; |
88 | int irq; | 88 | int irq; |
89 | struct clk *clk; | 89 | struct clk *clk_per; |
90 | struct clk *clk_ipg; | ||
90 | unsigned long spi_clk; | 91 | unsigned long spi_clk; |
91 | 92 | ||
92 | unsigned int count; | 93 | unsigned int count; |
@@ -853,15 +854,22 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
853 | goto out_free_irq; | 854 | goto out_free_irq; |
854 | } | 855 | } |
855 | 856 | ||
856 | spi_imx->clk = clk_get(&pdev->dev, NULL); | 857 | spi_imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); |
857 | if (IS_ERR(spi_imx->clk)) { | 858 | if (IS_ERR(spi_imx->clk_ipg)) { |
858 | dev_err(&pdev->dev, "unable to get clock\n"); | 859 | ret = PTR_ERR(spi_imx->clk_ipg); |
859 | ret = PTR_ERR(spi_imx->clk); | ||
860 | goto out_free_irq; | 860 | goto out_free_irq; |
861 | } | 861 | } |
862 | 862 | ||
863 | clk_enable(spi_imx->clk); | 863 | spi_imx->clk_per = devm_clk_get(&pdev->dev, "per"); |
864 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk); | 864 | if (IS_ERR(spi_imx->clk_per)) { |
865 | ret = PTR_ERR(spi_imx->clk_per); | ||
866 | goto out_free_irq; | ||
867 | } | ||
868 | |||
869 | clk_prepare_enable(spi_imx->clk_per); | ||
870 | clk_prepare_enable(spi_imx->clk_ipg); | ||
871 | |||
872 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per); | ||
865 | 873 | ||
866 | spi_imx->devtype_data->reset(spi_imx); | 874 | spi_imx->devtype_data->reset(spi_imx); |
867 | 875 | ||
@@ -879,8 +887,8 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
879 | return ret; | 887 | return ret; |
880 | 888 | ||
881 | out_clk_put: | 889 | out_clk_put: |
882 | clk_disable(spi_imx->clk); | 890 | clk_disable_unprepare(spi_imx->clk_per); |
883 | clk_put(spi_imx->clk); | 891 | clk_disable_unprepare(spi_imx->clk_ipg); |
884 | out_free_irq: | 892 | out_free_irq: |
885 | free_irq(spi_imx->irq, spi_imx); | 893 | free_irq(spi_imx->irq, spi_imx); |
886 | out_iounmap: | 894 | out_iounmap: |
@@ -908,8 +916,8 @@ static int __devexit spi_imx_remove(struct platform_device *pdev) | |||
908 | spi_bitbang_stop(&spi_imx->bitbang); | 916 | spi_bitbang_stop(&spi_imx->bitbang); |
909 | 917 | ||
910 | writel(0, spi_imx->base + MXC_CSPICTRL); | 918 | writel(0, spi_imx->base + MXC_CSPICTRL); |
911 | clk_disable(spi_imx->clk); | 919 | clk_disable_unprepare(spi_imx->clk_per); |
912 | clk_put(spi_imx->clk); | 920 | clk_disable_unprepare(spi_imx->clk_ipg); |
913 | free_irq(spi_imx->irq, spi_imx); | 921 | free_irq(spi_imx->irq, spi_imx); |
914 | iounmap(spi_imx->base); | 922 | iounmap(spi_imx->base); |
915 | 923 | ||