summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2008-10-15 09:39:47 +0200
committerWolfgang Denk <wd@denx.de>2008-10-18 21:54:02 +0200
commit67b23a322848d828a5e45c0567b72762bfde7abf (patch)
tree8dc26375504482eaa0e9600a6a52a6bb047dccf3 /include
parentc24853644ddd2dd2e4246b5854a93e6254a14092 (diff)
I2C: adding new "i2c bus" Command to the I2C Subsystem.
With this Command it is possible to add new I2C Busses, which are behind 1 .. n I2C Muxes. Details see README. Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include')
-rw-r--r--include/configs/mgcoge.h1
-rw-r--r--include/configs/mgsuvd.h1
-rw-r--r--include/i2c.h23
3 files changed, 25 insertions, 0 deletions
diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h
index 398e092686d..6564c15d07d 100644
--- a/include/configs/mgcoge.h
+++ b/include/configs/mgcoge.h
@@ -203,6 +203,7 @@
#define CONFIG_I2C_CMD_TREE 1
#define CFG_MAX_I2C_BUS 2
#define CFG_I2C_INIT_BOARD 1
+#define CONFIG_I2C_MUX 1
/* EEprom support */
#define CFG_I2C_EEPROM_ADDR_LEN 1
diff --git a/include/configs/mgsuvd.h b/include/configs/mgsuvd.h
index 20485750ea1..e2a7c07cc38 100644
--- a/include/configs/mgsuvd.h
+++ b/include/configs/mgsuvd.h
@@ -374,6 +374,7 @@
#define CONFIG_I2C_CMD_TREE 1
#define CFG_MAX_I2C_BUS 2
#define CFG_I2C_INIT_BOARD 1
+#define CONFIG_I2C_MUX 1
/* EEprom support */
#define CFG_I2C_EEPROM_ADDR_LEN 1
diff --git a/include/i2c.h b/include/i2c.h
index a6e797a3835..9f771dda105 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -85,6 +85,29 @@ void i2c_init(int speed, int slaveaddr);
void i2c_init_board(void);
#endif
+#if defined(CONFIG_I2C_MUX)
+
+typedef struct _mux {
+ uchar chip;
+ uchar channel;
+ char *name;
+ struct _mux *next;
+} I2C_MUX;
+
+typedef struct _mux_device {
+ int busid;
+ I2C_MUX *mux; /* List of muxes, to reach the device */
+ struct _mux_device *next;
+} I2C_MUX_DEVICE;
+
+int i2c_mux_add_device(I2C_MUX_DEVICE *dev);
+
+I2C_MUX_DEVICE *i2c_mux_search_device(int id);
+I2C_MUX_DEVICE *i2c_mux_ident_muxstring (uchar *buf);
+int i2x_mux_select_mux(int bus);
+int i2c_mux_ident_muxstring_f (uchar *buf);
+#endif
+
/*
* Probe the given I2C chip address. Returns 0 if a chip responded,
* not 0 on failure.