Module Name: src Committed By: jmcneill Date: Sun Nov 2 23:54:16 UTC 2014
Modified Files: src/sys/arch/arm/allwinner: awin_gpio.c awin_var.h Log Message: fix a kassert for pin group L and M on A31; allow pinset request to pass pin pullup/pulldown flags To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/allwinner/awin_gpio.c cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/allwinner/awin_var.h 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_gpio.c diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.12 src/sys/arch/arm/allwinner/awin_gpio.c:1.13 --- src/sys/arch/arm/allwinner/awin_gpio.c:1.12 Mon Oct 20 19:05:46 2014 +++ src/sys/arch/arm/allwinner/awin_gpio.c Sun Nov 2 23:54:16 2014 @@ -35,7 +35,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.12 2014/10/20 19:05:46 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.13 2014/11/02 23:54:16 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -488,7 +488,15 @@ awin_gpio_pinset_available(const struct if (!req->pinset_group) return false; - KASSERT('A' <= req->pinset_group && req->pinset_group <= 'I'); +#ifdef DIAGNOSTIC + if (awin_chip_id() == AWIN_CHIP_ID_A31) { + KASSERT( + ('A' <= req->pinset_group && req->pinset_group <= 'I') || + ('L' <= req->pinset_group && req->pinset_group <= 'M')); + } else { + KASSERT('A' <= req->pinset_group && req->pinset_group <= 'I'); + } +#endif struct awin_gpio_pin_group * const grp = &pin_groups[req->pinset_group - 'A']; @@ -564,6 +572,11 @@ awin_gpio_pinset_acquire(const struct aw * Change the function of this pin. */ awin_gpio_set_pin_func(&ncfg, j, req->pinset_func); + + if (req->pinset_flags & GPIO_PIN_PULLDOWN) + awin_gpio_set_pin_pull(&ncfg, j, AWIN_PIO_PULL_DOWN); + else if (req->pinset_flags & GPIO_PIN_PULLUP) + awin_gpio_set_pin_pull(&ncfg, j, AWIN_PIO_PULL_UP); } /* Index: src/sys/arch/arm/allwinner/awin_var.h diff -u src/sys/arch/arm/allwinner/awin_var.h:1.18 src/sys/arch/arm/allwinner/awin_var.h:1.19 --- src/sys/arch/arm/allwinner/awin_var.h:1.18 Mon Oct 13 12:34:00 2014 +++ src/sys/arch/arm/allwinner/awin_var.h Sun Nov 2 23:54:16 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: awin_var.h,v 1.18 2014/10/13 12:34:00 jmcneill Exp $ */ +/* $NetBSD: awin_var.h,v 1.19 2014/11/02 23:54:16 jmcneill Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,6 +66,7 @@ struct awin_gpio_pinset { uint8_t pinset_group; uint8_t pinset_func; uint32_t pinset_mask; + int pinset_flags; }; struct awin_gpio_pindata {