Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/samsung XU4 GPIO Review Changes
details: https://anonhg.NetBSD.org/src/rev/f0669b3c22df
branches: trunk
changeset: 342479:f0669b3c22df
user: marty <marty%NetBSD.org@localhost>
date: Thu Dec 24 01:10:51 2015 +0000
description:
XU4 GPIO Review Changes
Implement suggestions from Jared.
diffstat:
sys/arch/arm/samsung/exynos_gpio.c | 32 ++++++++++++++++++--------------
sys/arch/arm/samsung/exynos_pinctrl.c | 9 +++------
sys/arch/arm/samsung/exynos_var.h | 7 +++++--
sys/arch/arm/samsung/files.exynos | 9 ++-------
4 files changed, 28 insertions(+), 29 deletions(-)
diffs (159 lines):
diff -r 170b58f730a7 -r f0669b3c22df sys/arch/arm/samsung/exynos_gpio.c
--- a/sys/arch/arm/samsung/exynos_gpio.c Thu Dec 24 00:36:43 2015 +0000
+++ b/sys/arch/arm/samsung/exynos_gpio.c Thu Dec 24 01:10:51 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_gpio.c,v 1.17 2015/12/22 22:19:07 jmcneill Exp $ */
+/* $NetBSD: exynos_gpio.c,v 1.18 2015/12/24 01:10:51 marty Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include "gpio.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.17 2015/12/22 22:19:07 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.18 2015/12/24 01:10:51 marty Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -281,7 +281,8 @@
}
void
-exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent, int node)
+exynos_gpio_bank_config(struct exynos_pinctrl_softc * parent,
+ const struct fdt_attach_args *faa, int node)
{
struct exynos_gpio_bank *bank = kmem_zalloc(sizeof(*bank), KM_SLEEP);
struct exynos_gpio_softc *sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
@@ -320,32 +321,35 @@
bank->bank_cfg.drv = GPIO_READ(bank, EXYNOS_GPIO_DRV);
bank->bank_cfg.conpwd = GPIO_READ(bank, EXYNOS_GPIO_CONPWD);
bank->bank_cfg.pudpwd = GPIO_READ(bank, EXYNOS_GPIO_PUDPWD);
+
+ fdtbus_register_gpio_controller(bank->bank_dev, faa->faa_phandle,
+ &exynos_gpio_funcs);
}
/*
- * pinmame = gpLD-N
+ * pinmame = gpLD[-N]
* L = 'a' - 'z' -+
- * D = '0' - '8' -+ ===== bank name
- * N = '0' - '8' ===== pin number
+ * D = '0' - '9' -+ ===== bank name
+ * N = '0' - '7' ===== pin number
*/
static struct exynos_gpio_bank *
exynos_gpio_pin_lookup(const char *pinname, int *ppin)
{
char bankname[5];
- int pin;
+ int pin = 0;
int n;
struct exynos_gpio_bank *bank;
memset(bankname, 0, sizeof(bankname));
- bankname[0] = pinname[0]; /* 'g' */
- bankname[1] = pinname[1]; /* 'p' */
- bankname[2] = pinname[2]; /* L */
- bankname[3] = pinname[3]; /* D */
- bankname[4] = 0;
- if (ppin)
+ for (n = 0; n < 4; n++)
+ bankname[n] = pinname[n];
+ bankname[n] = 0;
+ if (ppin && pinname[4] == '-') {
pin = pinname[5] - '0'; /* skip the '-' */
-
+ if (pin < 0 || pin > 8)
+ return NULL;
+ }
for (n = 0; n < __arraycount(exynos5_banks); n++) {
bank = &exynos_gpio_banks[n];
if (strcmp(bank->bank_name, bankname) == 0) {
diff -r 170b58f730a7 -r f0669b3c22df sys/arch/arm/samsung/exynos_pinctrl.c
--- a/sys/arch/arm/samsung/exynos_pinctrl.c Thu Dec 24 00:36:43 2015 +0000
+++ b/sys/arch/arm/samsung/exynos_pinctrl.c Thu Dec 24 01:10:51 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_pinctrl.c,v 1.5 2015/12/22 22:34:42 jmcneill Exp $ */
+/* $NetBSD: exynos_pinctrl.c,v 1.6 2015/12/24 01:10:51 marty Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include "gpio.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.5 2015/12/22 22:34:42 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.6 2015/12/24 01:10:51 marty Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -98,12 +98,9 @@
child = OF_peer(child)) {
if (of_getprop_bool(child, "gpio-controller") == false)
continue;
- exynos_gpio_bank_config(sc,child);
+ exynos_gpio_bank_config(sc, faa, child);
}
- fdtbus_register_gpio_controller(self, faa->faa_phandle,
- &exynos_gpio_funcs);
-
aprint_naive("\n");
aprint_normal("\n");
diff -r 170b58f730a7 -r f0669b3c22df sys/arch/arm/samsung/exynos_var.h
--- a/sys/arch/arm/samsung/exynos_var.h Thu Dec 24 00:36:43 2015 +0000
+++ b/sys/arch/arm/samsung/exynos_var.h Thu Dec 24 01:10:51 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_var.h,v 1.21 2015/12/19 21:42:31 marty Exp $ */
+/* $NetBSD: exynos_var.h,v 1.22 2015/12/24 01:10:51 marty Exp $ */
/*-
* Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -125,8 +125,11 @@
extern void exynos_bootstrap(vaddr_t, vaddr_t);
extern void exynos_dma_bootstrap(psize_t memsize);
+
struct exynos_pinctrl_softc;
-extern void exynos_gpio_bank_config(struct exynos_pinctrl_softc *, int);
+struct fdt_attach_args;
+extern void exynos_gpio_bank_config(struct exynos_pinctrl_softc *,
+ const struct fdt_attach_args *, int);
extern void exynos_wdt_reset(void);
extern void exynos_init_clkout_for_usb(void); // board specific
diff -r 170b58f730a7 -r f0669b3c22df sys/arch/arm/samsung/files.exynos
--- a/sys/arch/arm/samsung/files.exynos Thu Dec 24 00:36:43 2015 +0000
+++ b/sys/arch/arm/samsung/files.exynos Thu Dec 24 01:10:51 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.exynos,v 1.17 2015/12/21 04:58:50 marty Exp $
+# $NetBSD: files.exynos,v 1.18 2015/12/24 01:10:51 marty Exp $
#
# Configuration info for Samsung Exynos SoC ARM Peripherals
#
@@ -87,11 +87,6 @@
file arch/arm/samsung/exynos_pinctrl.c exynos_pinctrl needs-flag
file arch/arm/samsung/exynos_gpio.c exynos_pinctrl needs-flag
-# GPIO
-#device exyogpio : gpiobus
-#attach exyogpio at fdt with exynos_gpio
-#file arch/arm/samsung/exynos_gpio.c exynos_gpio needs-flag
-
# USB2 Host Controller (EHCI/OHCI)
device exyousb { } : fdtbus
attach exyousb at fdt with exyo_usb
@@ -99,7 +94,7 @@
attach ehci at exyousb with ehci_exyousb
file arch/arm/samsung/exynos_usb.c exyo_usb
-# I2C support, bitbanging trough GPIO
+# I2C support, bitbanging through GPIO
device exyoi2c: i2cbus, i2c_bitbang
attach exyoi2c at fdt with exynos_i2c
file arch/arm/samsung/exynos_i2c.c exynos_i2c needs-flag
Home |
Main Index |
Thread Index |
Old Index