From patchwork Wed Jan 29 14:20:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 3551391 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB7F6C02DC for ; Wed, 29 Jan 2014 14:21:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC87720149 for ; Wed, 29 Jan 2014 14:21:03 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2EDC92017A for ; Wed, 29 Jan 2014 14:20:59 +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 1W8W0W-0005Wk-Ve; Wed, 29 Jan 2014 14:20:49 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W8W0U-0004Ta-L6; Wed, 29 Jan 2014 14:20:46 +0000 Received: from mail-wg0-f53.google.com ([74.125.82.53]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W8W0R-0004SS-Ki for linux-arm-kernel@lists.infradead.org; Wed, 29 Jan 2014 14:20:44 +0000 Received: by mail-wg0-f53.google.com with SMTP id y10so3676495wgg.20 for ; Wed, 29 Jan 2014 06:20:21 -0800 (PST) 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=1PSYzfjTrlvQq/MQiMfg1FizuGar732Pl0gImn1aWIg=; b=LQJnJxoOOrvPzKzYbDWoyMfxnnJ4EuRdq9k2JWSmqNvlOjEJTuVLujY8E3OhNwpLdc axNuCWa1vM8UMGqTGEgRESJQHcn8SoPYWYNN5bk0r0Ub2RsOFdJNtlL+AbLFAw5LITli MAieCfF18qWhe/OJKnCz37YhiIbsu8OAwcreInnmv1SRsJUNpFcO0SAVcgbBqLE203Kz x2ZbmblhHvKwmOW/ZrmLk+An5pup58ZAgcRG6mXo20O6bvEkVVXbNOKdQ1r8Ww5KeLzA z/jBSQ3+az20trZqGv/Eq53yGGn/+d6q6KAK/lx3rlYpHIOh8ESI+6qHbDBB74M+7IOM miiA== X-Gm-Message-State: ALoCoQlNuHMpOIghRJzle8IghOB1tfTONup8Y2jpTS++GZb8bQ7M/ehhGQHzpna1/pkbgvFsWhm8 X-Received: by 10.194.108.100 with SMTP id hj4mr342061wjb.83.1391005221468; Wed, 29 Jan 2014 06:20:21 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id q5sm5700991wia.2.2014.01.29.06.20.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jan 2014 06:20:20 -0800 (PST) From: Linus Walleij To: arm@kernel.org Subject: [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board Date: Wed, 29 Jan 2014 15:20:15 +0100 Message-Id: <1391005215-8520-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.5.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140129_092043_783181_59C6815B X-CRM114-Status: GOOD ( 16.58 ) X-Spam-Score: -2.6 (--) Cc: Linus Walleij , Arnaud Patard , 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.7 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 This board was missed when converting all the others to proper abstracted GPIO handling. Fix it up the right way by requesting and driving GPIO line 0 high through gpiolib to power off the machine. Cc: Arnaud Patard Reported-by: Arnd Bergmann Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Request the power off and set the power off hook with a device_initcall() so we know the GPIO driver is available when requesting the line. - Refer to POWER OFF rather than RESET everywhere. ARM SoC folks, if you're happy with this fix, please apply it directly to fixes in the ARM SoC tree. --- arch/arm/mach-iop32x/em7210.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c index 177cd073a83b..77e1ff057303 100644 --- a/arch/arm/mach-iop32x/em7210.c +++ b/arch/arm/mach-iop32x/em7210.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -176,11 +177,35 @@ static struct platform_device em7210_serial_device = { .resource = &em7210_uart_resource, }; +#define EM7210_HARDWARE_POWER 0 + void em7210_power_off(void) { - *IOP3XX_GPOE &= 0xfe; - *IOP3XX_GPOD |= 0x01; + int ret; + + ret = gpio_direction_output(EM7210_HARDWARE_POWER, 1); + if (ret) + pr_crit("could not drive power off GPIO high\n"); +} + +static int __init em7210_request_gpios(void) +{ + int ret; + + if (!machine_is_em7210()) + return 0; + + ret = gpio_request(EM7210_HARDWARE_POWER, "power"); + if (ret) { + pr_err("could not request power off GPIO\n"); + return 0; + } + + pm_power_off = em7210_power_off; + + return 0; } +device_initcall(em7210_request_gpios); static void __init em7210_init_machine(void) { @@ -194,9 +219,6 @@ static void __init em7210_init_machine(void) i2c_register_board_info(0, em7210_i2c_devices, ARRAY_SIZE(em7210_i2c_devices)); - - - pm_power_off = em7210_power_off; } MACHINE_START(EM7210, "Lanner EM7210")