From owner-svn-src-all@FreeBSD.ORG Fri May 6 02:45:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D239106564A; Fri, 6 May 2011 02:45:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F096E8FC08; Fri, 6 May 2011 02:45:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p462j2BX028998; Fri, 6 May 2011 02:45:02 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p462j2mv028994; Fri, 6 May 2011 02:45:02 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105060245.p462j2mv028994@svn.freebsd.org> From: Adrian Chadd Date: Fri, 6 May 2011 02:45:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221518 - head/sys/mips/atheros X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2011 02:45:03 -0000 Author: adrian Date: Fri May 6 02:45:02 2011 New Revision: 221518 URL: http://svn.freebsd.org/changeset/base/221518 Log: Fix GPIO_MAXPINS calculation for the AR71xx, AR724x, AR913x SoC. Submitted by: Luiz Otavio O Souza Modified: head/sys/mips/atheros/ar71xx_gpio.c head/sys/mips/atheros/ar71xx_gpiovar.h head/sys/mips/atheros/ar724xreg.h head/sys/mips/atheros/ar91xxreg.h Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Fri May 6 01:29:14 2011 (r221517) +++ head/sys/mips/atheros/ar71xx_gpio.c Fri May 6 02:45:02 2011 (r221518) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #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); } Modified: head/sys/mips/atheros/ar71xx_gpiovar.h ============================================================================== --- head/sys/mips/atheros/ar71xx_gpiovar.h Fri May 6 01:29:14 2011 (r221517) +++ head/sys/mips/atheros/ar71xx_gpiovar.h Fri May 6 02:45:02 2011 (r221518) @@ -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; Modified: head/sys/mips/atheros/ar724xreg.h ============================================================================== --- head/sys/mips/atheros/ar724xreg.h Fri May 6 01:29:14 2011 (r221517) +++ head/sys/mips/atheros/ar724xreg.h Fri May 6 02:45:02 2011 (r221518) @@ -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 Modified: head/sys/mips/atheros/ar91xxreg.h ============================================================================== --- head/sys/mips/atheros/ar91xxreg.h Fri May 6 01:29:14 2011 (r221517) +++ head/sys/mips/atheros/ar91xxreg.h Fri May 6 02:45:02 2011 (r221518) @@ -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