Skip to content

Commit

Permalink
spi: spi-adi-v3: convert to use common clk framework
Browse files Browse the repository at this point in the history
Use common clk api to get spi clock.

Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Scott Jiang authored and Mark Brown committed Apr 14, 2014
1 parent 766e372 commit c34cc24
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 7 additions & 0 deletions arch/blackfin/mach-bf609/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ static struct clk ethclk = {
.ops = &dummy_clk_ops,
};

static struct clk spiclk = {
.name = "spi",
.parent = &sclk1,
.ops = &dummy_clk_ops,
};

static struct clk_lookup bf609_clks[] = {
CLK(sys_clkin, NULL, "SYS_CLKIN"),
CLK(pll_clk, NULL, "PLLCLK"),
Expand All @@ -375,6 +381,7 @@ static struct clk_lookup bf609_clks[] = {
CLK(dclk, NULL, "DCLK"),
CLK(oclk, NULL, "OCLK"),
CLK(ethclk, NULL, "stmmaceth"),
CLK(spiclk, NULL, "spi"),
};

int __init clk_init(void)
Expand Down
13 changes: 7 additions & 6 deletions drivers/spi/spi-adi-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* GNU General Public License for more details.
*/

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
Expand Down Expand Up @@ -800,18 +801,18 @@ static int adi_spi_probe(struct platform_device *pdev)
struct adi_spi_master *drv_data;
struct resource *mem, *res;
unsigned int tx_dma, rx_dma;
unsigned long sclk;
struct clk *sclk;
int ret;

if (!info) {
dev_err(dev, "platform data missing!\n");
return -ENODEV;
}

sclk = get_sclk1();
if (!sclk) {
dev_err(dev, "can not get sclk1\n");
return -ENXIO;
sclk = devm_clk_get(dev, "spi");
if (IS_ERR(sclk)) {
dev_err(dev, "can not get spi clock\n");
return PTR_ERR(sclk);
}

res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
Expand Down Expand Up @@ -852,7 +853,7 @@ static int adi_spi_probe(struct platform_device *pdev)
drv_data->tx_dma = tx_dma;
drv_data->rx_dma = rx_dma;
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);
drv_data->regs = devm_ioremap_resource(dev, mem);
Expand Down

0 comments on commit c34cc24

Please sign in to comment.