Module Name: src Committed By: khorben Date: Fri May 10 01:10:03 UTC 2013
Modified Files: src/sys/dev/i2c [khorben-n900]: files.i2c i2c.c i2cvar.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.49.2.1 src/sys/dev/i2c/files.i2c cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/dev/i2c/i2c.c cvs rdiff -u -r1.8 -r1.8.28.1 src/sys/dev/i2c/i2cvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/i2c/files.i2c diff -u src/sys/dev/i2c/files.i2c:1.49 src/sys/dev/i2c/files.i2c:1.49.2.1 --- src/sys/dev/i2c/files.i2c:1.49 Mon May 6 22:04:12 2013 +++ src/sys/dev/i2c/files.i2c Fri May 10 01:10:02 2013 @@ -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 Index: src/sys/dev/i2c/i2c.c diff -u src/sys/dev/i2c/i2c.c:1.39 src/sys/dev/i2c/i2c.c:1.39.6.1 --- src/sys/dev/i2c/i2c.c:1.39 Sun Feb 3 16:28:51 2013 +++ src/sys/dev/i2c/i2c.c Fri May 10 01:10:03 2013 @@ -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 @@ iic_search(device_t parent, cfdata_t cf, 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 @@ iic_attach(device_t parent, device_t sel 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 @@ iic_attach(device_t parent, device_t sel 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 @@ iic_attach(device_t parent, device_t sel 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"); Index: src/sys/dev/i2c/i2cvar.h diff -u src/sys/dev/i2c/i2cvar.h:1.8 src/sys/dev/i2c/i2cvar.h:1.8.28.1 --- src/sys/dev/i2c/i2cvar.h:1.8 Sun Feb 28 15:33:21 2010 +++ src/sys/dev/i2c/i2cvar.h Fri May 10 01:10:03 2013 @@ -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 @@ struct i2c_attach_args { 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 */