aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Simek <monstr@monstr.eu>2009-10-29 05:12:59 -0400
committerMichal Simek <monstr@monstr.eu>2009-12-14 02:44:56 -0500
commit67bf87665466c4ea93e2c54d66dfd4cdac011a4b (patch)
treebd5379b9eec17b2b6555d2ea9efb1dbb4f8a5593
parent753758304019fc7c2ef3af674f52a193b1606d15 (diff)
microblaze: Support both levels for reset
Till this patch reset always perform writen to 1. Now we can use negative logic and perform reset write to 0. It is opposite level than is currently read from that pin Signed-off-by: Michal Simek <monstr@monstr.eu>
-rw-r--r--arch/microblaze/kernel/reset.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index 789af930d72..a1721a33042 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -17,6 +17,7 @@
17#include <linux/of_gpio.h> 17#include <linux/of_gpio.h>
18 18
19static int handle; /* reset pin handle */ 19static int handle; /* reset pin handle */
20static unsigned int reset_val;
20 21
21static int of_reset_gpio_handle(void) 22static int of_reset_gpio_handle(void)
22{ 23{
@@ -75,9 +76,9 @@ void of_platform_reset_gpio_probe(void)
75 } 76 }
76 77
77 /* get current setup value */ 78 /* get current setup value */
78 ret = gpio_get_value(handle); 79 reset_val = gpio_get_value(handle);
79 /* FIXME maybe worth to perform any action */ 80 /* FIXME maybe worth to perform any action */
80 pr_debug("Reset: Gpio output state: 0x%x\n", ret); 81 pr_debug("Reset: Gpio output state: 0x%x\n", reset_val);
81 82
82 /* Setup GPIO as output */ 83 /* Setup GPIO as output */
83 ret = gpio_direction_output(handle, 0); 84 ret = gpio_direction_output(handle, 0);
@@ -87,7 +88,8 @@ void of_platform_reset_gpio_probe(void)
87 /* Setup output direction */ 88 /* Setup output direction */
88 gpio_set_value(handle, 0); 89 gpio_set_value(handle, 0);
89 90
90 printk(KERN_INFO "RESET: Registered gpio device: %d\n", handle); 91 printk(KERN_INFO "RESET: Registered gpio device: %d, current val: %d\n",
92 handle, reset_val);
91 return; 93 return;
92err: 94err:
93 gpio_free(handle); 95 gpio_free(handle);
@@ -97,7 +99,7 @@ err:
97 99
98static void gpio_system_reset(void) 100static void gpio_system_reset(void)
99{ 101{
100 gpio_set_value(handle, 1); 102 gpio_set_value(handle, 1 - reset_val);
101} 103}
102#else 104#else
103#define gpio_system_reset() do {} while (0) 105#define gpio_system_reset() do {} while (0)