From patchwork Fri Sep 20 20:17:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2921031 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5C37F9F1BF for ; Fri, 20 Sep 2013 20:19:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7FEED20328 for ; Fri, 20 Sep 2013 20:19:14 +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 801D520324 for ; Fri, 20 Sep 2013 20:19:13 +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 1VN79o-00044H-Mt; Fri, 20 Sep 2013 20:18:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VN79Z-0004KR-04; Fri, 20 Sep 2013 20:18:13 +0000 Received: from mail-ee0-f49.google.com ([74.125.83.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VN79K-0004HG-8g for linux-arm-kernel@lists.infradead.org; Fri, 20 Sep 2013 20:17:59 +0000 Received: by mail-ee0-f49.google.com with SMTP id d41so481442eek.8 for ; Fri, 20 Sep 2013 13:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4biSy1LGGONyQNXAxJoenbtgRf9kMjkAOjSbBCaDuGA=; b=lFKl8VRHrxM12+ULHhvu1AA3AnP9atqvDgKY0dyTZGyuKO53l3Vmq5BGWXiJKUeY1s brdoChIpZP1jzyiL8w+dUA63Ph5+lhpRqn67gk2zECi6Ww8Tq9Nm8ZoW+4Wsgfvm92Xi ltPpxG4Irk2IpripWYqRB5gfe/MnCk5uT7DSxwcXWbPVqorTkCLf3hl7QgVPhZx6ua2a Re/SC7frWltcW6ESns0aQyeZfbhmJmCm2DX/NCfj0HfSC5NvS751ANDqn5bQs3zb28V5 SeBnH97hs3sP0zulJM2/efz2OeMKmzAXhhEY/BDkMtqdM8nKwGzub0ydFRP47xqXpt+q J86g== X-Gm-Message-State: ALoCoQloJQxPIRxMeN0ipa+/tdPW0SSPZW0IX2frRUpF01naAPjmTzwNavlsELtcbUpfJf2uyNzS X-Received: by 10.14.194.131 with SMTP id m3mr13045565een.45.1379708255323; Fri, 20 Sep 2013 13:17:35 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id a1sm21980224eem.1.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:17:34 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lennert Buytenhek , Dan Williams , Mikael Pettersson , Aaro Koskinen Subject: [PATCH 2/8] ARM: iop32x: request and issue reset using gpio Date: Fri, 20 Sep 2013 22:17:32 +0200 Message-Id: <1379708252-7887-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130920_161758_475239_58A96D09 X-CRM114-Status: GOOD ( 14.74 ) X-Spam-Score: -2.6 (--) Cc: Linus Walleij , Alexandre Courbot , linux-arm-kernel@lists.infradead.org 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=-4.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 As the IOP GPIO driver supports gpiolib we can use the standard GPIO calls to issue a reset of the machine instead of using the custom gpio_line_set/config calls. Also request the GPIO when initializing the machine. Cc: Aaro Koskinen Cc: Lennert Buytenhek Cc: Dan Williams Cc: Mikael Pettersson Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Also check machine_is_n2100() so we don't request the GPIOs on any other machine at boot. ChangeLog v1->v2: - Request GPIOs in a separate device_initcall() instead of doing it from machine_init, as the gpio chip is registered after the machine init, what was I thinking about? --- arch/arm/mach-iop32x/n2100.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 0691443..6bace5b 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -288,8 +289,14 @@ static void n2100_power_off(void) static void n2100_restart(enum reboot_mode mode, const char *cmd) { - gpio_line_set(N2100_HARDWARE_RESET, GPIO_LOW); - gpio_line_config(N2100_HARDWARE_RESET, GPIO_OUT); + int ret; + + ret = gpio_direction_output(N2100_HARDWARE_RESET, 0); + if (ret) { + pr_crit("could not drive reset GPIO low\n"); + return; + } + /* Wait for reset to happen */ while (1) ; } @@ -308,6 +315,19 @@ static void power_button_poll(unsigned long dummy) add_timer(&power_button_poll_timer); } +static int __init n2100_request_gpios(void) +{ + int ret; + + if (!machine_is_n2100()) + return 0; + + ret = gpio_request(N2100_HARDWARE_RESET, "reset"); + if (ret) + pr_err("could not request reset GPIO\n"); + return 0; +} +device_initcall(n2100_request_gpios); static void __init n2100_init_machine(void) {