From patchwork Mon Sep 9 15:40:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2862051 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 BB0629F2D6 for ; Mon, 9 Sep 2013 15:41:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A2156203E3 for ; Mon, 9 Sep 2013 15:41:41 +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 5645F203DA for ; Mon, 9 Sep 2013 15:41:40 +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 1VJ3aI-00026D-DL; Mon, 09 Sep 2013 15:41:02 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJ3a8-0001eY-3e; Mon, 09 Sep 2013 15:40:52 +0000 Received: from mail-la0-f42.google.com ([209.85.215.42]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VJ3a5-0001cR-Eq for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2013 15:40:50 +0000 Received: by mail-la0-f42.google.com with SMTP id ep20so5210610lab.1 for ; Mon, 09 Sep 2013 08:40:27 -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=Klh8A+AOZkye+v6QOzNhPKksiXi6KTEs/hs9lGGXX9c=; b=CeTKOvp9nHemw6Tf8Dfv6JT/sqCs8OGucfMgslHPoZY7Tz/WGJDyaFzeR+ru0ZvvBq UXb0I1HBnfyVuKof+hmuWHHcQGn8e/0gmURTgYhQB9xz2Sy3kX60yKkzD/RfNzYnhp9X qGZMxek0db29jJhnWgu/bGX0eW2gXav4hDo/hH5cAgigooaHuP7pRJjSh7m9TovnKUV4 nGwgvPvlbdMSFSgKFMAnh5prkSnQQge2wzEIs2ttQRyomWOdYL/h4RRhbn92ZPFViuwH R5J3UhoKeLQyZEBNYGv3IENvKaVcvC7IEbgvyjvPLgK5XyseiDdENsUTlkKlp23o6DhC HeMQ== X-Gm-Message-State: ALoCoQnh6sY4KRWleDUAtJvYepsLgIREqJNgwc+Eo4zoK3XisoXxquV9uY5Y2G5SV8cdXDe77ryV X-Received: by 10.152.3.42 with SMTP id 10mr7370015laz.22.1378741227475; Mon, 09 Sep 2013 08:40:27 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id vx8sm6247781lbb.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 09 Sep 2013 08:40:26 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Lennert Buytenhek , Dan Williams , Mikael Pettersson Subject: [PATCH 2/8] ARM: iop32x: request and issue reset using gpio Date: Mon, 9 Sep 2013 17:40:23 +0200 Message-Id: <1378741223-12921-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-20130909_114049_662168_401B1760 X-CRM114-Status: GOOD ( 13.37 ) 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=-5.1 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: Lennert Buytenhek Cc: Dan Williams Cc: Mikael Pettersson Signed-off-by: Linus Walleij --- arch/arm/mach-iop32x/n2100.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 0691443..cd199c1 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) ; } @@ -311,6 +318,8 @@ static void power_button_poll(unsigned long dummy) static void __init n2100_init_machine(void) { + int ret; + platform_device_register(&iop3xx_i2c0_device); platform_device_register(&n2100_flash_device); platform_device_register(&n2100_serial_device); @@ -326,6 +335,10 @@ static void __init n2100_init_machine(void) power_button_poll_timer.function = power_button_poll; power_button_poll_timer.expires = jiffies + (HZ / 10); add_timer(&power_button_poll_timer); + + ret = gpio_request(N2100_HARDWARE_RESET, "reset"); + if (ret) + pr_err("could not request reset GPIO\n"); } MACHINE_START(N2100, "Thecus N2100")