blob: 4fd5551a228269b8189c413e9d5dba72cefb18b1 [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
Heiko Schocherea818db2013-01-29 08:53:15 +01002 * (C) Copyright 2009
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 * Changes for multibus/multiadapter I2C support.
5 *
wdenkc6097192002-11-03 00:24:07 +00006 * (C) Copyright 2001, 2002
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
wdenkc6097192002-11-03 00:24:07 +000010 *
11 * This has been changed substantially by Gerald Van Baren, Custom IDEAS,
12 * vanbaren@cideas.com. It was heavily influenced by LiMon, written by
13 * Neil Russell.
Simon Glass28527092016-11-23 06:34:44 -070014 *
15 * NOTE: This driver should be converted to driver model before June 2017.
16 * Please see doc/driver-model/i2c-howto.txt for instructions.
wdenkc6097192002-11-03 00:24:07 +000017 */
18
19#include <common.h>
Ryan Mallonf3100ff2011-01-27 08:54:15 +130020#if defined(CONFIG_AT91FAMILY)
wdenk9d5028c2004-11-21 00:06:33 +000021#include <asm/io.h>
22#include <asm/arch/hardware.h>
Jens Scharsig0cf0b932010-02-03 22:46:58 +010023#include <asm/arch/at91_pio.h>
Andreas Bießmanncb96a0a2013-10-30 15:18:18 +010024#ifdef CONFIG_ATMEL_LEGACY
Daniel Gorsulowski4e574c42009-05-18 13:20:54 +020025#include <asm/arch/gpio.h>
Jens Scharsig0cf0b932010-02-03 22:46:58 +010026#endif
Daniel Gorsulowski4e574c42009-05-18 13:20:54 +020027#endif
Christophe Leroyb1e41d12017-07-06 10:33:21 +020028#if defined(CONFIG_8xx)
Heiko Schochera21ca952008-10-17 13:52:51 +020029#include <asm/io.h>
30#endif
wdenkc6097192002-11-03 00:24:07 +000031#include <i2c.h>
32
Mike Frysinger793b5722010-07-21 13:38:02 -040033#if defined(CONFIG_SOFT_I2C_GPIO_SCL)
34# include <asm/gpio.h>
35
36# ifndef I2C_GPIO_SYNC
37# define I2C_GPIO_SYNC
38# endif
39
40# ifndef I2C_INIT
41# define I2C_INIT \
42 do { \
43 gpio_request(CONFIG_SOFT_I2C_GPIO_SCL, "soft_i2c"); \
44 gpio_request(CONFIG_SOFT_I2C_GPIO_SDA, "soft_i2c"); \
45 } while (0)
46# endif
47
48# ifndef I2C_ACTIVE
49# define I2C_ACTIVE do { } while (0)
50# endif
51
52# ifndef I2C_TRISTATE
53# define I2C_TRISTATE do { } while (0)
54# endif
55
56# ifndef I2C_READ
57# define I2C_READ gpio_get_value(CONFIG_SOFT_I2C_GPIO_SDA)
58# endif
59
60# ifndef I2C_SDA
61# define I2C_SDA(bit) \
62 do { \
63 if (bit) \
64 gpio_direction_input(CONFIG_SOFT_I2C_GPIO_SDA); \
65 else \
66 gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SDA, 0); \
67 I2C_GPIO_SYNC; \
68 } while (0)
69# endif
70
71# ifndef I2C_SCL
72# define I2C_SCL(bit) \
73 do { \
74 gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SCL, bit); \
75 I2C_GPIO_SYNC; \
76 } while (0)
77# endif
78
79# ifndef I2C_DELAY
80# define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */
81# endif
82
83#endif
84
wdenkc6097192002-11-03 00:24:07 +000085/* #define DEBUG_I2C */
86
Wolfgang Denkd87080b2006-03-31 18:32:53 +020087DECLARE_GLOBAL_DATA_PTR;
Heiko Schocherea818db2013-01-29 08:53:15 +010088
89#ifndef I2C_SOFT_DECLARATIONS
Heiko Schocherea818db2013-01-29 08:53:15 +010090# define I2C_SOFT_DECLARATIONS
Heiko Schocherea818db2013-01-29 08:53:15 +010091#endif
92
Marek Vasut90f002a2013-08-01 12:32:20 +020093#if !defined(CONFIG_SYS_I2C_SOFT_SPEED)
94#define CONFIG_SYS_I2C_SOFT_SPEED CONFIG_SYS_I2C_SPEED
Heiko Schocherea818db2013-01-29 08:53:15 +010095#endif
Marek Vasut90f002a2013-08-01 12:32:20 +020096#if !defined(CONFIG_SYS_I2C_SOFT_SLAVE)
97#define CONFIG_SYS_I2C_SOFT_SLAVE CONFIG_SYS_I2C_SLAVE
Wolfgang Denkd87080b2006-03-31 18:32:53 +020098#endif
99
wdenkc6097192002-11-03 00:24:07 +0000100/*-----------------------------------------------------------------------
101 * Definitions
102 */
wdenkc6097192002-11-03 00:24:07 +0000103#define RETRIES 0
104
wdenkc6097192002-11-03 00:24:07 +0000105#define I2C_ACK 0 /* PD_SDA level to ack a byte */
106#define I2C_NOACK 1 /* PD_SDA level to noack a byte */
107
108
109#ifdef DEBUG_I2C
110#define PRINTD(fmt,args...) do { \
wdenkc6097192002-11-03 00:24:07 +0000111 printf (fmt ,##args); \
112 } while (0)
113#else
114#define PRINTD(fmt,args...)
115#endif
116
117/*-----------------------------------------------------------------------
118 * Local functions
119 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200120#if !defined(CONFIG_SYS_I2C_INIT_BOARD)
wdenkc6097192002-11-03 00:24:07 +0000121static void send_reset (void);
Heiko Schocher4ca107e2008-10-15 09:38:38 +0200122#endif
wdenkc6097192002-11-03 00:24:07 +0000123static void send_start (void);
124static void send_stop (void);
125static void send_ack (int);
126static int write_byte (uchar byte);
127static uchar read_byte (int);
128
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200129#if !defined(CONFIG_SYS_I2C_INIT_BOARD)
wdenkc6097192002-11-03 00:24:07 +0000130/*-----------------------------------------------------------------------
131 * Send a reset sequence consisting of 9 clocks with the data signal high
132 * to clock any confused device back into an idle state. Also send a
133 * <stop> at the end of the sequence for belts & suspenders.
134 */
135static void send_reset(void)
136{
Heiko Schocher98aed372008-10-15 09:35:26 +0200137 I2C_SOFT_DECLARATIONS /* intentional without ';' */
wdenkc6097192002-11-03 00:24:07 +0000138 int j;
139
wdenk60fbe252003-04-08 23:25:21 +0000140 I2C_SCL(1);
wdenkc6097192002-11-03 00:24:07 +0000141 I2C_SDA(1);
wdenk60fbe252003-04-08 23:25:21 +0000142#ifdef I2C_INIT
143 I2C_INIT;
144#endif
145 I2C_TRISTATE;
wdenkc6097192002-11-03 00:24:07 +0000146 for(j = 0; j < 9; j++) {
147 I2C_SCL(0);
148 I2C_DELAY;
149 I2C_DELAY;
150 I2C_SCL(1);
151 I2C_DELAY;
152 I2C_DELAY;
153 }
154 send_stop();
155 I2C_TRISTATE;
156}
Heiko Schocher4ca107e2008-10-15 09:38:38 +0200157#endif
wdenkc6097192002-11-03 00:24:07 +0000158
159/*-----------------------------------------------------------------------
160 * START: High -> Low on SDA while SCL is High
161 */
162static void send_start(void)
163{
Heiko Schocher98aed372008-10-15 09:35:26 +0200164 I2C_SOFT_DECLARATIONS /* intentional without ';' */
wdenkc6097192002-11-03 00:24:07 +0000165
166 I2C_DELAY;
167 I2C_SDA(1);
168 I2C_ACTIVE;
169 I2C_DELAY;
170 I2C_SCL(1);
171 I2C_DELAY;
172 I2C_SDA(0);
173 I2C_DELAY;
174}
175
176/*-----------------------------------------------------------------------
177 * STOP: Low -> High on SDA while SCL is High
178 */
179static void send_stop(void)
180{
Heiko Schocher98aed372008-10-15 09:35:26 +0200181 I2C_SOFT_DECLARATIONS /* intentional without ';' */
wdenkc6097192002-11-03 00:24:07 +0000182
183 I2C_SCL(0);
184 I2C_DELAY;
185 I2C_SDA(0);
186 I2C_ACTIVE;
187 I2C_DELAY;
188 I2C_SCL(1);
189 I2C_DELAY;
190 I2C_SDA(1);
191 I2C_DELAY;
192 I2C_TRISTATE;
193}
194
wdenkc6097192002-11-03 00:24:07 +0000195/*-----------------------------------------------------------------------
196 * ack should be I2C_ACK or I2C_NOACK
197 */
198static void send_ack(int ack)
199{
Heiko Schocher98aed372008-10-15 09:35:26 +0200200 I2C_SOFT_DECLARATIONS /* intentional without ';' */
wdenkc6097192002-11-03 00:24:07 +0000201
wdenkc6097192002-11-03 00:24:07 +0000202 I2C_SCL(0);
203 I2C_DELAY;
wdenkc6097192002-11-03 00:24:07 +0000204 I2C_ACTIVE;
Wolfgang Denkc15f80e2006-03-13 00:50:48 +0100205 I2C_SDA(ack);
wdenkc6097192002-11-03 00:24:07 +0000206 I2C_DELAY;
207 I2C_SCL(1);
208 I2C_DELAY;
209 I2C_DELAY;
210 I2C_SCL(0);
211 I2C_DELAY;
212}
213
wdenkc6097192002-11-03 00:24:07 +0000214/*-----------------------------------------------------------------------
215 * Send 8 bits and look for an acknowledgement.
216 */
217static int write_byte(uchar data)
218{
Heiko Schocher98aed372008-10-15 09:35:26 +0200219 I2C_SOFT_DECLARATIONS /* intentional without ';' */
wdenkc6097192002-11-03 00:24:07 +0000220 int j;
221 int nack;
222
223 I2C_ACTIVE;
224 for(j = 0; j < 8; j++) {
225 I2C_SCL(0);
226 I2C_DELAY;
227 I2C_SDA(data & 0x80);
228 I2C_DELAY;
229 I2C_SCL(1);
230 I2C_DELAY;
231 I2C_DELAY;
232
233 data <<= 1;
234 }
235
236 /*
237 * Look for an <ACK>(negative logic) and return it.
238 */
239 I2C_SCL(0);
240 I2C_DELAY;
241 I2C_SDA(1);
242 I2C_TRISTATE;
243 I2C_DELAY;
244 I2C_SCL(1);
245 I2C_DELAY;
246 I2C_DELAY;
247 nack = I2C_READ;
248 I2C_SCL(0);
249 I2C_DELAY;
250 I2C_ACTIVE;
251
252 return(nack); /* not a nack is an ack */
253}
254
wdenkc6097192002-11-03 00:24:07 +0000255/*-----------------------------------------------------------------------
256 * if ack == I2C_ACK, ACK the byte so can continue reading, else
257 * send I2C_NOACK to end the read.
258 */
259static uchar read_byte(int ack)
260{
Heiko Schocher98aed372008-10-15 09:35:26 +0200261 I2C_SOFT_DECLARATIONS /* intentional without ';' */
wdenkc6097192002-11-03 00:24:07 +0000262 int data;
263 int j;
264
265 /*
266 * Read 8 bits, MSB first.
267 */
268 I2C_TRISTATE;
Haavard Skinnemoen110e0062008-05-16 11:08:11 +0200269 I2C_SDA(1);
wdenkc6097192002-11-03 00:24:07 +0000270 data = 0;
271 for(j = 0; j < 8; j++) {
272 I2C_SCL(0);
273 I2C_DELAY;
274 I2C_SCL(1);
275 I2C_DELAY;
276 data <<= 1;
277 data |= I2C_READ;
278 I2C_DELAY;
279 }
280 send_ack(ack);
281
282 return(data);
283}
284
wdenkc6097192002-11-03 00:24:07 +0000285/*-----------------------------------------------------------------------
286 * Initialization
287 */
Heiko Schocherea818db2013-01-29 08:53:15 +0100288static void soft_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
wdenkc6097192002-11-03 00:24:07 +0000289{
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200290#if defined(CONFIG_SYS_I2C_INIT_BOARD)
Heiko Schocher4ca107e2008-10-15 09:38:38 +0200291 /* call board specific i2c bus reset routine before accessing the */
292 /* environment, which might be in a chip on that bus. For details */
293 /* about this problem see doc/I2C_Edge_Conditions. */
294 i2c_init_board();
295#else
wdenkc6097192002-11-03 00:24:07 +0000296 /*
wdenk8bde7f72003-06-27 21:31:46 +0000297 * WARNING: Do NOT save speed in a static variable: if the
298 * I2C routines are called before RAM is initialized (to read
299 * the DIMM SPD, for instance), RAM won't be usable and your
300 * system will crash.
wdenkc6097192002-11-03 00:24:07 +0000301 */
302 send_reset ();
Heiko Schocher4ca107e2008-10-15 09:38:38 +0200303#endif
wdenkc6097192002-11-03 00:24:07 +0000304}
305
306/*-----------------------------------------------------------------------
307 * Probe to see if a chip is present. Also good for checking for the
308 * completion of EEPROM writes since the chip stops responding until
309 * the write completes (typically 10mSec).
310 */
Heiko Schocherea818db2013-01-29 08:53:15 +0100311static int soft_i2c_probe(struct i2c_adapter *adap, uint8_t addr)
wdenkc6097192002-11-03 00:24:07 +0000312{
313 int rc;
314
Wolfgang Denk82d716f2006-03-12 01:30:45 +0100315 /*
Wolfgang Denk8e7b7032006-03-12 02:55:22 +0100316 * perform 1 byte write transaction with just address byte
Wolfgang Denk82d716f2006-03-12 01:30:45 +0100317 * (fake write)
318 */
wdenkc6097192002-11-03 00:24:07 +0000319 send_start();
wdenk6aff3112002-12-17 01:51:00 +0000320 rc = write_byte ((addr << 1) | 0);
wdenkc6097192002-11-03 00:24:07 +0000321 send_stop();
322
323 return (rc ? 1 : 0);
324}
325
326/*-----------------------------------------------------------------------
327 * Read bytes
328 */
Heiko Schocherea818db2013-01-29 08:53:15 +0100329static int soft_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
330 int alen, uchar *buffer, int len)
wdenkc6097192002-11-03 00:24:07 +0000331{
332 int shift;
333 PRINTD("i2c_read: chip %02X addr %02X alen %d buffer %p len %d\n",
334 chip, addr, alen, buffer, len);
335
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200336#ifdef CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW
wdenkc6097192002-11-03 00:24:07 +0000337 /*
338 * EEPROM chips that implement "address overflow" are ones
339 * like Catalyst 24WC04/08/16 which has 9/10/11 bits of
340 * address and the extra bits end up in the "chip address"
341 * bit slots. This makes a 24WC08 (1Kbyte) chip look like
342 * four 256 byte chips.
343 *
344 * Note that we consider the length of the address field to
345 * still be one byte because the extra address bits are
346 * hidden in the chip address.
347 */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +0200348 chip |= ((addr >> (alen * 8)) & CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW);
wdenkc6097192002-11-03 00:24:07 +0000349
350 PRINTD("i2c_read: fix addr_overflow: chip %02X addr %02X\n",
351 chip, addr);
352#endif
353
354 /*
355 * Do the addressing portion of a write cycle to set the
356 * chip's address pointer. If the address length is zero,
357 * don't do the normal write cycle to set the address pointer,
358 * there is no address pointer in this chip.
359 */
360 send_start();
361 if(alen > 0) {
362 if(write_byte(chip << 1)) { /* write cycle */
363 send_stop();
364 PRINTD("i2c_read, no chip responded %02X\n", chip);
365 return(1);
366 }
367 shift = (alen-1) * 8;
368 while(alen-- > 0) {
369 if(write_byte(addr >> shift)) {
370 PRINTD("i2c_read, address not <ACK>ed\n");
371 return(1);
372 }
373 shift -= 8;
374 }
Andrew Dyer2ac69852008-12-29 17:36:01 -0600375
376 /* Some I2C chips need a stop/start sequence here,
377 * other chips don't work with a full stop and need
378 * only a start. Default behaviour is to send the
379 * stop/start sequence.
380 */
381#ifdef CONFIG_SOFT_I2C_READ_REPEATED_START
wdenkc6097192002-11-03 00:24:07 +0000382 send_start();
Andrew Dyer2ac69852008-12-29 17:36:01 -0600383#else
384 send_stop();
385 send_start();
386#endif
wdenkc6097192002-11-03 00:24:07 +0000387 }
388 /*
389 * Send the chip address again, this time for a read cycle.
390 * Then read the data. On the last byte, we do a NACK instead
391 * of an ACK(len == 0) to terminate the read.
392 */
393 write_byte((chip << 1) | 1); /* read cycle */
394 while(len-- > 0) {
395 *buffer++ = read_byte(len == 0);
396 }
397 send_stop();
398 return(0);
399}
400
401/*-----------------------------------------------------------------------
402 * Write bytes
403 */
Heiko Schocherea818db2013-01-29 08:53:15 +0100404static int soft_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
405 int alen, uchar *buffer, int len)
wdenkc6097192002-11-03 00:24:07 +0000406{
407 int shift, failures = 0;
408
409 PRINTD("i2c_write: chip %02X addr %02X alen %d buffer %p len %d\n",
410 chip, addr, alen, buffer, len);
411
412 send_start();
413 if(write_byte(chip << 1)) { /* write cycle */
414 send_stop();
415 PRINTD("i2c_write, no chip responded %02X\n", chip);
416 return(1);
417 }
418 shift = (alen-1) * 8;
419 while(alen-- > 0) {
420 if(write_byte(addr >> shift)) {
421 PRINTD("i2c_write, address not <ACK>ed\n");
422 return(1);
423 }
424 shift -= 8;
425 }
426
427 while(len-- > 0) {
428 if(write_byte(*buffer++)) {
429 failures++;
430 }
431 }
432 send_stop();
433 return(failures);
434}
Heiko Schocherea818db2013-01-29 08:53:15 +0100435
436/*
437 * Register soft i2c adapters
438 */
Dirk Eibach37b33252015-10-28 11:46:39 +0100439U_BOOT_I2C_ADAP_COMPLETE(soft00, soft_i2c_init, soft_i2c_probe,
Heiko Schocherea818db2013-01-29 08:53:15 +0100440 soft_i2c_read, soft_i2c_write, NULL,
441 CONFIG_SYS_I2C_SOFT_SPEED, CONFIG_SYS_I2C_SOFT_SLAVE,
442 0)
443#if defined(I2C_SOFT_DECLARATIONS2)
Dirk Eibach37b33252015-10-28 11:46:39 +0100444U_BOOT_I2C_ADAP_COMPLETE(soft01, soft_i2c_init, soft_i2c_probe,
Heiko Schocherea818db2013-01-29 08:53:15 +0100445 soft_i2c_read, soft_i2c_write, NULL,
446 CONFIG_SYS_I2C_SOFT_SPEED_2,
447 CONFIG_SYS_I2C_SOFT_SLAVE_2,
448 1)
449#endif
450#if defined(I2C_SOFT_DECLARATIONS3)
Dirk Eibach37b33252015-10-28 11:46:39 +0100451U_BOOT_I2C_ADAP_COMPLETE(soft02, soft_i2c_init, soft_i2c_probe,
Heiko Schocherea818db2013-01-29 08:53:15 +0100452 soft_i2c_read, soft_i2c_write, NULL,
453 CONFIG_SYS_I2C_SOFT_SPEED_3,
454 CONFIG_SYS_I2C_SOFT_SLAVE_3,
455 2)
456#endif
457#if defined(I2C_SOFT_DECLARATIONS4)
Dirk Eibach37b33252015-10-28 11:46:39 +0100458U_BOOT_I2C_ADAP_COMPLETE(soft03, soft_i2c_init, soft_i2c_probe,
Heiko Schocherea818db2013-01-29 08:53:15 +0100459 soft_i2c_read, soft_i2c_write, NULL,
460 CONFIG_SYS_I2C_SOFT_SPEED_4,
461 CONFIG_SYS_I2C_SOFT_SLAVE_4,
462 3)
463#endif
Dirk Eibach7ed45d32015-10-28 11:46:35 +0100464#if defined(I2C_SOFT_DECLARATIONS5)
Dirk Eibach37b33252015-10-28 11:46:39 +0100465U_BOOT_I2C_ADAP_COMPLETE(soft04, soft_i2c_init, soft_i2c_probe,
Dirk Eibach7ed45d32015-10-28 11:46:35 +0100466 soft_i2c_read, soft_i2c_write, NULL,
467 CONFIG_SYS_I2C_SOFT_SPEED_5,
468 CONFIG_SYS_I2C_SOFT_SLAVE_5,
469 4)
470#endif
471#if defined(I2C_SOFT_DECLARATIONS6)
Dirk Eibach37b33252015-10-28 11:46:39 +0100472U_BOOT_I2C_ADAP_COMPLETE(soft05, soft_i2c_init, soft_i2c_probe,
Dirk Eibach7ed45d32015-10-28 11:46:35 +0100473 soft_i2c_read, soft_i2c_write, NULL,
474 CONFIG_SYS_I2C_SOFT_SPEED_6,
475 CONFIG_SYS_I2C_SOFT_SLAVE_6,
476 5)
477#endif
478#if defined(I2C_SOFT_DECLARATIONS7)
Dirk Eibach37b33252015-10-28 11:46:39 +0100479U_BOOT_I2C_ADAP_COMPLETE(soft06, soft_i2c_init, soft_i2c_probe,
Dirk Eibach7ed45d32015-10-28 11:46:35 +0100480 soft_i2c_read, soft_i2c_write, NULL,
481 CONFIG_SYS_I2C_SOFT_SPEED_7,
482 CONFIG_SYS_I2C_SOFT_SLAVE_7,
483 6)
484#endif
485#if defined(I2C_SOFT_DECLARATIONS8)
Dirk Eibach37b33252015-10-28 11:46:39 +0100486U_BOOT_I2C_ADAP_COMPLETE(soft07, soft_i2c_init, soft_i2c_probe,
Dirk Eibach7ed45d32015-10-28 11:46:35 +0100487 soft_i2c_read, soft_i2c_write, NULL,
488 CONFIG_SYS_I2C_SOFT_SPEED_8,
489 CONFIG_SYS_I2C_SOFT_SLAVE_8,
490 7)
491#endif
Dirk Eibach5c3b6dc2015-10-28 11:46:36 +0100492#if defined(I2C_SOFT_DECLARATIONS9)
Dirk Eibach37b33252015-10-28 11:46:39 +0100493U_BOOT_I2C_ADAP_COMPLETE(soft08, soft_i2c_init, soft_i2c_probe,
Dirk Eibach5c3b6dc2015-10-28 11:46:36 +0100494 soft_i2c_read, soft_i2c_write, NULL,
495 CONFIG_SYS_I2C_SOFT_SPEED_9,
496 CONFIG_SYS_I2C_SOFT_SLAVE_9,
497 8)
498#endif
499#if defined(I2C_SOFT_DECLARATIONS10)
Dirk Eibach37b33252015-10-28 11:46:39 +0100500U_BOOT_I2C_ADAP_COMPLETE(soft09, soft_i2c_init, soft_i2c_probe,
Dirk Eibach5c3b6dc2015-10-28 11:46:36 +0100501 soft_i2c_read, soft_i2c_write, NULL,
502 CONFIG_SYS_I2C_SOFT_SPEED_10,
503 CONFIG_SYS_I2C_SOFT_SLAVE_10,
504 9)
505#endif
506#if defined(I2C_SOFT_DECLARATIONS11)
507U_BOOT_I2C_ADAP_COMPLETE(soft10, soft_i2c_init, soft_i2c_probe,
508 soft_i2c_read, soft_i2c_write, NULL,
509 CONFIG_SYS_I2C_SOFT_SPEED_11,
510 CONFIG_SYS_I2C_SOFT_SLAVE_11,
511 10)
512#endif
513#if defined(I2C_SOFT_DECLARATIONS12)
514U_BOOT_I2C_ADAP_COMPLETE(soft11, soft_i2c_init, soft_i2c_probe,
515 soft_i2c_read, soft_i2c_write, NULL,
516 CONFIG_SYS_I2C_SOFT_SPEED_12,
517 CONFIG_SYS_I2C_SOFT_SLAVE_12,
518 11)
519#endif