From: Florian Fainelli <ffainelli@freebox.fr>
On BCM6345, the register offsets for the set/get GPIO registers is wrong
in order not add more complexity, use the HI_* variants for BCM6345
which results in reading/writing from/to the right register offsets.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
arch/mips/bcm63xx/gpio.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/mips/bcm63xx/gpio.c b/arch/mips/bcm63xx/gpio.c
index f560fe7..154353f 100644
--- a/arch/mips/bcm63xx/gpio.c
+++ b/arch/mips/bcm63xx/gpio.c
@@ -4,7 +4,7 @@
* for more details.
*
* Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
- * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org>
+ * Copyright (C) 2008-2011 Florian Fainelli <florian@openwrt.org>
*/
#include <linux/kernel.h>
@@ -33,7 +33,10 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
BUG();
if (gpio < 32) {
- reg = GPIO_DATA_LO_REG;
+ if (!BCMCPU_IS_6345())
+ reg = GPIO_DATA_LO_REG;
+ else
+ reg = GPIO_DATA_HI_REG;
mask = 1 << gpio;
v = &gpio_out_low;
} else {
@@ -60,7 +63,10 @@ static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned
gpio)
BUG();
if (gpio < 32) {
- reg = GPIO_DATA_LO_REG;
+ if (!BCMCPU_IS_6345())
+ reg = GPIO_DATA_LO_REG;
+ else
+ reg = GPIO_DATA_HI_REG;
mask = 1 << gpio;
} else {
reg = GPIO_DATA_HI_REG;
@@ -125,7 +131,11 @@ static struct gpio_chip bcm63xx_gpio_chip = {
int __init bcm63xx_gpio_init(void)
{
- gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
+ if (!BCMCPU_IS_6345())
+ gpio_out_low = bcm_gpio_readl(GPIO_DATA_LO_REG);
+ else
+ gpio_out_low = bcm_gpio_readl(GPIO_DATA_HI_REG);
+
gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG);
bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count();
pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio);
--
1.7.4.1
|