Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/spi/imx_spi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c index c3dc6cc..14d2b28 100644 --- a/drivers/spi/imx_spi.c +++ b/drivers/spi/imx_spi.c @@ -25,6 +25,8 @@ #include <mach/spi.h> #include <mach/generic.h> #include <mach/clock.h> +#include <linux/clk.h> +#include <linux/err.h> #define CSPI_0_0_RXDATA 0x00 #define CSPI_0_0_TXDATA 0x04 @@ -128,6 +130,7 @@ struct imx_spi { struct spi_master master; int *cs_array; void __iomem *regs; + struct clk *clk; unsigned int (*xchg_single)(struct imx_spi *imx, u32 data); void (*chipselect)(struct spi_device *spi, int active); @@ -276,7 +279,7 @@ static void cspi_0_7_chipselect(struct spi_device *spi, int is_active) return; } - reg |= spi_imx_clkdiv_2(imx_get_cspiclk(), spi->max_speed_hz) << + reg |= spi_imx_clkdiv_2(clk_get_rate(imx->clk), spi->max_speed_hz) << CSPI_0_7_CTRL_DR_SHIFT; reg |= (spi->bits_per_word - 1) << CSPI_0_7_CTRL_BL_SHIFT; @@ -381,7 +384,7 @@ static void cspi_2_3_chipselect(struct spi_device *spi, int is_active) ctrl |= CSPI_2_3_CTRL_MODE(cs); /* set clock speed */ - ctrl |= cspi_2_3_clkdiv(imx_get_cspiclk(), spi->max_speed_hz); + ctrl |= cspi_2_3_clkdiv(clk_get_rate(imx->clk), spi->max_speed_hz); /* set chip select to use */ ctrl |= CSPI_2_3_CTRL_CS(cs); @@ -532,6 +535,7 @@ static int imx_spi_probe(struct device_d *dev) master->setup = imx_spi_setup; master->transfer = imx_spi_transfer; + if (pdata) { master->num_chipselect = pdata->num_chipselect; imx->cs_array = pdata->chipselect; @@ -540,6 +544,10 @@ static int imx_spi_probe(struct device_d *dev) imx_spi_dt_probe(imx); } + imx->clk = clk_get(dev, NULL); + if (IS_ERR(imx->clk)) + return PTR_ERR(imx->clk); + #ifdef CONFIG_DRIVER_SPI_IMX_0_0 if (cpu_is_mx27()) version = SPI_IMX_VER_0_0; -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox