All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: linux-spi@vger.kernel.org
Cc: broonie@kernel.org, linux-arm-kernel@lists.infradead.org,
	kernel@pengutronix.de, <stable@vger.kernel.org>
Subject: [PATCH 1/3] spi: bitbang: fix shift for getmosi
Date: Wed, 12 Mar 2014 16:53:35 +0100	[thread overview]
Message-ID: <1394639617-26917-2-git-send-email-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <1394639617-26917-1-git-send-email-m.grzeschik@pengutronix.de>

The driver needs to shift the word bit after reading the mosi bit.
Otherwise the return word will have an Off-by-one bit value.

Cc: <stable@vger.kernel.org>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/spi/spi-bitbang-txrx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-bitbang-txrx.h b/drivers/spi/spi-bitbang-txrx.h
index c616e41..b6e348d 100644
--- a/drivers/spi/spi-bitbang-txrx.h
+++ b/drivers/spi/spi-bitbang-txrx.h
@@ -61,10 +61,10 @@ bitbang_txrx_be_cpha0(struct spi_device *spi,
 		spidelay(nsecs);
 
 		/* sample MSB (from slave) on leading edge */
-		word <<= 1;
 		if ((flags & SPI_MASTER_NO_RX) == 0)
 			word |= getmiso(spi);
 		setsck(spi, cpol);
+		word <<= 1;
 	}
 	return word;
 }
@@ -89,9 +89,9 @@ bitbang_txrx_be_cpha1(struct spi_device *spi,
 		spidelay(nsecs);
 
 		/* sample MSB (from slave) on trailing edge */
-		word <<= 1;
 		if ((flags & SPI_MASTER_NO_RX) == 0)
 			word |= getmiso(spi);
+		word <<= 1;
 	}
 	return word;
 }
-- 
1.9.0

WARNING: multiple messages have this Message-ID (diff)
From: m.grzeschik@pengutronix.de (Michael Grzeschik)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] spi: bitbang: fix shift for getmosi
Date: Wed, 12 Mar 2014 16:53:35 +0100	[thread overview]
Message-ID: <1394639617-26917-2-git-send-email-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <1394639617-26917-1-git-send-email-m.grzeschik@pengutronix.de>

The driver needs to shift the word bit after reading the mosi bit.
Otherwise the return word will have an Off-by-one bit value.

Cc: <stable@vger.kernel.org>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/spi/spi-bitbang-txrx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-bitbang-txrx.h b/drivers/spi/spi-bitbang-txrx.h
index c616e41..b6e348d 100644
--- a/drivers/spi/spi-bitbang-txrx.h
+++ b/drivers/spi/spi-bitbang-txrx.h
@@ -61,10 +61,10 @@ bitbang_txrx_be_cpha0(struct spi_device *spi,
 		spidelay(nsecs);
 
 		/* sample MSB (from slave) on leading edge */
-		word <<= 1;
 		if ((flags & SPI_MASTER_NO_RX) == 0)
 			word |= getmiso(spi);
 		setsck(spi, cpol);
+		word <<= 1;
 	}
 	return word;
 }
@@ -89,9 +89,9 @@ bitbang_txrx_be_cpha1(struct spi_device *spi,
 		spidelay(nsecs);
 
 		/* sample MSB (from slave) on trailing edge */
-		word <<= 1;
 		if ((flags & SPI_MASTER_NO_RX) == 0)
 			word |= getmiso(spi);
+		word <<= 1;
 	}
 	return word;
 }
-- 
1.9.0

  reply	other threads:[~2014-03-12 15:53 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 15:53 [PATCH 0/3] spi: bitbang fixes and passive serial driver Michael Grzeschik
2014-03-12 15:53 ` Michael Grzeschik
2014-03-12 15:53 ` Michael Grzeschik [this message]
2014-03-12 15:53   ` [PATCH 1/3] spi: bitbang: fix shift for getmosi Michael Grzeschik
2014-03-12 16:24   ` Mark Brown
2014-03-12 16:24     ` Mark Brown
     [not found]     ` <20140312162418.GU28112-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-12 21:45       ` Gerhard Sittig
2014-03-12 21:45         ` Gerhard Sittig
     [not found] ` <1394639617-26917-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 15:53   ` [PATCH 2/3] spi: bitbang: add lsb first support Michael Grzeschik
2014-03-12 15:53     ` Michael Grzeschik
2014-03-12 15:53   ` [PATCH 3/3] spi: psdev: add passive serial driver Michael Grzeschik
2014-03-12 15:53     ` Michael Grzeschik
2014-03-13 17:14     ` Mark Rutland
2014-03-13 17:14       ` Mark Rutland
     [not found]     ` <1394639617-26917-4-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 16:34       ` Mark Brown
2014-03-12 16:34         ` Mark Brown
     [not found]         ` <20140312163427.GV28112-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-14 10:19           ` Michael Grzeschik
2014-03-14 10:19             ` Michael Grzeschik
     [not found]             ` <20140314101907.GF4234-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-14 10:22               ` Mark Brown
2014-03-14 10:22                 ` Mark Brown
     [not found]                 ` <20140314102223.GR366-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-14 13:59                   ` Linus Walleij
2014-03-14 13:59                     ` Linus Walleij
     [not found]                     ` <CACRpkdZoO_hXw-p5ZHeUzMHULq_DEJNzpim0mcO5DBOgP=d60A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-03-14 18:11                       ` Michael Grzeschik
2014-03-14 18:11                         ` Michael Grzeschik
2014-03-12 17:54       ` Alexander Shiyan
2014-03-12 17:54         ` Alexander Shiyan
2014-03-14  8:06       ` Lothar Waßmann
2014-03-14  8:06         ` Lothar Waßmann
  -- strict thread matches above, loose matches on Subject: below --
2014-03-12 15:20 [PATCH 0/3] spi: bitbang fixes and " Michael Grzeschik
     [not found] ` <1394637636-29042-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 15:20   ` [PATCH 1/3] spi: bitbang: fix shift for getmosi Michael Grzeschik
     [not found]     ` <1394637636-29042-2-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 21:23       ` Gerhard Sittig
2014-03-12 21:37         ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394639617-26917-2-git-send-email-m.grzeschik@pengutronix.de \
    --to=m.grzeschik@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.