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: 23872 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7EC24202FA for ; Wed, 29 Jan 2014 14:20:24 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id m10sf4007811vbh.8 for ; Wed, 29 Jan 2014 06:20:23 -0800 (PST) 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=1PSYzfjTrlvQq/MQiMfg1FizuGar732Pl0gImn1aWIg=; b=e//W8OWLYH9OVA/UEXNc7IdAJxGTUin/5TGDVfkyNjjT6Cy6+Iif1fzzwsxp4KwZgc umnupH97AHtNqLA89lSeZlnnMTBMSFe7Gs3gRNVgiZuMgAJ9A/I0JQVuFylG9/WrF9Ei k6tY6qXE0GO69mOK7VftvvPZz7X7ccwfPZsRFdTPbsAvKIFmw2ir81E8w9C+etFzH3xY gPkBBWCurpCml+ggrdgJ2qQy8U7nVcSNzldewKjna0b/WGXa3R0l6fzR6S5DXYx5xtIv Q2fD026vVuNVC6aAhfv3ci8vtUtVOK4LtFrf1FmGc1nGvgKCOD4zw9n/O4jAqcuufI9k X2gQ== X-Gm-Message-State: ALoCoQnhNpuhU4oRWg8QH+OE6pxUh9mKUmuBU/qlbFhowLN6JkeISAW1FDXUpHVUSwH0MLLEt8gY X-Received: by 10.236.110.3 with SMTP id t3mr2659383yhg.3.1391005223425; Wed, 29 Jan 2014 06:20:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.134 with SMTP id i6ls119156qge.2.gmail; Wed, 29 Jan 2014 06:20:23 -0800 (PST) X-Received: by 10.220.97.145 with SMTP id l17mr66808vcn.35.1391005223310; Wed, 29 Jan 2014 06:20:23 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id eh16si830626vcb.93.2014.01.29.06.20.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 06:20:23 -0800 (PST) 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 ks9so1204019vcb.11 for ; Wed, 29 Jan 2014 06:20:23 -0800 (PST) X-Received: by 10.220.131.210 with SMTP id y18mr7010243vcs.12.1391005223079; Wed, 29 Jan 2014 06:20:23 -0800 (PST) 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 u4csp116380vcz; Wed, 29 Jan 2014 06:20:22 -0800 (PST) X-Received: by 10.180.206.172 with SMTP id lp12mr5936744wic.46.1391005221891; Wed, 29 Jan 2014 06:20:21 -0800 (PST) Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by mx.google.com with ESMTPS id ha2si1536116wib.6.2014.01.29.06.20.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jan 2014 06:20:21 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.45 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.45; Received: by mail-wg0-f45.google.com with SMTP id n12so3671694wgh.12 for ; Wed, 29 Jan 2014 06:20:21 -0800 (PST) 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 Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij , Arnaud Patard 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-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: , 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")