diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2007-12-12 12:42:40 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2007-12-12 12:42:40 +0000 |
commit | 94b114314e962bdeb1d7dfdbaf897b553bfd7c8d (patch) | |
tree | f8204d8d004935cd0d9cc4978715a90a35cf6422 /target/linux/adm5120/files/arch | |
parent | c4f8cd6b6927979025326dcc4fe659f8d34c4b76 (diff) | |
download | master-187ad058-94b114314e962bdeb1d7dfdbaf897b553bfd7c8d.tar.gz master-187ad058-94b114314e962bdeb1d7dfdbaf897b553bfd7c8d.tar.bz2 master-187ad058-94b114314e962bdeb1d7dfdbaf897b553bfd7c8d.zip |
[adm5120] use a shadow value for the write-only GPIO_CONF2 register
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9715 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120/files/arch')
-rw-r--r-- | target/linux/adm5120/files/arch/mips/adm5120/gpio.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/target/linux/adm5120/files/arch/mips/adm5120/gpio.c b/target/linux/adm5120/files/arch/mips/adm5120/gpio.c index a9e6e6bdfb..01d5a87c4e 100644 --- a/target/linux/adm5120/files/arch/mips/adm5120/gpio.c +++ b/target/linux/adm5120/files/arch/mips/adm5120/gpio.c @@ -74,6 +74,8 @@ static struct led_desc led_table[15] = { static struct adm5120_gpio_line adm5120_gpio_map[ADM5120_GPIO_COUNT]; +static u32 gpio_conf2; + /*-------------------------------------------------------------------------*/ static inline int gpio_is_invalid(unsigned gpio) @@ -340,11 +342,8 @@ EXPORT_SYMBOL(adm5120_irq_to_gpio); void __init adm5120_gpio_csx0_enable(void) { - u32 t; - - t = SW_READ_REG(GPIO_CONF2); - t |= GPIO_CONF2_CSX0; - SW_WRITE_REG(GPIO_CONF2, t); + gpio_conf2 |= GPIO_CONF2_CSX0; + SW_WRITE_REG(GPIO_CONF2, gpio_conf2); adm5120_gpio_map[ADM5120_GPIO_PIN1].flags &= ~GPIO_FLAG_VALID; adm5120_gpio_map[ADM5120_GPIO_PIN2].irq = ADM5120_IRQ_GPIO2; @@ -352,11 +351,8 @@ void __init adm5120_gpio_csx0_enable(void) void __init adm5120_gpio_csx1_enable(void) { - u32 t; - - t = SW_READ_REG(GPIO_CONF2); - t |= GPIO_CONF2_CSX1; - SW_WRITE_REG(GPIO_CONF2, t); + gpio_conf2 |= GPIO_CONF2_CSX1; + SW_WRITE_REG(GPIO_CONF2, gpio_conf2); adm5120_gpio_map[ADM5120_GPIO_PIN3].flags &= ~GPIO_FLAG_VALID; if (adm5120_package_bga()) @@ -365,11 +361,8 @@ void __init adm5120_gpio_csx1_enable(void) void __init adm5120_gpio_ew_enable(void) { - u32 t; - - t = SW_READ_REG(GPIO_CONF2); - t |= GPIO_CONF2_EW; - SW_WRITE_REG(GPIO_CONF2, t); + gpio_conf2 |= GPIO_CONF2_EW; + SW_WRITE_REG(GPIO_CONF2, gpio_conf2); adm5120_gpio_map[ADM5120_GPIO_PIN0].flags &= ~GPIO_FLAG_VALID; } @@ -378,7 +371,8 @@ void __init adm5120_gpio_init(void) { int i; - SW_WRITE_REG(GPIO_CONF2, 0); + gpio_conf2 = 0; + SW_WRITE_REG(GPIO_CONF2, gpio_conf2); for (i = 0; i < ADM5120_GPIO_COUNT; i++) adm5120_gpio_map[i].flags = GPIO_FLAG_VALID; |