summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.09.01/i2c.patch
blob: a5087ead275bad1ca6db51728c06bb79819f49ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
diff -raNu old/include/i2c.h new/include/i2c.h
--- old/include/i2c.h	2017-04-28 17:26:27.854898005 -0500
+++ new/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
+#elif !defined(CONFIG_DM_I2C_COMPAT)
 
 /*
  * Probe the given I2C chip address.  Returns 0 if a chip responded,