2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
6 #include <linux/kernel.h>
7 #include <linux/module.h>
8 #include <linux/delay.h>
9 #include <linux/gpio.h>
11 #include <asm/proc-fns.h>
13 #include <asm/arch/pxa-regs.h>
14 #include <asm/arch/pxa2xx-regs.h>
16 static void do_hw_reset(void);
18 static int reset_gpio = -1;
20 int init_gpio_reset(int gpio)
24 rc = gpio_request(gpio, "reset generator");
26 printk(KERN_ERR "Can't request reset_gpio\n");
30 rc = gpio_direction_input(gpio);
32 printk(KERN_ERR "Can't configure reset_gpio for input\n");
46 * This covers various types of logic connecting gpio pin
47 * to RESET pins (nRESET or GPIO_RESET):
49 static void do_gpio_reset(void)
51 BUG_ON(reset_gpio == -1);
54 gpio_direction_output(reset_gpio, 0);
56 /* rising edge or drive high */
57 gpio_set_value(reset_gpio, 1);
60 gpio_set_value(reset_gpio, 0);
62 /* give it some time */
70 static void do_hw_reset(void)
72 /* Initialize the watchdog and let it fire */
75 OSMR3 = OSCR + 368640; /* ... in 100 ms */
78 void arch_reset(char mode)
81 RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
85 /* Jump into ROM at address 0 */