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: 20483 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 58BA125DFC for ; Fri, 20 Sep 2013 20:17:37 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf842238yhz.3 for ; Fri, 20 Sep 2013 13:17:37 -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=U/nIVcbNJiUdDXnSb0GboSjynXjIc+AGs1sUXij6aARenMjr/CVbKzYEjJwIGA4WPP E51ikh2eOMSIVuqzf/Z/Km/Oj0MkjzsT5csPoDhucZlPwj6DwB9FTp0Jrl9ztbpCB0/b k63RjHv+7rQQQrO+c82wfYQWJ2q5OfrwScVB882l8fxZ+SDUwijCjAmWobp+IHaDb/MP mIRBjtEJG0gI/eMjkq2eY/opnwVzsfzN6hLsXyB9EOqp9Wjj2bHaj1eoaNF48zR9CEaC 0moqvstp3fprI/uNn1H7d40lL5fMQ6D0zxB8P9X+MFg+IAiKlqdGWiYh/eY8unx/D4Kh A50Q== X-Gm-Message-State: ALoCoQlbB30dLrNJ82xxNhNDrO2MozdBf8ApgjDvccx8NOpah9dQHNNoSvc2hBaB3SJL37OczTF+ X-Received: by 10.236.147.18 with SMTP id s18mr3275901yhj.28.1379708257117; Fri, 20 Sep 2013 13:17:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.64.38 with SMTP id l6ls412251qes.89.gmail; Fri, 20 Sep 2013 13:17:37 -0700 (PDT) X-Received: by 10.58.134.16 with SMTP id pg16mr7741990veb.21.1379708257004; Fri, 20 Sep 2013 13:17:37 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id fx4si3390328vdc.26.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:17:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 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.176; Received: by mail-vc0-f176.google.com with SMTP id lf11so676729vcb.7 for ; Fri, 20 Sep 2013 13:17:36 -0700 (PDT) X-Received: by 10.220.1.203 with SMTP id 11mr8041994vcg.15.1379708256875; Fri, 20 Sep 2013 13:17:36 -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 u4csp36796vcz; Fri, 20 Sep 2013 13:17:36 -0700 (PDT) X-Received: by 10.14.225.199 with SMTP id z47mr13280562eep.24.1379708255815; Fri, 20 Sep 2013 13:17:35 -0700 (PDT) Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) by mx.google.com with ESMTPS id f46si12690650eeo.39.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Sep 2013 13:17:35 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.42 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.83.42; Received: by mail-ee0-f42.google.com with SMTP id b45so496397eek.15 for ; Fri, 20 Sep 2013 13:17:35 -0700 (PDT) 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 Cc: Alexandre Courbot , linux-arm-kernel@lists.infradead.org, Linus Walleij 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-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.176 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) {