Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3516955imu; Mon, 14 Jan 2019 04:32:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN6So9CPGoQXCFuSMPwdkil/cZGtPqFbLNGGjiha5WauS7p1cRM0yOHnQeF+qTwnwD+AMxuu X-Received: by 2002:a63:c64f:: with SMTP id x15mr22050727pgg.16.1547469145506; Mon, 14 Jan 2019 04:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547469145; cv=none; d=google.com; s=arc-20160816; b=cTEFykyN2jLfd7im7zES85l+z17Iv/vitfcMrJEkfcOaf6HFAsZiPYet09ByBb/8Y5 1ySO+ir+m2+mYxlswfv1jvIwzYrFG7S37s13ZQGGj7sV6VXuzmS2Abm1qofBVKGN2tjp 6lPI195+PAP3ccx2J6MH87fIPSmsQUmSUaACc1+qYVPglSPmfTpdBMAkMRIemad4Cj4c K4bILzfKH2cb/tKMmysdUjOsKGwBWrELFhE9eTwSmqx9VPMcpmFu46yRp++Hfv2IH+pH FAN9d13sDazPtwJH+dEvrkv7H5ucxRmU2yGa7BNzHTCFy7T7tqTO5SdEqnob8enlz/J9 vApQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=B5M1RkbYcNfdAqBJ39XZ0mzGeHgee+CTjA0fkUkwqdI=; b=XlDXW4AFUZ6l4ToOBpDl6OxZoCVB2/0LXmiFZPFPDPgHY/d3bRsHT2ceUfpWiIXYzF NkNDYvBBrf/KGHcEk27Ra02HBgm4L1r16BpGoKKz8cmL+zbY8HzK+1giyXpYnYQF0FO8 KCyica+7vPCJJA5u66Zr2c7arOCKxXgNwjG/XHZO++mB8nYaQv8TsWapnozth6Oic2gS QTDqh1hHk7LfFevq6kFImDT/r4PQCMj1LYJwfcbfsFuoTmua/8Vm8Ek489GZ8g5AMvm+ uZjvYfkzAlliJQyynNML81xIyj1ltQU8MFl8lYBa4by+typ/SfZRxZxTbjsQrNRnbBPW cJMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=t8M6sXsL; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y189si270189pfg.75.2019.01.14.04.32.09; Mon, 14 Jan 2019 04:32:25 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=t8M6sXsL; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726615AbfANMaN (ORCPT + 99 others); Mon, 14 Jan 2019 07:30:13 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:59224 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfANMaM (ORCPT ); Mon, 14 Jan 2019 07:30:12 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0ECTJQW024875; Mon, 14 Jan 2019 06:29:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547468959; bh=B5M1RkbYcNfdAqBJ39XZ0mzGeHgee+CTjA0fkUkwqdI=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=t8M6sXsLmb0Tp9Ql3oKl0M9IFvDfWwwmxVTQAugs9QWZCRzSfMUfii1ZJgwWmyEM6 1k0gsKexOXuJNY78+qPqsjtSVD3zI6NsyUunpiYdJXu4ikzUY1VdoVqLPFCfpKd3Ic 1pnagWV3fweZJYA7GGXm2cy1kqUVhfGuC19JlVGU= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0ECTI6L089171 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 06:29:18 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 14 Jan 2019 06:29:18 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 14 Jan 2019 06:29:18 -0600 Received: from [172.24.190.89] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0ECTFPf025146; Mon, 14 Jan 2019 06:29:17 -0600 Subject: Re: [PATCH] Revert "spi: omap2-mcspi: Set FIFO DMA trigger level to word length" To: David Lechner , "linux-spi@vger.kernel.org" CC: Mark Brown , "linux-kernel@vger.kernel.org" , "linux-omap@vger.kernel.org" References: <20190113204905.29795-1-david@lechnology.com> From: Vignesh R Message-ID: <829bdc72-cf96-6aee-28d8-a47d0430710d@ti.com> Date: Mon, 14 Jan 2019 18:00:06 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190113204905.29795-1-david@lechnology.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/01/19 2:19 AM, David Lechner wrote: > 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. > Oops, that's unfortunate. I see ili9225 is using bits_per_word = 16. I believe commit b682cffa3ac6d9d broke spi_transfers where bits_per_word anything other than 8 bits. I don't have ili9225 HW but was able emulate this condition using a SPI flash as slave on AM335x and successfully reproduced the issue. Could you test if this diff[1] helps in fixing the regression without needing to revert commit b682cffa3ac6d9d? If below diff does not help, then could you post logs of types of spi_transfers being queued by ili9225 driver? I guess you can dump them by enabling DEBUG option in tinydrm-helpers.c. Also which TI SoC are you using? Sorry for the trouble! [1]: Adjust maxburst size of DMA xfer according to the DMA trigger level and word length instead of just word length diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 2fd8881fcd65..6b7edcff0e6b 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -623,8 +623,8 @@ omap2_mcspi_txrx_dma(struct spi_device *spi, struct spi_transfer *xfer) 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 = width / es; + cfg.dst_maxburst = width / es; rx = xfer->rx_buf; tx = xfer->tx_buf; -- Regards Vignesh > 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; >