From patchwork Mon Sep 9 15:41:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 19843 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5B2D025A57 for ; Mon, 9 Sep 2013 15:41:17 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id gd11sf7365012vcb.0 for ; Mon, 09 Sep 2013 08:41:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=OCP9zYEHc2b233nEEWFR7ggGDRGw3d16cPTdL7dQDyA=; b=gaF1PSJJbhML0zaIslP8YqpE1sXUtONY+PzFLlD8NHAafZjmzEeBPj96l+8zgUt+jm 47SfD89uiPqFNUiz4UVKGsNtb2B9xEs7qJFdZl3rLCXU2SNVuon15QXg4yVstfG6brJm MaEiuRc1kIfZAxsEJ/JjIXqQZ5RvhilvrBC+vUYW098jX4NA/VZJhfbOeW02fxfmGUSP 23Pip8qXqMLb4gvIOdGmGAIvYgMEYS9TechdeYfsxAX9Qb7nGr3tEZAQtnr+5crI6GPB pvwVckJ01oUzmVcvV1uf1VnKL41DcsEDek/2ifPrO5gnlGtK2XLhrsbwhrOmNWj0cX1Q aJhQ== X-Received: by 10.236.83.82 with SMTP id p58mr4347448yhe.28.1378741277098; Mon, 09 Sep 2013 08:41:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.97.66 with SMTP id dy2ls1921642qeb.85.gmail; Mon, 09 Sep 2013 08:41:17 -0700 (PDT) X-Received: by 10.220.244.132 with SMTP id lq4mr630533vcb.31.1378741277017; Mon, 09 Sep 2013 08:41:17 -0700 (PDT) Received: from mail-vb0-f44.google.com (mail-vb0-f44.google.com [209.85.212.44]) by mx.google.com with ESMTPS id o5si3271376vdw.154.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 08:41:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.44; Received: by mail-vb0-f44.google.com with SMTP id e13so4041838vbg.17 for ; Mon, 09 Sep 2013 08:41:16 -0700 (PDT) X-Gm-Message-State: ALoCoQkx2ba27qCgqppGl9vfznZHVFoiwS0aVH49z+3AoYgloIkgCxoBsqu69/rlb2lodCLVZ9s8 X-Received: by 10.52.230.202 with SMTP id ta10mr496247vdc.41.1378741276920; Mon, 09 Sep 2013 08:41:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp94171vcz; Mon, 9 Sep 2013 08:41:16 -0700 (PDT) X-Received: by 10.152.3.42 with SMTP id 10mr7372916laz.22.1378741275833; Mon, 09 Sep 2013 08:41:15 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id nb3si5873524lbb.24.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 08:41:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.179 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id x18so5053477lbi.24 for ; Mon, 09 Sep 2013 08:41:15 -0700 (PDT) X-Received: by 10.112.168.35 with SMTP id zt3mr16714870lbb.11.1378741275180; Mon, 09 Sep 2013 08:41:15 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id u20sm6250957lbh.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 09 Sep 2013 08:41:14 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lennert Buytenhek , Dan Williams , Mikael Pettersson Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 7/8] gpio: iop: use readl/writel accessors Date: Mon, 9 Sep 2013 17:41:11 +0200 Message-Id: <1378741271-13106-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.44 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Use the standard 32bit I/O accessors instead of just assigning addresses. Cc: Lennert Buytenhek Cc: Dan Williams Cc: Mikael Pettersson Signed-off-by: Linus Walleij --- drivers/gpio/gpio-iop.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpio-iop.c b/drivers/gpio/gpio-iop.c index 24a86b0..0d991d7 100644 --- a/drivers/gpio/gpio-iop.c +++ b/drivers/gpio/gpio-iop.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #define IOP3XX_N_GPIOS 8 @@ -29,38 +31,44 @@ static void __iomem *base; #define IOP3XX_GPIO_REG(reg) (base + (reg)) -#define IOP3XX_GPOE (volatile u32 *)IOP3XX_GPIO_REG(0x0000) -#define IOP3XX_GPID (volatile u32 *)IOP3XX_GPIO_REG(0x0004) -#define IOP3XX_GPOD (volatile u32 *)IOP3XX_GPIO_REG(0x0008) +#define IOP3XX_GPOE IOP3XX_GPIO_REG(0x0000) +#define IOP3XX_GPID IOP3XX_GPIO_REG(0x0004) +#define IOP3XX_GPOD IOP3XX_GPIO_REG(0x0008) static void gpio_line_config(int line, int direction) { unsigned long flags; + u32 val; local_irq_save(flags); + val = readl(IOP3XX_GPOE); if (direction == GPIO_IN) { - *IOP3XX_GPOE |= 1 << line; + val |= BIT(line); } else if (direction == GPIO_OUT) { - *IOP3XX_GPOE &= ~(1 << line); + val &= ~BIT(line); } + writel(val, IOP3XX_GPOE); local_irq_restore(flags); } static int gpio_line_get(int line) { - return !!(*IOP3XX_GPID & (1 << line)); + return !!(readl(IOP3XX_GPID) & BIT(line)); } static void gpio_line_set(int line, int value) { unsigned long flags; + u32 val; local_irq_save(flags); + val = readl(IOP3XX_GPOD); if (value == GPIO_LOW) { - *IOP3XX_GPOD &= ~(1 << line); + val &= ~BIT(line); } else if (value == GPIO_HIGH) { - *IOP3XX_GPOD |= 1 << line; + val |= BIT(line); } + writel(val, IOP3XX_GPOD); local_irq_restore(flags); }