i2c-octeon.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. /*
  2. * (C) Copyright 2009-2010
  3. * Nokia Siemens Networks, michael.lawnick.ext@nsn.com
  4. *
  5. * Portions Copyright (C) 2010, 2011 Cavium Networks, Inc.
  6. *
  7. * This is a driver for the i2c adapter in Cavium Networks' OCTEON processors.
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. */
  13. #include <linux/platform_device.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/of_i2c.h>
  18. #include <linux/delay.h>
  19. #include <linux/sched.h>
  20. #include <linux/slab.h>
  21. #include <linux/init.h>
  22. #include <linux/i2c.h>
  23. #include <linux/io.h>
  24. #include <linux/of.h>
  25. #include <asm/octeon/octeon.h>
  26. #define DRV_NAME "i2c-octeon"
  27. /* The previous out-of-tree version was implicitly version 1.0. */
  28. #define DRV_VERSION "2.0"
  29. /* register offsets */
  30. #define SW_TWSI 0x00
  31. #define TWSI_INT 0x10
  32. /* Controller command patterns */
  33. #define SW_TWSI_V 0x8000000000000000ull
  34. #define SW_TWSI_EOP_TWSI_DATA 0x0C00000100000000ull
  35. #define SW_TWSI_EOP_TWSI_CTL 0x0C00000200000000ull
  36. #define SW_TWSI_EOP_TWSI_CLKCTL 0x0C00000300000000ull
  37. #define SW_TWSI_EOP_TWSI_STAT 0x0C00000300000000ull
  38. #define SW_TWSI_EOP_TWSI_RST 0x0C00000700000000ull
  39. #define SW_TWSI_OP_TWSI_CLK 0x0800000000000000ull
  40. #define SW_TWSI_R 0x0100000000000000ull
  41. /* Controller command and status bits */
  42. #define TWSI_CTL_CE 0x80
  43. #define TWSI_CTL_ENAB 0x40
  44. #define TWSI_CTL_STA 0x20
  45. #define TWSI_CTL_STP 0x10
  46. #define TWSI_CTL_IFLG 0x08
  47. #define TWSI_CTL_AAK 0x04
  48. /* Some status values */
  49. #define STAT_START 0x08
  50. #define STAT_RSTART 0x10
  51. #define STAT_TXADDR_ACK 0x18
  52. #define STAT_TXDATA_ACK 0x28
  53. #define STAT_RXADDR_ACK 0x40
  54. #define STAT_RXDATA_ACK 0x50
  55. #define STAT_IDLE 0xF8
  56. struct octeon_i2c {
  57. wait_queue_head_t queue;
  58. struct i2c_adapter adap;
  59. int irq;
  60. u32 twsi_freq;
  61. int sys_freq;
  62. resource_size_t twsi_phys;
  63. void __iomem *twsi_base;
  64. resource_size_t regsize;
  65. struct device *dev;
  66. };
  67. /**
  68. * octeon_i2c_write_sw - write an I2C core register.
  69. * @i2c: The struct octeon_i2c.
  70. * @eop_reg: Register selector.
  71. * @data: Value to be written.
  72. *
  73. * The I2C core registers are accessed indirectly via the SW_TWSI CSR.
  74. */
  75. static void octeon_i2c_write_sw(struct octeon_i2c *i2c,
  76. u64 eop_reg,
  77. u8 data)
  78. {
  79. u64 tmp;
  80. __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI);
  81. do {
  82. tmp = __raw_readq(i2c->twsi_base + SW_TWSI);
  83. } while ((tmp & SW_TWSI_V) != 0);
  84. }
  85. /**
  86. * octeon_i2c_read_sw - write an I2C core register.
  87. * @i2c: The struct octeon_i2c.
  88. * @eop_reg: Register selector.
  89. *
  90. * Returns the data.
  91. *
  92. * The I2C core registers are accessed indirectly via the SW_TWSI CSR.
  93. */
  94. static u8 octeon_i2c_read_sw(struct octeon_i2c *i2c, u64 eop_reg)
  95. {
  96. u64 tmp;
  97. __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI);
  98. do {
  99. tmp = __raw_readq(i2c->twsi_base + SW_TWSI);
  100. } while ((tmp & SW_TWSI_V) != 0);
  101. return tmp & 0xFF;
  102. }
  103. /**
  104. * octeon_i2c_write_int - write the TWSI_INT register
  105. * @i2c: The struct octeon_i2c.
  106. * @data: Value to be written.
  107. */
  108. static void octeon_i2c_write_int(struct octeon_i2c *i2c, u64 data)
  109. {
  110. __raw_writeq(data, i2c->twsi_base + TWSI_INT);
  111. __raw_readq(i2c->twsi_base + TWSI_INT);
  112. }
  113. /**
  114. * octeon_i2c_int_enable - enable the TS interrupt.
  115. * @i2c: The struct octeon_i2c.
  116. *
  117. * The interrupt will be asserted when there is non-STAT_IDLE state in
  118. * the SW_TWSI_EOP_TWSI_STAT register.
  119. */
  120. static void octeon_i2c_int_enable(struct octeon_i2c *i2c)
  121. {
  122. octeon_i2c_write_int(i2c, 0x40);
  123. }
  124. /**
  125. * octeon_i2c_int_disable - disable the TS interrupt.
  126. * @i2c: The struct octeon_i2c.
  127. */
  128. static void octeon_i2c_int_disable(struct octeon_i2c *i2c)
  129. {
  130. octeon_i2c_write_int(i2c, 0);
  131. }
  132. /**
  133. * octeon_i2c_unblock - unblock the bus.
  134. * @i2c: The struct octeon_i2c.
  135. *
  136. * If there was a reset while a device was driving 0 to bus,
  137. * bus is blocked. We toggle it free manually by some clock
  138. * cycles and send a stop.
  139. */
  140. static void octeon_i2c_unblock(struct octeon_i2c *i2c)
  141. {
  142. int i;
  143. dev_dbg(i2c->dev, "%s\n", __func__);
  144. for (i = 0; i < 9; i++) {
  145. octeon_i2c_write_int(i2c, 0x0);
  146. udelay(5);
  147. octeon_i2c_write_int(i2c, 0x200);
  148. udelay(5);
  149. }
  150. octeon_i2c_write_int(i2c, 0x300);
  151. udelay(5);
  152. octeon_i2c_write_int(i2c, 0x100);
  153. udelay(5);
  154. octeon_i2c_write_int(i2c, 0x0);
  155. }
  156. /**
  157. * octeon_i2c_isr - the interrupt service routine.
  158. * @int: The irq, unused.
  159. * @dev_id: Our struct octeon_i2c.
  160. */
  161. static irqreturn_t octeon_i2c_isr(int irq, void *dev_id)
  162. {
  163. struct octeon_i2c *i2c = dev_id;
  164. octeon_i2c_int_disable(i2c);
  165. wake_up_interruptible(&i2c->queue);
  166. return IRQ_HANDLED;
  167. }
  168. static int octeon_i2c_test_iflg(struct octeon_i2c *i2c)
  169. {
  170. return (octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_CTL) & TWSI_CTL_IFLG) != 0;
  171. }
  172. /**
  173. * octeon_i2c_wait - wait for the IFLG to be set.
  174. * @i2c: The struct octeon_i2c.
  175. *
  176. * Returns 0 on success, otherwise a negative errno.
  177. */
  178. static int octeon_i2c_wait(struct octeon_i2c *i2c)
  179. {
  180. int result;
  181. octeon_i2c_int_enable(i2c);
  182. result = wait_event_interruptible_timeout(i2c->queue,
  183. octeon_i2c_test_iflg(i2c),
  184. i2c->adap.timeout);
  185. octeon_i2c_int_disable(i2c);
  186. if (result < 0) {
  187. dev_dbg(i2c->dev, "%s: wait interrupted\n", __func__);
  188. return result;
  189. } else if (result == 0) {
  190. dev_dbg(i2c->dev, "%s: timeout\n", __func__);
  191. return -ETIMEDOUT;
  192. }
  193. return 0;
  194. }
  195. /**
  196. * octeon_i2c_start - send START to the bus.
  197. * @i2c: The struct octeon_i2c.
  198. *
  199. * Returns 0 on success, otherwise a negative errno.
  200. */
  201. static int octeon_i2c_start(struct octeon_i2c *i2c)
  202. {
  203. u8 data;
  204. int result;
  205. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
  206. TWSI_CTL_ENAB | TWSI_CTL_STA);
  207. result = octeon_i2c_wait(i2c);
  208. if (result) {
  209. if (octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT) == STAT_IDLE) {
  210. /*
  211. * Controller refused to send start flag May
  212. * be a client is holding SDA low - let's try
  213. * to free it.
  214. */
  215. octeon_i2c_unblock(i2c);
  216. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
  217. TWSI_CTL_ENAB | TWSI_CTL_STA);
  218. result = octeon_i2c_wait(i2c);
  219. }
  220. if (result)
  221. return result;
  222. }
  223. data = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
  224. if ((data != STAT_START) && (data != STAT_RSTART)) {
  225. dev_err(i2c->dev, "%s: bad status (0x%x)\n", __func__, data);
  226. return -EIO;
  227. }
  228. return 0;
  229. }
  230. /**
  231. * octeon_i2c_stop - send STOP to the bus.
  232. * @i2c: The struct octeon_i2c.
  233. *
  234. * Returns 0 on success, otherwise a negative errno.
  235. */
  236. static int octeon_i2c_stop(struct octeon_i2c *i2c)
  237. {
  238. u8 data;
  239. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
  240. TWSI_CTL_ENAB | TWSI_CTL_STP);
  241. data = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
  242. if (data != STAT_IDLE) {
  243. dev_err(i2c->dev, "%s: bad status(0x%x)\n", __func__, data);
  244. return -EIO;
  245. }
  246. return 0;
  247. }
  248. /**
  249. * octeon_i2c_write - send data to the bus.
  250. * @i2c: The struct octeon_i2c.
  251. * @target: Target address.
  252. * @data: Pointer to the data to be sent.
  253. * @length: Length of the data.
  254. *
  255. * The address is sent over the bus, then the data.
  256. *
  257. * Returns 0 on success, otherwise a negative errno.
  258. */
  259. static int octeon_i2c_write(struct octeon_i2c *i2c, int target,
  260. const u8 *data, int length)
  261. {
  262. int i, result;
  263. u8 tmp;
  264. result = octeon_i2c_start(i2c);
  265. if (result)
  266. return result;
  267. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_DATA, target << 1);
  268. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
  269. result = octeon_i2c_wait(i2c);
  270. if (result)
  271. return result;
  272. for (i = 0; i < length; i++) {
  273. tmp = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
  274. if ((tmp != STAT_TXADDR_ACK) && (tmp != STAT_TXDATA_ACK)) {
  275. dev_err(i2c->dev,
  276. "%s: bad status before write (0x%x)\n",
  277. __func__, tmp);
  278. return -EIO;
  279. }
  280. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_DATA, data[i]);
  281. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
  282. result = octeon_i2c_wait(i2c);
  283. if (result)
  284. return result;
  285. }
  286. return 0;
  287. }
  288. /**
  289. * octeon_i2c_read - receive data from the bus.
  290. * @i2c: The struct octeon_i2c.
  291. * @target: Target address.
  292. * @data: Pointer to the location to store the datae .
  293. * @length: Length of the data.
  294. *
  295. * The address is sent over the bus, then the data is read.
  296. *
  297. * Returns 0 on success, otherwise a negative errno.
  298. */
  299. static int octeon_i2c_read(struct octeon_i2c *i2c, int target,
  300. u8 *data, int length)
  301. {
  302. int i, result;
  303. u8 tmp;
  304. if (length < 1)
  305. return -EINVAL;
  306. result = octeon_i2c_start(i2c);
  307. if (result)
  308. return result;
  309. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_DATA, (target<<1) | 1);
  310. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
  311. result = octeon_i2c_wait(i2c);
  312. if (result)
  313. return result;
  314. for (i = 0; i < length; i++) {
  315. tmp = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
  316. if ((tmp != STAT_RXDATA_ACK) && (tmp != STAT_RXADDR_ACK)) {
  317. dev_err(i2c->dev,
  318. "%s: bad status before read (0x%x)\n",
  319. __func__, tmp);
  320. return -EIO;
  321. }
  322. if (i+1 < length)
  323. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
  324. TWSI_CTL_ENAB | TWSI_CTL_AAK);
  325. else
  326. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL,
  327. TWSI_CTL_ENAB);
  328. result = octeon_i2c_wait(i2c);
  329. if (result)
  330. return result;
  331. data[i] = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_DATA);
  332. }
  333. return 0;
  334. }
  335. /**
  336. * octeon_i2c_xfer - The driver's master_xfer function.
  337. * @adap: Pointer to the i2c_adapter structure.
  338. * @msgs: Pointer to the messages to be processed.
  339. * @num: Length of the MSGS array.
  340. *
  341. * Returns the number of messages processed, or a negative errno on
  342. * failure.
  343. */
  344. static int octeon_i2c_xfer(struct i2c_adapter *adap,
  345. struct i2c_msg *msgs,
  346. int num)
  347. {
  348. struct i2c_msg *pmsg;
  349. int i;
  350. int ret = 0;
  351. struct octeon_i2c *i2c = i2c_get_adapdata(adap);
  352. for (i = 0; ret == 0 && i < num; i++) {
  353. pmsg = &msgs[i];
  354. dev_dbg(i2c->dev,
  355. "Doing %s %d byte(s) to/from 0x%02x - %d of %d messages\n",
  356. pmsg->flags & I2C_M_RD ? "read" : "write",
  357. pmsg->len, pmsg->addr, i + 1, num);
  358. if (pmsg->flags & I2C_M_RD)
  359. ret = octeon_i2c_read(i2c, pmsg->addr, pmsg->buf,
  360. pmsg->len);
  361. else
  362. ret = octeon_i2c_write(i2c, pmsg->addr, pmsg->buf,
  363. pmsg->len);
  364. }
  365. octeon_i2c_stop(i2c);
  366. return (ret != 0) ? ret : num;
  367. }
  368. static u32 octeon_i2c_functionality(struct i2c_adapter *adap)
  369. {
  370. return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
  371. }
  372. static const struct i2c_algorithm octeon_i2c_algo = {
  373. .master_xfer = octeon_i2c_xfer,
  374. .functionality = octeon_i2c_functionality,
  375. };
  376. static struct i2c_adapter octeon_i2c_ops = {
  377. .owner = THIS_MODULE,
  378. .name = "OCTEON adapter",
  379. .algo = &octeon_i2c_algo,
  380. .timeout = 2,
  381. };
  382. /**
  383. * octeon_i2c_setclock - Calculate and set clock divisors.
  384. */
  385. static int octeon_i2c_setclock(struct octeon_i2c *i2c)
  386. {
  387. int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
  388. int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
  389. for (ndiv_idx = 0; ndiv_idx < 8 && delta_hz != 0; ndiv_idx++) {
  390. /*
  391. * An mdiv value of less than 2 seems to not work well
  392. * with ds1337 RTCs, so we constrain it to larger
  393. * values.
  394. */
  395. for (mdiv_idx = 15; mdiv_idx >= 2 && delta_hz != 0; mdiv_idx--) {
  396. /*
  397. * For given ndiv and mdiv values check the
  398. * two closest thp values.
  399. */
  400. tclk = i2c->twsi_freq * (mdiv_idx + 1) * 10;
  401. tclk *= (1 << ndiv_idx);
  402. thp_base = (i2c->sys_freq / (tclk * 2)) - 1;
  403. for (inc = 0; inc <= 1; inc++) {
  404. thp_idx = thp_base + inc;
  405. if (thp_idx < 5 || thp_idx > 0xff)
  406. continue;
  407. foscl = i2c->sys_freq / (2 * (thp_idx + 1));
  408. foscl = foscl / (1 << ndiv_idx);
  409. foscl = foscl / (mdiv_idx + 1) / 10;
  410. diff = abs(foscl - i2c->twsi_freq);
  411. if (diff < delta_hz) {
  412. delta_hz = diff;
  413. thp = thp_idx;
  414. mdiv = mdiv_idx;
  415. ndiv = ndiv_idx;
  416. }
  417. }
  418. }
  419. }
  420. octeon_i2c_write_sw(i2c, SW_TWSI_OP_TWSI_CLK, thp);
  421. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CLKCTL, (mdiv << 3) | ndiv);
  422. return 0;
  423. }
  424. static int octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
  425. {
  426. u8 status;
  427. int tries;
  428. /* disable high level controller, enable bus access */
  429. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_CTL, TWSI_CTL_ENAB);
  430. /* reset controller */
  431. octeon_i2c_write_sw(i2c, SW_TWSI_EOP_TWSI_RST, 0);
  432. for (tries = 10; tries; tries--) {
  433. udelay(1);
  434. status = octeon_i2c_read_sw(i2c, SW_TWSI_EOP_TWSI_STAT);
  435. if (status == STAT_IDLE)
  436. return 0;
  437. }
  438. dev_err(i2c->dev, "%s: TWSI_RST failed! (0x%x)\n", __func__, status);
  439. return -EIO;
  440. }
  441. static int octeon_i2c_probe(struct platform_device *pdev)
  442. {
  443. int irq, result = 0;
  444. struct octeon_i2c *i2c;
  445. struct resource *res_mem;
  446. /* All adaptors have an irq. */
  447. irq = platform_get_irq(pdev, 0);
  448. if (irq < 0)
  449. return irq;
  450. i2c = devm_kzalloc(&pdev->dev, sizeof(*i2c), GFP_KERNEL);
  451. if (!i2c) {
  452. dev_err(&pdev->dev, "kzalloc failed\n");
  453. result = -ENOMEM;
  454. goto out;
  455. }
  456. i2c->dev = &pdev->dev;
  457. res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  458. if (res_mem == NULL) {
  459. dev_err(i2c->dev, "found no memory resource\n");
  460. result = -ENXIO;
  461. goto out;
  462. }
  463. i2c->twsi_phys = res_mem->start;
  464. i2c->regsize = resource_size(res_mem);
  465. /*
  466. * "clock-rate" is a legacy binding, the official binding is
  467. * "clock-frequency". Try the official one first and then
  468. * fall back if it doesn't exist.
  469. */
  470. if (of_property_read_u32(pdev->dev.of_node,
  471. "clock-frequency", &i2c->twsi_freq) &&
  472. of_property_read_u32(pdev->dev.of_node,
  473. "clock-rate", &i2c->twsi_freq)) {
  474. dev_err(i2c->dev,
  475. "no I2C 'clock-rate' or 'clock-frequency' property\n");
  476. result = -ENXIO;
  477. goto out;
  478. }
  479. i2c->sys_freq = octeon_get_io_clock_rate();
  480. if (!devm_request_mem_region(&pdev->dev, i2c->twsi_phys, i2c->regsize,
  481. res_mem->name)) {
  482. dev_err(i2c->dev, "request_mem_region failed\n");
  483. goto out;
  484. }
  485. i2c->twsi_base = devm_ioremap(&pdev->dev, i2c->twsi_phys, i2c->regsize);
  486. init_waitqueue_head(&i2c->queue);
  487. i2c->irq = irq;
  488. result = devm_request_irq(&pdev->dev, i2c->irq,
  489. octeon_i2c_isr, 0, DRV_NAME, i2c);
  490. if (result < 0) {
  491. dev_err(i2c->dev, "failed to attach interrupt\n");
  492. goto out;
  493. }
  494. result = octeon_i2c_initlowlevel(i2c);
  495. if (result) {
  496. dev_err(i2c->dev, "init low level failed\n");
  497. goto out;
  498. }
  499. result = octeon_i2c_setclock(i2c);
  500. if (result) {
  501. dev_err(i2c->dev, "clock init failed\n");
  502. goto out;
  503. }
  504. i2c->adap = octeon_i2c_ops;
  505. i2c->adap.dev.parent = &pdev->dev;
  506. i2c->adap.dev.of_node = pdev->dev.of_node;
  507. i2c_set_adapdata(&i2c->adap, i2c);
  508. platform_set_drvdata(pdev, i2c);
  509. result = i2c_add_adapter(&i2c->adap);
  510. if (result < 0) {
  511. dev_err(i2c->dev, "failed to add adapter\n");
  512. goto out;
  513. }
  514. dev_info(i2c->dev, "version %s\n", DRV_VERSION);
  515. of_i2c_register_devices(&i2c->adap);
  516. return 0;
  517. out:
  518. return result;
  519. };
  520. static int octeon_i2c_remove(struct platform_device *pdev)
  521. {
  522. struct octeon_i2c *i2c = platform_get_drvdata(pdev);
  523. i2c_del_adapter(&i2c->adap);
  524. return 0;
  525. };
  526. static struct of_device_id octeon_i2c_match[] = {
  527. {
  528. .compatible = "cavium,octeon-3860-twsi",
  529. },
  530. {},
  531. };
  532. MODULE_DEVICE_TABLE(of, octeon_i2c_match);
  533. static struct platform_driver octeon_i2c_driver = {
  534. .probe = octeon_i2c_probe,
  535. .remove = octeon_i2c_remove,
  536. .driver = {
  537. .owner = THIS_MODULE,
  538. .name = DRV_NAME,
  539. .of_match_table = octeon_i2c_match,
  540. },
  541. };
  542. module_platform_driver(octeon_i2c_driver);
  543. MODULE_AUTHOR("Michael Lawnick <michael.lawnick.ext@nsn.com>");
  544. MODULE_DESCRIPTION("I2C-Bus adapter for Cavium OCTEON processors");
  545. MODULE_LICENSE("GPL");
  546. MODULE_VERSION(DRV_VERSION);