From patchwork Fri Sep 13 07:55:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 20012 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 3D73720F2F for ; Fri, 13 Sep 2013 07:56:00 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id u18sf906699qcx.2 for ; Fri, 13 Sep 2013 00:56:00 -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=UlSZG+sJgnm9fnmBQxBUHYbH/jJ/lIsaBTUXI8oSaTI=; b=DxEEL9JNsYt9swPN264XghYk95e7/Wps6N6F659ejm8uN/MQU1Owbzn50QWfSuWrNO GdJTxxqk0vo/AaVsYV3VBhoKbNPn5gY73TOZ32P7C0LBFq53riPsDsavrp1GgRPm7kNp z0RtGUCJfciEu6of4koBAvZVO92BfTWnnLG3VyrfZwRAQbVMkRWmp7ug7F8TZd+v8wfI YoJZnm5ujPWAzdX2/zzvj+VF2vxCYCpqQJbF39vCU5grd6aWw2Y8IgnjX7Jd00ktS32a aGsvyRvf3LqFAQmr0vFIgdWuOYLdK6ElMpkMX95hW+o3q615w3spWTwfhFgXbkfyh7R6 87uQ== X-Gm-Message-State: ALoCoQkJG9eAN92WaJ8e7NN1SKvkQlcK2Sd6jUwhSiK4xxUxD7cnD78Rfuz4354GkNTp+WshAEnS X-Received: by 10.236.189.37 with SMTP id b25mr229618yhn.48.1379058959773; Fri, 13 Sep 2013 00:55:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.98.198 with SMTP id ek6ls1045697qeb.45.gmail; Fri, 13 Sep 2013 00:55:59 -0700 (PDT) X-Received: by 10.52.103.101 with SMTP id fv5mr350648vdb.31.1379058959467; Fri, 13 Sep 2013 00:55:59 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id zw10si2768457vdb.18.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 00:55:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 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.180; Received: by mail-vc0-f180.google.com with SMTP id gf11so653636vcb.25 for ; Fri, 13 Sep 2013 00:55:59 -0700 (PDT) X-Received: by 10.52.173.165 with SMTP id bl5mr9341678vdc.18.1379058959264; Fri, 13 Sep 2013 00:55:59 -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 u4csp66304vcz; Fri, 13 Sep 2013 00:55:58 -0700 (PDT) X-Received: by 10.112.64.7 with SMTP id k7mr13041lbs.43.1379058957953; Fri, 13 Sep 2013 00:55:57 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by mx.google.com with ESMTPS id zm6si5168658lbb.21.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 00:55:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.175 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id y6so1764075lbh.20 for ; Fri, 13 Sep 2013 00:55:57 -0700 (PDT) X-Received: by 10.112.77.134 with SMTP id s6mr176633lbw.38.1379058957029; Fri, 13 Sep 2013 00:55:57 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id ap7sm3631125lac.10.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 00:55:56 -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 v2] ARM: iop32x: request and issue reset using gpio Date: Fri, 13 Sep 2013 09:55:41 +0200 Message-Id: <1379058941-8360-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.180 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 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 | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 0691443..2dba955 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,16 @@ static void power_button_poll(unsigned long dummy) add_timer(&power_button_poll_timer); } +static int __init n2100_request_gpios(void) +{ + int ret; + + 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) {