From patchwork Mon Feb 4 10:09:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 10795383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 315F5746 for ; Mon, 4 Feb 2019 10:22:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E6572AC80 for ; Mon, 4 Feb 2019 10:22:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11FF32AD7D; Mon, 4 Feb 2019 10:22:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 008E12AD54 for ; Mon, 4 Feb 2019 10:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R1jUG8UhEYQBBAdrC8XbGLpathinWrklaGDpE7xUbHQ=; b=TqgRGjX2CM/Kis JTHPtJ+IYvbvBK6pK8elVeuUThKCJDW/aLSIWPyFIWVf7y3Trnt1e2jqhFMqfxC77Jvqj70Ebe+bR XlgLtMalOSrg21l7TjF1TwHxFC1Ov2kevQIIM3OH1P5LXcusdi7ZZ/v5klgX/Gf/LLlXx2K+tx+5n Ivh+njjDtW2mdmLl+TQ2YkjlamQwuzl+Z6u1TruokaOjNG9/OtdH8BuFlGOpXr0hWUgFutDVtL54c zp/OXjJqNH/B+pnAVfZ+dgE8NOluUvxQB0t/jDIYrSwI6HTj04XkVBNM/9nUzFyLVpTIewr+kCLom OYDEDfu13pHAcUBTzMWg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gqbO2-0006Nv-F9; Mon, 04 Feb 2019 10:21:58 +0000 Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gqbBz-0005ym-F9; Mon, 04 Feb 2019 10:09:34 +0000 X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="23387567" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Feb 2019 03:09:30 -0700 Received: from NAM04-BN3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.108) with Microsoft SMTP Server (TLS) id 14.3.352.0; Mon, 4 Feb 2019 03:09:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kn/yZj9INKHkEQl/zoGxdTrB+FRyWlYTxAbzAokJqXg=; b=MlwS/Ft8fXT4lRplv918/iyr7LOYAwDb6C7BgnKB4YlHZiv1LzUrEOxqNsO3EjfCKpSUt0LlwPRHDNP+7gVUTOSkM1R1qCKbmu/WdCmmkYqhBUEhJV70Mr4GpwsY79aHgzcMpWrBxJfDsKbh6Br8COBWwXHs8xcDH8LWlNAEQWI= Received: from BN6PR11MB1842.namprd11.prod.outlook.com (10.175.98.146) by BN6PR11MB1473.namprd11.prod.outlook.com (10.172.21.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.16; Mon, 4 Feb 2019 10:09:29 +0000 Received: from BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::847:4296:13b9:fc9f]) by BN6PR11MB1842.namprd11.prod.outlook.com ([fe80::847:4296:13b9:fc9f%8]) with mapi id 15.20.1580.019; Mon, 4 Feb 2019 10:09:29 +0000 From: To: , , , , , , , , Subject: [PATCH v4 03/13] spi: atmel-quadspi: drop wrappers for iomem accesses Thread-Topic: [PATCH v4 03/13] spi: atmel-quadspi: drop wrappers for iomem accesses Thread-Index: AQHUvHG3hTnXBKRwUkGWSgBj26+yAA== Date: Mon, 4 Feb 2019 10:09:28 +0000 Message-ID: <20190204100910.26701-4-tudor.ambarus@microchip.com> References: <20190204100910.26701-1-tudor.ambarus@microchip.com> In-Reply-To: <20190204100910.26701-1-tudor.ambarus@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR08CA0270.eurprd08.prod.outlook.com (2603:10a6:803:dc::43) To BN6PR11MB1842.namprd11.prod.outlook.com (2603:10b6:404:101::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Tudor.Ambarus@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.9.5 x-originating-ip: [94.177.32.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BN6PR11MB1473; 6:nXbbemTttL2nJB/MYEYpSIG19CIVSfjgEREzjmfiwcxd6/B6aSVdlGbNQU9THVXMojhz8s1rT7PabwaRxxDs/3eaX1aa2x9u9PJf7KpD4XuActehMoF2DkqD/uoUcdrT7G2UrtOnqImtlrXLo+iOw/pbzxH3hGZHNNDt/3f2XA9RjdMnDXeguNYBMijwTXgWoWHmJVrnWn03xzCxx5Q4TlnfF1sAxo9h0HrUzu4kkUoDUfM11wkKD2PUKxMSWwwK0jZO8AM3fpH7hKERCTUPmwhkNm9npyeowJ4czrYjTjra1lYCIZt9n7CQLCdEcYoyNFa3gZRcZt0EL8EXVPHOpqkLRpi1lQj52XZf1sep/A4u5OAMhQhI9cXxWyud6pkSqjXDtOml9q+fhS1dS837L7CBgcCHZPfxiKalhb31npk2Hq3hGAcW+7WsvG9185c9Ee49X6h+9jE9v31WMpHEsA==; 5:o01xUDCVVKhqPwgc5jL0spT1pkRaznOeeiGti9p/K+T90TI71JVRSmxDl/FOTcSpdfYtd6K0B4DhLbJNwQC9IDt78G2dEWfU7GZw/qUMZsmord59I3MVWeUSMBl0tZnAF78L1OvD0TP+TxMwXZ6INhgIx2wq+zZCSpAvmIRqAtuWiBWwu5Q7Oiy5Xsp30iKfYmEBz/K2vfHSKurvFFjWHg==; 7:ysaVd0NkldOj7Zjn/U1YJXtljNLRtzlyHdneBT81Ic9ALSBaKmPFx2AQbNfNe7+BslLxBBpldWaBSxdDBf5I9ovwEi2kfOTG9L9nfZqg9d/FwqlCoAzmWFoPYDdbzWUa0P8CPFKs8c1gYXJMF8j2Dw== x-ms-office365-filtering-correlation-id: b951f7b0-398d-4c0a-9ddc-08d68a88d94c x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(2017052603328)(7153060)(7193020); SRVR:BN6PR11MB1473; x-ms-traffictypediagnostic: BN6PR11MB1473: x-microsoft-antispam-prvs: x-forefront-prvs: 0938781D02 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(52116002)(8676002)(478600001)(2906002)(26005)(2501003)(186003)(50226002)(53936002)(4326008)(81156014)(316002)(66066001)(8936002)(3846002)(81166006)(6116002)(1076003)(386003)(6506007)(106356001)(68736007)(6436002)(6512007)(39060400002)(76176011)(102836004)(107886003)(71200400001)(54906003)(71190400001)(105586002)(476003)(99286004)(36756003)(7736002)(14444005)(6486002)(97736004)(446003)(11346002)(14454004)(2616005)(86362001)(305945005)(7416002)(256004)(72206003)(486006)(110136005)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR11MB1473; H:BN6PR11MB1842.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 0zPUwbU6OKUUSrEl7dG0jXbtGjgSVJJTMdyQDZfGu+eXSq5aS9FNoQkf8lBXjgx/wRltBmLfFE7iUcTdtVJmMbRRVwuvF8TTFMR3YIXd0cbOw4zh/RFI1WicWqwY/qMekZ+J0mey6xT/KF41dR4U5gqz1BCWje0oXogysduOnuDyR5LNJhEiAkhPWQP4RGKPmSBjnwiu78gsSpF99OjZc7GoXpJVWpiCOPJ09phn+WOv8PIJX88IIpzklkwxXWrjqK0VE0NazCWtPss0kINoaKyweJzxYR9noM7fsk+tem5PYAg7xkpZKkHfMSu7XThYovRjRaHo3dShN+UbOwxaLNA4cVy6DGkj2JgZW9aX/ERzaG20Rcm5EsCgEmfD5dm5RRkZB/vffCGgru6vSvbfH1jtw2rLBMBW/AwC+C41BQg= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b951f7b0-398d-4c0a-9ddc-08d68a88d94c X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2019 10:09:26.2206 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1473 X-OriginatorOrg: microchip.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190204_020931_858884_B3583E2E X-CRM114-Status: GOOD ( 10.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Tudor.Ambarus@microchip.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tudor Ambarus The wrappers hid that the accesses are relaxed. Drop them. Suggested-by: Boris Brezillon Signed-off-by: Tudor Ambarus Reviewed-by: Boris Brezillon --- v4: - drop local variable that kept aq->regs, the compiler should be smart enough to store it in a register - collect R-b v3: no change v2: new patch drivers/spi/atmel-quadspi.c | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 7d83ce8747e8..c745e75b755e 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -175,17 +175,6 @@ static const struct qspi_mode sama5d2_qspi_modes[] = { { 4, 4, 4, QSPI_IFR_WIDTH_QUAD_CMD }, }; -/* Register access functions */ -static inline u32 qspi_readl(struct atmel_qspi *aq, u32 reg) -{ - return readl_relaxed(aq->regs + reg); -} - -static inline void qspi_writel(struct atmel_qspi *aq, u32 reg, u32 value) -{ - writel_relaxed(value, aq->regs + reg); -} - static inline bool is_compatible(const struct spi_mem_op *op, const struct qspi_mode *mode) { @@ -243,7 +232,7 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) * Serial Memory Mode (SMM). */ if (aq->mr != QSPI_MR_SMM) { - qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + writel_relaxed(QSPI_MR_SMM, aq->regs + QSPI_MR); aq->mr = QSPI_MR_SMM; } @@ -303,17 +292,17 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) ifr |= QSPI_IFR_TFRTYP_TRSFR_WRITE; /* Clear pending interrupts */ - (void)qspi_readl(aq, QSPI_SR); + (void)readl_relaxed(aq->regs + QSPI_SR); /* Set QSPI Instruction Frame registers */ - qspi_writel(aq, QSPI_IAR, iar); - qspi_writel(aq, QSPI_ICR, icr); - qspi_writel(aq, QSPI_IFR, ifr); + writel_relaxed(iar, aq->regs + QSPI_IAR); + writel_relaxed(icr, aq->regs + QSPI_ICR); + writel_relaxed(ifr, aq->regs + QSPI_IFR); /* Skip to the final steps if there is no data */ if (op->data.nbytes) { /* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */ - (void)qspi_readl(aq, QSPI_IFR); + (void)readl_relaxed(aq->regs + QSPI_IFR); /* Send/Receive data */ if (op->data.dir == SPI_MEM_DATA_IN) @@ -324,22 +313,22 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) op->data.buf.out, op->data.nbytes); /* Release the chip-select */ - qspi_writel(aq, QSPI_CR, QSPI_CR_LASTXFER); + writel_relaxed(QSPI_CR_LASTXFER, aq->regs + QSPI_CR); } /* Poll INSTRuction End status */ - sr = qspi_readl(aq, QSPI_SR); + sr = readl_relaxed(aq->regs + QSPI_SR); if ((sr & QSPI_SR_CMD_COMPLETED) == QSPI_SR_CMD_COMPLETED) return err; /* Wait for INSTRuction End interrupt */ reinit_completion(&aq->cmd_completion); aq->pending = sr & QSPI_SR_CMD_COMPLETED; - qspi_writel(aq, QSPI_IER, QSPI_SR_CMD_COMPLETED); + writel_relaxed(QSPI_SR_CMD_COMPLETED, aq->regs + QSPI_IER); if (!wait_for_completion_timeout(&aq->cmd_completion, msecs_to_jiffies(1000))) err = -ETIMEDOUT; - qspi_writel(aq, QSPI_IDR, QSPI_SR_CMD_COMPLETED); + writel_relaxed(QSPI_SR_CMD_COMPLETED, aq->regs + QSPI_IDR); return err; } @@ -378,7 +367,7 @@ static int atmel_qspi_setup(struct spi_device *spi) scbr--; scr = QSPI_SCR_SCBR(scbr); - qspi_writel(aq, QSPI_SCR, scr); + writel_relaxed(scr, aq->regs + QSPI_SCR); return 0; } @@ -386,14 +375,14 @@ static int atmel_qspi_setup(struct spi_device *spi) static int atmel_qspi_init(struct atmel_qspi *aq) { /* Reset the QSPI controller */ - qspi_writel(aq, QSPI_CR, QSPI_CR_SWRST); + writel_relaxed(QSPI_CR_SWRST, aq->regs + QSPI_CR); /* Set the QSPI controller by default in Serial Memory Mode */ - qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); + writel_relaxed(QSPI_MR_SMM, aq->regs + QSPI_MR); aq->mr = QSPI_MR_SMM; /* Enable the QSPI controller */ - qspi_writel(aq, QSPI_CR, QSPI_CR_QSPIEN); + writel_relaxed(QSPI_CR_QSPIEN, aq->regs + QSPI_CR); return 0; } @@ -403,8 +392,8 @@ static irqreturn_t atmel_qspi_interrupt(int irq, void *dev_id) struct atmel_qspi *aq = (struct atmel_qspi *)dev_id; u32 status, mask, pending; - status = qspi_readl(aq, QSPI_SR); - mask = qspi_readl(aq, QSPI_IMR); + status = readl_relaxed(aq->regs + QSPI_SR); + mask = readl_relaxed(aq->regs + QSPI_IMR); pending = status & mask; if (!pending) @@ -510,7 +499,7 @@ static int atmel_qspi_remove(struct platform_device *pdev) struct atmel_qspi *aq = spi_controller_get_devdata(ctrl); spi_unregister_controller(ctrl); - qspi_writel(aq, QSPI_CR, QSPI_CR_QSPIDIS); + writel_relaxed(QSPI_CR_QSPIDIS, aq->regs + QSPI_CR); clk_disable_unprepare(aq->clk); return 0; }