blob: 5313490bf3a0845cbaa8852b67bfd17e054bcad1 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dirk Eibachb46226b2014-07-03 09:28:18 +02002/*
3 * (C) Copyright 2013
Mario Sixd38826a2018-03-06 08:04:58 +01004 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
Dirk Eibachb46226b2014-07-03 09:28:18 +02005 */
6
7#include <common.h>
8#include <i2c.h>
Mario Six92164212018-01-15 11:08:11 +01009#ifdef CONFIG_DM_I2C
10#include <dm.h>
Mario Six98e42492019-01-28 09:45:57 +010011#include <regmap.h>
Mario Six92164212018-01-15 11:08:11 +010012#else
Dirk Eibachb46226b2014-07-03 09:28:18 +020013#include <gdsys_fpga.h>
Mario Six92164212018-01-15 11:08:11 +010014#endif
Mario Six64ef0942018-01-15 11:08:10 +010015#include <asm/unaligned.h>
Dirk Eibachb46226b2014-07-03 09:28:18 +020016
Mario Six92164212018-01-15 11:08:11 +010017#ifdef CONFIG_DM_I2C
18struct ihs_i2c_priv {
19 uint speed;
Mario Six98e42492019-01-28 09:45:57 +010020 struct regmap *map;
Mario Six92164212018-01-15 11:08:11 +010021};
22
Mario Six98e42492019-01-28 09:45:57 +010023struct ihs_i2c_regs {
24 u16 interrupt_status;
25 u16 interrupt_enable_control;
26 u16 write_mailbox_ext;
27 u16 write_mailbox;
28 u16 read_mailbox_ext;
29 u16 read_mailbox;
Mario Six92164212018-01-15 11:08:11 +010030};
31
Mario Six98e42492019-01-28 09:45:57 +010032#define ihs_i2c_set(map, member, val) \
33 regmap_set(map, struct ihs_i2c_regs, member, val)
34
35#define ihs_i2c_get(map, member, valp) \
36 regmap_get(map, struct ihs_i2c_regs, member, valp)
37
Mario Six92164212018-01-15 11:08:11 +010038#else /* !CONFIG_DM_I2C */
Dirk Eibachb46226b2014-07-03 09:28:18 +020039DECLARE_GLOBAL_DATA_PTR;
40
Dirk Eibach071be892015-10-28 11:46:22 +010041#ifdef CONFIG_SYS_I2C_IHS_DUAL
Mario Six92164212018-01-15 11:08:11 +010042
Dirk Eibach071be892015-10-28 11:46:22 +010043#define I2C_SET_REG(fld, val) \
Dirk Eibach3af0cdb2015-10-28 11:46:23 +010044 do { \
45 if (I2C_ADAP_HWNR & 0x10) \
46 FPGA_SET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
47 else \
48 FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val); \
49 } while (0)
Dirk Eibach071be892015-10-28 11:46:22 +010050#else
51#define I2C_SET_REG(fld, val) \
Dirk Eibach3af0cdb2015-10-28 11:46:23 +010052 FPGA_SET_REG(I2C_ADAP_HWNR, i2c0.fld, val)
Dirk Eibach071be892015-10-28 11:46:22 +010053#endif
54
55#ifdef CONFIG_SYS_I2C_IHS_DUAL
56#define I2C_GET_REG(fld, val) \
Dirk Eibach3af0cdb2015-10-28 11:46:23 +010057 do { \
58 if (I2C_ADAP_HWNR & 0x10) \
59 FPGA_GET_REG(I2C_ADAP_HWNR & 0xf, i2c1.fld, val); \
60 else \
61 FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val); \
62 } while (0)
Dirk Eibach071be892015-10-28 11:46:22 +010063#else
64#define I2C_GET_REG(fld, val) \
Dirk Eibach3af0cdb2015-10-28 11:46:23 +010065 FPGA_GET_REG(I2C_ADAP_HWNR, i2c0.fld, val)
Dirk Eibach071be892015-10-28 11:46:22 +010066#endif
Mario Six92164212018-01-15 11:08:11 +010067#endif /* CONFIG_DM_I2C */
Dirk Eibach071be892015-10-28 11:46:22 +010068
Dirk Eibachb46226b2014-07-03 09:28:18 +020069enum {
Mario Six64ef0942018-01-15 11:08:10 +010070 I2CINT_ERROR_EV = BIT(13),
71 I2CINT_TRANSMIT_EV = BIT(14),
72 I2CINT_RECEIVE_EV = BIT(15),
Dirk Eibachb46226b2014-07-03 09:28:18 +020073};
74
75enum {
Mario Six64ef0942018-01-15 11:08:10 +010076 I2CMB_READ = 0 << 10,
Dirk Eibachb46226b2014-07-03 09:28:18 +020077 I2CMB_WRITE = 1 << 10,
Mario Six64ef0942018-01-15 11:08:10 +010078 I2CMB_1BYTE = 0 << 11,
Dirk Eibachb46226b2014-07-03 09:28:18 +020079 I2CMB_2BYTE = 1 << 11,
Mario Six64ef0942018-01-15 11:08:10 +010080 I2CMB_DONT_HOLD_BUS = 0 << 13,
Dirk Eibachb46226b2014-07-03 09:28:18 +020081 I2CMB_HOLD_BUS = 1 << 13,
82 I2CMB_NATIVE = 2 << 14,
83};
84
Mario Six64ef0942018-01-15 11:08:10 +010085enum {
86 I2COP_WRITE = 0,
87 I2COP_READ = 1,
88};
89
Mario Six92164212018-01-15 11:08:11 +010090#ifdef CONFIG_DM_I2C
91static int wait_for_int(struct udevice *dev, int read)
92#else
Dirk Eibachb46226b2014-07-03 09:28:18 +020093static int wait_for_int(bool read)
Mario Six92164212018-01-15 11:08:11 +010094#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +020095{
96 u16 val;
Mario Six64ef0942018-01-15 11:08:10 +010097 uint ctr = 0;
Mario Six92164212018-01-15 11:08:11 +010098#ifdef CONFIG_DM_I2C
99 struct ihs_i2c_priv *priv = dev_get_priv(dev);
Mario Six92164212018-01-15 11:08:11 +0100100#endif
101
102#ifdef CONFIG_DM_I2C
Mario Six98e42492019-01-28 09:45:57 +0100103 ihs_i2c_get(priv->map, interrupt_status, &val);
Mario Six92164212018-01-15 11:08:11 +0100104#else
Dirk Eibach071be892015-10-28 11:46:22 +0100105 I2C_GET_REG(interrupt_status, &val);
Mario Six92164212018-01-15 11:08:11 +0100106#endif
Mario Six64ef0942018-01-15 11:08:10 +0100107 /* Wait until error or receive/transmit interrupt was raised */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200108 while (!(val & (I2CINT_ERROR_EV
109 | (read ? I2CINT_RECEIVE_EV : I2CINT_TRANSMIT_EV)))) {
110 udelay(10);
Mario Six64ef0942018-01-15 11:08:10 +0100111 if (ctr++ > 5000)
Dirk Eibachb46226b2014-07-03 09:28:18 +0200112 return 1;
Mario Six92164212018-01-15 11:08:11 +0100113#ifdef CONFIG_DM_I2C
Mario Six98e42492019-01-28 09:45:57 +0100114 ihs_i2c_get(priv->map, interrupt_status, &val);
Mario Six92164212018-01-15 11:08:11 +0100115#else
Dirk Eibach071be892015-10-28 11:46:22 +0100116 I2C_GET_REG(interrupt_status, &val);
Mario Six92164212018-01-15 11:08:11 +0100117#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200118 }
119
120 return (val & I2CINT_ERROR_EV) ? 1 : 0;
121}
122
Mario Six92164212018-01-15 11:08:11 +0100123#ifdef CONFIG_DM_I2C
124static int ihs_i2c_transfer(struct udevice *dev, uchar chip,
125 uchar *buffer, int len, int read, bool is_last)
126#else
Dirk Eibachb46226b2014-07-03 09:28:18 +0200127static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read,
128 bool is_last)
Mario Six92164212018-01-15 11:08:11 +0100129#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200130{
131 u16 val;
Mario Six2df71d62018-03-28 14:37:42 +0200132 u16 data;
Mario Six92164212018-01-15 11:08:11 +0100133#ifdef CONFIG_DM_I2C
134 struct ihs_i2c_priv *priv = dev_get_priv(dev);
Mario Six92164212018-01-15 11:08:11 +0100135#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200136
Mario Six64ef0942018-01-15 11:08:10 +0100137 /* Clear interrupt status */
Mario Six2df71d62018-03-28 14:37:42 +0200138 data = I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV;
Mario Six92164212018-01-15 11:08:11 +0100139#ifdef CONFIG_DM_I2C
Mario Six98e42492019-01-28 09:45:57 +0100140 ihs_i2c_set(priv->map, interrupt_status, data);
141 ihs_i2c_get(priv->map, interrupt_status, &val);
Mario Six92164212018-01-15 11:08:11 +0100142#else
Mario Six2df71d62018-03-28 14:37:42 +0200143 I2C_SET_REG(interrupt_status, data);
Dirk Eibach071be892015-10-28 11:46:22 +0100144 I2C_GET_REG(interrupt_status, &val);
Mario Six92164212018-01-15 11:08:11 +0100145#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200146
Mario Six64ef0942018-01-15 11:08:10 +0100147 /* If we want to write and have data, write the bytes to the mailbox */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200148 if (!read && len) {
149 val = buffer[0];
150
151 if (len > 1)
152 val |= buffer[1] << 8;
Mario Six92164212018-01-15 11:08:11 +0100153#ifdef CONFIG_DM_I2C
Mario Six98e42492019-01-28 09:45:57 +0100154 ihs_i2c_set(priv->map, write_mailbox_ext, val);
Mario Six92164212018-01-15 11:08:11 +0100155#else
Dirk Eibach071be892015-10-28 11:46:22 +0100156 I2C_SET_REG(write_mailbox_ext, val);
Mario Six92164212018-01-15 11:08:11 +0100157#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200158 }
159
Mario Six2df71d62018-03-28 14:37:42 +0200160 data = I2CMB_NATIVE
161 | (read ? 0 : I2CMB_WRITE)
162 | (chip << 1)
163 | ((len > 1) ? I2CMB_2BYTE : 0)
164 | (is_last ? 0 : I2CMB_HOLD_BUS);
165
Mario Six92164212018-01-15 11:08:11 +0100166#ifdef CONFIG_DM_I2C
Mario Six98e42492019-01-28 09:45:57 +0100167 ihs_i2c_set(priv->map, write_mailbox, data);
Mario Six92164212018-01-15 11:08:11 +0100168#else
Mario Six2df71d62018-03-28 14:37:42 +0200169 I2C_SET_REG(write_mailbox, data);
Mario Six92164212018-01-15 11:08:11 +0100170#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200171
Mario Six92164212018-01-15 11:08:11 +0100172#ifdef CONFIG_DM_I2C
173 if (wait_for_int(dev, read))
174#else
Dirk Eibachb46226b2014-07-03 09:28:18 +0200175 if (wait_for_int(read))
Mario Six92164212018-01-15 11:08:11 +0100176#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200177 return 1;
178
Mario Six64ef0942018-01-15 11:08:10 +0100179 /* If we want to read, get the bytes from the mailbox */
Dirk Eibachb46226b2014-07-03 09:28:18 +0200180 if (read) {
Mario Six92164212018-01-15 11:08:11 +0100181#ifdef CONFIG_DM_I2C
Mario Six98e42492019-01-28 09:45:57 +0100182 ihs_i2c_get(priv->map, read_mailbox_ext, &val);
Mario Six92164212018-01-15 11:08:11 +0100183#else
Dirk Eibach071be892015-10-28 11:46:22 +0100184 I2C_GET_REG(read_mailbox_ext, &val);
Mario Six92164212018-01-15 11:08:11 +0100185#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200186 buffer[0] = val & 0xff;
187 if (len > 1)
188 buffer[1] = val >> 8;
189 }
190
191 return 0;
192}
193
Mario Six92164212018-01-15 11:08:11 +0100194#ifdef CONFIG_DM_I2C
Mario Six9cef9832018-01-15 11:08:12 +0100195static int ihs_i2c_send_buffer(struct udevice *dev, uchar chip, u8 *data, int len, bool hold_bus, int read)
196#else
197static int ihs_i2c_send_buffer(uchar chip, u8 *data, int len, bool hold_bus,
198 int read)
199#endif
200{
201 while (len) {
202 int transfer = min(len, 2);
203 bool is_last = len <= transfer;
204
205#ifdef CONFIG_DM_I2C
206 if (ihs_i2c_transfer(dev, chip, data, transfer, read,
207 hold_bus ? false : is_last))
208 return 1;
209#else
210 if (ihs_i2c_transfer(chip, data, transfer, read,
211 hold_bus ? false : is_last))
212 return 1;
213#endif
214
215 data += transfer;
216 len -= transfer;
217 }
218
219 return 0;
220}
221
222#ifdef CONFIG_DM_I2C
223static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int alen,
224 bool hold_bus)
Mario Six92164212018-01-15 11:08:11 +0100225#else
Mario Six64ef0942018-01-15 11:08:10 +0100226static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus)
Mario Six92164212018-01-15 11:08:11 +0100227#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200228{
Mario Six92164212018-01-15 11:08:11 +0100229#ifdef CONFIG_DM_I2C
Mario Six9cef9832018-01-15 11:08:12 +0100230 return ihs_i2c_send_buffer(dev, chip, addr, alen, hold_bus, I2COP_WRITE);
Mario Six92164212018-01-15 11:08:11 +0100231#else
Mario Six9cef9832018-01-15 11:08:12 +0100232 return ihs_i2c_send_buffer(chip, addr, alen, hold_bus, I2COP_WRITE);
Mario Six92164212018-01-15 11:08:11 +0100233#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200234}
235
Mario Six92164212018-01-15 11:08:11 +0100236#ifdef CONFIG_DM_I2C
237static int ihs_i2c_access(struct udevice *dev, uchar chip, u8 *addr,
238 int alen, uchar *buffer, int len, int read)
239#else
Mario Six64ef0942018-01-15 11:08:10 +0100240static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr,
241 int alen, uchar *buffer, int len, int read)
Mario Six92164212018-01-15 11:08:11 +0100242#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200243{
Mario Six64ef0942018-01-15 11:08:10 +0100244 /* Don't hold the bus if length of data to send/receive is zero */
Mario Six92164212018-01-15 11:08:11 +0100245#ifdef CONFIG_DM_I2C
246 if (len <= 0 || ihs_i2c_address(dev, chip, addr, alen, len))
247 return 1;
248#else
Mario Six64ef0942018-01-15 11:08:10 +0100249 if (len <= 0 || ihs_i2c_address(chip, addr, alen, len))
Dirk Eibachb46226b2014-07-03 09:28:18 +0200250 return 1;
Mario Six92164212018-01-15 11:08:11 +0100251#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200252
Mario Six92164212018-01-15 11:08:11 +0100253#ifdef CONFIG_DM_I2C
Mario Six9cef9832018-01-15 11:08:12 +0100254 return ihs_i2c_send_buffer(dev, chip, buffer, len, false, read);
Mario Six92164212018-01-15 11:08:11 +0100255#else
Mario Six9cef9832018-01-15 11:08:12 +0100256 return ihs_i2c_send_buffer(chip, buffer, len, false, read);
Mario Six92164212018-01-15 11:08:11 +0100257#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200258}
259
Mario Six92164212018-01-15 11:08:11 +0100260#ifdef CONFIG_DM_I2C
261
262int ihs_i2c_probe(struct udevice *bus)
263{
264 struct ihs_i2c_priv *priv = dev_get_priv(bus);
Mario Six92164212018-01-15 11:08:11 +0100265
Mario Six98e42492019-01-28 09:45:57 +0100266 regmap_init_mem(dev_ofnode(bus), &priv->map);
Mario Six92164212018-01-15 11:08:11 +0100267
268 return 0;
269}
270
271static int ihs_i2c_set_bus_speed(struct udevice *bus, uint speed)
272{
273 struct ihs_i2c_priv *priv = dev_get_priv(bus);
274
275 if (speed != priv->speed && priv->speed != 0)
276 return 1;
277
278 priv->speed = speed;
279
280 return 0;
281}
282
283static int ihs_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs)
284{
285 struct i2c_msg *dmsg, *omsg, dummy;
286
287 memset(&dummy, 0, sizeof(struct i2c_msg));
288
289 /* We expect either two messages (one with an offset and one with the
290 * actucal data) or one message (just data)
291 */
292 if (nmsgs > 2 || nmsgs == 0) {
293 debug("%s: Only one or two messages are supported.", __func__);
294 return -1;
295 }
296
297 omsg = nmsgs == 1 ? &dummy : msg;
298 dmsg = nmsgs == 1 ? msg : msg + 1;
299
300 if (dmsg->flags & I2C_M_RD)
301 return ihs_i2c_access(bus, dmsg->addr, omsg->buf,
302 omsg->len, dmsg->buf, dmsg->len,
303 I2COP_READ);
304 else
305 return ihs_i2c_access(bus, dmsg->addr, omsg->buf,
306 omsg->len, dmsg->buf, dmsg->len,
307 I2COP_WRITE);
308}
309
310static int ihs_i2c_probe_chip(struct udevice *bus, u32 chip_addr,
311 u32 chip_flags)
312{
313 uchar buffer[2];
314
315 if (ihs_i2c_transfer(bus, chip_addr, buffer, 0, I2COP_READ, true))
316 return 1;
317
318 return 0;
319}
320
321static const struct dm_i2c_ops ihs_i2c_ops = {
322 .xfer = ihs_i2c_xfer,
323 .probe_chip = ihs_i2c_probe_chip,
324 .set_bus_speed = ihs_i2c_set_bus_speed,
325};
326
327static const struct udevice_id ihs_i2c_ids[] = {
328 { .compatible = "gdsys,ihs_i2cmaster", },
329 { /* sentinel */ }
330};
331
332U_BOOT_DRIVER(i2c_ihs) = {
333 .name = "i2c_ihs",
334 .id = UCLASS_I2C,
335 .of_match = ihs_i2c_ids,
336 .probe = ihs_i2c_probe,
337 .priv_auto_alloc_size = sizeof(struct ihs_i2c_priv),
338 .ops = &ihs_i2c_ops,
339};
340
341#else /* CONFIG_DM_I2C */
342
Dirk Eibachb46226b2014-07-03 09:28:18 +0200343static void ihs_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
344{
345#ifdef CONFIG_SYS_I2C_INIT_BOARD
346 /*
347 * Call board specific i2c bus reset routine before accessing the
348 * environment, which might be in a chip on that bus. For details
349 * about this problem see doc/I2C_Edge_Conditions.
350 */
351 i2c_init_board();
352#endif
353}
354
355static int ihs_i2c_probe(struct i2c_adapter *adap, uchar chip)
356{
357 uchar buffer[2];
358
Mario Six64ef0942018-01-15 11:08:10 +0100359 if (ihs_i2c_transfer(chip, buffer, 0, I2COP_READ, true))
Dirk Eibachb46226b2014-07-03 09:28:18 +0200360 return 1;
361
362 return 0;
363}
364
365static int ihs_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
366 int alen, uchar *buffer, int len)
367{
Mario Six64ef0942018-01-15 11:08:10 +0100368 u8 addr_bytes[4];
369
370 put_unaligned_le32(addr, addr_bytes);
371
372 return ihs_i2c_access(adap, chip, addr_bytes, alen, buffer, len,
373 I2COP_READ);
Dirk Eibachb46226b2014-07-03 09:28:18 +0200374}
375
376static int ihs_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
377 int alen, uchar *buffer, int len)
378{
Mario Six64ef0942018-01-15 11:08:10 +0100379 u8 addr_bytes[4];
380
381 put_unaligned_le32(addr, addr_bytes);
382
383 return ihs_i2c_access(adap, chip, addr_bytes, alen, buffer, len,
384 I2COP_WRITE);
Dirk Eibachb46226b2014-07-03 09:28:18 +0200385}
386
387static unsigned int ihs_i2c_set_bus_speed(struct i2c_adapter *adap,
Dirk Eibach071be892015-10-28 11:46:22 +0100388 unsigned int speed)
Dirk Eibachb46226b2014-07-03 09:28:18 +0200389{
390 if (speed != adap->speed)
391 return 1;
392 return speed;
393}
394
395/*
396 * Register IHS i2c adapters
397 */
398#ifdef CONFIG_SYS_I2C_IHS_CH0
399U_BOOT_I2C_ADAP_COMPLETE(ihs0, ihs_i2c_init, ihs_i2c_probe,
400 ihs_i2c_read, ihs_i2c_write,
401 ihs_i2c_set_bus_speed,
402 CONFIG_SYS_I2C_IHS_SPEED_0,
403 CONFIG_SYS_I2C_IHS_SLAVE_0, 0)
Dirk Eibach071be892015-10-28 11:46:22 +0100404#ifdef CONFIG_SYS_I2C_IHS_DUAL
405U_BOOT_I2C_ADAP_COMPLETE(ihs0_1, ihs_i2c_init, ihs_i2c_probe,
406 ihs_i2c_read, ihs_i2c_write,
407 ihs_i2c_set_bus_speed,
408 CONFIG_SYS_I2C_IHS_SPEED_0_1,
409 CONFIG_SYS_I2C_IHS_SLAVE_0_1, 16)
410#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200411#endif
412#ifdef CONFIG_SYS_I2C_IHS_CH1
413U_BOOT_I2C_ADAP_COMPLETE(ihs1, ihs_i2c_init, ihs_i2c_probe,
414 ihs_i2c_read, ihs_i2c_write,
415 ihs_i2c_set_bus_speed,
416 CONFIG_SYS_I2C_IHS_SPEED_1,
417 CONFIG_SYS_I2C_IHS_SLAVE_1, 1)
Dirk Eibach071be892015-10-28 11:46:22 +0100418#ifdef CONFIG_SYS_I2C_IHS_DUAL
419U_BOOT_I2C_ADAP_COMPLETE(ihs1_1, ihs_i2c_init, ihs_i2c_probe,
420 ihs_i2c_read, ihs_i2c_write,
421 ihs_i2c_set_bus_speed,
422 CONFIG_SYS_I2C_IHS_SPEED_1_1,
423 CONFIG_SYS_I2C_IHS_SLAVE_1_1, 17)
424#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200425#endif
426#ifdef CONFIG_SYS_I2C_IHS_CH2
427U_BOOT_I2C_ADAP_COMPLETE(ihs2, ihs_i2c_init, ihs_i2c_probe,
428 ihs_i2c_read, ihs_i2c_write,
429 ihs_i2c_set_bus_speed,
430 CONFIG_SYS_I2C_IHS_SPEED_2,
431 CONFIG_SYS_I2C_IHS_SLAVE_2, 2)
Dirk Eibach071be892015-10-28 11:46:22 +0100432#ifdef CONFIG_SYS_I2C_IHS_DUAL
433U_BOOT_I2C_ADAP_COMPLETE(ihs2_1, ihs_i2c_init, ihs_i2c_probe,
434 ihs_i2c_read, ihs_i2c_write,
435 ihs_i2c_set_bus_speed,
436 CONFIG_SYS_I2C_IHS_SPEED_2_1,
437 CONFIG_SYS_I2C_IHS_SLAVE_2_1, 18)
438#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200439#endif
440#ifdef CONFIG_SYS_I2C_IHS_CH3
441U_BOOT_I2C_ADAP_COMPLETE(ihs3, ihs_i2c_init, ihs_i2c_probe,
442 ihs_i2c_read, ihs_i2c_write,
443 ihs_i2c_set_bus_speed,
444 CONFIG_SYS_I2C_IHS_SPEED_3,
445 CONFIG_SYS_I2C_IHS_SLAVE_3, 3)
Dirk Eibach071be892015-10-28 11:46:22 +0100446#ifdef CONFIG_SYS_I2C_IHS_DUAL
447U_BOOT_I2C_ADAP_COMPLETE(ihs3_1, ihs_i2c_init, ihs_i2c_probe,
448 ihs_i2c_read, ihs_i2c_write,
449 ihs_i2c_set_bus_speed,
450 CONFIG_SYS_I2C_IHS_SPEED_3_1,
451 CONFIG_SYS_I2C_IHS_SLAVE_3_1, 19)
452#endif
Dirk Eibachb46226b2014-07-03 09:28:18 +0200453#endif
Mario Six92164212018-01-15 11:08:11 +0100454#endif /* CONFIG_DM_I2C */