aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-iop32x
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-iop32x')
-rw-r--r--arch/arm/mach-iop32x/em7210.c32
1 files 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 @@
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/gpio.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <linux/io.h> 28#include <linux/io.h>
28#include <linux/irq.h> 29#include <linux/irq.h>
@@ -176,11 +177,35 @@ static struct platform_device em7210_serial_device = {
176 .resource = &em7210_uart_resource, 177 .resource = &em7210_uart_resource,
177}; 178};
178 179
180#define EM7210_HARDWARE_POWER 0
181
179void em7210_power_off(void) 182void em7210_power_off(void)
180{ 183{
181 *IOP3XX_GPOE &= 0xfe; 184 int ret;
182 *IOP3XX_GPOD |= 0x01; 185
186 ret = gpio_direction_output(EM7210_HARDWARE_POWER, 1);
187 if (ret)
188 pr_crit("could not drive power off GPIO high\n");
189}
190
191static int __init em7210_request_gpios(void)
192{
193 int ret;
194
195 if (!machine_is_em7210())
196 return 0;
197
198 ret = gpio_request(EM7210_HARDWARE_POWER, "power");
199 if (ret) {
200 pr_err("could not request power off GPIO\n");
201 return 0;
202 }
203
204 pm_power_off = em7210_power_off;
205
206 return 0;
183} 207}
208device_initcall(em7210_request_gpios);
184 209
185static void __init em7210_init_machine(void) 210static void __init em7210_init_machine(void)
186{ 211{
@@ -194,9 +219,6 @@ static void __init em7210_init_machine(void)
194 219
195 i2c_register_board_info(0, em7210_i2c_devices, 220 i2c_register_board_info(0, em7210_i2c_devices,
196 ARRAY_SIZE(em7210_i2c_devices)); 221 ARRAY_SIZE(em7210_i2c_devices));
197
198
199 pm_power_off = em7210_power_off;
200} 222}
201 223
202MACHINE_START(EM7210, "Lanner EM7210") 224MACHINE_START(EM7210, "Lanner EM7210")