Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/khorben-n900]: src/sys/dev/i2c Added two locators for I2C devices: "intr...
details: https://anonhg.NetBSD.org/src/rev/236bfc08c5e7
branches: khorben-n900
changeset: 786695:236bfc08c5e7
user: khorben <khorben%NetBSD.org@localhost>
date: Fri May 10 01:10:02 2013 +0000
description:
Added two locators for I2C devices: "intr" and "intrbase".
They are required to allow the TPS65950 companion chip to both handle its
interrupts on the system, and allow its extra GPIO pins to be used as
interrupts as well.
XXX This change is not adequate because intr_establish() is a MD interface,
so it will have to be re-designed before merging to the main tree.
diffstat:
sys/dev/i2c/files.i2c | 4 ++--
sys/dev/i2c/i2c.c | 14 ++++++++++++--
sys/dev/i2c/i2cvar.h | 4 +++-
3 files changed, 17 insertions(+), 5 deletions(-)
diffs (90 lines):
diff -r 52f9a8f250e4 -r 236bfc08c5e7 sys/dev/i2c/files.i2c
--- a/sys/dev/i2c/files.i2c Fri May 10 00:57:56 2013 +0000
+++ b/sys/dev/i2c/files.i2c Fri May 10 01:10:02 2013 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: files.i2c,v 1.49 2013/05/06 22:04:12 rkujawa Exp $
+# $NetBSD: files.i2c,v 1.49.2.1 2013/05/10 01:10:02 khorben Exp $
obsolete defflag opt_i2cbus.h I2C_SCAN
define i2cbus { }
define i2cexec
-device iic { [addr = -1], [size = -1] }
+device iic { [addr = -1], [size = -1], [intr = -1], [intrbase = -1] }
attach iic at i2cbus
file dev/i2c/i2c.c iic
file dev/i2c/i2c_exec.c iic | i2cbus | i2cexec
diff -r 52f9a8f250e4 -r 236bfc08c5e7 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Fri May 10 00:57:56 2013 +0000
+++ b/sys/dev/i2c/i2c.c Fri May 10 01:10:02 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c.c,v 1.39 2013/02/03 16:28:51 jdc Exp $ */
+/* $NetBSD: i2c.c,v 1.39.6.1 2013/05/10 01:10:03 khorben Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.39 2013/02/03 16:28:51 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.39.6.1 2013/05/10 01:10:03 khorben Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -112,6 +112,8 @@
ia.ia_tag = sc->sc_tag;
ia.ia_addr = cf->cf_loc[IICCF_ADDR];
ia.ia_size = cf->cf_loc[IICCF_SIZE];
+ ia.ia_intr = cf->cf_loc[IICCF_INTR];
+ ia.ia_intrbase = cf->cf_loc[IICCF_INTRBASE];
ia.ia_type = sc->sc_type;
ia.ia_name = NULL;
@@ -192,6 +194,7 @@
prop_dictionary_t dev;
prop_data_t cdata;
uint32_t addr, size;
+ int intr, intrbase;
uint64_t cookie;
const char *name;
struct i2c_attach_args ia;
@@ -214,6 +217,11 @@
loc[1] = size;
else
loc[1] = -1;
+ if (!prop_dictionary_get_uint32(dev, "intr", &intr))
+ intr = -1;
+ if (!prop_dictionary_get_uint32(dev, "intrbase",
+ &intrbase))
+ intrbase = -1;
memset(&ia, 0, sizeof ia);
ia.ia_addr = addr;
@@ -222,6 +230,8 @@
ia.ia_name = name;
ia.ia_cookie = cookie;
ia.ia_size = size;
+ ia.ia_intr = intr;
+ ia.ia_intrbase = intrbase;
buf = NULL;
cdata = prop_dictionary_get(dev, "compatible");
diff -r 52f9a8f250e4 -r 236bfc08c5e7 sys/dev/i2c/i2cvar.h
--- a/sys/dev/i2c/i2cvar.h Fri May 10 00:57:56 2013 +0000
+++ b/sys/dev/i2c/i2cvar.h Fri May 10 01:10:02 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i2cvar.h,v 1.8 2010/02/28 15:33:21 snj Exp $ */
+/* $NetBSD: i2cvar.h,v 1.8.28.1 2013/05/10 01:10:03 khorben Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -117,6 +117,8 @@
i2c_tag_t ia_tag; /* our controller */
i2c_addr_t ia_addr; /* address of device */
int ia_size; /* size (for EEPROMs) */
+ int ia_intr; /* interrupt */
+ int ia_intrbase; /* interrupt base */
int ia_type; /* bus type */
/* only set if using direct config */
const char * ia_name; /* name of the device */
Home |
Main Index |
Thread Index |
Old Index