aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/geode.h
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2008-01-30 07:33:35 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:35 -0500
commitade761496dcd0aea1c41da21d5a6ced4897f02e7 (patch)
tree95c05a5e72eb02f1db5f2cb6cc7c38a769d12e0d /include/asm-x86/geode.h
parent519efbc0b3b6004a3b98d66a446bce30852c8171 (diff)
x86: GEODE: update GPIO API to support setting multiple GPIOs at once
The existing Geode GPIO API only allows for updating one GPIO at once. There are instances where users want to update multiple GPIOs at once. With the current API, they are given two choices; either ignore the GPIO API: outl(0xc000, gpio_base + GPIO_OUTPUT_VAL); outl(0xc000, gpio_base + GPIO_OUTPUT_ENABLE); Alternatively, call each GPIO update separately: geode_gpio_set(14, GPIO_OUTPUT_VAL); geode_gpio_set(15, GPIO_OUTPUT_VAL); geode_gpio_set(14, GPIO_OUTPUT_ENABLE); geode_gpio_set(15, GPIO_OUTPUT_ENABLE); Neither are desirable. This patch changes the GPIO API to allow for setting of multiple GPIOs at once; rather than being passed an integer, we pass a bitmask and provide a translation function. The above code would now look like this: geode_gpio_set(geode_gpio(14)|geode_gpio(15), GPIO_OUTPUT_VAL); geode_gpio_set(geode_gpio(14)|geode_gpio(15), GPIO_OUTPUT_ENABLE); Since there are no upstream users of the GPIO API yet (afaik), best to change this now. This also adds a bit of sanity checking; it is no longer possible to use a GPIO above 28. Note the semantics of geode_gpio_isset() have changed: geode_gpio_isset(geode_gpio(3)|geode_gpio(4), ...) will only return true iff both GPIOs are set. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/geode.h')
-rw-r--r--include/asm-x86/geode.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h
index 771af336734f..811fe14f70b2 100644
--- a/include/asm-x86/geode.h
+++ b/include/asm-x86/geode.h
@@ -121,9 +121,15 @@ extern int geode_get_dev_base(unsigned int dev);
121#define GPIO_MAP_Z 0xE8 121#define GPIO_MAP_Z 0xE8
122#define GPIO_MAP_W 0xEC 122#define GPIO_MAP_W 0xEC
123 123
124extern void geode_gpio_set(unsigned int, unsigned int); 124static inline u32 geode_gpio(unsigned int nr)
125extern void geode_gpio_clear(unsigned int, unsigned int); 125{
126extern int geode_gpio_isset(unsigned int, unsigned int); 126 BUG_ON(nr > 28);
127 return 1 << nr;
128}
129
130extern void geode_gpio_set(u32, unsigned int);
131extern void geode_gpio_clear(u32, unsigned int);
132extern int geode_gpio_isset(u32, unsigned int);
127extern void geode_gpio_setup_event(unsigned int, int, int); 133extern void geode_gpio_setup_event(unsigned int, int, int);
128extern void geode_gpio_set_irq(unsigned int, unsigned int); 134extern void geode_gpio_set_irq(unsigned int, unsigned int);
129 135