aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-pxa2xx.c
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2015-09-25 03:27:17 -0400
committerMark Brown <broonie@kernel.org>2015-09-25 12:52:18 -0400
commit0eca7cf2696506006463b9d67bb6110c82d3e064 (patch)
tree3c565d772c82493825578b9395032f3d00f8ba6b /drivers/spi/spi-pxa2xx.c
parentb69d42b5c44bcfc1c73fe185d4644487f1bd3193 (diff)
spi: pxa2xx: Set the max_speed_hz of the master
Carry input clock of the controller in max_speed_hz of struct spi_master instead of in own driver data. They mean the same thing and more over now the max_speed_hz is not even set here. As an added bonus this allows SPI core to validate that transfer speed is not beyond the maximum input clock. This is not a problem in spi-pxa2xx as the driver doesn't use transfer speed parameter directly but via input clock divider calculation which will top at divide by one. However it's better to validate speed before passing it here. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-pxa2xx.c')
-rw-r--r--drivers/spi/spi-pxa2xx.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index a25bc1d4bf7f..0e075db589ca 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -802,7 +802,7 @@ static unsigned int quark_x1000_get_clk_div(int rate, u32 *dds)
802 802
803static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) 803static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate)
804{ 804{
805 unsigned long ssp_clk = drv_data->max_clk_rate; 805 unsigned long ssp_clk = drv_data->master->max_speed_hz;
806 const struct ssp_device *ssp = drv_data->ssp; 806 const struct ssp_device *ssp = drv_data->ssp;
807 807
808 rate = min_t(int, ssp_clk, rate); 808 rate = min_t(int, ssp_clk, rate);
@@ -1217,13 +1217,13 @@ static int setup(struct spi_device *spi)
1217 /* NOTE: PXA25x_SSP _could_ use external clocking ... */ 1217 /* NOTE: PXA25x_SSP _could_ use external clocking ... */
1218 cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, spi->bits_per_word); 1218 cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, spi->bits_per_word);
1219 if (!pxa25x_ssp_comp(drv_data)) 1219 if (!pxa25x_ssp_comp(drv_data))
1220 dev_dbg(&spi->dev, "%ld Hz actual, %s\n", 1220 dev_dbg(&spi->dev, "%u Hz actual, %s\n",
1221 drv_data->max_clk_rate 1221 drv_data->master->max_speed_hz
1222 / (1 + ((cr0 & SSCR0_SCR(0xfff)) >> 8)), 1222 / (1 + ((cr0 & SSCR0_SCR(0xfff)) >> 8)),
1223 chip->enable_dma ? "DMA" : "PIO"); 1223 chip->enable_dma ? "DMA" : "PIO");
1224 else 1224 else
1225 dev_dbg(&spi->dev, "%ld Hz actual, %s\n", 1225 dev_dbg(&spi->dev, "%u Hz actual, %s\n",
1226 drv_data->max_clk_rate / 2 1226 drv_data->master->max_speed_hz / 2
1227 / (1 + ((cr0 & SSCR0_SCR(0x0ff)) >> 8)), 1227 / (1 + ((cr0 & SSCR0_SCR(0x0ff)) >> 8)),
1228 chip->enable_dma ? "DMA" : "PIO"); 1228 chip->enable_dma ? "DMA" : "PIO");
1229 1229
@@ -1473,7 +1473,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1473 /* Enable SOC clock */ 1473 /* Enable SOC clock */
1474 clk_prepare_enable(ssp->clk); 1474 clk_prepare_enable(ssp->clk);
1475 1475
1476 drv_data->max_clk_rate = clk_get_rate(ssp->clk); 1476 master->max_speed_hz = clk_get_rate(ssp->clk);
1477 1477
1478 /* Load default SSP configuration */ 1478 /* Load default SSP configuration */
1479 pxa2xx_spi_write(drv_data, SSCR0, 0); 1479 pxa2xx_spi_write(drv_data, SSCR0, 0);