Received: by 10.213.65.68 with SMTP id h4csp2202577imn; Sun, 8 Apr 2018 22:24:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/TlOzkrv8bEslfA4vnHcdHiyTtuiSRNMol6kKkjhrUhJ6103kiT8rk0AvFWIVbAxPyw5vJ X-Received: by 2002:a17:902:8bc1:: with SMTP id r1-v6mr37231796plo.310.1523251441070; Sun, 08 Apr 2018 22:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523251441; cv=none; d=google.com; s=arc-20160816; b=PN0KrlbE7A/eecUqW+gYCldtkteLIs9haS3rpCHaR+9yGFaUh2EQgwrZRlttYgExiX oJIfa+XmliwOz3VthVVNTvFBz4DC8X/reqJP2R/Q8kIyJ5k/NDLafMs/AGdlyti5CS+G t0MkKPHiYqO4k+iyAal4ZdLqlsoIrsM6BLADoaC6nSmyxGtSevMKZrhjGvnD1VYZX65t Zz0Vx7FG9Pl7ys1P1WTKL5ZKa1jI2yOhoQsMHFF6VYNOxJ/h2BE9xyguo/HEcMfk8flN KAIsA7Zl/Rh4D13/mCYFR95FKD7LLYX5e/8MIR3k7/+pUC99hCOVOi7eW7P46cmoRPtT gg5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=nqviKwCNq/a/QBEHosZu1z1fMHOwa3IUdLgk+WyTpHs=; b=hPnALg3pQIS/IuxvoWgWToFc9Si8xaYPrHpLLZ4eRGHqDH/jLJ3KrJnkQW9tZCeT7q YYNOatn7zzbdCP8eYkUBcDAHVTByGTejbM8yzJ6L2OGH7IevP2458rQ82rRzfzp2nnWS vJPNjdnjGVJ7200bPrchv7kke8d6AGVZkbveNiRrvhqEFQ/KOSU7JIvQGl9Kkk/tl8w0 YG8J+hB6J9b+M5XRJTED2neNNDju4srpWbKAqDE7MMQTC6I3yBlkKqrV3kJuHce4vsvd JjaEe/pGEhSFxww24uMRZyu1WUfiSzPXi0Prj22+ZdjEfijph78m4nj4TcEZwL6+u/Ir J2hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=UTqzU01l; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si10549348pga.391.2018.04.08.22.23.24; Sun, 08 Apr 2018 22:24:01 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=UTqzU01l; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754806AbeDIAXD (ORCPT + 99 others); Sun, 8 Apr 2018 20:23:03 -0400 Received: from mail-sn1nam01on0134.outbound.protection.outlook.com ([104.47.32.134]:37792 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754735AbeDIAWv (ORCPT ); Sun, 8 Apr 2018 20:22:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=nqviKwCNq/a/QBEHosZu1z1fMHOwa3IUdLgk+WyTpHs=; b=UTqzU01liBU9bkXrROLQ9taV0PyCGxm6fZemiss4o0pFkkZBY3a+5RoFs1iaKvvwmsCooKJM9AAeHV0XgZgvGIngfYcjNFB76RQtTGvPB0frEyZ4dhEf0h8IcHOTYV4eVVtmC0AuO2X9x6/fwc4pPWubeqlcreAMWtc288Up8gM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1014.namprd21.prod.outlook.com (52.132.133.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:22:48 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:22:48 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Maxime Chevallier , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 038/161] spi: a3700: Clear DATA_OUT when performing a read Thread-Topic: [PATCH AUTOSEL for 4.14 038/161] spi: a3700: Clear DATA_OUT when performing a read Thread-Index: AQHTz5iIyv5ak0pv+0GRFcpwm3L0Nw== Date: Mon, 9 Apr 2018 00:20:14 +0000 Message-ID: <20180409001936.162706-38-alexander.levin@microsoft.com> References: <20180409001936.162706-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001936.162706-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1014;7:nfrGyqm0x8N1IkMxFWTaKQD7M9u5TTuqjUN71aaewi4IExU+Qi9NxEsoPhm6RiK/uUujL8Vy05/t9M7VqKvD6QcfQL+afqEtXQPjzdfHEb7k8WhaCpNuZHNuTrcQCdOecJTEt6CWr57g+YcQ27RrZelGlYO4oiJ7nhq6TEDGnRTgfiukozD9IBzwmTfJLwzIOcMoc1SY44dBRK56BBjyOWTGSnDeMyu1Md59U+6nPyFT+49VfPGVzL9P0v4hLxhB;20:QLR93Z9uPa3zVpcWL2/qaJdLqs+kQUaFbo12hYZnOXk8nwdnRHDqYQ13NXmO5H+sSc76N2Jocvb70weOz1A6S8ofqNInJp0FnU8zg16Lak4vKB0j8jVA1Qjjn5yiHGI8q4glqhHcjNf5NV3BcPpoSx8SlIQsSZsE2R2WHLJhkQM= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 8ad1038f-0945-4066-5b8c-08d59db0061d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1014; x-ms-traffictypediagnostic: DM5PR2101MB1014: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1014;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1014; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(366004)(39860400002)(39380400002)(396003)(376002)(189003)(199004)(81166006)(81156014)(478600001)(6436002)(72206003)(575784001)(8936002)(10290500003)(106356001)(99286004)(86362001)(2616005)(7736002)(2501003)(6666003)(446003)(476003)(8676002)(11346002)(105586002)(305945005)(5250100002)(6512007)(53936002)(68736007)(107886003)(66066001)(86612001)(2906002)(14454004)(186003)(22452003)(25786009)(4326008)(2900100001)(486006)(36756003)(6486002)(3660700001)(54906003)(26005)(3280700002)(110136005)(1076002)(10090500001)(76176011)(6506007)(97736004)(316002)(3846002)(6116002)(102836004)(5660300001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1014;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: HXN0nU8DLBdnqK5pLV8AZ31Qvk4U7KlQo3AxIelFhqI0RZMOjsecJ6JsJiI0uaqKyVb58NhLDm7rprqMiyDZXxSZDFoYSFYbDDCiX9lXI4uZjlbCebwvp5EApWV/XgjBsC6z/7ExN8TFM6+dmTKmycgDdTXWeuc9XGKId6SJTFEFzNxv+slY/LHh07tIETeChsN8vvhG/WRu6ZA1NQOzzzYK22S0REbr8BuUcPiLrN0mQUXCQRyCMzo9iQM3PlyJCVTGOKWyHBFQqnm0NdyvzPEp2JH2yCrAX36s09/JL5rsh4En1NrxXJDzPmoIYX4C6NTjv0GFVagjRrD6J+cAhceT5GSEhdhOBvlzJVRnxREYtFmgwzVCuRLLmw9ZdbH32UQEoLQ1dgo53njntog02Ag7KRIxkxIxw4p4tpoMaRY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ad1038f-0945-4066-5b8c-08d59db0061d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:20:14.9883 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1014 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/spi/spi-armada-3700.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index fe3fa1e8517a..4903f15177cf 100644 --- 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 spi_master *m= aster, a3700_spi_header_set(a3700_spi); =20 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); --=20 2.15.1