Commit c34cc248 authored by Scott Jiang's avatar Scott Jiang Committed by Mark Brown

spi: spi-adi-v3: convert to use common clk framework

Use common clk api to get spi clock.
Signed-off-by: default avatarScott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 766e3721
...@@ -363,6 +363,12 @@ static struct clk ethclk = { ...@@ -363,6 +363,12 @@ static struct clk ethclk = {
.ops = &dummy_clk_ops, .ops = &dummy_clk_ops,
}; };
static struct clk spiclk = {
.name = "spi",
.parent = &sclk1,
.ops = &dummy_clk_ops,
};
static struct clk_lookup bf609_clks[] = { static struct clk_lookup bf609_clks[] = {
CLK(sys_clkin, NULL, "SYS_CLKIN"), CLK(sys_clkin, NULL, "SYS_CLKIN"),
CLK(pll_clk, NULL, "PLLCLK"), CLK(pll_clk, NULL, "PLLCLK"),
...@@ -375,6 +381,7 @@ static struct clk_lookup bf609_clks[] = { ...@@ -375,6 +381,7 @@ static struct clk_lookup bf609_clks[] = {
CLK(dclk, NULL, "DCLK"), CLK(dclk, NULL, "DCLK"),
CLK(oclk, NULL, "OCLK"), CLK(oclk, NULL, "OCLK"),
CLK(ethclk, NULL, "stmmaceth"), CLK(ethclk, NULL, "stmmaceth"),
CLK(spiclk, NULL, "spi"),
}; };
int __init clk_init(void) int __init clk_init(void)
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
...@@ -800,7 +801,7 @@ static int adi_spi_probe(struct platform_device *pdev) ...@@ -800,7 +801,7 @@ static int adi_spi_probe(struct platform_device *pdev)
struct adi_spi_master *drv_data; struct adi_spi_master *drv_data;
struct resource *mem, *res; struct resource *mem, *res;
unsigned int tx_dma, rx_dma; unsigned int tx_dma, rx_dma;
unsigned long sclk; struct clk *sclk;
int ret; int ret;
if (!info) { if (!info) {
...@@ -808,10 +809,10 @@ static int adi_spi_probe(struct platform_device *pdev) ...@@ -808,10 +809,10 @@ static int adi_spi_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
sclk = get_sclk1(); sclk = devm_clk_get(dev, "spi");
if (!sclk) { if (IS_ERR(sclk)) {
dev_err(dev, "can not get sclk1\n"); dev_err(dev, "can not get spi clock\n");
return -ENXIO; return PTR_ERR(sclk);
} }
res = platform_get_resource(pdev, IORESOURCE_DMA, 0); res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
...@@ -852,7 +853,7 @@ static int adi_spi_probe(struct platform_device *pdev) ...@@ -852,7 +853,7 @@ static int adi_spi_probe(struct platform_device *pdev)
drv_data->tx_dma = tx_dma; drv_data->tx_dma = tx_dma;
drv_data->rx_dma = rx_dma; drv_data->rx_dma = rx_dma;
drv_data->pin_req = info->pin_req; drv_data->pin_req = info->pin_req;
drv_data->sclk = sclk; drv_data->sclk = clk_get_rate(sclk);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
drv_data->regs = devm_ioremap_resource(dev, mem); drv_data->regs = devm_ioremap_resource(dev, mem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment