From patchwork Wed Oct 24 07:35:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 10654313 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 8F6D713A4 for ; Wed, 24 Oct 2018 07:47:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B0D52A3A2 for ; Wed, 24 Oct 2018 07:47:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B5502A686; Wed, 24 Oct 2018 07:47:37 +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 E43D52A3A2 for ; Wed, 24 Oct 2018 07:47:36 +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=eC+PKEGelchQjMB8v2/E8Bm5C+26v3NE8C3LAXgT1js=; b=nMZa8Hb36pFg+KDDB7HXHwoo4g KeKYWpysVT1nh5GHw9H/bz/P9pJAzNOLgM4I4beW1p0H05FdqmhIkLQtamW3aFu8Mc26qc9ODPdaE Lik7PRw0GYympM2L0W3lfBtbAshtUCGrJyGRxsoDUEiuL54GAhG4FpWWKPXfp+kZv54jmhtwDSq2T vngPPFvzZquU3wz31ja2JXU+l3nUaK82Q427WiO9uWWQN55oeQr9AnoxqqbXwXVjr1pyoK9AOiF9z IJQs58hROuWyI2s5dRMuRZh8bQ/cHGwClbznnm7iS3z1A9nM7IzbbRT9Ejo3/bE4fOfwjxNX9U6/6 XsazSHwg==; 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 1gFDt6-00085S-9K; Wed, 24 Oct 2018 07:47:32 +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 1gFDsg-0007o0-Bw for linux-amlogic@bombadil.infradead.org; Wed, 24 Oct 2018 07:47:06 +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=ikxhkAlY3IsVD60OGSXDQ3Qj8tMnntG3LfkwFZuf0hc=; b=tJediXdA9PPBauVYhAbuDiUle aCfVirvMoA5v8rl66Siz+6PeF+DRJSpoKmHzAopPGiWp0hudr/vl5JPNbERhIZh+DRGWpqrPSgZyc zKrPtpkt5GMUfxzFw0oKq5FL0YkwY3DAdJGqE/CPpMbinS0hdaU83os062bAjDmTdX5EIThrM+KJ1 jUlkwmKrYS1DxFB1mftH5HFkZKwdYEM0GPjLRBUnxW5GfH6+osvbFuUqsBduJIXZ8c7KU9v3Wv/Dp iAAlI5SUuuRTBCxGLVUHh3v/Vet4bNfRtsSWneL0etlKeVYu15bGmQhPrh8jP9zPMvMfqjyrz0iaJ 8sMqd6v0A==; Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDiD-0003nk-Qs for linux-amlogic@lists.infradead.org; Wed, 24 Oct 2018 07:36:21 +0000 Received: by mail-wr1-x442.google.com with SMTP id g9-v6so4375413wrq.4 for ; Wed, 24 Oct 2018 00:36:07 -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=ikxhkAlY3IsVD60OGSXDQ3Qj8tMnntG3LfkwFZuf0hc=; b=1RL0pv17yJgRj0+4QnhogGdwK44kO6UBlmB9GnWzUCr7QP+GMAGLU9g4xhqdWC3ELs pWQLV/+p/WHKEm8BdDd10R3h2jCMWKXpW9ZxV9PSvhLnVbnZ7+WSewEWuYCbzFLbDb6+ VJWEYOdzAFnVhn8UVws9j04g6NVrbncSLmyFkrpLwZ9bmd62F6KUfQaZBjOlgF9jUAco GD6aZ8naaJ3NvjKq/Iq33fBj3RkVTn8sDYHqmWvD3VGApLL85o6/RJEtO0+x7e3dWkp4 lcLC/Md6CwjFt7/Bzy9MOJ6ybl9DAscaGvyi6CZVr7fuSvHeMZpKKSiNJmMHrpRSA3nf z/UQ== 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=ikxhkAlY3IsVD60OGSXDQ3Qj8tMnntG3LfkwFZuf0hc=; b=DSYxzgtAGEBWJJCSP7qO+R4SvnYe7kDtd12bdFCIE3CRgc/1jzrI/bNihlh0BIYc4v 8bPxgpsbU1d8DAmLo0nDRTAWe5GDvsRi2VndEBjknDrG9XKZKhR9XSNaLGUM2+fLueYt iXUHrCS3XHY42ktZ7Rx3DQYoas2Box65XWEP9KBRuis/+QtQ28YpO4ddWOFX+lPz1foy YyqEpegonHQJLTVlignaDpagt3B4cIMvPoSi/o12cYwu161/ShZGc3m9RaEUSZ1To4/g 4m5hwoqZYS4xPBGsY4+m5RI2GW66SQX1C9eWggxclchUYTfxZ+drBlnTJHUs062SR9fG OLXw== X-Gm-Message-State: AGRZ1gKaH9h0+yALWK3XzQjjuTayxiB1f4tcrYM7xqxQrJEoDt4F6yMw 2t4ReOpBi/2lLv7Jh7oCRWRxOQ== X-Google-Smtp-Source: AJdET5fgLMMx5BIAi763+0NbrSmi/Rw+CJVINiJBNj1b9j92EgeOf+sJocfQ7cCvbhY41n/8xgmVnA== X-Received: by 2002:adf:e28d:: with SMTP id v13-v6mr1530852wri.139.1540366566485; Wed, 24 Oct 2018 00:36:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Oct 2018 00:36:05 -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 4/7] ata: ahci_sunxi: use xxxsetbitsi_le32 functions Date: Wed, 24 Oct 2018 07:35:50 +0000 Message-Id: <1540366553-18541-5-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_083617_912248_9ADDDAA0 X-CRM114-Status: GOOD ( 13.37 ) 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 converts ahci_sunxi to use xxxsetbits_le32 functions Signed-off-by: Corentin Labbe --- drivers/ata/ahci_sunxi.c | 62 +++++++++++----------------------------- 1 file changed, 17 insertions(+), 45 deletions(-) diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c index 911710643305..69c2e01c3d52 100644 --- a/drivers/ata/ahci_sunxi.c +++ b/drivers/ata/ahci_sunxi.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "ahci.h" #define DRV_NAME "ahci-sunxi" @@ -58,34 +59,6 @@ MODULE_PARM_DESC(enable_pmp, #define AHCI_P0PHYCR 0x0178 #define AHCI_P0PHYSR 0x017c -static void sunxi_clrbits(void __iomem *reg, u32 clr_val) -{ - u32 reg_val; - - reg_val = readl(reg); - reg_val &= ~(clr_val); - writel(reg_val, reg); -} - -static void sunxi_setbits(void __iomem *reg, u32 set_val) -{ - u32 reg_val; - - reg_val = readl(reg); - reg_val |= set_val; - writel(reg_val, reg); -} - -static void sunxi_clrsetbits(void __iomem *reg, u32 clr_val, u32 set_val) -{ - u32 reg_val; - - reg_val = readl(reg); - reg_val &= ~(clr_val); - reg_val |= set_val; - writel(reg_val, reg); -} - static u32 sunxi_getbits(void __iomem *reg, u8 mask, u8 shift) { return (readl(reg) >> shift) & mask; @@ -100,22 +73,21 @@ static int ahci_sunxi_phy_init(struct device *dev, void __iomem *reg_base) writel(0, reg_base + AHCI_RWCR); msleep(5); - sunxi_setbits(reg_base + AHCI_PHYCS1R, BIT(19)); - sunxi_clrsetbits(reg_base + AHCI_PHYCS0R, - (0x7 << 24), - (0x5 << 24) | BIT(23) | BIT(18)); - sunxi_clrsetbits(reg_base + AHCI_PHYCS1R, - (0x3 << 16) | (0x1f << 8) | (0x3 << 6), - (0x2 << 16) | (0x6 << 8) | (0x2 << 6)); - sunxi_setbits(reg_base + AHCI_PHYCS1R, BIT(28) | BIT(15)); - sunxi_clrbits(reg_base + AHCI_PHYCS1R, BIT(19)); - sunxi_clrsetbits(reg_base + AHCI_PHYCS0R, - (0x7 << 20), (0x3 << 20)); - sunxi_clrsetbits(reg_base + AHCI_PHYCS2R, - (0x1f << 5), (0x19 << 5)); + setbits_le32(reg_base + AHCI_PHYCS1R, BIT(19)); + clrsetbits_le32(reg_base + AHCI_PHYCS0R, (0x7 << 24), + (0x5 << 24) | BIT(23) | BIT(18)); + clrsetbits_le32(reg_base + AHCI_PHYCS1R, + (0x3 << 16) | (0x1f << 8) | (0x3 << 6), + (0x2 << 16) | (0x6 << 8) | (0x2 << 6)); + setbits_le32(reg_base + AHCI_PHYCS1R, BIT(28) | BIT(15)); + clrbits_le32(reg_base + AHCI_PHYCS1R, BIT(19)); + clrsetbits_le32(reg_base + AHCI_PHYCS0R, + (0x7 << 20), (0x3 << 20)); + clrsetbits_le32(reg_base + AHCI_PHYCS2R, + (0x1f << 5), (0x19 << 5)); msleep(5); - sunxi_setbits(reg_base + AHCI_PHYCS0R, (0x1 << 19)); + setbits_le32(reg_base + AHCI_PHYCS0R, (0x1 << 19)); timeout = 250; /* Power up takes aprox 50 us */ do { @@ -130,7 +102,7 @@ static int ahci_sunxi_phy_init(struct device *dev, void __iomem *reg_base) udelay(1); } while (1); - sunxi_setbits(reg_base + AHCI_PHYCS2R, (0x1 << 24)); + setbits_le32(reg_base + AHCI_PHYCS2R, (0x1 << 24)); timeout = 100; /* Calibration takes aprox 10 us */ do { @@ -158,10 +130,10 @@ static void ahci_sunxi_start_engine(struct ata_port *ap) struct ahci_host_priv *hpriv = ap->host->private_data; /* Setup DMA before DMA start */ - sunxi_clrsetbits(hpriv->mmio + AHCI_P0DMACR, 0x0000ff00, 0x00004400); + clrsetbits_le32(hpriv->mmio + AHCI_P0DMACR, 0x0000ff00, 0x00004400); /* Start DMA */ - sunxi_setbits(port_mmio + PORT_CMD, PORT_CMD_START); + setbits_le32(port_mmio + PORT_CMD, PORT_CMD_START); } static const struct ata_port_info ahci_sunxi_port_info = {