From patchwork Tue Sep 10 12:30:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 19849 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 B088E246A4 for ; Tue, 10 Sep 2013 12:30:09 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id u18sf8903514qcx.2 for ; Tue, 10 Sep 2013 05:30:09 -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=ItUaaBFcrmQ2FYYuZxsDlzpU3j6leVcFoxzYwrUhH7Y=; b=IZ0AlP/we3d3f52HdNRlRo61E+HBn6xWVv34cT8pkaFqrxqJ/cyYd+LkVbPcv8qChd /T8XpaiD1JW9/iSkni5KxJ2Qb83cxoxygFbYGgrs6HywxUxXkEk6wV4wkGfAd2onUGK2 cY+uIfzo+3hY/MCXOpjd/863rLpdhcvgG4II2RrV2PZ/T6bOo5axwsihdVfGyCj9V8TI 98NqlO9bCkvFVtVwo1FfqNydPl+VlRFR2Ko6+ABlgXlSbqtLXM/rjMjkcBA/YcHxzY51 LSu6xHSc+DL6EgIajTONL/rOiO2ctoveZtgsaGt/99yQ+YUYhqj8fuxmsO99fUxCBkoY dIZw== X-Received: by 10.236.109.134 with SMTP id s6mr8150002yhg.32.1378816209560; Tue, 10 Sep 2013 05:30:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.41.5 with SMTP id b5ls2226507qel.70.gmail; Tue, 10 Sep 2013 05:30:09 -0700 (PDT) X-Received: by 10.220.164.70 with SMTP id d6mr8133821vcy.19.1378816209326; Tue, 10 Sep 2013 05:30:09 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id zw10si4366873vdb.96.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:30:09 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ht10so4852753vcb.24 for ; Tue, 10 Sep 2013 05:30:09 -0700 (PDT) X-Gm-Message-State: ALoCoQlKAVxY3kpCThW1hrP/FUxU9nKpfzMraMv/oh4tk9fy7f0reCeIqt40S5OZZOCLSnN6g42Y X-Received: by 10.221.40.10 with SMTP id to10mr1269779vcb.22.1378816209194; Tue, 10 Sep 2013 05:30:09 -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 u4csp18358vcz; Tue, 10 Sep 2013 05:30:08 -0700 (PDT) X-Received: by 10.112.35.232 with SMTP id l8mr1409029lbj.36.1378816208032; Tue, 10 Sep 2013 05:30:08 -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 uf8si7950310lbc.165.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:30:06 -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 x18so6252564lbi.10 for ; Tue, 10 Sep 2013 05:30:06 -0700 (PDT) X-Received: by 10.152.10.99 with SMTP id h3mr21320280lab.13.1378816205535; Tue, 10 Sep 2013 05:30:05 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id oc1sm8481652lbb.3.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 10 Sep 2013 05:30:04 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Imre Kaloz , Krzysztof Halasa Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 1/7] ARM: ixp4xx: convert remaining users to use gpiolib Date: Tue, 10 Sep 2013 14:30:00 +0200 Message-Id: <1378816200-7940-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.220.179 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: , A few call sites inside mach-ixp4xx were still using the custom ixp4xx GPIO API with gpio_line_* accessors, convert all these to use the standard gpiolib functions instead. Also attempt to request and label all GPIOs before use. Cc: Imre Kaloz Cc: Krzysztof Halasa Cc: Alexandre Courbot Signed-off-by: Linus Walleij --- arch/arm/mach-ixp4xx/dsmg600-setup.c | 16 +++++++++------- arch/arm/mach-ixp4xx/ixdp425-setup.c | 8 +++++--- arch/arm/mach-ixp4xx/nas100d-setup.c | 15 ++++++++------- arch/arm/mach-ixp4xx/nslu2-setup.c | 10 +++++----- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index 63de1b3..9095097 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -161,11 +162,8 @@ static struct platform_device *dsmg600_devices[] __initdata = { static void dsmg600_power_off(void) { - /* enable the pwr cntl gpio */ - gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); - - /* poweroff */ - gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); + /* enable the pwr cntl and drive it high */ + gpio_direction_output(DSMG600_PO_GPIO, 1); } /* This is used to make sure the power-button pusher is serious. The button @@ -202,7 +200,7 @@ static void dsmg600_power_handler(unsigned long data) ctrl_alt_del(); /* Change the state of the power LED to "blink" */ - gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); + gpio_set_value(DSMG600_LED_PWR_GPIO, 0); } else { power_button_countdown = PBUTTON_HOLDDOWN_COUNT; } @@ -252,6 +250,7 @@ static void __init dsmg600_init(void) pm_power_off = dsmg600_power_off; + gpio_request(DSMG600_RB_GPIO, "reset button"); if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, IRQF_DISABLED | IRQF_TRIGGER_LOW, "DSM-G600 reset button", NULL) < 0) { @@ -266,7 +265,10 @@ static void __init dsmg600_init(void) */ /* Make sure that the power button GPIO is set up as an input */ - gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); + gpio_request(DSMG600_PB_GPIO, "power button"); + gpio_direction_input(DSMG600_PB_GPIO); + /* Request poweroff GPIO line */ + gpio_request(DSMG600_PO_GPIO, "power off button"); /* Set the initial value for the power button IRQ handler */ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 22d688b..e7b8bef 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -80,10 +81,10 @@ ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_NCE) { - gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); + gpio_set_value(IXDP425_NAND_NCE_PIN, 0); udelay(5); } else - gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); + gpio_set_value(IXDP425_NAND_NCE_PIN, 1); offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0; offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; @@ -227,7 +228,8 @@ static void __init ixdp425_init(void) ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3), ixdp425_flash_nand_resource.end = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; - gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); + gpio_request(IXDP425_NAND_NCE_PIN, "NAND NCE pin"); + gpio_direction_output(IXDP425_NAND_NCE_PIN, 0); /* Configure expansion bus for NAND Flash */ *IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index ed667ce..04f723a 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -184,11 +184,8 @@ static void nas100d_power_off(void) { /* This causes the box to drop the power and go dead. */ - /* enable the pwr cntl gpio */ - gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); - - /* do the deed */ - gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); + /* enable the pwr cntl gpio and assert power off */ + gpio_direction_output(NAS100D_PO_GPIO, 1); } /* This is used to make sure the power-button pusher is serious. The button @@ -225,7 +222,7 @@ static void nas100d_power_handler(unsigned long data) ctrl_alt_del(); /* Change the state of the power LED to "blink" */ - gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); + gpio_set_value(NAS100D_LED_PWR_GPIO, 0); } else { power_button_countdown = PBUTTON_HOLDDOWN_COUNT; } @@ -283,8 +280,12 @@ static void __init nas100d_init(void) * have to poll it with a kernel timer. */ + /* Request the power off GPIO */ + gpio_request(NAS100D_PO_GPIO, "power off"); + /* Make sure that the power button GPIO is set up as an input */ - gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); + gpio_request(NAS100D_PB_GPIO, "power button"); + gpio_direction_input(NAS100D_PB_GPIO); /* Set the initial value for the power button IRQ handler */ power_button_countdown = PBUTTON_HOLDDOWN_COUNT; diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 7e55236..c8c13df 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -197,11 +197,8 @@ static void nslu2_power_off(void) { /* This causes the box to drop the power and go dead. */ - /* enable the pwr cntl gpio */ - gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); - - /* do the deed */ - gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); + /* enable the pwr cntl gpio and assert power off */ + gpio_direction_output(NSLU2_PO_GPIO, 1); } static irqreturn_t nslu2_power_handler(int irq, void *dev_id) @@ -273,6 +270,9 @@ static void __init nslu2_init(void) gpio_to_irq(NSLU2_PB_GPIO)); } + /* Request the power off GPIO */ + gpio_request(NSLU2_PO_GPIO, "power off"); + /* * Map in a portion of the flash and read the MAC address. * Since it is stored in BE in the flash itself, we need to