From patchwork Wed Mar 12 15:53:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 3818811 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17CABBF540 for ; Wed, 12 Mar 2014 15:54:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 96E7F2017B for ; Wed, 12 Mar 2014 15:54:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C86B920163 for ; Wed, 12 Mar 2014 15:54:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754785AbaCLPyJ (ORCPT ); Wed, 12 Mar 2014 11:54:09 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:46773 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755148AbaCLPyI (ORCPT ); Wed, 12 Mar 2014 11:54:08 -0400 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:a236:9fff:fe00:814]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1WNlTP-0005fw-PV; Wed, 12 Mar 2014 16:53:39 +0100 Received: from mgr by dude.hi.pengutronix.de with local (Exim 4.82) (envelope-from ) id 1WNlTP-0002iF-7L; Wed, 12 Mar 2014 16:53:39 +0100 From: Michael Grzeschik To: linux-spi@vger.kernel.org Cc: broonie@kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de, Subject: [PATCH 1/3] spi: bitbang: fix shift for getmosi Date: Wed, 12 Mar 2014 16:53:35 +0100 Message-Id: <1394639617-26917-2-git-send-email-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1394639617-26917-1-git-send-email-m.grzeschik@pengutronix.de> References: <1394639617-26917-1-git-send-email-m.grzeschik@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:a236:9fff:fe00:814 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-spi@vger.kernel.org Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Signed-off-by: Michael Grzeschik --- 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; }