From patchwork Wed Oct 24 07:35:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10654323 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 7D98413A9 for ; Wed, 24 Oct 2018 07:54:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6655329F74 for ; Wed, 24 Oct 2018 07:54:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5867B2A060; Wed, 24 Oct 2018 07:54:38 +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=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 DADB729F74 for ; Wed, 24 Oct 2018 07:54:37 +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=+R03vC/+Btr1hbdtu0sV3I611ClIDqBHmUSj7lRWHWs=; b=k6g6HyQPeqWuyhhLWt5k44/yI4 ui++XKMPH4Fcl2ZCg1vXIZcvBVUFOHDDPK4hzXBGOiDIrDwBL0wXN5vfXNGw7KLpgYgjuTqRuNAEt p1pZu3bv+c6TQdFpuyQShWbP7/KiMjSmudSB8hxvLwKpIbp1bea3+hk9uz/e0J1dj3Umt7LMz3JI/ xy55hKf1vkI2XDaQmQ/U3Us/NVOg6UyCN8OnqYp0MJX4YZFCz0VSXHdQQKGe0KxWxcxnMPFrNkvMu bAluIyRUwr0deBUfL9/zYxfRonMWHpGpbY5RnWZV+SUFBbQVdlG0EutzNv+FwATFg5vO7A5IVdUgD xQ8Wqw2w==; 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 1gFDzv-0002Ry-B7; Wed, 24 Oct 2018 07:54:35 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDsS-0005cJ-Lc for linux-amlogic@bombadil.infradead.org; Wed, 24 Oct 2018 07:46:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=L88Lfnmc/N8gUEWTdkG+BxTm3V0b7bIO1yVIVTZbeG4=; b=taSzREgzqDN5hHVxpxEprW/lz ZEGJJNdfH/FYw0G7Awl2xwEFRJt6fwYe8GxR7k9sXieg9lXdHqUpv6c1up2FWGI40J0FsECwq0z/p XY47+nR1OZfOtiqeWRM3hY0EWvq0BUEJN3YM2usakXUwabumoYKrtoYC2ItBnwwvCord2eVTX8nz2 fWz8apWfoXTDT5Gu3TXDZD0ty454q/5HQ04TPi4KzU8sXbSU/E7sSuLfZf5BfYAHgG4JkSDko0vDN 6zhJwFvtsfQQx9G1Nq7RS7hLgRtBBi9Wn10JY+Ih717oa4gOtc2hBw2IcaeF3vV6PJNhw0Nx6U/lb thzo+RHsQ==; Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDiE-0003o1-P9 for linux-amlogic@lists.infradead.org; Wed, 24 Oct 2018 07:36:24 +0000 Received: by mail-wm1-x342.google.com with SMTP id s10-v6so2159151wmc.5 for ; Wed, 24 Oct 2018 00:36:08 -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=L88Lfnmc/N8gUEWTdkG+BxTm3V0b7bIO1yVIVTZbeG4=; b=x/TSjgu25TvNgs9VmJZuSAl8dvUbcaEScHcOHuJ4At9u0M+pDuvoCmxajfBnDhK9Uf iZsnkrbPHXKbkM5ysIVj65CfzAz+CJ32utolctFrG0mB0jM5ZB8da+esje0wiSXy2jde Vxp2kSNfGRNMTA8zLH3iQvREO+Qc8nYzq7wT1WMrezbMWTDWCi2UvxXUzi2NOMQIPf0t GlNJJ7gg31lbwuw+nT061+8p9esBOqEahF7LvEvPe8qTG/YCjkYiZt/4Fu1B92CwI4fr TxagemSD/W4RYefOKNBg47DUlYlaPMmqZ4XXh0h3fWEik67bFVTaee1Cy3MqC9SZ3j01 mJXQ== 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=L88Lfnmc/N8gUEWTdkG+BxTm3V0b7bIO1yVIVTZbeG4=; b=HRRRrofzrMI4Aa1HjIZ2U7rKgdeK8S6+qdzBb9LiaEUANDWw7M8UWAgQRVFqqB2b06 YCO5cbfCo+xH8+1qVKj53sGmegp9dyfc7c701pSBTbODw+tHdeOvsCXRGeCqWpjZdub7 5qF7BhpRICj7csFrav+eS43sRKO0SsNYniVY/beffYtqYqmxKEVz2O8fOub4SJCYFKHb Aa7bcQ7UKzBBCiEWyf3f9/3j07P1Res+8D0H1UEXeRtJY1yELYC/qOHm4rRTNUCkJ3p1 nYIPLpVdRcqGlqOlkZw9sSIjOPgKQO9ZDHu2oHfm07Vqeb/icGs+JCqYo3AI7CZ5OX1F EPmg== X-Gm-Message-State: AGRZ1gJL9IpTL/BpB5i/GJo1LZLxNgnI7Pmav+clRRvB57+2VtBC+QZ8 eKS2RAznSyQfrUu8KXhY+0pdOA== X-Google-Smtp-Source: AJdET5crZhAXz1KRb0S1BlPR0jMga616tJ5k9RmjLz/x7WzW7Bu/VUIAzb2xZyWoSP6tOR/tpBKDLw== X-Received: by 2002:a1c:a851:: with SMTP id r78-v6mr1420888wme.97.1540366567519; Wed, 24 Oct 2018 00:36:07 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id b139-v6sm6254351wmd.36.2018.10.24.00.36.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Oct 2018 00:36:06 -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, matthias.bgg@gmail.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 v3 5/7] net: ethernet: stmmac: dwmac-sun8i: use xxxsetbits_le32 Date: Wed, 24 Oct 2018 07:35:51 +0000 Message-Id: <1540366553-18541-6-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540366553-18541-1-git-send-email-clabbe@baylibre.com> References: <1540366553-18541-1-git-send-email-clabbe@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181024_083619_556261_2EBF8C83 X-CRM114-Status: GOOD ( 13.27 ) 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, linux-sunxi@googlegroups.com, linux-mediatek@lists.infradead.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 xxxsetbits_le32 functions. Signed-off-by: Corentin Labbe --- .../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)