Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jul 2013 03:55:19 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253510 - head/sys/mips/atheros
Message-ID:  <201307210355.r6L3tJZS057437@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sun Jul 21 03:55:18 2013
New Revision: 253510
URL: http://svnweb.freebsd.org/changeset/base/253510

Log:
  Teach the GPIO code about the AR934x GPIO register and pin counts.

Modified:
  head/sys/mips/atheros/ar71xx_gpio.c

Modified: head/sys/mips/atheros/ar71xx_gpio.c
==============================================================================
--- head/sys/mips/atheros/ar71xx_gpio.c	Sun Jul 21 03:54:39 2013	(r253509)
+++ head/sys/mips/atheros/ar71xx_gpio.c	Sun Jul 21 03:55:18 2013	(r253510)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include <mips/atheros/ar71xx_setup.h>
 #include <mips/atheros/ar71xx_gpiovar.h>
 #include <mips/atheros/ar933xreg.h>
+#include <mips/atheros/ar934xreg.h>
 
 #include "gpio_if.h"
 
@@ -90,13 +91,23 @@ static int ar71xx_gpio_pin_toggle(device
 static void
 ar71xx_gpio_function_enable(struct ar71xx_gpio_softc *sc, uint32_t mask)
 {
-	GPIO_SET_BITS(sc, AR71XX_GPIO_FUNCTION, mask);
+	if (ar71xx_soc == AR71XX_SOC_AR9341 ||
+	    ar71xx_soc == AR71XX_SOC_AR9342 ||
+	    ar71xx_soc == AR71XX_SOC_AR9344)
+		GPIO_SET_BITS(sc, AR934X_GPIO_REG_FUNC, mask);
+	else
+		GPIO_SET_BITS(sc, AR71XX_GPIO_FUNCTION, mask);
 }
 
 static void
 ar71xx_gpio_function_disable(struct ar71xx_gpio_softc *sc, uint32_t mask)
 {
-	GPIO_CLEAR_BITS(sc, AR71XX_GPIO_FUNCTION, mask);
+	if (ar71xx_soc == AR71XX_SOC_AR9341 ||
+	    ar71xx_soc == AR71XX_SOC_AR9342 ||
+	    ar71xx_soc == AR71XX_SOC_AR9344)
+		GPIO_CLEAR_BITS(sc, AR934X_GPIO_REG_FUNC, mask);
+	else
+		GPIO_CLEAR_BITS(sc, AR71XX_GPIO_FUNCTION, mask);
 }
 
 static void
@@ -141,6 +152,10 @@ ar71xx_gpio_pin_max(device_t dev, int *m
 		case AR71XX_SOC_AR9331:
 			*maxpin = AR933X_GPIO_COUNT - 1;
 			break;
+		case AR71XX_SOC_AR9341:
+		case AR71XX_SOC_AR9342:
+		case AR71XX_SOC_AR9344:
+			*maxpin = AR934X_GPIO_COUNT - 1;
 		default:
 			*maxpin = AR71XX_GPIO_PINS - 1;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307210355.r6L3tJZS057437>