summaryrefslogtreecommitdiff
path: root/target/linux/rb532/files/include
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-01-11 10:42:06 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-01-11 10:42:06 +0000
commit9dd1cc458f802fc14461f2eff78fb9992ba73c0b (patch)
treed4bdb75621c44823d72ffa61a04c762262350b3a /target/linux/rb532/files/include
parentaa00d4ee30c5a55834e891f77476489b539036b6 (diff)
Upgrade rb532 to .23, provide generic GPIO API to this board
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10171 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/rb532/files/include')
-rw-r--r--target/linux/rb532/files/include/asm-mips/rc32434/gpio.h95
-rw-r--r--target/linux/rb532/files/include/asm-mips/rc32434/rc32434.h1
2 files changed, 64 insertions, 32 deletions
diff --git a/target/linux/rb532/files/include/asm-mips/rc32434/gpio.h b/target/linux/rb532/files/include/asm-mips/rc32434/gpio.h
index 1638cfeacc..393259342d 100644
--- a/target/linux/rb532/files/include/asm-mips/rc32434/gpio.h
+++ b/target/linux/rb532/files/include/asm-mips/rc32434/gpio.h
@@ -1,39 +1,21 @@
-#ifndef __IDT_GPIO_H__
-#define __IDT_GPIO_H__
-
-/*******************************************************************************
- *
+/*
* Copyright 2002 Integrated Device Technology, Inc.
- * All rights reserved.
+ * All rights reserved.
*
* GPIO register definition.
*
- * File : $Id: gpio.h,v 1.2 2002/06/06 18:34:04 astichte Exp $
- *
* Author : ryan.holmQVist@idt.com
* Date : 20011005
- * Update :
- * $Log: gpio.h,v $
- * Revision 1.2 2002/06/06 18:34:04 astichte
- * Added XXX_PhysicalAddress and XXX_VirtualAddress
- *
- * Revision 1.1 2002/05/29 17:33:22 sysarch
- * jba File moved from vcode/include/idt/acacia
- *
- *
- ******************************************************************************/
+ * Copyright (C) 2001, 2002 Ryan Holm <ryan.holmQVist@idt.com>
+ * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
+ */
-enum
-{
- GPIO0_PhysicalAddress = 0x18050000,
- GPIO_PhysicalAddress = GPIO0_PhysicalAddress, // Default
+#ifndef _RC32434_GPIO_H_
+#define _RC32434_GPIO_H_
- GPIO0_VirtualAddress = 0xb8050000,
- GPIO_VirtualAddress = GPIO0_VirtualAddress, // Default
-} ;
+#include <linux/types.h>
-typedef struct
-{
+struct rb500_gpio_reg {
u32 gpiofunc; /* GPIO Function Register
* gpiofunc[x]==0 bit = gpio
* func[x]==1 bit = altfunc
@@ -53,9 +35,9 @@ typedef struct
* cleared in ISR (STICKY bits)
*/
u32 gpionmien; /* GPIO Non-maskable Interrupt Enable Register */
-} volatile * GPIO_t ;
+};
-typedef enum
+enum gpio_regs
{
GPIO_gpio_v = 0, // gpiofunc use pin as GPIO.
GPIO_alt_v = 1, // gpiofunc use pin as alt.
@@ -175,7 +157,58 @@ typedef enum
GPIO_pcimuintn_m = GPIO_pin13_m,
GPIO_pcimuintn_cfg_v = GPIO_output_v,
-} GPIO_DEFS_t;
+};
+
+extern int rb500_gpio_get_value(unsigned gpio);
+extern void rb500_gpio_set_value(unsigned gpio, int value);
+extern int rb500_gpio_direction_input(unsigned gpio);
+extern int rb500_gpio_direction_output(unsigned gpio, int value);
+
+
+/* Wrappers for the arch-neutral GPIO API */
+
+static inline int gpio_request(unsigned gpio, const char *label)
+{
+ /* Not yet implemented */
+ return 0;
+}
+
+static inline void gpio_free(unsigned gpio)
+{
+ /* Not yet implemented */
+}
+
+static inline int gpio_direction_input(unsigned gpio)
+{
+ return rb500_gpio_direction_input(gpio);
+}
+
+static inline int gpio_direction_output(unsigned gpio, int value)
+{
+ return rb500_gpio_direction_output(gpio, value);
+}
+
+static inline int gpio_get_value(unsigned gpio)
+{
+ return rb500_gpio_get_value(gpio);
+}
+
+static inline void gpio_set_value(unsigned gpio, int value)
+{
+ rb500_gpio_set_value(gpio, value);
+}
+
+static inline int gpio_to_irq(unsigned gpio)
+{
+ return gpio;
+}
+
+static inline int irq_to_gpio(unsigned irq)
+{
+ return irq;
+}
-#endif // __IDT_GPIO_H__
+/* For cansleep */
+#include <asm-generic/gpio.h>
+#endif /* _RC32434_GPIO_H_ */
diff --git a/target/linux/rb532/files/include/asm-mips/rc32434/rc32434.h b/target/linux/rb532/files/include/asm-mips/rc32434/rc32434.h
index 848fc86b3a..f3e53e4332 100644
--- a/target/linux/rb532/files/include/asm-mips/rc32434/rc32434.h
+++ b/target/linux/rb532/files/include/asm-mips/rc32434/rc32434.h
@@ -32,7 +32,6 @@
#define RC32434_REG_BASE 0x18000000
#define interrupt ((volatile INT_t ) INT0_VirtualAddress)
-#define gpio ((volatile GPIO_t) GPIO0_VirtualAddress)
#define IDT_CLOCK_MULT 2