Commit 69fc7eed authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Russell King

[ARM] 5300/1: fixup spitz reset during boot

Some machines don't have the pullup/down on their reset
pin, so configuring the reset generating pin as input makes
them reset immediately. Fix that by making reset pin direction
configurable.
Signed-off-by: default avatarDmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 6defd904
...@@ -10,9 +10,12 @@ ...@@ -10,9 +10,12 @@
extern unsigned int reset_status; extern unsigned int reset_status;
extern void clear_reset_status(unsigned int mask); extern void clear_reset_status(unsigned int mask);
/* /**
* register GPIO as reset generator * init_gpio_reset() - register GPIO as reset generator
*
* @gpio - gpio nr
* @output - set gpio as out/low instead of input during normal work
*/ */
extern int init_gpio_reset(int gpio); extern int init_gpio_reset(int gpio, int output);
#endif /* __ASM_ARCH_RESET_H */ #endif /* __ASM_ARCH_RESET_H */
...@@ -20,7 +20,7 @@ static void do_hw_reset(void); ...@@ -20,7 +20,7 @@ static void do_hw_reset(void);
static int reset_gpio = -1; static int reset_gpio = -1;
int init_gpio_reset(int gpio) int init_gpio_reset(int gpio, int output)
{ {
int rc; int rc;
...@@ -30,9 +30,12 @@ int init_gpio_reset(int gpio) ...@@ -30,9 +30,12 @@ int init_gpio_reset(int gpio)
goto out; goto out;
} }
if (output)
rc = gpio_direction_output(gpio, 0);
else
rc = gpio_direction_input(gpio); rc = gpio_direction_input(gpio);
if (rc) { if (rc) {
printk(KERN_ERR "Can't configure reset_gpio for input\n"); printk(KERN_ERR "Can't configure reset_gpio\n");
gpio_free(gpio); gpio_free(gpio);
goto out; goto out;
} }
......
...@@ -618,7 +618,7 @@ static void spitz_restart(char mode) ...@@ -618,7 +618,7 @@ static void spitz_restart(char mode)
static void __init common_init(void) static void __init common_init(void)
{ {
init_gpio_reset(SPITZ_GPIO_ON_RESET); init_gpio_reset(SPITZ_GPIO_ON_RESET, 1);
pm_power_off = spitz_poweroff; pm_power_off = spitz_poweroff;
arm_pm_restart = spitz_restart; arm_pm_restart = spitz_restart;
......
...@@ -781,7 +781,7 @@ static void __init tosa_init(void) ...@@ -781,7 +781,7 @@ static void __init tosa_init(void)
gpio_set_wake(MFP_PIN_GPIO1, 1); gpio_set_wake(MFP_PIN_GPIO1, 1);
/* We can't pass to gpio-keys since it will drop the Reset altfunc */ /* We can't pass to gpio-keys since it will drop the Reset altfunc */
init_gpio_reset(TOSA_GPIO_ON_RESET); init_gpio_reset(TOSA_GPIO_ON_RESET, 0);
pm_power_off = tosa_poweroff; pm_power_off = tosa_poweroff;
arm_pm_restart = tosa_restart; arm_pm_restart = tosa_restart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment