From patchwork Mon Sep 24 19:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10612811 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 8F65D6CB for ; Mon, 24 Sep 2018 19:14:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F002A2A0 for ; Mon, 24 Sep 2018 19:14:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 727DB2A563; Mon, 24 Sep 2018 19:14:24 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 F2B932A2A0 for ; Mon, 24 Sep 2018 19:14:23 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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=1kM3wOqVDWKy6QeZ9+5FwMTzdSuYzNQnOBxA9f0zirw=; b=AUOD7Xi1e4OPx1dPttP0GqLqLy 17jiJH9hjQ+C4sV0p/MOUnqrp08B++O0vLvLeGhF06I1bsjPHU62EQAxrddID+VGjQqTP/XlivdAa ji3z19W9fY+NAiA9LAsxneeb3v4XTWAyUjgHrIRIgPPTFI0gyWni164yIudvHuh/fcfrpV8EgySUi 3M9aMhLmigllWQROo3QCzC6jIzAINYAbkgmsfH2DOgiv5E1O02Pf51DnP1a7vqoC1vaVXwwbkbblc hRfj1AqIFVtreikm59UxKIFpeyPlDTrAFal9FZm3DxkNsO5P+ohYXJdpo0xj/12WQuhzUxM7gV3tt zPqFsNTw==; 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 1g4WJJ-0005rz-Vb; Mon, 24 Sep 2018 19:14:21 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4WAH-0000hr-EQ for linux-amlogic@lists.infradead.org; Mon, 24 Sep 2018 19:05:29 +0000 Received: by mail-wm1-x343.google.com with SMTP id q8-v6so11143058wmq.4 for ; Mon, 24 Sep 2018 12:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5ovJ89b4f0jIndSx6u2gnoJYN1C5zis8Q20nM2X/nQY=; b=sAt12VCAmFy8D2MjfHDSBJ+EIZUfCBgQ25eJvT6t4fIadfZJvQpl1nZfdCv2+krP0z 0xfn+NnWS1u0MWXHPK1+OMqSaMifEva8QjL1TXXzL/+PmVO7yb+gpWIj/9c5V4AzCbTY 0WVwwJn8Ckd/qwuqiz/lPH/JVg9wRXTYS4urzPJcXIER+dMxv+eGzNgFSnDjiQXShGX0 vN8R8cZzM0913Mvu2QxBFvVzzxvNcVnU/oRUs/S/jOHcjnRsc5S3CEWXOvEH6gHncxsk F42FG1MlX0qLr7/aZRGAXOtRKtLXtFKGdJ+S2Kk6tkWMzO07+JZJMU1WBHkVDqNmJ/y8 PZ7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5ovJ89b4f0jIndSx6u2gnoJYN1C5zis8Q20nM2X/nQY=; b=SX6G1d9MOzxOlhYfDygTRJdlyl1/p2NfmOdrlF/mNNw5e0bYmKOE+XJABJCYeTdyFg ePf5/Tw0I0zvTXza3yZMBRx7FYwIGGdSLyj8SYj+ji7iiQBNpzUAUK5rmWMLNpXwE7IB IKrwmpOA1IcziPay75e8ayY7DET/1Yk+9aIBcO3RfT1wBKQGgazLxuQSCiapx5KnJPiD JfDh6RbxoY+U/Jcwg3sJd90gbAppf1XjyPoaewrBYiMDtdc78FCn+xbDpuuGG2cYAKg4 OaRdj3hvoeFqBpGn2d0D2Kga9iTfmxNimJrB29fpVIqP5XMiEK9iSXW/M/0uLM8TpzC7 RPRw== X-Gm-Message-State: ABuFfoi/REeyxa69D0V0yAsIfbSDL4g2E8Esp2dBRBf3I1IukG3xu1KV sA2PbhbN+C7AmNDp0WiE7Jy8GQ== X-Google-Smtp-Source: ACcGV60mh5eBGHuaDzCS9co1quv6trb6fadSI2JQjt8gEX5/GILMOV0RbZqiY8RxsmKXDTCU2dlzuQ== X-Received: by 2002:a1c:4857:: with SMTP id v84-v6mr8222775wma.8.1537815871871; Mon, 24 Sep 2018 12:04:31 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id e141-v6sm27721433wmd.32.2018.09.24.12.04.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Sep 2018 12:04:31 -0700 (PDT) From: Corentin Labbe To: Gilles.Muller@lip6.fr, Julia.Lawall@lip6.fr, agust@denx.de, airlied@linux.ie, alexandre.torgue@st.com, alistair@popple.id.au, benh@kernel.crashing.org, carlo@caione.org, davem@davemloft.net, galak@kernel.crashing.org, joabreu@synopsys.com, khilman@baylibre.com, maxime.ripard@bootlin.com, michal.lkml@markovi.net, mpe@ellerman.id.au, mporter@kernel.crashing.org, narmstrong@baylibre.com, nicolas.palix@imag.fr, oss@buserror.net, paulus@samba.org, peppe.cavallaro@st.com, tj@kernel.org, vitb@kernel.crashing.org, wens@csie.org Subject: [PATCH v2 5/7] net: ethernet: stmmac: dwmac-sun8i: use xxxsetbits32 Date: Mon, 24 Sep 2018 19:04:14 +0000 Message-Id: <1537815856-31728-6-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537815856-31728-1-git-send-email-clabbe@baylibre.com> References: <1537815856-31728-1-git-send-email-clabbe@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180924_120501_544785_3657F9B0 X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Corentin Labbe , linux-amlogic@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, cocci@systeme.lip6.fr, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch convert dwmac-sun8i driver to use all xxxsetbits32 functions. Signed-off-by: Corentin Labbe --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 62 ++++++----------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index f9a61f90cfbc..74067a59af50 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "stmmac.h" #include "stmmac_platform.h" @@ -342,50 +343,30 @@ static void sun8i_dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan) static void sun8i_dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan) { - u32 v; - - v = readl(ioaddr + EMAC_TX_CTL1); - v |= EMAC_TX_DMA_START; - v |= EMAC_TX_DMA_EN; - writel(v, ioaddr + EMAC_TX_CTL1); + setbits_le32(ioaddr + EMAC_TX_CTL1, + EMAC_TX_DMA_START | EMAC_TX_DMA_EN); } static void sun8i_dwmac_enable_dma_transmission(void __iomem *ioaddr) { - u32 v; - - v = readl(ioaddr + EMAC_TX_CTL1); - v |= EMAC_TX_DMA_START; - v |= EMAC_TX_DMA_EN; - writel(v, ioaddr + EMAC_TX_CTL1); + setbits_le32(ioaddr + EMAC_TX_CTL1, + EMAC_TX_DMA_START | EMAC_TX_DMA_EN); } static void sun8i_dwmac_dma_stop_tx(void __iomem *ioaddr, u32 chan) { - u32 v; - - v = readl(ioaddr + EMAC_TX_CTL1); - v &= ~EMAC_TX_DMA_EN; - writel(v, ioaddr + EMAC_TX_CTL1); + clrbits_le32(ioaddr + EMAC_TX_CTL1, EMAC_TX_DMA_EN); } static void sun8i_dwmac_dma_start_rx(void __iomem *ioaddr, u32 chan) { - u32 v; - - v = readl(ioaddr + EMAC_RX_CTL1); - v |= EMAC_RX_DMA_START; - v |= EMAC_RX_DMA_EN; - writel(v, ioaddr + EMAC_RX_CTL1); + setbits_le32(ioaddr + EMAC_RX_CTL1, + EMAC_RX_DMA_START | EMAC_RX_DMA_EN); } static void sun8i_dwmac_dma_stop_rx(void __iomem *ioaddr, u32 chan) { - u32 v; - - v = readl(ioaddr + EMAC_RX_CTL1); - v &= ~EMAC_RX_DMA_EN; - writel(v, ioaddr + EMAC_RX_CTL1); + clrbits_le32(ioaddr + EMAC_RX_CTL1, EMAC_RX_DMA_EN); } static int sun8i_dwmac_dma_interrupt(void __iomem *ioaddr, @@ -578,7 +559,6 @@ static void sun8i_dwmac_set_umac_addr(struct mac_device_info *hw, unsigned int reg_n) { void __iomem *ioaddr = hw->pcsr; - u32 v; if (!addr) { writel(0, ioaddr + EMAC_MACADDR_HI(reg_n)); @@ -588,9 +568,8 @@ static void sun8i_dwmac_set_umac_addr(struct mac_device_info *hw, stmmac_set_mac_addr(ioaddr, addr, EMAC_MACADDR_HI(reg_n), EMAC_MACADDR_LO(reg_n)); if (reg_n > 0) { - v = readl(ioaddr + EMAC_MACADDR_HI(reg_n)); - v |= MAC_ADDR_TYPE_DST; - writel(v, ioaddr + EMAC_MACADDR_HI(reg_n)); + setbits_le32(ioaddr + EMAC_MACADDR_HI(reg_n), + MAC_ADDR_TYPE_DST); } } @@ -608,11 +587,8 @@ static void sun8i_dwmac_get_umac_addr(struct mac_device_info *hw, static int sun8i_dwmac_rx_ipc_enable(struct mac_device_info *hw) { void __iomem *ioaddr = hw->pcsr; - u32 v; - v = readl(ioaddr + EMAC_RX_CTL0); - v |= EMAC_RX_DO_CRC; - writel(v, ioaddr + EMAC_RX_CTL0); + setbits_le32(ioaddr + EMAC_RX_CTL0, EMAC_RX_DO_CRC); return 1; } @@ -662,21 +638,15 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, unsigned int pause_time, u32 tx_cnt) { void __iomem *ioaddr = hw->pcsr; - u32 v; - v = readl(ioaddr + EMAC_RX_CTL0); if (fc == FLOW_AUTO) - v |= EMAC_RX_FLOW_CTL_EN; + setbits_le32(ioaddr + EMAC_RX_CTL0, EMAC_RX_FLOW_CTL_EN); else - v &= ~EMAC_RX_FLOW_CTL_EN; - writel(v, ioaddr + EMAC_RX_CTL0); - - v = readl(ioaddr + EMAC_TX_FLOW_CTL); + clrbits_le32(ioaddr + EMAC_RX_CTL0, EMAC_RX_FLOW_CTL_EN); if (fc == FLOW_AUTO) - v |= EMAC_TX_FLOW_CTL_EN; + setbits_le32(ioaddr + EMAC_TX_FLOW_CTL, EMAC_TX_FLOW_CTL_EN); else - v &= ~EMAC_TX_FLOW_CTL_EN; - writel(v, ioaddr + EMAC_TX_FLOW_CTL); + clrbits_le32(ioaddr + EMAC_TX_FLOW_CTL, EMAC_TX_FLOW_CTL_EN); } static int sun8i_dwmac_reset(struct stmmac_priv *priv)