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>
12 #include <asm/system_misc.h>
14 #include <mach/regs-ost.h>
15 #include <mach/reset.h>
16 #include <mach/smemc.h>
18 unsigned int reset_status
;
19 EXPORT_SYMBOL(reset_status
);
21 static void do_hw_reset(void);
23 static int reset_gpio
= -1;
25 int init_gpio_reset(int gpio
, int output
, int level
)
29 rc
= gpio_request(gpio
, "reset generator");
31 printk(KERN_ERR
"Can't request reset_gpio\n");
36 rc
= gpio_direction_output(gpio
, level
);
38 rc
= gpio_direction_input(gpio
);
40 printk(KERN_ERR
"Can't configure reset_gpio\n");
54 * This covers various types of logic connecting gpio pin
55 * to RESET pins (nRESET or GPIO_RESET):
57 static void do_gpio_reset(void)
59 BUG_ON(reset_gpio
== -1);
62 gpio_direction_output(reset_gpio
, 0);
64 /* rising edge or drive high */
65 gpio_set_value(reset_gpio
, 1);
68 gpio_set_value(reset_gpio
, 0);
70 /* give it some time */
78 static void do_hw_reset(void)
80 /* Initialize the watchdog and let it fire */
81 writel_relaxed(OWER_WME
, OWER
);
82 writel_relaxed(OSSR_M3
, OSSR
);
84 writel_relaxed(readl_relaxed(OSCR
) + 368640, OSMR3
);
86 * SDRAM hangs on watchdog reset on Marvell PXA270 (erratum 71)
87 * we put SDRAM into self-refresh to prevent that
90 writel_relaxed(MDREFR_SLFRSH
, MDREFR
);
93 void pxa_restart(enum reboot_mode mode
, const char *cmd
)
98 clear_reset_status(RESET_STATUS_ALL
);
102 /* Jump into ROM at address 0 */