From patchwork Sun Jun 14 17:25:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Kaneko X-Patchwork-Id: 6605151 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 526619F358 for ; Sun, 14 Jun 2015 17:25:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CE33205E5 for ; Sun, 14 Jun 2015 17:25:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69BC7205E7 for ; Sun, 14 Jun 2015 17:25:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752207AbbFNRZe (ORCPT ); Sun, 14 Jun 2015 13:25:34 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:35842 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751625AbbFNRZd (ORCPT ); Sun, 14 Jun 2015 13:25:33 -0400 Received: by pdjm12 with SMTP id m12so56025801pdj.3; Sun, 14 Jun 2015 10:25:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=98DBegT2znABiTkd0MdEtu+5jfi4xrCGpP+QNrB5Zmc=; b=W7an0M7wpk9VHti/zT7wWI6i+m8o/8NGqdTuHLIb0Q0AXbGhUNKyw3NxHVeq7uhaJB Xd+Ap73cONkmQg+cENrpuN+k4faAVD2aC4R2FO6JpoabSg66v7naXetXAiWWeANkXvSL 3NZx3J8n+hCb1k2UaP/sMyetL+s+BdBmdwvsbfK1KUO3W3Q0lbsrs9jD5HCKJlH2YhIP HXMruQbTmqzGSwrqQqyB6Ng5SuStnPdqzRTrUAcIdnessKVSzjp4XHYhC4vYInv/vtSM Uurd8OYSfVv2jeOafwJR2x2uqd8psw94s8FGFI/FiwHXIOHrUTF0g+M/lT7mvqPQ3LdK HwTA== X-Received: by 10.70.123.104 with SMTP id lz8mr2999723pdb.80.1434302732714; Sun, 14 Jun 2015 10:25:32 -0700 (PDT) Received: from localhost.localdomain (KD118152108246.ppp-bb.dion.ne.jp. [118.152.108.246]) by mx.google.com with ESMTPSA id pu1sm9708257pdb.33.2015.06.14.10.25.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Jun 2015 10:25:32 -0700 (PDT) From: Yoshihiro Kaneko To: linux-spi@vger.kernel.org Cc: Geert Uytterhoeven , Mark Brown , Simon Horman , Magnus Damm , linux-sh@vger.kernel.org Subject: [PATCH/RFC] spi: sh-msiof: Fix FIFO size to 64 word from 256 word Date: Mon, 15 Jun 2015 02:25:05 +0900 Message-Id: <1434302705-31104-1-git-send-email-ykaneko0929@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=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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: Koji Matsuoka The upper limit of Tx/Rx FIFO size is 64 word by the specification of H/W. This patch corrects to 64 word from 256 word. Signed-off-by: Koji Matsuoka Signed-off-by: Yoshihiro Kaneko --- This patch is based on the for-next branch of Mark Brown's spi tree. drivers/spi/spi-sh-msiof.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index d3370a6..a7629f8 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -48,8 +48,8 @@ struct sh_msiof_spi_priv { const struct sh_msiof_chipdata *chipdata; struct sh_msiof_spi_info *info; struct completion done; - int tx_fifo_size; - int rx_fifo_size; + unsigned int tx_fifo_size; + unsigned int rx_fifo_size; void *tx_dma_page; void *rx_dma_page; dma_addr_t tx_dma_addr; @@ -95,8 +95,6 @@ struct sh_msiof_spi_priv { #define MDR2_WDLEN1(i) (((i) - 1) << 16) /* Word Count (1-64/256 (SH, A1))) */ #define MDR2_GRPMASK1 0x00000001 /* Group Output Mask 1 (SH, A1) */ -#define MAX_WDLEN 256U - /* TSCR and RSCR */ #define SCR_BRPS_MASK 0x1f00 /* Prescaler Setting (1-32) */ #define SCR_BRPS(i) (((i) - 1) << 8) @@ -850,7 +848,12 @@ static int sh_msiof_transfer_one(struct spi_master *master, * DMA supports 32-bit words only, hence pack 8-bit and 16-bit * words, with byte resp. word swapping. */ - unsigned int l = min(len, MAX_WDLEN * 4); + unsigned int l = 0; + + if (tx_buf) + l = min(len, p->tx_fifo_size * 4); + if (rx_buf) + l = min(len, p->rx_fifo_size * 4); if (bits <= 8) { if (l & 3) @@ -963,7 +966,7 @@ static const struct sh_msiof_chipdata sh_data = { static const struct sh_msiof_chipdata r8a779x_data = { .tx_fifo_size = 64, - .rx_fifo_size = 256, + .rx_fifo_size = 64, .master_flags = SPI_MASTER_MUST_TX, };