From patchwork Fri Sep 13 09:07:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20017 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9643425E09 for ; Fri, 13 Sep 2013 09:07:30 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x20sf954863qcv.3 for ; Fri, 13 Sep 2013 02:07:30 -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=4biSy1LGGONyQNXAxJoenbtgRf9kMjkAOjSbBCaDuGA=; b=lhVGZDuc0S8T6aUzLce+rIxTSf45D8Z+IJrjLq6TFe55K44D29UK/edNkIPKycOYl5 JbE/L2rR+q1R/QuFdcugnK7fR+p+Q10pRXKw0QDPpGC+1de068w7NOf1QogTE+lD5q7l PGpUdlHysK3s73qmXsTX44NCY7gYpI5+8r58t5dVQmC6i1hBeUTQsEmOl4KoxrPFSRQJ jm26NjbZzB6/D8armk6+kUw6QEjTnb420sq3sPHPU7N1l9JSZ1IVM6KoN11i3C8VKzyc Cs1cc4qUEMRCQBZmS5c+4KKIXkZOo6Hf3hXAYJm5e2GdmDAbAGjTINncKY0EAm08kS4Z c9Hw== X-Gm-Message-State: ALoCoQm2D/17ReKCl4P+ne3pyvV57xAJ+y9q+lf8xRP8vx71Azd4CuNGnSteNHiZR75SO2EGYaOo X-Received: by 10.236.138.108 with SMTP id z72mr4761338yhi.18.1379063249999; Fri, 13 Sep 2013 02:07:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.38.70 with SMTP id e6ls1140539qek.77.gmail; Fri, 13 Sep 2013 02:07:29 -0700 (PDT) X-Received: by 10.220.43.19 with SMTP id u19mr10971091vce.3.1379063249781; Fri, 13 Sep 2013 02:07:29 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id i15si2837335vep.54.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 02:07:29 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 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.171; Received: by mail-vc0-f171.google.com with SMTP id ij15so710661vcb.2 for ; Fri, 13 Sep 2013 02:07:29 -0700 (PDT) X-Received: by 10.220.43.19 with SMTP id u19mr10971085vce.3.1379063249678; Fri, 13 Sep 2013 02:07:29 -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 u4csp69376vcz; Fri, 13 Sep 2013 02:07:29 -0700 (PDT) X-Received: by 10.152.88.20 with SMTP id bc20mr404299lab.37.1379063248472; Fri, 13 Sep 2013 02:07:28 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by mx.google.com with ESMTPS id 2si3299479lar.96.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 02:07:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.172 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id x18so1885992lbi.3 for ; Fri, 13 Sep 2013 02:07:27 -0700 (PDT) X-Received: by 10.112.210.136 with SMTP id mu8mr11145981lbc.25.1379063247669; Fri, 13 Sep 2013 02:07:27 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id i3sm3789622laf.4.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 02:07:26 -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 , Aaro Koskinen Subject: [PATCH 2/8 v3] ARM: iop32x: request and issue reset using gpio Date: Fri, 13 Sep 2013 11:07:17 +0200 Message-Id: <1379063237-12534-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.171 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: , 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) {