projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix the comment
[openwrt.git]
/
target
/
linux
/
rdc-2.6
/
files
/
arch
/
i386
/
mach-rdc
/
gpio.c
diff --git
a/target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c
b/target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c
index
eadb152
..
2c38867
100644
(file)
--- a/
target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c
+++ b/
target/linux/rdc-2.6/files/arch/i386/mach-rdc/gpio.c
@@
-15,21
+15,25
@@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/delay.h>
-#define RDC3210_CFGREG_ADDR 0x0CF8
-#define RDC3210_CFGREG_DATA 0x0CFC
+#include <asm/mach-rdc/rdc321x_defs.h>
+
+static inline int rdc_gpio_is_valid(unsigned gpio)
+{
+ return ((gpio > RDC_MAX_GPIO) ? 0 : 1);
+}
static unsigned int rdc_gpio_read(unsigned gpio)
{
unsigned int val;
static unsigned int rdc_gpio_read(unsigned gpio)
{
unsigned int val;
- val = 0x80000000 | (7 << 11) | ((0x48));
+ val = 0x80000000 | (7 << 11) | ((
gpio&0x20?0x84:
0x48));
outl(val, RDC3210_CFGREG_ADDR);
udelay(10);
val = inl(RDC3210_CFGREG_DATA);
outl(val, RDC3210_CFGREG_ADDR);
udelay(10);
val = inl(RDC3210_CFGREG_DATA);
- val |= (0x1 <<
gpio
);
+ val |= (0x1 <<
(gpio & 0x1F)
);
outl(val, RDC3210_CFGREG_DATA);
udelay(10);
outl(val, RDC3210_CFGREG_DATA);
udelay(10);
- val = 0x80000000 | (7 << 11) | ((0x4C));
+ val = 0x80000000 | (7 << 11) | ((
gpio&0x20?0x88:
0x4C));
outl(val, RDC3210_CFGREG_ADDR);
udelay(10);
val = inl(RDC3210_CFGREG_DATA);
outl(val, RDC3210_CFGREG_ADDR);
udelay(10);
val = inl(RDC3210_CFGREG_DATA);
@@
-37,7
+41,7
@@
static unsigned int rdc_gpio_read(unsigned gpio)
return val;
}
return val;
}
-void rdc_gpio_write(unsigned int val)
+
static
void rdc_gpio_write(unsigned int val)
{
if (val) {
outl(val, RDC3210_CFGREG_DATA);
{
if (val) {
outl(val, RDC3210_CFGREG_DATA);
@@
-47,7
+51,8
@@
void rdc_gpio_write(unsigned int val)
int rdc_gpio_get_value(unsigned gpio)
{
int rdc_gpio_get_value(unsigned gpio)
{
- return ((int)rdc_gpio_read(gpio));
+ if (rdc_gpio_is_valid(gpio))
+ return (int)rdc_gpio_read(gpio);
}
EXPORT_SYMBOL(rdc_gpio_get_value);
}
EXPORT_SYMBOL(rdc_gpio_get_value);
@@
-55,12
+60,15
@@
void rdc_gpio_set_value(unsigned gpio, int value)
{
unsigned int val;
{
unsigned int val;
+ if (!rdc_gpio_is_valid(gpio))
+ return;
+
val = rdc_gpio_read(gpio);
if (value)
val = rdc_gpio_read(gpio);
if (value)
- val &= ~(0x1 <<
gpio
);
+ val &= ~(0x1 <<
(gpio & 0x1F)
);
else
else
- val |= (0x1 <<
gpio
);
+ val |= (0x1 <<
(gpio & 0x1F)
);
rdc_gpio_write(val);
}
rdc_gpio_write(val);
}
This page took
0.023978 seconds
and
4
git commands to generate.