Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/omap Support TI_AM335X gpio to omap2_gpio.c.
details: https://anonhg.NetBSD.org/src/rev/b77cbe683f54
branches: trunk
changeset: 348346:b77cbe683f54
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Sat Oct 15 15:11:56 2016 +0000
description:
Support TI_AM335X gpio to omap2_gpio.c.
diffstat:
sys/arch/arm/omap/files.omap2 | 5 ++---
sys/arch/arm/omap/omap2_gpio.c | 41 ++++++++++++++++++++++++++++++++---------
2 files changed, 34 insertions(+), 12 deletions(-)
diffs (108 lines):
diff -r 45a028581783 -r b77cbe683f54 sys/arch/arm/omap/files.omap2
--- a/sys/arch/arm/omap/files.omap2 Sat Oct 15 15:08:59 2016 +0000
+++ b/sys/arch/arm/omap/files.omap2 Sat Oct 15 15:11:56 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.omap2,v 1.35 2016/10/04 16:10:34 kiyohara Exp $
+# $NetBSD: files.omap2,v 1.36 2016/10/15 15:11:56 kiyohara Exp $
#
# Configuration info for Texas Instruments OMAP2/OMAP3 CPU support
# Based on xscale/files.pxa2x0
@@ -59,8 +59,7 @@
# OMAP2 GPIO controllers
device omapgpio: gpiobus
attach omapgpio at obio with omap2gpio
-file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & !ti_am335x & omapgpio
-file arch/arm/omap/am335x_gpio.c ti_am335x & omapgpio
+file arch/arm/omap/omap2_gpio.c (omap2 | omap3) & omapgpio
# TI_AM335X (and maybe TI OMAP4) I2C controllers
device tiiic: i2cbus, i2cexec
diff -r 45a028581783 -r b77cbe683f54 sys/arch/arm/omap/omap2_gpio.c
--- a/sys/arch/arm/omap/omap2_gpio.c Sat Oct 15 15:08:59 2016 +0000
+++ b/sys/arch/arm/omap/omap2_gpio.c Sat Oct 15 15:11:56 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $ */
+/* $NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -28,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.18 2016/07/11 14:53:05 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap2_gpio.c,v 1.19 2016/10/15 15:11:56 kiyohara Exp $");
#define _INTR_PRIVATE
@@ -50,9 +50,13 @@
#include <sys/bus.h>
+#include <arm/omap/am335x_prcm.h>
#include <arm/omap/omap2_reg.h>
#include <arm/omap/omap2_obiovar.h>
#include <arm/omap/omap2_gpio.h>
+#include <arm/omap/omap2_prcm.h>
+#include <arm/omap/sitara_cm.h>
+#include <arm/omap/sitara_cmreg.h>
#include <arm/pic/picvar.h>
#if NGPIO > 0
@@ -60,6 +64,13 @@
#include <dev/gpio/gpiovar.h>
#endif
+static const struct omap_module gpio_module[] = {
+ { 0, 0 },
+ { AM335X_PRCM_CM_PER, CM_PER_GPIO1_CLKCTRL },
+ { AM335X_PRCM_CM_PER, CM_PER_GPIO2_CLKCTRL },
+ { AM335X_PRCM_CM_PER, CM_PER_GPIO3_CLKCTRL },
+};
+
static void gpio_pic_block_irqs(struct pic_softc *, size_t, uint32_t);
static void gpio_pic_block_irqs2(struct pic_softc *, size_t, uint32_t);
static void gpio_pic_unblock_irqs(struct pic_softc *, size_t, uint32_t);
@@ -318,16 +329,11 @@
{
struct gpio_softc * const gpio = arg;
uint32_t mask = 1 << pin;
- uint32_t old, new;
- old = GPIO_READ(gpio, GPIO_DATAOUT);
if (value)
- new = old | mask;
+ GPIO_WRITE(gpio, GPIO_SETDATAOUT, mask);
else
- new = old & ~mask;
-
- if (old != new)
- GPIO_WRITE(gpio, GPIO_DATAOUT, new);
+ GPIO_WRITE(gpio, GPIO_CLEARDATAOUT, mask);
}
static void
@@ -524,6 +530,23 @@
aprint_normal(", intr %d", oa->obio_intr);
}
aprint_normal("\n");
+
+#ifdef TI_AM335X
+ switch (oa->obio_addr) {
+ case GPIO0_BASE_TI_AM335X:
+ break;
+ case GPIO1_BASE_TI_AM335X:
+ prcm_module_enable(&gpio_module[1]);
+ break;
+ case GPIO2_BASE_TI_AM335X:
+ prcm_module_enable(&gpio_module[2]);
+ break;
+ case GPIO3_BASE_TI_AM335X:
+ prcm_module_enable(&gpio_module[3]);
+ break;
+ }
+#endif
+
#if NGPIO > 0
#if 0
config_interrupts(self, gpio_attach1);
Home |
Main Index |
Thread Index |
Old Index