Module Name: src Committed By: bouyer Date: Fri Oct 2 16:04:40 UTC 2015
Modified Files: src/sys/arch/arm/allwinner: awin_gpio.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/allwinner/awin_gpio.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_gpio.c diff -u src/sys/arch/arm/allwinner/awin_gpio.c:1.19 src/sys/arch/arm/allwinner/awin_gpio.c:1.20 --- src/sys/arch/arm/allwinner/awin_gpio.c:1.19 Fri Oct 2 14:06:02 2015 +++ src/sys/arch/arm/allwinner/awin_gpio.c Fri Oct 2 16:04:40 2015 @@ -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 @@ static struct awin_gpio_pin_group { 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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .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 @@ static struct awin_gpio_pin_group { .gp_pin_ctl = awin_gpio_pin_ctl, }, .grp_pin_mask = 0, + .grp_index = 9, .grp_nc_name = "nc-pj", }, [10] = { @@ -202,6 +213,7 @@ static struct awin_gpio_pin_group { .gp_pin_ctl = awin_gpio_pin_ctl, }, .grp_pin_mask = 0, + .grp_index = 10, .grp_nc_name = "nc-pk", }, [11] = { @@ -213,6 +225,7 @@ static struct awin_gpio_pin_group { .gp_pin_ctl = awin_gpio_pin_ctl, }, .grp_pin_mask = 0, + .grp_index = 11, .grp_nc_name = "nc-pl", }, [12] = { @@ -224,6 +237,7 @@ static struct awin_gpio_pin_group { .gp_pin_ctl = awin_gpio_pin_ctl, }, .grp_pin_mask = 0, + .grp_index = 12, .grp_nc_name = "nc-pm", }, [13] = { @@ -268,6 +282,20 @@ awin_gpio_match(device_t parent, cfdata_ } #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 @@ awin_gpio_config_pins(device_t self) 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 @@ awin_gpio_config_pins(device_t self) } 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 */