Received: by 10.192.165.148 with SMTP id m20csp525753imm; Wed, 25 Apr 2018 03:40:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+yI6islDmfWx9mcz3L6pIumURzYg45xniffkXCHGCHR7tLmyckGKA5LtZddVqRIxzdsb7T X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr27931403pld.103.1524652833886; Wed, 25 Apr 2018 03:40:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524652833; cv=none; d=google.com; s=arc-20160816; b=OqjM/szkeXhNRJigPR0sGSD1Qz9kuh79VAWo26SD9ehegzbs3tcpjIO8vH8l8Wgmx8 FJUQ1ZE/V1Mtyg3DHFTgonCXitXxJm0dzUdCpCkAbkXX23o1jG2pmllqHsgjrVtuoUpM kJSRqFBYtgrZZSNKll6CaQncUQIwQHI/UnVG1SdmDUQ1WN5noymcQPJUxlIacf1BEPFU cjECWI2GDEF9fZosew4hlpRFtBm+SIQI/w4igqXbHpHXIQp/O0xQNItAQLajPd4+CT4o MD1mx8gUkySyPMmFZkZytxSN7VWP/RmYxLMQtbpZFif79ShvOhiq1+U3Kga7PSuwXmEu yf2A== 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=rivMztVSLgNu7oXCWS6SjQ7OIyuZZ5oA0UnUwkG/8bY=; b=PQ8A2e+UsaBHtcn/U/vh8uZNdag+2saiL3OFoVkgU7k3n+CssX51Z6FgZvYPXzpM3s iObqxWePm6QHBWF6E+SCMXuKrYPp0IeOFPaJyK6jvWOns0ukzg1McycuxpgIjuHVS9gW 2QO/SoJNwH9w10HTSph2xkj7zjnt0hcRXC+l5kBrVNzNaRiSrhtQbZugewCLr855y1Kg IkbImPRi/pmcxcosWPLoKDwQTcQGb8Ymg+ZtTycWXthm0A7kxj2kf+2UugMjQaXuL6eJ I5vSF7znJDUh/+nQQjfamZlHV2Mj247zpPmvo0y7sA/Q0zQ4oeOsvrngrrRgWGLcvBFj O4VQ== 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 s65si3953945pgc.269.2018.04.25.03.40.19; Wed, 25 Apr 2018 03:40:33 -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 S1753547AbeDYKjH (ORCPT + 99 others); Wed, 25 Apr 2018 06:39:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51748 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752806AbeDYKjC (ORCPT ); Wed, 25 Apr 2018 06:39:02 -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 36EEE36; Wed, 25 Apr 2018 10:39:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Chevallier , Mark Brown , Sasha Levin Subject: [PATCH 4.14 052/183] spi: a3700: Clear DATA_OUT when performing a read Date: Wed, 25 Apr 2018 12:34:32 +0200 Message-Id: <20180425103244.645304344@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maxime Chevallier [ Upstream commit 44a5f423e70374e5b42cecd85e78f2d79334e0f2 ] When performing a read using FIFO mode, the spi controller shifts out the last 2 bytes that were written in a previous transfer on MOSI. This undocumented behaviour can cause devices to misinterpret the transfer, so we explicitly clear the WFIFO before each read. This behaviour was noticed on EspressoBin. Signed-off-by: Maxime Chevallier Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-armada-3700.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c @@ -624,6 +624,11 @@ static int a3700_spi_transfer_one(struct a3700_spi_header_set(a3700_spi); if (xfer->rx_buf) { + /* Clear WFIFO, since it's last 2 bytes are shifted out during + * a read operation + */ + spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, 0); + /* Set read data length */ spireg_write(a3700_spi, A3700_SPI_IF_DIN_CNT_REG, a3700_spi->buf_len);