Received: by 10.213.65.68 with SMTP id h4csp1796438imn; Mon, 19 Mar 2018 13:30:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELsdLPOMtnxJyKoGC81kwrMUBXEBIw6Zg3l4nC+l9do+o36AktSZYygrSng2+6EreHmsqo/j X-Received: by 10.101.97.139 with SMTP id c11mr10237261pgv.431.1521491449504; Mon, 19 Mar 2018 13:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521491449; cv=none; d=google.com; s=arc-20160816; b=wP4RPa0kKNzR5uqT6QcoXKlcQIbvl/tKJuEQCty9cN9xcUO6Y/ak+KCrr/S0ubabtf U1ncuTnW88Yks8vnEEB1cz+mrSkNpgBOHdwjKU//shfMPsAINlNuX8iRBxz5n2gUhh7x NvrrtA4B+AVIW4GJRj/xUPSZt3hpI4JnnN4/o4kXurw4eSohZNFlSl+cGfCVGTdVA+lv HMvEfKwM21KrzOYg56ipO5oyVj9qGC0ziEUzyABskJbtqB/vaGLsuu47/fjsox8Fj1sd jyF2kEgVMGjrX24F4vF2KGeVnAnRDDPKujPt2AcomZdn8ISjrUDgiVhmEaMBN6n1Jl6E UhHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+mpfmKiZnEzGBa1COo2hLy+dofB2VonWrqAU68N/6aA=; b=UZz3bRPmNM5gQmDNwy21pSde5kpUef+L/7Fn+b/VrhItCmUU9pc/O/nqosKN2UiR8r TJHc+CKIlDA87AnZWqEoFEI281afNE5Ys1AAZhbmD8pLUCXiQsF7O3b5loQDi0AZ+PYX mTJKPn+BPZPa2YGjFN3OlYP3GVHyUzIxnGwevJ9gVyfqnbnhycbKc4hFvFYMikSJtCfI 89cJcRYlIZHOcQuZqW2AkI/Atn5ZunV2TkQxYXBRMe1tiwOQR4qRcgEWW0fprMPqijqs FWRG1/qLMt5cjPZ1yshaJI3RBrG2XG6dqVVx4w0BUJSfM+z3I2htxNMuZXLTKaIuyPcb H7GQ== ARC-Authentication-Results: i=1; mx.google.com; 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 97-v6si35317plb.23.2018.03.19.13.30.35; Mon, 19 Mar 2018 13:30:49 -0700 (PDT) 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; 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 S971228AbeCSU2y (ORCPT + 99 others); Mon, 19 Mar 2018 16:28:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43036 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030530AbeCSSNN (ORCPT ); Mon, 19 Mar 2018 14:13:13 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id EE4D711D6; Mon, 19 Mar 2018 18:13:12 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Akinobu Mita , Sasha Levin Subject: [PATCH 4.4 032/134] spi: omap2-mcspi: poll OMAP2_MCSPI_CHSTAT_RXS for PIO transfer Date: Mon, 19 Mar 2018 19:05:15 +0100 Message-Id: <20180319171853.917407502@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Akinobu Mita [ Upstream commit 812613591cb652344186c4cd912304ed02138566 ] When running the spi-loopback-test with slower clock rate like 10 KHz, the test for 251 bytes transfer was failed. This failure triggered an spi-omap2-mcspi's error message "DMA RX last word empty". This message means that PIO for reading the remaining bytes due to the DMA transfer length reduction is failed. This problem can be fixed by polling OMAP2_MCSPI_CHSTAT_RXS bit in channel status register to wait until the receive buffer register is filled. Cc: Mark Brown Signed-off-by: Akinobu Mita Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-omap2-mcspi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -457,6 +457,8 @@ omap2_mcspi_rx_dma(struct spi_device *sp int elements = 0; int word_len, element_count; struct omap2_mcspi_cs *cs = spi->controller_state; + void __iomem *chstat_reg = cs->base + OMAP2_MCSPI_CHSTAT0; + mcspi = spi_master_get_devdata(spi->master); mcspi_dma = &mcspi->dma_channels[spi->chip_select]; count = xfer->len; @@ -517,8 +519,8 @@ omap2_mcspi_rx_dma(struct spi_device *sp if (l & OMAP2_MCSPI_CHCONF_TURBO) { elements--; - if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0) - & OMAP2_MCSPI_CHSTAT_RXS)) { + if (!mcspi_wait_for_reg_bit(chstat_reg, + OMAP2_MCSPI_CHSTAT_RXS)) { u32 w; w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); @@ -536,8 +538,7 @@ omap2_mcspi_rx_dma(struct spi_device *sp return count; } } - if (likely(mcspi_read_cs_reg(spi, OMAP2_MCSPI_CHSTAT0) - & OMAP2_MCSPI_CHSTAT_RXS)) { + if (!mcspi_wait_for_reg_bit(chstat_reg, OMAP2_MCSPI_CHSTAT_RXS)) { u32 w; w = mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0);