All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-arm-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	<stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 1/3] spi: bitbang: fix shift for getmosi
Date: Wed, 12 Mar 2014 16:20:34 +0100	[thread overview]
Message-ID: <1394637636-29042-2-git-send-email-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <1394637636-29042-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Signed-off-by: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 15:20 [PATCH 0/3] spi: bitbang fixes and passive serial driver Michael Grzeschik
     [not found] ` <1394637636-29042-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 15:20   ` Michael Grzeschik [this message]
     [not found]     ` <1394637636-29042-2-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 21:23       ` [PATCH 1/3] spi: bitbang: fix shift for getmosi Gerhard Sittig
2014-03-12 21:37         ` Mark Brown
2014-03-12 15:20   ` [PATCH 2/3] spi: bitbang: add lsb first support Michael Grzeschik
     [not found]     ` <1394637636-29042-3-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-03-12 21:29       ` Gerhard Sittig
     [not found]         ` <20140312212941.GP3327-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org>
2014-03-12 21:35           ` Mark Brown
     [not found]             ` <20140312213544.GX28112-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-03-13 18:11               ` Gerhard Sittig
     [not found]                 ` <20140313181107.GT3327-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org>
2014-03-13 18:41                   ` Mark Brown
2014-03-13 19:22                   ` Geert Uytterhoeven
2014-03-12 15:20   ` [PATCH 3/3] spi: psdev: add passive serial driver Michael Grzeschik
2014-03-12 15:42   ` [PATCH 0/3] spi: bitbang fixes and " Michael Grzeschik
2014-03-12 15:53 Michael Grzeschik
2014-03-12 15:53 ` [PATCH 1/3] spi: bitbang: fix shift for getmosi Michael Grzeschik
2014-03-12 15:53   ` 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

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=1394637636-29042-2-git-send-email-m.grzeschik@pengutronix.de \
    --to=m.grzeschik-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=linux-arm-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --subject='Re: [PATCH 1/3] spi: bitbang: fix shift for getmosi' \
    /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

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.