From patchwork Thu Feb 27 01:05:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3729801 X-Patchwork-Delegate: broonie@sirena.org.uk 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 919D7BF13A for ; Thu, 27 Feb 2014 01:05:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FC8520218 for ; Thu, 27 Feb 2014 01:05:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3385201EF for ; Thu, 27 Feb 2014 01:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752908AbaB0BFJ (ORCPT ); Wed, 26 Feb 2014 20:05:09 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:42265 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752466AbaB0BFI (ORCPT ); Wed, 26 Feb 2014 20:05:08 -0500 Received: by mail-pb0-f48.google.com with SMTP id md12so1770108pbc.7 for ; Wed, 26 Feb 2014 17:05:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=g9U3vjMaj65S4YwxZ9pLaL+m/WjJ4/9kF4P+OlTTSLE=; b=HZB0PaBpzKzBerwSJYU5VMPt1pjcDyMm0vyasfj3zwH28JTJ39bfMevMkbcCtqaqVB 8ewuYH0H6DgDUVE3XPWSFHp7yA/7NyFCI3wcjCicVaIZocw+KirfGbqj67mgG6TW/usK 5kaafJ8tzFFcU33QJlhINPeJPhwtkH7CXTIZeGw0Y0a9HAcKi8Mkby001qQVv4/2hvj2 n1vIpHydNOGofZoh3LgfU9qOCq9sLWx162IkUW6Yffe6M7aU7uSY59ZtqrtUZuUXEnez vx2+l1Hy7gZJgmKyNbOddaHaAlnLOg5B2XB6vymSQ8Gds2nTiNfQwbrglseHYqQQuMKh Rnkg== X-Gm-Message-State: ALoCoQmlVj3SBA+nUo3rANaQrL/hs5PXkP3Zxtk4//dl3nZ7pOWFZGzG/m6P5LOGHNPorXhI7vaD X-Received: by 10.68.108.1 with SMTP id hg1mr10205521pbb.80.1393463107529; Wed, 26 Feb 2014 17:05:07 -0800 (PST) Received: from [192.168.0.102] (218-164-131-56.dynamic.hinet.net. [218.164.131.56]) by mx.google.com with ESMTPSA id it4sm7527389pbc.39.2014.02.26.17.05.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 17:05:06 -0800 (PST) Message-ID: <1393463102.12945.3.camel@phoenix> Subject: [PATCH] spi: coldfire-qspi: Fix bits per word setting when t->bits_per_word is not set From: Axel Lin To: Mark Brown Cc: Stephen Warren , Steven King , linux-spi@vger.kernel.org Date: Thu, 27 Feb 2014 09:05:02 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 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, 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 This ensures to use spi_device's bits_per_word setting when t->bits_per_word is not set. This looks like a bug introduced by commit 24778be20f8 "spi: convert drivers to use bits_per_word_mask". Signed-off-by: Axel Lin --- drivers/spi/spi-coldfire-qspi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c index c29bbb0..8c85bea 100644 --- a/drivers/spi/spi-coldfire-qspi.c +++ b/drivers/spi/spi-coldfire-qspi.c @@ -315,12 +315,16 @@ static int mcfqspi_transfer_one(struct spi_master *master, { struct mcfqspi *mcfqspi = spi_master_get_devdata(master); u16 qmr = MCFQSPI_QMR_MSTR; + u8 bpw; - qmr |= t->bits_per_word << 10; + bpw = t->bits_per_word ? : spi->bits_per_word; + + qmr |= bpw << 10; if (spi->mode & SPI_CPHA) qmr |= MCFQSPI_QMR_CPHA; if (spi->mode & SPI_CPOL) qmr |= MCFQSPI_QMR_CPOL; + if (t->speed_hz) qmr |= mcfqspi_qmr_baud(t->speed_hz); else @@ -328,7 +332,7 @@ static int mcfqspi_transfer_one(struct spi_master *master, mcfqspi_wr_qmr(mcfqspi, qmr); mcfqspi_wr_qir(mcfqspi, MCFQSPI_QIR_SPIFE); - if (t->bits_per_word == 8) + if (bpw == 8) mcfqspi_transfer_msg8(mcfqspi, t->len, t->tx_buf, t->rx_buf); else mcfqspi_transfer_msg16(mcfqspi, t->len / 2, t->tx_buf,