summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.03/mtcdt/i2c.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/u-boot/u-boot-2016.03/mtcdt/i2c.patch')
-rw-r--r--recipes-bsp/u-boot/u-boot-2016.03/mtcdt/i2c.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2016.03/mtcdt/i2c.patch b/recipes-bsp/u-boot/u-boot-2016.03/mtcdt/i2c.patch
new file mode 100644
index 0000000..af726a3
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2016.03/mtcdt/i2c.patch
@@ -0,0 +1,114 @@
+diff -raNu git.orig/include/i2c.h git/include/i2c.h
+--- git.orig/include/i2c.h 2017-04-28 17:26:27.854898005 -0500
++++ git/include/i2c.h 2017-05-01 17:27:32.673437788 -0500
+@@ -17,6 +17,27 @@
+ #ifndef _I2C_H_
+ #define _I2C_H_
+
++#define U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \
++ _set_speed, _speed, _slaveaddr, _hwadapnr, _name) \
++ { \
++ .init = _init, \
++ .probe = _probe, \
++ .read = _read, \
++ .write = _write, \
++ .set_bus_speed = _set_speed, \
++ .speed = _speed, \
++ .slaveaddr = _slaveaddr, \
++ .init_done = 0, \
++ .hwadapnr = _hwadapnr, \
++ .name = #_name \
++};
++
++#define U_BOOT_I2C_ADAP_COMPLETE(_name, _init, _probe, _read, _write, \
++ _set_speed, _speed, _slaveaddr, _hwadapnr) \
++ ll_entry_declare(struct i2c_adapter, _name, i2c) = \
++ U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \
++ _set_speed, _speed, _slaveaddr, _hwadapnr, _name);
++
+ /*
+ * For now there are essentially two parts to this file - driver model
+ * here at the top, and the older code below (with CONFIG_SYS_I2C being
+@@ -538,6 +559,26 @@
+ */
+ void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs);
+
++
++struct i2c_adapter {
++ void (*init)(struct i2c_adapter *adap, int speed,
++ int slaveaddr);
++ int (*probe)(struct i2c_adapter *adap, uint8_t chip);
++ int (*read)(struct i2c_adapter *adap, uint8_t chip,
++ uint addr, int alen, uint8_t *buffer,
++ int len);
++ int (*write)(struct i2c_adapter *adap, uint8_t chip,
++ uint addr, int alen, uint8_t *buffer,
++ int len);
++ uint (*set_bus_speed)(struct i2c_adapter *adap,
++ uint speed);
++ int speed;
++ int waitdelay;
++ int slaveaddr;
++ int init_done;
++ int hwadapnr;
++ char *name;
++};
+ #ifndef CONFIG_DM_I2C
+
+ /*
+@@ -578,46 +619,6 @@
+ #define CONFIG_SYS_SPD_BUS_NUM 0
+ #endif
+
+-struct i2c_adapter {
+- void (*init)(struct i2c_adapter *adap, int speed,
+- int slaveaddr);
+- int (*probe)(struct i2c_adapter *adap, uint8_t chip);
+- int (*read)(struct i2c_adapter *adap, uint8_t chip,
+- uint addr, int alen, uint8_t *buffer,
+- int len);
+- int (*write)(struct i2c_adapter *adap, uint8_t chip,
+- uint addr, int alen, uint8_t *buffer,
+- int len);
+- uint (*set_bus_speed)(struct i2c_adapter *adap,
+- uint speed);
+- int speed;
+- int waitdelay;
+- int slaveaddr;
+- int init_done;
+- int hwadapnr;
+- char *name;
+-};
+-
+-#define U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \
+- _set_speed, _speed, _slaveaddr, _hwadapnr, _name) \
+- { \
+- .init = _init, \
+- .probe = _probe, \
+- .read = _read, \
+- .write = _write, \
+- .set_bus_speed = _set_speed, \
+- .speed = _speed, \
+- .slaveaddr = _slaveaddr, \
+- .init_done = 0, \
+- .hwadapnr = _hwadapnr, \
+- .name = #_name \
+-};
+-
+-#define U_BOOT_I2C_ADAP_COMPLETE(_name, _init, _probe, _read, _write, \
+- _set_speed, _speed, _slaveaddr, _hwadapnr) \
+- ll_entry_declare(struct i2c_adapter, _name, i2c) = \
+- U_BOOT_I2C_MKENT_COMPLETE(_init, _probe, _read, _write, \
+- _set_speed, _speed, _slaveaddr, _hwadapnr, _name);
+
+ struct i2c_adapter *i2c_get_adapter(int index);
+
+@@ -803,7 +804,7 @@
+ void i2c_soft_scl(int bit);
+ void i2c_soft_delay(void);
+ #endif
+-#else
++#else if !defined(CONFIG_DM_I2C_COMPAT)
+
+ /*
+ * Probe the given I2C chip address. Returns 0 if a chip responded,