lkml.org 
[lkml]   [2015]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.2 052/120] spi: Fix regression in spi-bitbang-txrx.h
    Date
    4.2-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Lars Persson <lars.persson@axis.com>

    commit 26a67ec47a4c58fe79c6421c3dc3d697d322d2d6 upstream.

    This patch fixes a regression introduced by commit 232a5adc5199 ("spi:
    bitbang: only toggle bitchanges"). The attempt to optimize writes of
    consecutive bit patterns broke most of the combinations of word size
    and SPI modes due to selecting the wrong bit as the MSB value.

    Fixes: 232a5adc5199 (spi: bitbang: only toggle bitchanges)
    Signed-off-by: Lars Persson <larper@axis.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/spi/spi-bitbang-txrx.h | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    --- a/drivers/spi/spi-bitbang-txrx.h
    +++ b/drivers/spi/spi-bitbang-txrx.h
    @@ -49,7 +49,7 @@ bitbang_txrx_be_cpha0(struct spi_device
    {
    /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */

    - bool oldbit = !(word & 1);
    + u32 oldbit = (!(word & (1<<(bits-1)))) << 31;
    /* clock starts at inactive polarity */
    for (word <<= (32 - bits); likely(bits); bits--) {

    @@ -81,7 +81,7 @@ bitbang_txrx_be_cpha1(struct spi_device
    {
    /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */

    - bool oldbit = !(word & (1 << 31));
    + u32 oldbit = (!(word & (1<<(bits-1)))) << 31;
    /* clock starts at inactive polarity */
    for (word <<= (32 - bits); likely(bits); bits--) {




    \
     
     \ /
      Last update: 2015-09-19 20:01    [W:4.286 / U:0.940 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site