i2c-octeon.c 15 KB

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