Module Name:    src
Committed By:   jmcneill
Date:           Wed Oct 15 23:29:46 UTC 2014

Modified Files:
        src/sys/arch/arm/allwinner: awin_com.c

Log Message:
different pinset for A31


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/allwinner/awin_com.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/allwinner/awin_com.c
diff -u src/sys/arch/arm/allwinner/awin_com.c:1.5 src/sys/arch/arm/allwinner/awin_com.c:1.6
--- src/sys/arch/arm/allwinner/awin_com.c:1.5	Thu Mar 13 23:45:32 2014
+++ src/sys/arch/arm/allwinner/awin_com.c	Wed Oct 15 23:29:46 2014
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: awin_com.c,v 1.5 2014/03/13 23:45:32 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_com.c,v 1.6 2014/10/15 23:29:46 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -77,6 +77,10 @@ static const struct awin_gpio_pinset awi
 	{ 'A', AWIN_PIO_PA_UART7_FUNC, AWIN_PIO_PA_UART7_PINS },
 };
 
+static const struct awin_gpio_pinset awin_com_pinsets_a31[] = {
+	{ 'H', AWIN_A31_PIO_PH_UART0_FUNC, AWIN_A31_PIO_PH_UART0_PINS },
+};
+
 CFATTACH_DECL_NEW(awin_com, sizeof(struct awin_com_softc),
 	awin_com_match, awin_com_attach, NULL, NULL);
 
@@ -89,8 +93,14 @@ awin_com_match(device_t parent, cfdata_t
 	const struct awin_locators * const loc = &aio->aio_loc;
 	bus_space_tag_t iot = aio->aio_core_a4x_bst;
 	bus_space_handle_t bsh;
-	const struct awin_gpio_pinset * const pinset = loc->loc_port +
-	    ((cf->cf_flags & 1) ? awin_com_alt_pinsets : awin_com_pinsets);
+	const struct awin_gpio_pinset *pinset;
+
+	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+		pinset = awin_com_pinsets_a31;
+	} else {
+		pinset = loc->loc_port + ((cf->cf_flags & 1) ?
+		    awin_com_alt_pinsets : awin_com_pinsets);
+	}
 
 	KASSERT(!strcmp(cf->cf_name, loc->loc_name));
 	KASSERT(loc->loc_offset >= AWIN_UART0_OFFSET);
@@ -128,10 +138,16 @@ awin_com_attach(device_t parent, device_
 	const struct awin_locators * const loc = &aio->aio_loc;
 	bus_space_tag_t iot = aio->aio_core_a4x_bst;
 	const bus_addr_t iobase = AWIN_CORE_PBASE + loc->loc_offset;
-	const struct awin_gpio_pinset * const pinset = loc->loc_port +
-	    ((cf->cf_flags & 1) ? awin_com_alt_pinsets : awin_com_pinsets);
+	const struct awin_gpio_pinset *pinset;
 	bus_space_handle_t ioh;
 
+	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+		pinset = awin_com_pinsets_a31;
+	} else {
+		pinset = loc->loc_port + ((cf->cf_flags & 1) ?
+		    awin_com_alt_pinsets : awin_com_pinsets);
+	}
+
 	awin_com_ports |= __BIT(loc->loc_port);
 
 	awin_gpio_pinset_acquire(pinset);

Reply via email to