i2c-davinci.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /*
  2. * TI DAVINCI I2C adapter driver.
  3. *
  4. * Copyright (C) 2006 Texas Instruments.
  5. * Copyright (C) 2007 MontaVista Software Inc.
  6. *
  7. * Updated by Vinod & Sudhakar Feb 2005
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. * ----------------------------------------------------------------------------
  25. *
  26. */
  27. #include <linux/kernel.h>
  28. #include <linux/module.h>
  29. #include <linux/delay.h>
  30. #include <linux/i2c.h>
  31. #include <linux/clk.h>
  32. #include <linux/errno.h>
  33. #include <linux/sched.h>
  34. #include <linux/err.h>
  35. #include <linux/interrupt.h>
  36. #include <linux/platform_device.h>
  37. #include <linux/io.h>
  38. #include <asm/hardware.h>
  39. #include <asm/mach-types.h>
  40. #include <asm/arch/i2c.h>
  41. /* ----- global defines ----------------------------------------------- */
  42. #define DAVINCI_I2C_TIMEOUT (1*HZ)
  43. #define I2C_DAVINCI_INTR_ALL (DAVINCI_I2C_IMR_AAS | \
  44. DAVINCI_I2C_IMR_SCD | \
  45. DAVINCI_I2C_IMR_ARDY | \
  46. DAVINCI_I2C_IMR_NACK | \
  47. DAVINCI_I2C_IMR_AL)
  48. #define DAVINCI_I2C_OAR_REG 0x00
  49. #define DAVINCI_I2C_IMR_REG 0x04
  50. #define DAVINCI_I2C_STR_REG 0x08
  51. #define DAVINCI_I2C_CLKL_REG 0x0c
  52. #define DAVINCI_I2C_CLKH_REG 0x10
  53. #define DAVINCI_I2C_CNT_REG 0x14
  54. #define DAVINCI_I2C_DRR_REG 0x18
  55. #define DAVINCI_I2C_SAR_REG 0x1c
  56. #define DAVINCI_I2C_DXR_REG 0x20
  57. #define DAVINCI_I2C_MDR_REG 0x24
  58. #define DAVINCI_I2C_IVR_REG 0x28
  59. #define DAVINCI_I2C_EMDR_REG 0x2c
  60. #define DAVINCI_I2C_PSC_REG 0x30
  61. #define DAVINCI_I2C_IVR_AAS 0x07
  62. #define DAVINCI_I2C_IVR_SCD 0x06
  63. #define DAVINCI_I2C_IVR_XRDY 0x05
  64. #define DAVINCI_I2C_IVR_RDR 0x04
  65. #define DAVINCI_I2C_IVR_ARDY 0x03
  66. #define DAVINCI_I2C_IVR_NACK 0x02
  67. #define DAVINCI_I2C_IVR_AL 0x01
  68. #define DAVINCI_I2C_STR_BB (1 << 12)
  69. #define DAVINCI_I2C_STR_RSFULL (1 << 11)
  70. #define DAVINCI_I2C_STR_SCD (1 << 5)
  71. #define DAVINCI_I2C_STR_ARDY (1 << 2)
  72. #define DAVINCI_I2C_STR_NACK (1 << 1)
  73. #define DAVINCI_I2C_STR_AL (1 << 0)
  74. #define DAVINCI_I2C_MDR_NACK (1 << 15)
  75. #define DAVINCI_I2C_MDR_STT (1 << 13)
  76. #define DAVINCI_I2C_MDR_STP (1 << 11)
  77. #define DAVINCI_I2C_MDR_MST (1 << 10)
  78. #define DAVINCI_I2C_MDR_TRX (1 << 9)
  79. #define DAVINCI_I2C_MDR_XA (1 << 8)
  80. #define DAVINCI_I2C_MDR_IRS (1 << 5)
  81. #define DAVINCI_I2C_IMR_AAS (1 << 6)
  82. #define DAVINCI_I2C_IMR_SCD (1 << 5)
  83. #define DAVINCI_I2C_IMR_XRDY (1 << 4)
  84. #define DAVINCI_I2C_IMR_RRDY (1 << 3)
  85. #define DAVINCI_I2C_IMR_ARDY (1 << 2)
  86. #define DAVINCI_I2C_IMR_NACK (1 << 1)
  87. #define DAVINCI_I2C_IMR_AL (1 << 0)
  88. #define MOD_REG_BIT(val, mask, set) do { \
  89. if (set) { \
  90. val |= mask; \
  91. } else { \
  92. val &= ~mask; \
  93. } \
  94. } while (0)
  95. struct davinci_i2c_dev {
  96. struct device *dev;
  97. void __iomem *base;
  98. struct completion cmd_complete;
  99. struct clk *clk;
  100. int cmd_err;
  101. u8 *buf;
  102. size_t buf_len;
  103. int irq;
  104. struct i2c_adapter adapter;
  105. };
  106. /* default platform data to use if not supplied in the platform_device */
  107. static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = {
  108. .bus_freq = 100,
  109. .bus_delay = 0,
  110. };
  111. static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev,
  112. int reg, u16 val)
  113. {
  114. __raw_writew(val, i2c_dev->base + reg);
  115. }
  116. static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg)
  117. {
  118. return __raw_readw(i2c_dev->base + reg);
  119. }
  120. /*
  121. * This functions configures I2C and brings I2C out of reset.
  122. * This function is called during I2C init function. This function
  123. * also gets called if I2C encounters any errors.
  124. */
  125. static int i2c_davinci_init(struct davinci_i2c_dev *dev)
  126. {
  127. struct davinci_i2c_platform_data *pdata = dev->dev->platform_data;
  128. u16 psc;
  129. u32 clk;
  130. u32 d;
  131. u32 clkh;
  132. u32 clkl;
  133. u32 input_clock = clk_get_rate(dev->clk);
  134. u16 w;
  135. if (!pdata)
  136. pdata = &davinci_i2c_platform_data_default;
  137. /* put I2C into reset */
  138. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  139. MOD_REG_BIT(w, DAVINCI_I2C_MDR_IRS, 0);
  140. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  141. /* NOTE: I2C Clock divider programming info
  142. * As per I2C specs the following formulas provide prescaler
  143. * and low/high divider values
  144. * input clk --> PSC Div -----------> ICCL/H Div --> output clock
  145. * module clk
  146. *
  147. * output clk = module clk / (PSC + 1) [ (ICCL + d) + (ICCH + d) ]
  148. *
  149. * Thus,
  150. * (ICCL + ICCH) = clk = (input clk / ((psc +1) * output clk)) - 2d;
  151. *
  152. * where if PSC == 0, d = 7,
  153. * if PSC == 1, d = 6
  154. * if PSC > 1 , d = 5
  155. */
  156. /* get minimum of 7 MHz clock, but max of 12 MHz */
  157. psc = (input_clock / 7000000) - 1;
  158. if ((input_clock / (psc + 1)) > 12000000)
  159. psc++; /* better to run under spec than over */
  160. d = (psc >= 2) ? 5 : 7 - psc;
  161. clk = ((input_clock / (psc + 1)) / (pdata->bus_freq * 1000)) - (d << 1);
  162. clkh = clk >> 1;
  163. clkl = clk - clkh;
  164. davinci_i2c_write_reg(dev, DAVINCI_I2C_PSC_REG, psc);
  165. davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh);
  166. davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl);
  167. dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk);
  168. dev_dbg(dev->dev, "PSC = %d\n",
  169. davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
  170. dev_dbg(dev->dev, "CLKL = %d\n",
  171. davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKL_REG));
  172. dev_dbg(dev->dev, "CLKH = %d\n",
  173. davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKH_REG));
  174. dev_dbg(dev->dev, "bus_freq = %dkHz, bus_delay = %d\n",
  175. pdata->bus_freq, pdata->bus_delay);
  176. /* Take the I2C module out of reset: */
  177. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  178. MOD_REG_BIT(w, DAVINCI_I2C_MDR_IRS, 1);
  179. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  180. /* Enable interrupts */
  181. davinci_i2c_write_reg(dev, DAVINCI_I2C_IMR_REG, I2C_DAVINCI_INTR_ALL);
  182. return 0;
  183. }
  184. /*
  185. * Waiting for bus not busy
  186. */
  187. static int i2c_davinci_wait_bus_not_busy(struct davinci_i2c_dev *dev,
  188. char allow_sleep)
  189. {
  190. unsigned long timeout;
  191. timeout = jiffies + DAVINCI_I2C_TIMEOUT;
  192. while (davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG)
  193. & DAVINCI_I2C_STR_BB) {
  194. if (time_after(jiffies, timeout)) {
  195. dev_warn(dev->dev,
  196. "timeout waiting for bus ready\n");
  197. return -ETIMEDOUT;
  198. }
  199. if (allow_sleep)
  200. schedule_timeout(1);
  201. }
  202. return 0;
  203. }
  204. /*
  205. * Low level master read/write transaction. This function is called
  206. * from i2c_davinci_xfer.
  207. */
  208. static int
  209. i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
  210. {
  211. struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
  212. struct davinci_i2c_platform_data *pdata = dev->dev->platform_data;
  213. u32 flag;
  214. u16 w;
  215. int r;
  216. if (msg->len == 0)
  217. return -EINVAL;
  218. if (!pdata)
  219. pdata = &davinci_i2c_platform_data_default;
  220. /* Introduce a delay, required for some boards (e.g Davinci EVM) */
  221. if (pdata->bus_delay)
  222. udelay(pdata->bus_delay);
  223. /* set the slave address */
  224. davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr);
  225. dev->buf = msg->buf;
  226. dev->buf_len = msg->len;
  227. davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len);
  228. init_completion(&dev->cmd_complete);
  229. dev->cmd_err = 0;
  230. /* Take I2C out of reset, configure it as master and set the
  231. * start bit */
  232. flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST | DAVINCI_I2C_MDR_STT;
  233. /* if the slave address is ten bit address, enable XA bit */
  234. if (msg->flags & I2C_M_TEN)
  235. flag |= DAVINCI_I2C_MDR_XA;
  236. if (!(msg->flags & I2C_M_RD))
  237. flag |= DAVINCI_I2C_MDR_TRX;
  238. if (stop)
  239. flag |= DAVINCI_I2C_MDR_STP;
  240. /* Enable receive or transmit interrupts */
  241. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG);
  242. if (msg->flags & I2C_M_RD)
  243. MOD_REG_BIT(w, DAVINCI_I2C_IMR_RRDY, 1);
  244. else
  245. MOD_REG_BIT(w, DAVINCI_I2C_IMR_XRDY, 1);
  246. davinci_i2c_write_reg(dev, DAVINCI_I2C_IMR_REG, w);
  247. /* write the data into mode register */
  248. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
  249. r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
  250. DAVINCI_I2C_TIMEOUT);
  251. dev->buf_len = 0;
  252. if (r < 0)
  253. return r;
  254. if (r == 0) {
  255. dev_err(dev->dev, "controller timed out\n");
  256. i2c_davinci_init(dev);
  257. return -ETIMEDOUT;
  258. }
  259. /* no error */
  260. if (likely(!dev->cmd_err))
  261. return msg->len;
  262. /* We have an error */
  263. if (dev->cmd_err & DAVINCI_I2C_STR_AL) {
  264. i2c_davinci_init(dev);
  265. return -EIO;
  266. }
  267. if (dev->cmd_err & DAVINCI_I2C_STR_NACK) {
  268. if (msg->flags & I2C_M_IGNORE_NAK)
  269. return msg->len;
  270. if (stop) {
  271. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  272. MOD_REG_BIT(w, DAVINCI_I2C_MDR_STP, 1);
  273. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  274. }
  275. return -EREMOTEIO;
  276. }
  277. return -EIO;
  278. }
  279. /*
  280. * Prepare controller for a transaction and call i2c_davinci_xfer_msg
  281. */
  282. static int
  283. i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
  284. {
  285. struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
  286. int i;
  287. int ret;
  288. dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
  289. ret = i2c_davinci_wait_bus_not_busy(dev, 1);
  290. if (ret < 0) {
  291. dev_warn(dev->dev, "timeout waiting for bus ready\n");
  292. return ret;
  293. }
  294. for (i = 0; i < num; i++) {
  295. ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
  296. dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
  297. ret);
  298. if (ret < 0)
  299. return ret;
  300. }
  301. return num;
  302. }
  303. static u32 i2c_davinci_func(struct i2c_adapter *adap)
  304. {
  305. return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
  306. }
  307. /*
  308. * Interrupt service routine. This gets called whenever an I2C interrupt
  309. * occurs.
  310. */
  311. static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
  312. {
  313. struct davinci_i2c_dev *dev = dev_id;
  314. u32 stat;
  315. int count = 0;
  316. u16 w;
  317. while ((stat = davinci_i2c_read_reg(dev, DAVINCI_I2C_IVR_REG))) {
  318. dev_dbg(dev->dev, "%s: stat=0x%x\n", __func__, stat);
  319. if (count++ == 100) {
  320. dev_warn(dev->dev, "Too much work in one IRQ\n");
  321. break;
  322. }
  323. switch (stat) {
  324. case DAVINCI_I2C_IVR_AL:
  325. dev->cmd_err |= DAVINCI_I2C_STR_AL;
  326. complete(&dev->cmd_complete);
  327. break;
  328. case DAVINCI_I2C_IVR_NACK:
  329. dev->cmd_err |= DAVINCI_I2C_STR_NACK;
  330. complete(&dev->cmd_complete);
  331. break;
  332. case DAVINCI_I2C_IVR_ARDY:
  333. davinci_i2c_write_reg(dev,
  334. DAVINCI_I2C_STR_REG, DAVINCI_I2C_STR_ARDY);
  335. complete(&dev->cmd_complete);
  336. break;
  337. case DAVINCI_I2C_IVR_RDR:
  338. if (dev->buf_len) {
  339. *dev->buf++ =
  340. davinci_i2c_read_reg(dev,
  341. DAVINCI_I2C_DRR_REG);
  342. dev->buf_len--;
  343. if (dev->buf_len)
  344. continue;
  345. davinci_i2c_write_reg(dev,
  346. DAVINCI_I2C_STR_REG,
  347. DAVINCI_I2C_IMR_RRDY);
  348. } else
  349. dev_err(dev->dev, "RDR IRQ while no "
  350. "data requested\n");
  351. break;
  352. case DAVINCI_I2C_IVR_XRDY:
  353. if (dev->buf_len) {
  354. davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG,
  355. *dev->buf++);
  356. dev->buf_len--;
  357. if (dev->buf_len)
  358. continue;
  359. w = davinci_i2c_read_reg(dev,
  360. DAVINCI_I2C_IMR_REG);
  361. MOD_REG_BIT(w, DAVINCI_I2C_IMR_XRDY, 0);
  362. davinci_i2c_write_reg(dev,
  363. DAVINCI_I2C_IMR_REG,
  364. w);
  365. } else
  366. dev_err(dev->dev, "TDR IRQ while no data to "
  367. "send\n");
  368. break;
  369. case DAVINCI_I2C_IVR_SCD:
  370. davinci_i2c_write_reg(dev,
  371. DAVINCI_I2C_STR_REG, DAVINCI_I2C_STR_SCD);
  372. complete(&dev->cmd_complete);
  373. break;
  374. case DAVINCI_I2C_IVR_AAS:
  375. dev_warn(dev->dev, "Address as slave interrupt\n");
  376. }/* switch */
  377. }/* while */
  378. return count ? IRQ_HANDLED : IRQ_NONE;
  379. }
  380. static struct i2c_algorithm i2c_davinci_algo = {
  381. .master_xfer = i2c_davinci_xfer,
  382. .functionality = i2c_davinci_func,
  383. };
  384. static int davinci_i2c_probe(struct platform_device *pdev)
  385. {
  386. struct davinci_i2c_dev *dev;
  387. struct i2c_adapter *adap;
  388. struct resource *mem, *irq, *ioarea;
  389. int r;
  390. /* NOTE: driver uses the static register mapping */
  391. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  392. if (!mem) {
  393. dev_err(&pdev->dev, "no mem resource?\n");
  394. return -ENODEV;
  395. }
  396. irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  397. if (!irq) {
  398. dev_err(&pdev->dev, "no irq resource?\n");
  399. return -ENODEV;
  400. }
  401. ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1,
  402. pdev->name);
  403. if (!ioarea) {
  404. dev_err(&pdev->dev, "I2C region already claimed\n");
  405. return -EBUSY;
  406. }
  407. dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL);
  408. if (!dev) {
  409. r = -ENOMEM;
  410. goto err_release_region;
  411. }
  412. dev->dev = get_device(&pdev->dev);
  413. dev->irq = irq->start;
  414. platform_set_drvdata(pdev, dev);
  415. dev->clk = clk_get(&pdev->dev, "I2CCLK");
  416. if (IS_ERR(dev->clk)) {
  417. r = -ENODEV;
  418. goto err_free_mem;
  419. }
  420. clk_enable(dev->clk);
  421. dev->base = (void __iomem *)IO_ADDRESS(mem->start);
  422. i2c_davinci_init(dev);
  423. r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev);
  424. if (r) {
  425. dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq);
  426. goto err_unuse_clocks;
  427. }
  428. adap = &dev->adapter;
  429. i2c_set_adapdata(adap, dev);
  430. adap->owner = THIS_MODULE;
  431. adap->class = I2C_CLASS_HWMON;
  432. strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name));
  433. adap->algo = &i2c_davinci_algo;
  434. adap->dev.parent = &pdev->dev;
  435. /* FIXME */
  436. adap->timeout = 1;
  437. adap->nr = pdev->id;
  438. r = i2c_add_numbered_adapter(adap);
  439. if (r) {
  440. dev_err(&pdev->dev, "failure adding adapter\n");
  441. goto err_free_irq;
  442. }
  443. return 0;
  444. err_free_irq:
  445. free_irq(dev->irq, dev);
  446. err_unuse_clocks:
  447. clk_disable(dev->clk);
  448. clk_put(dev->clk);
  449. dev->clk = NULL;
  450. err_free_mem:
  451. platform_set_drvdata(pdev, NULL);
  452. put_device(&pdev->dev);
  453. kfree(dev);
  454. err_release_region:
  455. release_mem_region(mem->start, (mem->end - mem->start) + 1);
  456. return r;
  457. }
  458. static int davinci_i2c_remove(struct platform_device *pdev)
  459. {
  460. struct davinci_i2c_dev *dev = platform_get_drvdata(pdev);
  461. struct resource *mem;
  462. platform_set_drvdata(pdev, NULL);
  463. i2c_del_adapter(&dev->adapter);
  464. put_device(&pdev->dev);
  465. clk_disable(dev->clk);
  466. clk_put(dev->clk);
  467. dev->clk = NULL;
  468. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
  469. free_irq(IRQ_I2C, dev);
  470. kfree(dev);
  471. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  472. release_mem_region(mem->start, (mem->end - mem->start) + 1);
  473. return 0;
  474. }
  475. /* work with hotplug and coldplug */
  476. MODULE_ALIAS("platform:i2c_davinci");
  477. static struct platform_driver davinci_i2c_driver = {
  478. .probe = davinci_i2c_probe,
  479. .remove = davinci_i2c_remove,
  480. .driver = {
  481. .name = "i2c_davinci",
  482. .owner = THIS_MODULE,
  483. },
  484. };
  485. /* I2C may be needed to bring up other drivers */
  486. static int __init davinci_i2c_init_driver(void)
  487. {
  488. return platform_driver_register(&davinci_i2c_driver);
  489. }
  490. subsys_initcall(davinci_i2c_init_driver);
  491. static void __exit davinci_i2c_exit_driver(void)
  492. {
  493. platform_driver_unregister(&davinci_i2c_driver);
  494. }
  495. module_exit(davinci_i2c_exit_driver);
  496. MODULE_AUTHOR("Texas Instruments India");
  497. MODULE_DESCRIPTION("TI DaVinci I2C bus adapter");
  498. MODULE_LICENSE("GPL");