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 Let pinsets override the default mult...



details:   https://anonhg.NetBSD.org/src/rev/dccb1433e3e6
branches:  trunk
changeset: 333960:dccb1433e3e6
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Nov 23 23:04:58 2014 +0000

description:
Let pinsets override the default multi-driving select level.

diffstat:

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

diffs (56 lines):

diff -r 1a5a6d7847e7 -r dccb1433e3e6 sys/arch/arm/allwinner/awin_gpio.c
--- a/sys/arch/arm/allwinner/awin_gpio.c        Sun Nov 23 22:42:14 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_gpio.c        Sun Nov 23 23:04:58 2014 +0000
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.13 2014/11/02 23:54:16 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.14 2014/11/23 23:04:58 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -384,6 +384,16 @@
 }
 
 static void
+awin_gpio_set_pin_drv(struct awin_gpio_pin_cfg *cfg, u_int pin, u_int drv)
+{
+       const u_int shift = (pin & 15) << 1;
+       const u_int i = (pin >> 4) & 1;
+       
+       cfg->drv[i] &= ~(0x03 << shift);
+       cfg->drv[i] |= drv << shift;
+}
+
+static void
 awin_gpio_update_cfg_regs(bus_space_tag_t bst, struct awin_gpio_pin_group *grp,
     const struct awin_gpio_pin_cfg *ncfg)
 {
@@ -577,6 +587,9 @@
                        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);
+
+               if (req->pinset_drv)
+                       awin_gpio_set_pin_drv(&ncfg, j, req->pinset_drv);
        }
 
        /*
diff -r 1a5a6d7847e7 -r dccb1433e3e6 sys/arch/arm/allwinner/awin_var.h
--- a/sys/arch/arm/allwinner/awin_var.h Sun Nov 23 22:42:14 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_var.h Sun Nov 23 23:04:58 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_var.h,v 1.25 2014/11/17 01:38:00 jmcneill Exp $ */
+/* $NetBSD: awin_var.h,v 1.26 2014/11/23 23:04:58 jmcneill Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -76,6 +76,7 @@
        uint8_t pinset_func;
        uint32_t pinset_mask;
        int pinset_flags;
+       int pinset_drv;
 };
 
 struct awin_gpio_pindata {



Home | Main Index | Thread Index | Old Index