* [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board
@ 2014-01-29 14:20 Linus Walleij
2014-01-29 23:19 ` Arnaud Patard (Rtp)
2014-01-31 6:11 ` Kevin Hilman
0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2014-01-29 14:20 UTC (permalink / raw)
To: linux-arm-kernel
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 <arnaud.patard@rtp-net.org>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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 <linux/mtd/physmap.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
+#include <linux/gpio.h>
#include <mach/hardware.h>
#include <linux/io.h>
#include <linux/irq.h>
@@ -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")
--
1.8.5.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board
2014-01-29 14:20 [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board Linus Walleij
@ 2014-01-29 23:19 ` Arnaud Patard (Rtp)
2014-01-30 8:56 ` Linus Walleij
2014-01-31 6:11 ` Kevin Hilman
1 sibling, 1 reply; 4+ messages in thread
From: Arnaud Patard (Rtp) @ 2014-01-29 23:19 UTC (permalink / raw)
To: linux-arm-kernel
Linus Walleij <linus.walleij@linaro.org> writes:
> 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 <arnaud.patard@rtp-net.org>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> 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 <linux/mtd/physmap.h>
> #include <linux/platform_device.h>
> #include <linux/i2c.h>
> +#include <linux/gpio.h>
> #include <mach/hardware.h>
> #include <linux/io.h>
> #include <linux/irq.h>
> @@ -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);
btw, any reason for not using gpio_direction_output() in
em7210_request_gpios() and gpio_set_value() here ? (just wondering)
I can't test it on my ss4000e but at least this patch looks fine.
Arnaud
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board
2014-01-29 23:19 ` Arnaud Patard (Rtp)
@ 2014-01-30 8:56 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2014-01-30 8:56 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Jan 30, 2014 at 12:19 AM, Arnaud Patard
<arnaud.patard@rtp-net.org> wrote:
> Linus Walleij <linus.walleij@linaro.org> writes:
>> void em7210_power_off(void)
>> {
>> - *IOP3XX_GPOE &= 0xfe;
>> - *IOP3XX_GPOD |= 0x01;
>> + int ret;
>> +
>> + ret = gpio_direction_output(EM7210_HARDWARE_POWER, 1);
>
> btw, any reason for not using gpio_direction_output() in
> em7210_request_gpios() and gpio_set_value() here ? (just wondering)
Mainly because the old code did not drive a default value on
the pin (which would be zero then) but relies on the power-on
default.
So by not doing this I'm not poking any hardware that wasn't poked
earlier.
> I can't test it on my ss4000e but at least this patch looks fine.
Would be nice!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board
2014-01-29 14:20 [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board Linus Walleij
2014-01-29 23:19 ` Arnaud Patard (Rtp)
@ 2014-01-31 6:11 ` Kevin Hilman
1 sibling, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2014-01-31 6:11 UTC (permalink / raw)
To: linux-arm-kernel
Linus Walleij <linus.walleij@linaro.org> writes:
> 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 <arnaud.patard@rtp-net.org>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Queueing for fixes (w/ack from Arnd.)
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-31 6:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-29 14:20 [PATCH v2] ARM: iop32x: fix power off handling for the EM7210 board Linus Walleij
2014-01-29 23:19 ` Arnaud Patard (Rtp)
2014-01-30 8:56 ` Linus Walleij
2014-01-31 6:11 ` Kevin Hilman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.