Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2900862imu; Sun, 13 Jan 2019 12:52:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN6IVACXaJmdOSEkZEriNMvQLd5Y6u1MZ8qf3t/P3WT1BNO1ySlHMNh4BgyD6mBOZ/zHihkn X-Received: by 2002:a62:8893:: with SMTP id l141mr22582307pfd.1.1547412750925; Sun, 13 Jan 2019 12:52:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547412750; cv=none; d=google.com; s=arc-20160816; b=DMIUUdBqkOS6GU3VBS9dYq8hBt5cq08r+XSiJXASrP+U3HLPD0azTETEG45DpU7/sn jN6BI0iXcTb4G4rNpNWrhTvwJVL/O4jfnRTMGquTqJ946nVyKu/LFM7UvHuDWbojiIWp ADJPQVwo0e2vWNFntUOh6zdNkrkG4xCblQIWnfbAiEr9wQqn85i7HScHcK6HgyafVQAV 26TlhWb8APzTcl+K+9Cb5lecmXNbGXYu1ORQp8lQ9gtkWyb/QyIJxs0uGI5drwsTvzRo WjbcP5clnI9z4DtxRtJ54IuWIJY3UBVDe4Fne7nPleqRP+0z60grrTqTYZVU5mm8n2+9 skjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=2inpnJwKeTLPPL+VWYfwtbuBFTig9TqMnU7NbVqj5Xs=; b=1G3Il6USpvWw51b+e7TCW9weAkgj3P4QZ07zQW2JDPcepnL+yMeoFC6CLQkCRJ+voH fMQVo9BzumGXaLvck6HSniTBoFthH6uEa/M3fGx6hYP1jZHj0iGQ7BgC2TCup9ik4JvN JQ5ZKiAJ9lOSGR+wnLiuGPHUUDzVdt8c7rn8VaRqtBuaqeIFhyZ/tcm0Ne4IjTKrtug1 IYAf8/vGnsFLJdHzKHNMWCi6jmt2bzvAk+5/sCzwF372vdFL3mQYBTdLvG9Tdkw74pF4 I8l7RyWQdMWbWbdv0HyuG1LRsRB/zqMJ9Aos9UucKO+C6WH4nwcwc/HwXjcYtFHkv5Q0 h55w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=R0KaZCtY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s73si37394795pfs.54.2019.01.13.12.51.53; Sun, 13 Jan 2019 12:52:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=R0KaZCtY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726609AbfAMUtc (ORCPT + 99 others); Sun, 13 Jan 2019 15:49:32 -0500 Received: from vern.gendns.com ([98.142.107.122]:32988 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726522AbfAMUtc (ORCPT ); Sun, 13 Jan 2019 15:49:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2inpnJwKeTLPPL+VWYfwtbuBFTig9TqMnU7NbVqj5Xs=; b=R0KaZCtYSZzH/zcPEpxOiK2W7W 0wTHoNmYAL2Sq6p4H8xsbK/HY6KUU9kwdzND/spHVNEd4krtHJXpY2kb+QXv55uCWJgfPUlY0vQIw Dkc07BGPBOTP0ylZYILMSm5ZE2ulUdZlpl+AHc/U3bVj8/UOCjgm07mn/5la0QLhzc48sqPqlxaJd oP3UK2BeGi8AVxRKt450RMxiSmz8Wek1OQFnHBvqD1EBUQDr3LPqHLOrXngm91uE5L26sIUSpwo4I ya7hlIBgFRvLnvwPDX1HtM6qa+MnQilXtQxSy2TBUcrGmla+yuHl5zuOBlxl3+ahNt5hn4SgvmILO HcwrplsQ==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:52892 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gimec-0000Nf-Qk; Sun, 13 Jan 2019 15:46:46 -0500 From: David Lechner To: linux-spi@vger.kernel.org Cc: David Lechner , Mark Brown , linux-kernel@vger.kernel.org, Vignesh R Subject: [PATCH] Revert "spi: omap2-mcspi: Set FIFO DMA trigger level to word length" Date: Sun, 13 Jan 2019 14:49:05 -0600 Message-Id: <20190113204905.29795-1-david@lechnology.com> X-Mailer: git-send-email 2.17.1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit b682cffa3ac6d9d9e16e9b413c45caee3b391fab. That commit breaks displays using tinydrm drivers, such as ili9225. It causes corruption in the image that is displayed (it looks like only 1/2 of the framebuffer data is sent, the other half of the display remains blank.) The following error appears multiple times: ili9225 spi1.0: EOW timed out Eventually, the system locks up without any additional errors. Cc: Vignesh R Signed-off-by: David Lechner --- drivers/spi/spi-omap2-mcspi.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 2fd8881fcd65..5a3854ff2e08 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -306,7 +306,7 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, struct omap2_mcspi_cs *cs = spi->controller_state; struct omap2_mcspi *mcspi; unsigned int wcnt; - int max_fifo_depth, bytes_per_word; + int max_fifo_depth, fifo_depth, bytes_per_word; u32 chconf, xferlevel; mcspi = spi_master_get_devdata(master); @@ -322,6 +322,10 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, else max_fifo_depth = OMAP2_MCSPI_MAX_FIFODEPTH; + fifo_depth = gcd(t->len, max_fifo_depth); + if (fifo_depth < 2 || fifo_depth % bytes_per_word != 0) + goto disable_fifo; + wcnt = t->len / bytes_per_word; if (wcnt > OMAP2_MCSPI_MAX_FIFOWCNT) goto disable_fifo; @@ -329,17 +333,16 @@ static void omap2_mcspi_set_fifo(const struct spi_device *spi, xferlevel = wcnt << 16; if (t->rx_buf != NULL) { chconf |= OMAP2_MCSPI_CHCONF_FFER; - xferlevel |= (bytes_per_word - 1) << 8; + xferlevel |= (fifo_depth - 1) << 8; } - if (t->tx_buf != NULL) { chconf |= OMAP2_MCSPI_CHCONF_FFET; - xferlevel |= bytes_per_word - 1; + xferlevel |= fifo_depth - 1; } mcspi_write_reg(master, OMAP2_MCSPI_XFERLEVEL, xferlevel); mcspi_write_chconf0(spi, chconf); - mcspi->fifo_depth = max_fifo_depth; + mcspi->fifo_depth = fifo_depth; return; } @@ -598,6 +601,7 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) struct dma_slave_config cfg; enum dma_slave_buswidth width; unsigned es; + u32 burst; void __iomem *chstat_reg; void __iomem *irqstat_reg; int wait_res; @@ -617,14 +621,22 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) } count = xfer->len; + burst = 1; + + if (mcspi->fifo_depth > 0) { + if (count > mcspi->fifo_depth) + burst = mcspi->fifo_depth / es; + else + burst = count / es; + } memset(&cfg, 0, sizeof(cfg)); cfg.src_addr = cs->phys + OMAP2_MCSPI_RX0; cfg.dst_addr = cs->phys + OMAP2_MCSPI_TX0; cfg.src_addr_width = width; cfg.dst_addr_width = width; - cfg.src_maxburst = es; - cfg.dst_maxburst = es; + cfg.src_maxburst = burst; + cfg.dst_maxburst = burst; rx = xfer->rx_buf; tx = xfer->tx_buf; -- 2.17.1