From patchwork Wed Jun 22 09:49:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 9192267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9853F601C0 for ; Wed, 22 Jun 2016 09:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8538228161 for ; Wed, 22 Jun 2016 09:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79D69283E5; Wed, 22 Jun 2016 09:51:35 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0B69E28161 for ; Wed, 22 Jun 2016 09:51:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFenF-0006Nd-Hl; Wed, 22 Jun 2016 09:49:57 +0000 Received: from 82-70-136-246.dsl.in-addr.zen.co.uk ([82.70.136.246] helo=rainbowdash.ducie.codethink.co.uk) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFenC-0006Md-5u for linux-arm-kernel@lists.infradead.org; Wed, 22 Jun 2016 09:49:55 +0000 Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.87) (envelope-from ) id 1bFemo-0007J6-OE; Wed, 22 Jun 2016 10:49:30 +0100 From: Ben Dooks To: linux-kernel@lists.codethink.co.uk Subject: [PATCH] mailbox: pl320: remove __raw IO Date: Wed, 22 Jun 2016 10:49:29 +0100 Message-Id: <1466588969-28051-1-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.8.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160622_024954_412074_84CC1E7C X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jassi Brar , Ben Dooks , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 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 The use of __raw IO accesors is not endian safe and should be used sparingly. The relaxed variants should be as lightweight and also are endian safe. Note, this has not been run-time tested. Signed-off-by: Ben Dooks Acked-by: Rob Herring --- Cc: linux-arm-kernel@lists.infradead.org Cc: Jassi Brar Cc: Rob Herring --- drivers/mailbox/pl320-ipc.c | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/mailbox/pl320-ipc.c b/drivers/mailbox/pl320-ipc.c index f80acb3..2dbed87 100644 --- a/drivers/mailbox/pl320-ipc.c +++ b/drivers/mailbox/pl320-ipc.c @@ -58,29 +58,29 @@ static ATOMIC_NOTIFIER_HEAD(ipc_notifier); static inline void set_destination(int source, int mbox) { - __raw_writel(CHAN_MASK(source), ipc_base + IPCMxDSET(mbox)); - __raw_writel(CHAN_MASK(source), ipc_base + IPCMxMSET(mbox)); + writel_relaxed(CHAN_MASK(source), ipc_base + IPCMxDSET(mbox)); + writel_relaxed(CHAN_MASK(source), ipc_base + IPCMxMSET(mbox)); } static inline void clear_destination(int source, int mbox) { - __raw_writel(CHAN_MASK(source), ipc_base + IPCMxDCLEAR(mbox)); - __raw_writel(CHAN_MASK(source), ipc_base + IPCMxMCLEAR(mbox)); + writel_relaxed(CHAN_MASK(source), ipc_base + IPCMxDCLEAR(mbox)); + writel_relaxed(CHAN_MASK(source), ipc_base + IPCMxMCLEAR(mbox)); } static void __ipc_send(int mbox, u32 *data) { int i; for (i = 0; i < 7; i++) - __raw_writel(data[i], ipc_base + IPCMxDR(mbox, i)); - __raw_writel(0x1, ipc_base + IPCMxSEND(mbox)); + writel_relaxed(data[i], ipc_base + IPCMxDR(mbox, i)); + writel_relaxed(0x1, ipc_base + IPCMxSEND(mbox)); } static u32 __ipc_rcv(int mbox, u32 *data) { int i; for (i = 0; i < 7; i++) - data[i] = __raw_readl(ipc_base + IPCMxDR(mbox, i)); + data[i] = readl_relaxed(ipc_base + IPCMxDR(mbox, i)); return data[1]; } @@ -112,15 +112,15 @@ static irqreturn_t ipc_handler(int irq, void *dev) u32 irq_stat; u32 data[7]; - irq_stat = __raw_readl(ipc_base + IPCMMIS(1)); + irq_stat = readl_relaxed(ipc_base + IPCMMIS(1)); if (irq_stat & MBOX_MASK(IPC_TX_MBOX)) { - __raw_writel(0, ipc_base + IPCMxSEND(IPC_TX_MBOX)); + writel_relaxed(0, ipc_base + IPCMxSEND(IPC_TX_MBOX)); complete(&ipc_completion); } if (irq_stat & MBOX_MASK(IPC_RX_MBOX)) { __ipc_rcv(IPC_RX_MBOX, data); atomic_notifier_call_chain(&ipc_notifier, data[0], data + 1); - __raw_writel(2, ipc_base + IPCMxSEND(IPC_RX_MBOX)); + writel_relaxed(2, ipc_base + IPCMxSEND(IPC_RX_MBOX)); } return IRQ_HANDLED; @@ -146,7 +146,7 @@ static int pl320_probe(struct amba_device *adev, const struct amba_id *id) if (ipc_base == NULL) return -ENOMEM; - __raw_writel(0, ipc_base + IPCMxSEND(IPC_TX_MBOX)); + writel_relaxed(0, ipc_base + IPCMxSEND(IPC_TX_MBOX)); ipc_irq = adev->irq[0]; ret = request_irq(ipc_irq, ipc_handler, 0, dev_name(&adev->dev), NULL); @@ -154,20 +154,20 @@ static int pl320_probe(struct amba_device *adev, const struct amba_id *id) goto err; /* Init slow mailbox */ - __raw_writel(CHAN_MASK(A9_SOURCE), - ipc_base + IPCMxSOURCE(IPC_TX_MBOX)); - __raw_writel(CHAN_MASK(M3_SOURCE), - ipc_base + IPCMxDSET(IPC_TX_MBOX)); - __raw_writel(CHAN_MASK(M3_SOURCE) | CHAN_MASK(A9_SOURCE), - ipc_base + IPCMxMSET(IPC_TX_MBOX)); + writel_relaxed(CHAN_MASK(A9_SOURCE), + ipc_base + IPCMxSOURCE(IPC_TX_MBOX)); + writel_relaxed(CHAN_MASK(M3_SOURCE), + ipc_base + IPCMxDSET(IPC_TX_MBOX)); + writel_relaxed(CHAN_MASK(M3_SOURCE) | CHAN_MASK(A9_SOURCE), + ipc_base + IPCMxMSET(IPC_TX_MBOX)); /* Init receive mailbox */ - __raw_writel(CHAN_MASK(M3_SOURCE), - ipc_base + IPCMxSOURCE(IPC_RX_MBOX)); - __raw_writel(CHAN_MASK(A9_SOURCE), - ipc_base + IPCMxDSET(IPC_RX_MBOX)); - __raw_writel(CHAN_MASK(M3_SOURCE) | CHAN_MASK(A9_SOURCE), - ipc_base + IPCMxMSET(IPC_RX_MBOX)); + writel_relaxed(CHAN_MASK(M3_SOURCE), + ipc_base + IPCMxSOURCE(IPC_RX_MBOX)); + writel_relaxed(CHAN_MASK(A9_SOURCE), + ipc_base + IPCMxDSET(IPC_RX_MBOX)); + writel_relaxed(CHAN_MASK(M3_SOURCE) | CHAN_MASK(A9_SOURCE), + ipc_base + IPCMxMSET(IPC_RX_MBOX)); return 0; err: