Received: by 10.213.65.68 with SMTP id h4csp2156954imn; Sun, 8 Apr 2018 21:10:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx48F3UBRzlDpJOXsIWojhTdqo10kvo2VCziWvRiikBvpDUSqH2j1oS0UDPhwazi7zImvPx0p X-Received: by 2002:a17:902:1006:: with SMTP id b6-v6mr37294310pla.252.1523247055955; Sun, 08 Apr 2018 21:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523247055; cv=none; d=google.com; s=arc-20160816; b=meqHqDkPfR1OvvSk3KpKk9zfxbc7tkQiXYi1dITSbJdeUcZeoqXV1+1KyPJzrKQUzl H8Gl4rI34bb9BecJxB8AhQB8Wl2R/jChpdT1eueS96A9wf9VG8Nlg5Lq0CpVqtjbDCZA v55C/vWoiJZnPDaKoSIuZcCa2wuAW5d0e2FmsNQiRFz8uSQXXxIeK1kqgI7Oxm7WAHBO oKEmXIHUQVrvsxB897x67+sQmWb0iEs9M3koWIKtGxhB04l2toHq6EE6hY5Ir5pOQDXx o6ofqezJleAUC4sF/5qdMiuYvDvucjYZpBwn/zsjIZqw5rVQb5RGKy8g/2VsQ6nsbbuy zB0w== 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=YAIqU376avGt5rApDYNSLCe3US6Ay6S8lfSTNoEYNt0=; b=MrTny6cbffdKI1UhLIDO4lqrKDC+hEr8ZguVIoRJds+XLht9fhHCdNP56cp9eIpFYx SEvqPNRg/C32bUKsIKLUWobsZZeiZZdPMCIkP1mav8c4moRkrs492S5QvuIo74Jat37+ bwuB49bcv1GiT20gDF9FxrEW5hg2WuNG4gVWr8+Im1VCTon4QC0T3Fo27sA2P8yan0dQ m/5JjdZ2xDsc9C5BN8s37f/LsnR9ypxiWuOBh10hbfIL8ZcNVWK+DBhSmMZkpuHZiEWQ ad6xcetTefg9pkzQLhRxzO5hr73jY35Pm/3c2lwOMHcNzcTdJLRX0TM5f457LnHn0t4/ 8b/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=oKYe06wB; 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 x185si10408878pgb.649.2018.04.08.21.10.18; Sun, 08 Apr 2018 21:10:55 -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=oKYe06wB; 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 S1754157AbeDIEFM (ORCPT + 99 others); Mon, 9 Apr 2018 00:05:12 -0400 Received: from mail-bl2nam02on0131.outbound.protection.outlook.com ([104.47.38.131]:5451 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753268AbeDIARy (ORCPT ); Sun, 8 Apr 2018 20:17:54 -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=YAIqU376avGt5rApDYNSLCe3US6Ay6S8lfSTNoEYNt0=; b=oKYe06wByvkB3qNCxdfgMg++uJgdg0QpbEbtN+wjRosUpPe02vua6RAFMTuQbquKS3U5hHHcI3nq2YifjcWLT5Ud9W6qS74x1OLdhrn6G9P6UQyumG8MO8+XJf+Cmcifiyg3PqUqkKg0+9AFgPdbWiDm3B9zaRrcj05l62qcioM= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1048.namprd21.prod.outlook.com (52.132.128.17) 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:17:47 +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:17:47 +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.15 043/189] spi: a3700: Clear DATA_OUT when performing a read Thread-Topic: [PATCH AUTOSEL for 4.15 043/189] spi: a3700: Clear DATA_OUT when performing a read Thread-Index: AQHTz5gfnlxVEAkmv0idypDJRGiFew== Date: Mon, 9 Apr 2018 00:17:19 +0000 Message-ID: <20180409001637.162453-43-alexander.levin@microsoft.com> References: <20180409001637.162453-1-alexander.levin@microsoft.com> In-Reply-To: <20180409001637.162453-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;DM5PR2101MB1048;7:3LJ/ELOB1ZtafgNLb56qVj/SG3L9A8mGoadqlJzZWPYjiF1jA3Ycf6SmgFm8GE3gvvrGqJXtAqNTJErhHD3QAOo9Cdh/3beuVsKD4ZFDP8k9MEmfdXXXc2IfTopV5YMmxkcaT+p46wv+2fdGYDqXeUCSCyu196zJNRo2U8YWqm8NtkpxFr05vv23SZ76/hIEtEywus+lL7fYFvu4mYIEC7pg985jvVnxJLwMlEND0oj2plYAgbNxqZ0nxod7R4uL;20:zdZfVqlLF4ri6NrCUr0b5fKvVOIXA8yXfZL1q2yqNbFGdEDd5iBvHEHSkXf+L3pH8qE8BFb6NJyiXX3lrgf3N4+spohEqzcOJikNI2CtIArueCewLDC1/KklPQv+y1ErCoaQfnt8rCHwhGqsgQiJc681ZBsHFuaTUMaeFFJD2xM= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 97138065-cbfc-44f6-06cf-08d59daf528f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1048; x-ms-traffictypediagnostic: DM5PR2101MB1048: 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)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB1048;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1048; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(39380400002)(376002)(39860400002)(346002)(396003)(189003)(199004)(86362001)(1076002)(575784001)(99286004)(6116002)(110136005)(3846002)(54906003)(22452003)(3280700002)(105586002)(2906002)(76176011)(4326008)(6512007)(6436002)(6486002)(3660700001)(6666003)(7736002)(86612001)(25786009)(2900100001)(14454004)(97736004)(53936002)(107886003)(68736007)(102836004)(36756003)(6506007)(26005)(186003)(106356001)(305945005)(5250100002)(72206003)(478600001)(2501003)(10290500003)(81166006)(5660300001)(8676002)(66066001)(316002)(81156014)(2616005)(10090500001)(11346002)(446003)(476003)(8936002)(486006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1048;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: /0OMsk47N5fq4ubppgVyeqQ/zlAhAOdX+0Wvd7NIo/M7cfH0wiLUGNXoMrom1FxAgd8RpLhnQ2U60Pkb0FtLcUcRqjfB3qePcWCCnHNBxgXU1tcsXOg8YrRNGwJTbk3fNEHb7zKa4QiuJWV+fCDe1iIs2ITzrK3p8wYwqL4UmBozzhqQ0jH1BDCrh7Qwz8ZuyDmmpo1Q2k8g4SZeuXk0JasHe7S6nt1XPdGw133e2RntFq5E4OA6JhOz+O9POFODpbDEnJxQwnj1NTRtOLUpSe1diqfSJR+PUCbkrdTCnY18ElH/5iiNTptwQw+/VCrLV4EHaLPWvy7QmEgPt9P53zu6Nw6fVo2di+cNmbF9HSEkGFHFqvo0shyxoGlZtP0UeubKekXvT9NDiwYTo61mKh3F4PlKwmrwBHmjmzUlCiM= 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: 97138065-cbfc-44f6-06cf-08d59daf528f X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:17:19.9792 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1048 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 d65345312527..c11ea6c169a4 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c @@ -615,6 +615,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