diff options
Diffstat (limited to 'drivers/spi/spi-au1550.c')
-rw-r--r-- | drivers/spi/spi-au1550.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index c4141c92bcff..aafb812d7ea6 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c | |||
@@ -55,8 +55,6 @@ struct au1550_spi { | |||
55 | 55 | ||
56 | volatile psc_spi_t __iomem *regs; | 56 | volatile psc_spi_t __iomem *regs; |
57 | int irq; | 57 | int irq; |
58 | unsigned freq_max; | ||
59 | unsigned freq_min; | ||
60 | 58 | ||
61 | unsigned len; | 59 | unsigned len; |
62 | unsigned tx_count; | 60 | unsigned tx_count; |
@@ -248,11 +246,8 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t) | |||
248 | hz = t->speed_hz; | 246 | hz = t->speed_hz; |
249 | } | 247 | } |
250 | 248 | ||
251 | if (hz > spi->max_speed_hz || hz > hw->freq_max || hz < hw->freq_min) { | 249 | if (!hz) |
252 | dev_err(&spi->dev, "setupxfer: clock rate=%d out of range\n", | ||
253 | hz); | ||
254 | return -EINVAL; | 250 | return -EINVAL; |
255 | } | ||
256 | 251 | ||
257 | au1550_spi_bits_handlers_set(hw, spi->bits_per_word); | 252 | au1550_spi_bits_handlers_set(hw, spi->bits_per_word); |
258 | 253 | ||
@@ -287,23 +282,6 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t) | |||
287 | return 0; | 282 | return 0; |
288 | } | 283 | } |
289 | 284 | ||
290 | static int au1550_spi_setup(struct spi_device *spi) | ||
291 | { | ||
292 | struct au1550_spi *hw = spi_master_get_devdata(spi->master); | ||
293 | |||
294 | if (spi->max_speed_hz == 0) | ||
295 | spi->max_speed_hz = hw->freq_max; | ||
296 | if (spi->max_speed_hz > hw->freq_max | ||
297 | || spi->max_speed_hz < hw->freq_min) | ||
298 | return -EINVAL; | ||
299 | /* | ||
300 | * NOTE: cannot change speed and other hw settings immediately, | ||
301 | * otherwise sharing of spi bus is not possible, | ||
302 | * so do not call setupxfer(spi, NULL) here | ||
303 | */ | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | /* | 285 | /* |
308 | * for dma spi transfers, we have to setup rx channel, otherwise there is | 286 | * for dma spi transfers, we have to setup rx channel, otherwise there is |
309 | * no reliable way how to recognize that spi transfer is done | 287 | * no reliable way how to recognize that spi transfer is done |
@@ -838,7 +816,6 @@ static int au1550_spi_probe(struct platform_device *pdev) | |||
838 | hw->bitbang.master = hw->master; | 816 | hw->bitbang.master = hw->master; |
839 | hw->bitbang.setup_transfer = au1550_spi_setupxfer; | 817 | hw->bitbang.setup_transfer = au1550_spi_setupxfer; |
840 | hw->bitbang.chipselect = au1550_spi_chipsel; | 818 | hw->bitbang.chipselect = au1550_spi_chipsel; |
841 | hw->bitbang.master->setup = au1550_spi_setup; | ||
842 | hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs; | 819 | hw->bitbang.txrx_bufs = au1550_spi_txrx_bufs; |
843 | 820 | ||
844 | if (hw->usedma) { | 821 | if (hw->usedma) { |
@@ -909,8 +886,9 @@ static int au1550_spi_probe(struct platform_device *pdev) | |||
909 | { | 886 | { |
910 | int min_div = (2 << 0) * (2 * (4 + 1)); | 887 | int min_div = (2 << 0) * (2 * (4 + 1)); |
911 | int max_div = (2 << 3) * (2 * (63 + 1)); | 888 | int max_div = (2 << 3) * (2 * (63 + 1)); |
912 | hw->freq_max = hw->pdata->mainclk_hz / min_div; | 889 | master->max_speed_hz = hw->pdata->mainclk_hz / min_div; |
913 | hw->freq_min = hw->pdata->mainclk_hz / (max_div + 1) + 1; | 890 | master->min_speed_hz = |
891 | hw->pdata->mainclk_hz / (max_div + 1) + 1; | ||
914 | } | 892 | } |
915 | 893 | ||
916 | au1550_spi_setup_psc_as_spi(hw); | 894 | au1550_spi_setup_psc_as_spi(hw); |