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 Based on suggestion from jared, redo ...
details: https://anonhg.NetBSD.org/src/rev/46b61ddfade7
branches: trunk
changeset: 340797:46b61ddfade7
user: bouyer <bouyer%NetBSD.org@localhost>
date: Fri Oct 02 16:04:40 2015 +0000
description:
Based on suggestion from jared, redo previous using a specific print callback
to avoid the extra line. Now output looks like:
gpio0 at awingpio0 port B: 18 pins
gpio1 at awingpio0 port C: 25 pins
gpio2 at awingpio0 port D: 28 pins
gpio3 at awingpio0 port E: 12 pins
gpio4 at awingpio0 port G: 12 pins
gpio5 at awingpio0 port H: 28 pins
gpio6 at awingpio0 port I: 22 pins
diffstat:
sys/arch/arm/allwinner/awin_gpio.c | 34 ++++++++++++++++++++++++++++++----
1 files changed, 30 insertions(+), 4 deletions(-)
diffs (163 lines):
diff -r c810358e48df -r 46b61ddfade7 sys/arch/arm/allwinner/awin_gpio.c
--- a/sys/arch/arm/allwinner/awin_gpio.c Fri Oct 02 14:06:02 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_gpio.c Fri Oct 02 16:04:40 2015 +0000
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.19 2015/10/02 14:06:02 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gpio.c,v 1.20 2015/10/02 16:04:40 bouyer Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -81,6 +81,7 @@
bus_space_handle_t grp_bsh;
struct awin_gpio_pin_cfg grp_cfg;
struct gpio_chipset_tag grp_gc_tag;
+ const int grp_index;
const char grp_nc_name[6];
} pin_groups[] = {
[0] = {
@@ -92,6 +93,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 0,
.grp_nc_name = "nc-pa",
},
[1] = {
@@ -103,6 +105,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 1,
.grp_nc_name = "nc-pb",
},
[2] = {
@@ -114,6 +117,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 2,
.grp_nc_name = "nc-pc",
},
[3] = {
@@ -125,6 +129,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 3,
.grp_nc_name = "nc-pd",
},
[4] = {
@@ -136,6 +141,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 4,
.grp_nc_name = "nc-pe",
},
[5] = {
@@ -147,6 +153,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 5,
.grp_nc_name = "nc-pf",
},
[6] = {
@@ -158,6 +165,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 6,
.grp_nc_name = "nc-pg",
},
[7] = {
@@ -169,6 +177,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 7,
.grp_nc_name = "nc-ph",
},
[8] = {
@@ -180,6 +189,7 @@
.gp_pin_write = awin_gpio_pin_write,
.gp_pin_ctl = awin_gpio_pin_ctl,
},
+ .grp_index = 8,
.grp_nc_name = "nc-pi",
},
[9] = {
@@ -191,6 +201,7 @@
.gp_pin_ctl = awin_gpio_pin_ctl,
},
.grp_pin_mask = 0,
+ .grp_index = 9,
.grp_nc_name = "nc-pj",
},
[10] = {
@@ -202,6 +213,7 @@
.gp_pin_ctl = awin_gpio_pin_ctl,
},
.grp_pin_mask = 0,
+ .grp_index = 10,
.grp_nc_name = "nc-pk",
},
[11] = {
@@ -213,6 +225,7 @@
.gp_pin_ctl = awin_gpio_pin_ctl,
},
.grp_pin_mask = 0,
+ .grp_index = 11,
.grp_nc_name = "nc-pl",
},
[12] = {
@@ -224,6 +237,7 @@
.gp_pin_ctl = awin_gpio_pin_ctl,
},
.grp_pin_mask = 0,
+ .grp_index = 12,
.grp_nc_name = "nc-pm",
},
[13] = {
@@ -268,6 +282,20 @@
}
#if NGPIO > 0
+static int
+awin_gpio_cfprint(void *priv, const char *pnp)
+{
+ struct gpiobus_attach_args *gba = priv;
+ struct awin_gpio_pin_group *grp = gba->gba_gc->gp_cookie;
+
+ if (pnp)
+ aprint_normal("gpiobus at %s", pnp);
+
+ aprint_normal(" port %c", 'A' + grp->grp_index);
+
+ return UNCONF;
+}
+
static void
awin_gpio_config_pins(device_t self)
{
@@ -298,7 +326,6 @@
for (u_int i = 0; i < __arraycount(pin_groups); i++) {
struct awin_gpio_pin_group * const grp = &pin_groups[i];
uint32_t mask = grp->grp_pin_mask & ~grp->grp_pin_inuse_mask;
- device_t gpio;
/*
* If this group has no bits to provide, skip it.
@@ -324,8 +351,7 @@
}
gba.gba_npins = pin - gba.gba_pins;
- gpio = config_found_ia(self, "gpiobus", &gba, gpiobus_print);
- aprint_normal_dev(gpio, "port %c\n", 'A' + i);
+ config_found_ia(self, "gpiobus", &gba, awin_gpio_cfprint);
}
}
#endif /* NGPIO > 0 */
Home |
Main Index |
Thread Index |
Old Index