Commit 190fc9d9686283465bfa45e7a25cff0e05cc99e4
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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.
Showing 3 changed files Side-by-side Diff
drivers/spi/spi-dw.c
... | ... | @@ -376,9 +376,6 @@ |
376 | 376 | chip = dws->cur_chip; |
377 | 377 | spi = message->spi; |
378 | 378 | |
379 | - if (unlikely(!chip->clk_div)) | |
380 | - chip->clk_div = dws->max_freq / chip->speed_hz; | |
381 | - | |
382 | 379 | if (message->state == ERROR_STATE) { |
383 | 380 | message->status = -EIO; |
384 | 381 | goto early_exit; |
... | ... | @@ -419,7 +416,7 @@ |
419 | 416 | if (transfer->speed_hz) { |
420 | 417 | speed = chip->speed_hz; |
421 | 418 | |
422 | - if (transfer->speed_hz != speed) { | |
419 | + if ((transfer->speed_hz != speed) || (!chip->clk_div)) { | |
423 | 420 | speed = transfer->speed_hz; |
424 | 421 | |
425 | 422 | /* clk_div doesn't support odd number */ |
... | ... | @@ -581,7 +578,6 @@ |
581 | 578 | dev_err(&spi->dev, "No max speed HZ parameter\n"); |
582 | 579 | return -EINVAL; |
583 | 580 | } |
584 | - chip->speed_hz = spi->max_speed_hz; | |
585 | 581 | |
586 | 582 | chip->tmode = 0; /* Tx & Rx */ |
587 | 583 | /* Default SPI mode is SCPOL = 0, SCPH = 0 */ |
drivers/spi/spi-sirf.c
... | ... | @@ -562,9 +562,9 @@ |
562 | 562 | |
563 | 563 | sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); |
564 | 564 | txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
565 | - sspi->word_width; | |
565 | + (sspi->word_width >> 1); | |
566 | 566 | rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | |
567 | - sspi->word_width; | |
567 | + (sspi->word_width >> 1); | |
568 | 568 | |
569 | 569 | if (!(spi->mode & SPI_CS_HIGH)) |
570 | 570 | regval |= SIRFSOC_SPI_CS_IDLE_STAT; |
drivers/spi/spi.c
... | ... | @@ -615,13 +615,13 @@ |
615 | 615 | sg_free_table(sgt); |
616 | 616 | return -ENOMEM; |
617 | 617 | } |
618 | - sg_buf = page_address(vm_page) + | |
619 | - ((size_t)buf & ~PAGE_MASK); | |
618 | + sg_set_page(&sgt->sgl[i], vm_page, | |
619 | + min, offset_in_page(buf)); | |
620 | 620 | } else { |
621 | 621 | sg_buf = buf; |
622 | + sg_set_buf(&sgt->sgl[i], sg_buf, min); | |
622 | 623 | } |
623 | 624 | |
624 | - sg_set_buf(&sgt->sgl[i], sg_buf, min); | |
625 | 625 | |
626 | 626 | buf += min; |
627 | 627 | len -= min; |