Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp465234pxb; Wed, 8 Sep 2021 05:25:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfSuLJiByoqqegn3CiOhn9qYuyxKY8nmfpdCYo/puzI6eLhoK/V7Oiksf59mJya4OMhCut X-Received: by 2002:a05:6638:2728:: with SMTP id m40mr3460649jav.141.1631103937333; Wed, 08 Sep 2021 05:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631103937; cv=none; d=google.com; s=arc-20160816; b=Mj5Kzf2DngmJqY09JeByUBtWWvddFUBNkKjVplvxgSxgIdDnCs8pMzOKY9fg/6F5ed Or5aEMujL9Di3ZYWKxfVYsSkSR04hYudtFktp+iPguNMc0Z+aX31HQbfJqXR8sfT3fHE P0cyHI6SS7wfSyGOHDWSFJjIJw/4M7abK46QYN6opqj8UwR2C5phM9KRRtkx9EW+BCaX Zk4siBqGHnTE1eiCCtUvv925dVGWYMHaloPcdbYw0Oavl2zrCYw3QHnVKuvLIWVntV3u BYKoHTFsmHGpl0AhelCROlEjG6c3wirt0ga74Igfgogy4C+bolzUUon3hhuuJR8mv90w YiDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=einaWie+AkqgLoHIE/9XECHZY7I9IDne9pKF3qRvuHQ=; b=R68HR4T0qaljDbS0zRliFEQIrFrBl9dTrI/P0+oR6yrszJKpGOSD4vgmbyCZe7p/dc skkJWA8kDNJSnhCKick0EdLLHT2Mg6VXP6MXt9F3mmZhwHgVG3vym9XbZbCEm+5/C+lw pe76Nqs59dbbPVhsm603Z+Wm0QhKKHKjFq4+Lw9+VUa/1k1HvP9KcQvDX8BZw8sKHqRX 9TkNnJejJLuAxMlX9EWl/JBKCX9UwQjK0xCH78mwH6DVMYwDjXYIWv8m+HvrK4SAFY1x Vos6nfG0AtwG3yTuCe0eE/4z2CdDKVA94qxXBbuT2yELKRfxyE9drn9VCIs9XCldCQ2H QMfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=e6zQKP1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x13si1932714jat.3.2021.09.08.05.25.26; Wed, 08 Sep 2021 05:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=e6zQKP1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351538AbhIHLgV (ORCPT + 99 others); Wed, 8 Sep 2021 07:36:21 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:36016 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348768AbhIHLgH (ORCPT ); Wed, 8 Sep 2021 07:36:07 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18858Mnv005982; Wed, 8 Sep 2021 06:34:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=einaWie+AkqgLoHIE/9XECHZY7I9IDne9pKF3qRvuHQ=; b=e6zQKP1mOp2GBSwoY+5Ke7PUbBN+9MzdIbvQevY1R4J/SO8+3+SISMeImmU8cs6cc4q9 ZyWj2tO3gvdIA0jJGXJU36WfIZUES6HM+Zx3XCQVq5be2u5+06+uins7XVQ7ChXRxzOo ou0yKNpJr4UCTKooZz6jtTA91uIKQ7PJN5or50IHIwgHc493qE8o3/QylDFCxDbSMSVK WY2q28JxjZbermM22qPTHf1Ct414Ns86Qvw7d8nIteVWcWRLktguxTGo0R25ObFAxybF W/TXS++H+Jl16aCQPbRPzKi3sB6eZXWaDFw1rkOVJtR4N8eRiG6BFVjTC38UzYL65+sF aA== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 3axcp997pf-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 08 Sep 2021 06:34:56 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 8 Sep 2021 12:34:55 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Wed, 8 Sep 2021 12:34:55 +0100 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.231]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id E9AA72BA; Wed, 8 Sep 2021 11:34:54 +0000 (UTC) From: Lucas Tanure To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" , Sanjay R Mehta , Nehal Bakulchandra Shah CC: , , , Lucas Tanure Subject: [PATCH 05/10] spi: amd: Refactor amd_spi_busy_wait Date: Wed, 8 Sep 2021 12:34:46 +0100 Message-ID: <20210908113450.788452-6-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210908113450.788452-1-tanureal@opensource.cirrus.com> References: <20210908113450.788452-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: M1lruVQ2W344bY55HRkaLApiS2eU-jrh X-Proofpoint-ORIG-GUID: M1lruVQ2W344bY55HRkaLApiS2eU-jrh X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use amd_spi_readreg32 to read 32 bits registers Signed-off-by: Lucas Tanure --- drivers/spi/spi-amd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index f23467cf6acd..f2dd8d432aff 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -103,21 +103,15 @@ static inline void amd_spi_set_tx_count(struct amd_spi *amd_spi, u8 tx_count) amd_spi_setclear_reg8(amd_spi, AMD_SPI_TX_COUNT_REG, tx_count, 0xff); } -static inline int amd_spi_busy_wait(struct amd_spi *amd_spi) +static int amd_spi_busy_wait(struct amd_spi *amd_spi) { - bool spi_busy; int timeout = 100000; /* poll for SPI bus to become idle */ - spi_busy = (ioread32((u8 __iomem *)amd_spi->io_remap_addr + - AMD_SPI_CTRL0_REG) & AMD_SPI_BUSY) == AMD_SPI_BUSY; - while (spi_busy) { + while (amd_spi_readreg32(amd_spi, AMD_SPI_CTRL0_REG) & AMD_SPI_BUSY) { usleep_range(10, 20); if (timeout-- < 0) return -ETIMEDOUT; - - spi_busy = (ioread32((u8 __iomem *)amd_spi->io_remap_addr + - AMD_SPI_CTRL0_REG) & AMD_SPI_BUSY) == AMD_SPI_BUSY; } return 0; -- 2.33.0