From patchwork Mon Nov 17 15:17:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 5322401 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B9D549F1E1 for ; Mon, 17 Nov 2014 15:17:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F39C92010F for ; Mon, 17 Nov 2014 15:17:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C73C20120 for ; Mon, 17 Nov 2014 15:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752804AbaKQPRU (ORCPT ); Mon, 17 Nov 2014 10:17:20 -0500 Received: from mail-pd0-f172.google.com ([209.85.192.172]:41789 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752419AbaKQPRU (ORCPT ); Mon, 17 Nov 2014 10:17:20 -0500 Received: by mail-pd0-f172.google.com with SMTP id r10so21349628pdi.17 for ; Mon, 17 Nov 2014 07:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=vkF7lpNkAChWrFKRtvI+jU/EjSKak/wlTD7c8w8KhMU=; b=LGgbCmeAAGyxoB0388LVCwb3usQlJ03/vfMYS9EqdRpWFqyBS/e/Zn4ZLCrAIYSOX8 whe6tPpi+gY5/1lbXKeROPCozxf/SzdVeKu2tF9Vxm6gHMdC2vmSkxbgzRQLQHO+C4Tf ewRJ9njYR+8bfo0rZT+8v4Y7UdT7YH/DojoLEn+peTH7PSnqSj0eNlO0nvUJPWy/i2OQ FShoH4Bzi1QWJn0NMJMRrRJoEz88YTICxidOkmaie0m7ZvXvMJn42kKyMmhfoJT3kd48 7cO1/rJaJwbjwS01t2FIcbWe9EcjEzQpYJ2E9zrzHHnCokp9e4gmv3+WW+vh0ihhF2yT DujQ== X-Received: by 10.66.218.42 with SMTP id pd10mr2303024pac.151.1416237439682; Mon, 17 Nov 2014 07:17:19 -0800 (PST) Received: from localhost.localdomain ([140.207.223.187]) by mx.google.com with ESMTPSA id xd3sm5778407pbc.54.2014.11.17.07.17.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Nov 2014 07:17:19 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: workgroup.linux@csr.com, Qipan Li , Barry Song Subject: [PATCH 1/2] spi: sirf: fix word width configuration Date: Mon, 17 Nov 2014 23:17:02 +0800 Message-Id: <1416237423-3606-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, 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 From: Qipan Li commit 8c328a262f ("spi: sirf: Avoid duplicate code in various bits_per_word cases") is wrong in setting data width register of fifo is not right, it should use sspi->word_width >> 1 to set related bits. According to hardware spec, the mapping between register value and data width: 0 - byte 1 - WORD 2 - DWORD Signed-off-by: Qipan Li Signed-off-by: Barry Song --- drivers/spi/spi-sirf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 39e2c0a..f63de78 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -562,9 +562,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) sspi->word_width = DIV_ROUND_UP(bits_per_word, 8); txfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | - sspi->word_width; + (sspi->word_width >> 1); rxfifo_ctrl = SIRFSOC_SPI_FIFO_THD(SIRFSOC_SPI_FIFO_SIZE / 2) | - sspi->word_width; + (sspi->word_width >> 1); if (!(spi->mode & SPI_CS_HIGH)) regval |= SIRFSOC_SPI_CS_IDLE_STAT;