From patchwork Sun Aug 11 14:26:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Lentin X-Patchwork-Id: 2842711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 985C7BF546 for ; Sun, 11 Aug 2013 14:28:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B666A2020F for ; Sun, 11 Aug 2013 14:28:52 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A125B20204 for ; Sun, 11 Aug 2013 14:28:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V8WdB-0002CR-GX; Sun, 11 Aug 2013 14:28:29 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V8Wd4-0003qs-Ad; Sun, 11 Aug 2013 14:28:22 +0000 Received: from marmot.wormnet.eu ([2a03:9800:10:2d:3203:b3a5:8bdc:5b68]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V8Wcr-0003pa-QS for linux-arm-kernel@lists.infradead.org; Sun, 11 Aug 2013 14:28:11 +0000 Received: from mijo.vandergast.wormnet.eu ([80.229.158.163] helo=bunsen.vandergast.wormnet.eu) by marmot.wormnet.eu with esmtpa (Exim 4.80) (envelope-from ) id 1V8WcO-0000Uk-MU; Sun, 11 Aug 2013 15:27:40 +0100 From: Jamie Lentin To: Andrew Lunn Subject: [PATCH 1/2] Convert power recovery pin to a fixed regulator Date: Sun, 11 Aug 2013 15:26:49 +0100 Message-Id: <1376231210-6484-2-git-send-email-jm@lentin.co.uk> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1376231210-6484-1-git-send-email-jm@lentin.co.uk> References: <1376231210-6484-1-git-send-email-jm@lentin.co.uk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130811_102810_142463_E42840AB X-CRM114-Status: GOOD ( 11.80 ) X-Spam-Score: -1.9 (-) Cc: Jamie Lentin , Jason Cooper , linux ARM X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP dnskw_gpio_register() is broken, and probably has been for a while, since dnskw_init() is called too early to register GPIOs. Instead use a fixed regulator to turn the pin high, which knows to defer the registration until later. Signed-off-by: Jamie Lentin --- arch/arm/boot/dts/kirkwood-dnskw.dtsi | 13 +++++++++++++ arch/arm/mach-kirkwood/board-dnskw.c | 15 --------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi index d544f77..9e74127 100644 --- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi +++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi @@ -217,6 +217,19 @@ regulator-boot-on; gpio = <&gpio1 8 0>; }; + power_back_on: regulator@3 { + /* Turning this pin high means the NAS will turn on + immediately after a power failure. */ + compatible = "regulator-fixed"; + reg = <3>; + regulator-name = "Recover after power failure"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + regulator-boot-on; + gpio = <&gpio1 5 0>; + enable-active-high; + }; }; }; diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c index 2af7a95..0b441b9 100644 --- a/arch/arm/mach-kirkwood/board-dnskw.c +++ b/arch/arm/mach-kirkwood/board-dnskw.c @@ -14,23 +14,8 @@ #include #include #include -#include #include "common.h" -/* Register any GPIO for output and set the value */ -static void __init dnskw_gpio_register(unsigned gpio, char *name, int def) -{ - if (gpio_request(gpio, name) == 0 && - gpio_direction_output(gpio, 0) == 0) { - gpio_set_value(gpio, def); - if (gpio_export(gpio, 0) != 0) - pr_err("dnskw: Failed to export GPIO %s\n", name); - } else - pr_err("dnskw: Failed to register %s\n", name); -} - void __init dnskw_init(void) { - /* Set NAS to turn back on after a power failure */ - dnskw_gpio_register(37, "dnskw:power:recover", 1); }