Received: by 10.223.185.116 with SMTP id b49csp1075785wrg; Sat, 3 Mar 2018 14:53:17 -0800 (PST) X-Google-Smtp-Source: AG47ELvMSzHOmOj5dKXGJrSuuah+BbLqIjDDd+LnVXzXBKr0fVjGw/sfftbuOsWFv69/Jm4loYSo X-Received: by 2002:a17:902:7445:: with SMTP id e5-v6mr8859020plt.204.1520117597456; Sat, 03 Mar 2018 14:53:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520117597; cv=none; d=google.com; s=arc-20160816; b=AGnyibnLHB2rPGXs9+QkHp4SguIS5az6zp92aNbJPWFkBnF8Eb5YKQO0wDOg2/WTsF 1m2seNxhQE1JwDHFYJ9qFTynp2qEBtqDqBkJ6Buk/E3qJcpLezkaitom3gWQSuWeVCg3 caB6Ly9Y5WRa/8MEjZaQ++c+Wh2JgA6Pf5NDVbhmZgCMrDGpWxWPKC4b8K38Y6gT2q8D tuLO8n4atEf1IquthVUpb9SuMcY0SxPjVdauGupWEtyxPJzGf9qRFcASj74ZN4oGZwbt qO0frcLstKmVr7I+gkkTu89JPwAhEmIGBtT1bnPrDTx5TYXIICL1mcIZg26oCip7qYLp UQMA== 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=5dDrWX85vmoHSDIa23KmbC/wWVDg4inwT9AGmBlT8AA=; b=wAyGAJLnEJKCY6lAWWM1DM96JXwhACpvfbiBkzyf/2vpqsAk7nYyjQp9zDdoFa66c2 cmDmx5WV0sHyVrBEmMGczLZRB5JXjNHOZ5ZYjdB5aV52auJvKkHBG2g8zlvG6IFZ7zlZ f47btmzGwXaHe/NVPZJ1bXb/s1B9MCurZQSasIu172R2nZX1DxXUJfMBzs6J5GP2nZcl WgtNp1gbcNAZLkeR/rUQ6ChbuhUFE36seDZTSbgcpy1nb6lNHeWsJ724QypdOiyoxKIs MO+/igdO/zSwvqwaV7MqIDKtwstdxsOvrusxWRUAow+YrxtnMPlFWycSI3dYdC8wedKr RYLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Rb0Oy1g1; 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 z3-v6si6868848plb.137.2018.03.03.14.53.03; Sat, 03 Mar 2018 14:53:17 -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=@microsoft.com header.s=selector1 header.b=Rb0Oy1g1; 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 S935478AbeCCWw2 (ORCPT + 99 others); Sat, 3 Mar 2018 17:52:28 -0500 Received: from mail-by2nam01on0095.outbound.protection.outlook.com ([104.47.34.95]:48488 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935423AbeCCWlI (ORCPT ); Sat, 3 Mar 2018 17:41:08 -0500 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=5dDrWX85vmoHSDIa23KmbC/wWVDg4inwT9AGmBlT8AA=; b=Rb0Oy1g1u5Dd/Pj8UMKESHSvTFruoi189yzQeJFkHxoYWIZbX/9fYZGi7xymx/9q46lHMwS2jNeTBmkTqaer2ak/Wgx6eYup67jbXjpQFbscUKgCNVOesXcPM6RIecbT7jQLyx0BRt68u0s0dTtgIQdjYu8SmTtjIv4kVnsN36w= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB0940.namprd21.prod.outlook.com (52.132.146.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.5; Sat, 3 Mar 2018 22:41:05 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:41:05 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Akinobu Mita , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 19/63] spi: omap2-mcspi: poll OMAP2_MCSPI_CHSTAT_RXS for PIO transfer Thread-Topic: [PATCH AUTOSEL for 3.18 19/63] spi: omap2-mcspi: poll OMAP2_MCSPI_CHSTAT_RXS for PIO transfer Thread-Index: AQHTsz+hzryBAtC+s0GjuXPJ8BBceg== Date: Sat, 3 Mar 2018 22:33:20 +0000 Message-ID: <20180303223228.27323-19-alexander.levin@microsoft.com> References: <20180303223228.27323-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223228.27323-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;MW2PR2101MB0940;6:UnS72QnojW+bz+ZDhx3BDrMaTaGFE35bK+qYLXn1R9fxUKNtrSkXxJrjmnxKc86VS8jntZcZ0eZ0gLMwKC+9Yzmdmm6PI13R59yroPGfaSMkCYeyKryIyfutXt9gdIK2o7F/yC1VryQG4PYcWtIMrTs8WTWl1gA8n7EGumeELpdlroSwrQBAVb6aW2yWxhuOQOGnukwIDIdb3cXzq1RWdM5Kq8+FqAYkBPpnJAH34GCExP7XdsoDV+PIXHgJ8PXE7BoW3mHSDBaFr0qBzsGWnrJPuJ6X9HAsEuJgqhAMxCbaxmGGXq2QcIb7fdXS53TDPYNj5240GwOMo7hFtMAAqrGZvQwCCtyKx24bo5li05bexKlJcnGv7aYCKNXEUzaE;5:GgSALj0k7ESN9XQI36feOFiLsa2LNKsxQHMHc8UE2hD/2HtqEPjAikvrQVzw2cLeC9WPz5tC7UvyV8NyC0Y2cKCaXQaju8MRNksKGNT3Z7Yc0olmcs+gqvpYDOUacCk5wo6HFw+hTJmqJI/zJaBnBbN+UgyjEUmmRT1Yn8cHVAs=;24:xQDsLsZ3buH6WhmNq1BgLau7x1c9RsmUFk08B3RuUP9WKxFderlMr8D6H4KnrV97JLeo+39aex5Iv4+EZmWb8LgMi2DqkvQSxSeVUXdFx+0=;7:ubb/Mcw4NC5SlBhqXUchvX3yP2+byuxsnfvQ0eTOR7lyzSwGeSbbxpRQXU3awEz3zQ3MqYoNv3NdG3+XL1MzHGAIoc1G+bqi6UuQr3MYCXI0fwpJiFPXAkwROV8uXCtPeNHyoXln0pbXldbopD+4dUzcgGwdfvOUAhOyhqI5+el1kS1Uyj9kmwhHB1IY9HLXIF07cD9frDy7z1zrNdzElhEeWKI7EHnFuM+KWyKARe78+/WJLwxnk3WIJqHcuHjO x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f66be878-0f2a-4e08-850c-08d58157d971 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB0940; x-ms-traffictypediagnostic: MW2PR2101MB0940: 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)(85827821059158); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB0940;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB0940; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(39380400002)(346002)(366004)(39860400002)(396003)(199004)(189003)(106356001)(68736007)(6486002)(25786009)(22452003)(6436002)(186003)(2906002)(81156014)(81166006)(10090500001)(66066001)(8676002)(36756003)(6512007)(39060400002)(2900100001)(316002)(97736004)(59450400001)(102836004)(53936002)(6506007)(3280700002)(26005)(4326008)(5250100002)(305945005)(2501003)(76176011)(2950100002)(86362001)(99286004)(3846002)(72206003)(14454004)(3660700001)(478600001)(1076002)(15760500003)(5660300001)(10290500003)(6666003)(6116002)(7736002)(86612001)(107886003)(110136005)(54906003)(105586002)(8936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB0940;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: E3MGE27Kw+jVuGwAbZX0D+vjsvWkC52xDuozr94DfTaLJwzEmWK4wRxdAuFMOowruQIc6Tp+1wkqI8+eHNqr4+D6X5eAvXVHXXondQA+s4id4BUv26QxfxSskumXsctaekqDQd7gCC8tjC64xmwVtfFlgx/UQqGGVTxap1i+EwI= 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: f66be878-0f2a-4e08-850c-08d58157d971 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:33:20.5910 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB0940 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/spi/spi-omap2-mcspi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 352eed7463ac..7f48cb57822c 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -441,6 +441,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_t= ransfer *xfer, int elements =3D 0; int word_len, element_count; struct omap2_mcspi_cs *cs =3D spi->controller_state; + void __iomem *chstat_reg =3D cs->base + OMAP2_MCSPI_CHSTAT0; + mcspi =3D spi_master_get_devdata(spi->master); mcspi_dma =3D &mcspi->dma_channels[spi->chip_select]; count =3D xfer->len; @@ -501,8 +503,8 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_t= ransfer *xfer, if (l & OMAP2_MCSPI_CHCONF_TURBO) { elements--; =20 - 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; =20 w =3D mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); @@ -520,8 +522,7 @@ omap2_mcspi_rx_dma(struct spi_device *spi, struct spi_t= ransfer *xfer, 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; =20 w =3D mcspi_read_cs_reg(spi, OMAP2_MCSPI_RX0); --=20 2.14.1