spi: Fixes for v3.18

There's a couple of driver fixes here, plus one core fix for the DMA
 mapping which wasn't doing the right thing for vmalloc()ed addresses
 that hadn't been through kmap().  It's fairly rare to use vmalloc() with
 SPI and it's a subset of those users who might fail so it's unsurprising
 that this wasn't noticed sooner.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJUdiZZAAoJECTWi3JdVIfQ4ncH/Rf8zsdc2sWT791fOHEuWBAF
 vIAuyVKKoaJXY/mGvzJ/afm9Qjkr//fhlVJCvjwAS+vTKCfe/yi5x4ic+gcgHU+Q
 S5FuRdAvTeN9chIGIY/0A5u0p9Y2tSEzhyw5RIVtyLJpRgWP7mIhuP7zdFECzFEx
 A9VtH30dQdcVXFVIcfXoo2ltzcvWSampZIb6NezWkz5foNWJk4KxQ34TkgEDUioT
 TIEXX0e4C2KqQuibeiz/GFgfPlqgu1wXfS8XKtUN4LXj6Yz1BS2ADTBK4i3tx9M/
 iBwwj6cd1n8ESYJno0kCBOvoTTHnuWmOPRVt3BIzI7wzjCnP/uD/4oWEmFafx0w=
 =/6dY
 -----END PGP SIGNATURE-----

Merge tag 'spi-v3.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "There's a couple of driver fixes here, plus one core fix for the DMA
  mapping which wasn't doing the right thing for vmalloc()ed addresses
  that hadn't been through kmap().  It's fairly rare to use vmalloc()
  with SPI and it's a subset of those users who might fail so it's
  unsurprising that this wasn't noticed sooner"

* tag 'spi-v3.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: sirf: fix word width configuration
  spi: Fix mapping from vmalloc-ed buffer to scatter list
  spi: dw: Fix dynamic speed change.
This commit is contained in:
Linus Torvalds 2014-11-27 17:55:42 -08:00
commit 190fc9d968
3 changed files with 6 additions and 10 deletions

View File

@ -376,9 +376,6 @@ static void pump_transfers(unsigned long data)
chip = dws->cur_chip;
spi = message->spi;
if (unlikely(!chip->clk_div))
chip->clk_div = dws->max_freq / chip->speed_hz;
if (message->state == ERROR_STATE) {
message->status = -EIO;
goto early_exit;
@ -419,7 +416,7 @@ static void pump_transfers(unsigned long data)
if (transfer->speed_hz) {
speed = chip->speed_hz;
if (transfer->speed_hz != speed) {
if ((transfer->speed_hz != speed) || (!chip->clk_div)) {
speed = transfer->speed_hz;
/* clk_div doesn't support odd number */
@ -581,7 +578,6 @@ static int dw_spi_setup(struct spi_device *spi)
dev_err(&spi->dev, "No max speed HZ parameter\n");
return -EINVAL;
}
chip->speed_hz = spi->max_speed_hz;
chip->tmode = 0; /* Tx & Rx */
/* Default SPI mode is SCPOL = 0, SCPH = 0 */

View File

@ -562,9 +562,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
sspi->word_width = DIV_ROUND_UP(bits_per_word, 8);
txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
sspi->word_width;
(sspi->word_width >> 1);
rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) |
sspi->word_width;
(sspi->word_width >> 1);
if (!(spi->mode & SPI_CS_HIGH))
regval |= SIRFSOC_SPI_CS_IDLE_STAT;

View File

@ -615,13 +615,13 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
sg_free_table(sgt);
return -ENOMEM;
}
sg_buf = page_address(vm_page) +
((size_t)buf & ~PAGE_MASK);
sg_set_page(&sgt->sgl[i], vm_page,
min, offset_in_page(buf));
} else {
sg_buf = buf;
sg_set_buf(&sgt->sgl[i], sg_buf, min);
}
sg_set_buf(&sgt->sgl[i], sg_buf, min);
buf += min;
len -= min;