From patchwork Fri Sep 20 20:18:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20488 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6235E25DFC for ; Fri, 20 Sep 2013 20:18:18 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id u18sf830883qcx.2 for ; Fri, 20 Sep 2013 13:18:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version: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=wp8RsUackpI6GEIxFREdyVvYDO6M1DR2QF0W0tNLPrc=; b=GdHVG8+oa5JkghY/T3TUbHyjcS8FREGGnQDpP06x9v2AM4JRNoGHt34LaA2ktl1L9X lJ+fTfuzKUuGJvz6ayIW2BT+TuRC4b0klwADhxxIZqFU8pIDJ5+BV58AGSyMXD2Sc4Ve RRhKmw5ZBqladjgUOtu6NhpGp69xWuEBaJi+iBFcsF+QagYmTmacFOOxRZpfYJOeBv1e oUFucEb/3Z8mUpz8TBRPxRA32F93D5oM+hPVApz6P8BXecqifR1guqzlcF8tj3WN2YTk UlmOVGjFlFqTtj8uJOvFeCtrMpVWBJv9paJtO4R74SqD+n+WZczk33vSBnTOUExAqwAP uWRw== X-Gm-Message-State: ALoCoQnQjOBJPDaRibEcHEtIBIQ47ASc68wi4UvmYJC7ttprpuY2rOZlasEL5iQCB1c09gvaNn7M X-Received: by 10.236.198.197 with SMTP id v45mr3199529yhn.26.1379708298220; Fri, 20 Sep 2013 13:18:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.231 with SMTP id y7ls382376qeu.39.gmail; Fri, 20 Sep 2013 13:18:18 -0700 (PDT) X-Received: by 10.221.40.10 with SMTP id to10mr2876898vcb.22.1379708298110; Fri, 20 Sep 2013 13:18:18 -0700 (PDT) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id oh2si3401704vcb.10.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:18:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.47 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.47; Received: by mail-vb0-f47.google.com with SMTP id h10so670389vbh.6 for ; Fri, 20 Sep 2013 13:18:18 -0700 (PDT) X-Received: by 10.59.11.69 with SMTP id eg5mr8051067ved.17.1379708298020; Fri, 20 Sep 2013 13:18:18 -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 u4csp36821vcz; Fri, 20 Sep 2013 13:18:17 -0700 (PDT) X-Received: by 10.15.45.8 with SMTP id a8mr13100402eew.1.1379708297077; Fri, 20 Sep 2013 13:18:17 -0700 (PDT) Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com [209.85.215.174]) by mx.google.com with ESMTPS id w44si12633591eef.225.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:18:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.174 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.174; Received: by mail-ea0-f174.google.com with SMTP id z15so491662ead.5 for ; Fri, 20 Sep 2013 13:18:16 -0700 (PDT) X-Received: by 10.14.177.199 with SMTP id d47mr13066181eem.14.1379708296522; Fri, 20 Sep 2013 13:18:16 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id a43sm21953191eep.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:18:15 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lennert Buytenhek , Dan Williams , Mikael Pettersson , Aaro Koskinen Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 7/8] gpio: iop: use readl/writel accessors Date: Fri, 20 Sep 2013 22:18:12 +0200 Message-Id: <1379708292-8087-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.47 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: Aaro Koskinen 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); }