Fix GPIO_MAXPINS calculation for the AR71xx, AR724x, AR913x SoC.

Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
This commit is contained in:
adrian 2011-05-06 02:45:02 +00:00
parent e4e59a6cee
commit 94eb8448ed
4 changed files with 16 additions and 5 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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

View File

@ -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