Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/allwinner fix a kassert for pin group L and M o...



details:   https://anonhg.NetBSD.org/src/rev/a4e85fad223e
branches:  trunk
changeset: 803561:a4e85fad223e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Nov 02 23:54:16 2014 +0000

description:
fix a kassert for pin group L and M on A31; allow pinset request to pass pin pullup/pulldown flags

diffstat:

 sys/arch/arm/allwinner/awin_gpio.c |  17 +++++++++++++++--
 sys/arch/arm/allwinner/awin_var.h  |   3 ++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r 6d3048d1e64a -r a4e85fad223e sys/arch/arm/allwinner/awin_gpio.c
--- a/sys/arch/arm/allwinner/awin_gpio.c        Sun Nov 02 23:14:20 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_gpio.c        Sun Nov 02 23:54:16 2014 +0000
@@ -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 @@
        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 @@
                 * 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);
        }
 
        /*
diff -r 6d3048d1e64a -r a4e85fad223e sys/arch/arm/allwinner/awin_var.h
--- a/sys/arch/arm/allwinner/awin_var.h Sun Nov 02 23:14:20 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_var.h Sun Nov 02 23:54:16 2014 +0000
@@ -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 @@
        uint8_t pinset_group;
        uint8_t pinset_func;
        uint32_t pinset_mask;
+       int pinset_flags;
 };
 
 struct awin_gpio_pindata {



Home | Main Index | Thread Index | Old Index