diff options
author | adrian <adrian@FreeBSD.org> | 2011-05-06 02:45:02 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2011-05-06 02:45:02 +0000 |
commit | 94eb8448ed7c89ab280bf0aabcde41193007921f (patch) | |
tree | b9e81a13f9c7bbf51dd8eb791c0f6828580665ae /sys/mips | |
parent | e4e59a6cee21f1c822331285e993f57317404cae (diff) | |
download | FreeBSD-src-94eb8448ed7c89ab280bf0aabcde41193007921f.zip FreeBSD-src-94eb8448ed7c89ab280bf0aabcde41193007921f.tar.gz |
Fix GPIO_MAXPINS calculation for the AR71xx, AR724x, AR913x SoC.
Submitted by: Luiz Otavio O Souza <loos.br@gmail.com>
Diffstat (limited to 'sys/mips')
-rw-r--r-- | sys/mips/atheros/ar71xx_gpio.c | 15 | ||||
-rw-r--r-- | sys/mips/atheros/ar71xx_gpiovar.h | 2 | ||||
-rw-r--r-- | sys/mips/atheros/ar724xreg.h | 2 | ||||
-rw-r--r-- | sys/mips/atheros/ar91xxreg.h | 2 |
4 files changed, 16 insertions, 5 deletions
diff --git a/sys/mips/atheros/ar71xx_gpio.c b/sys/mips/atheros/ar71xx_gpio.c index 866c72b..09b4d50 100644 --- a/sys/mips/atheros/ar71xx_gpio.c +++ b/sys/mips/atheros/ar71xx_gpio.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/resource.h> #include <mips/atheros/ar71xxreg.h> +#include <mips/atheros/ar71xx_setup.h> #include <mips/atheros/ar71xx_gpiovar.h> #include "gpio_if.h" @@ -144,7 +145,19 @@ static int ar71xx_gpio_pin_max(device_t dev, int *maxpin) { - *maxpin = AR71XX_GPIO_PINS - 1; + switch (ar71xx_soc) { + case AR71XX_SOC_AR9130: + case AR71XX_SOC_AR9132: + *maxpin = AR91XX_GPIO_PINS - 1; + break; + case AR71XX_SOC_AR7240: + case AR71XX_SOC_AR7241: + case AR71XX_SOC_AR7242: + *maxpin = AR724X_GPIO_PINS - 1; + break; + default: + *maxpin = AR71XX_GPIO_PINS - 1; + } return (0); } diff --git a/sys/mips/atheros/ar71xx_gpiovar.h b/sys/mips/atheros/ar71xx_gpiovar.h index a9ed7e0..3489f5a 100644 --- a/sys/mips/atheros/ar71xx_gpiovar.h +++ b/sys/mips/atheros/ar71xx_gpiovar.h @@ -52,6 +52,8 @@ GPIO_WRITE(sc, reg, GPIO_READ(sc, (reg)) & ~(bits)) #define AR71XX_GPIO_PINS 12 +#define AR724X_GPIO_PINS 18 +#define AR91XX_GPIO_PINS 22 struct ar71xx_gpio_softc { device_t dev; diff --git a/sys/mips/atheros/ar724xreg.h b/sys/mips/atheros/ar724xreg.h index eaceb1d..73e20af 100644 --- a/sys/mips/atheros/ar724xreg.h +++ b/sys/mips/atheros/ar724xreg.h @@ -105,6 +105,4 @@ #define AR724X_GPIO_FUNC_UART_EN (1 >> 1) #define AR724X_GPIO_FUNC_JTAG_DISABLE (1 >> 0) -#define AR724X_GPIO_COUNT 18 - #endif diff --git a/sys/mips/atheros/ar91xxreg.h b/sys/mips/atheros/ar91xxreg.h index 729d9ff..2dfaeb5 100644 --- a/sys/mips/atheros/ar91xxreg.h +++ b/sys/mips/atheros/ar91xxreg.h @@ -81,6 +81,4 @@ #define AR91XX_GPIO_FUNC_UART_EN (1 << 8) #define AR91XX_GPIO_FUNC_USB_CLK_EN (1 << 4) -#define AR91XX_GPIO_COUNT 22 - #endif |