i2c-davinci.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  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 clkh;
  131. u32 clkl;
  132. u32 input_clock = clk_get_rate(dev->clk);
  133. u16 w;
  134. if (!pdata)
  135. pdata = &davinci_i2c_platform_data_default;
  136. /* put I2C into reset */
  137. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  138. MOD_REG_BIT(w, DAVINCI_I2C_MDR_IRS, 0);
  139. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  140. /* NOTE: I2C Clock divider programming info
  141. * As per I2C specs the following formulas provide prescaler
  142. * and low/high divider values
  143. * input clk --> PSC Div -----------> ICCL/H Div --> output clock
  144. * module clk
  145. *
  146. * output clk = module clk / (PSC + 1) [ (ICCL + d) + (ICCH + d) ]
  147. *
  148. * Thus,
  149. * (ICCL + ICCH) = clk = (input clk / ((psc +1) * output clk)) - 2d;
  150. *
  151. * where if PSC == 0, d = 7,
  152. * if PSC == 1, d = 6
  153. * if PSC > 1 , d = 5
  154. */
  155. psc = 26; /* To get 1MHz clock */
  156. clk = ((input_clock / (psc + 1)) / (pdata->bus_freq * 1000)) - 10;
  157. clkh = (50 * clk) / 100;
  158. clkl = clk - clkh;
  159. davinci_i2c_write_reg(dev, DAVINCI_I2C_PSC_REG, psc);
  160. davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh);
  161. davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl);
  162. dev_dbg(dev->dev, "CLK = %d\n", clk);
  163. dev_dbg(dev->dev, "PSC = %d\n",
  164. davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
  165. dev_dbg(dev->dev, "CLKL = %d\n",
  166. davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKL_REG));
  167. dev_dbg(dev->dev, "CLKH = %d\n",
  168. davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKH_REG));
  169. /* Take the I2C module out of reset: */
  170. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  171. MOD_REG_BIT(w, DAVINCI_I2C_MDR_IRS, 1);
  172. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  173. /* Enable interrupts */
  174. davinci_i2c_write_reg(dev, DAVINCI_I2C_IMR_REG, I2C_DAVINCI_INTR_ALL);
  175. return 0;
  176. }
  177. /*
  178. * Waiting for bus not busy
  179. */
  180. static int i2c_davinci_wait_bus_not_busy(struct davinci_i2c_dev *dev,
  181. char allow_sleep)
  182. {
  183. unsigned long timeout;
  184. timeout = jiffies + DAVINCI_I2C_TIMEOUT;
  185. while (davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG)
  186. & DAVINCI_I2C_STR_BB) {
  187. if (time_after(jiffies, timeout)) {
  188. dev_warn(dev->dev,
  189. "timeout waiting for bus ready\n");
  190. return -ETIMEDOUT;
  191. }
  192. if (allow_sleep)
  193. schedule_timeout(1);
  194. }
  195. return 0;
  196. }
  197. /*
  198. * Low level master read/write transaction. This function is called
  199. * from i2c_davinci_xfer.
  200. */
  201. static int
  202. i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
  203. {
  204. struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
  205. struct davinci_i2c_platform_data *pdata = dev->dev->platform_data;
  206. u32 flag;
  207. u32 stat;
  208. u16 w;
  209. int r;
  210. if (msg->len == 0)
  211. return -EINVAL;
  212. if (!pdata)
  213. pdata = &davinci_i2c_platform_data_default;
  214. /* Introduce a delay, required for some boards (e.g Davinci EVM) */
  215. if (pdata->bus_delay)
  216. udelay(pdata->bus_delay);
  217. /* set the slave address */
  218. davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr);
  219. dev->buf = msg->buf;
  220. dev->buf_len = msg->len;
  221. davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len);
  222. init_completion(&dev->cmd_complete);
  223. dev->cmd_err = 0;
  224. /* Clear any pending interrupts by reading the IVR */
  225. stat = davinci_i2c_read_reg(dev, DAVINCI_I2C_IVR_REG);
  226. /* Take I2C out of reset, configure it as master and set the
  227. * start bit */
  228. flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST | DAVINCI_I2C_MDR_STT;
  229. /* if the slave address is ten bit address, enable XA bit */
  230. if (msg->flags & I2C_M_TEN)
  231. flag |= DAVINCI_I2C_MDR_XA;
  232. if (!(msg->flags & I2C_M_RD))
  233. flag |= DAVINCI_I2C_MDR_TRX;
  234. if (stop)
  235. flag |= DAVINCI_I2C_MDR_STP;
  236. /* Enable receive or transmit interrupts */
  237. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG);
  238. if (msg->flags & I2C_M_RD)
  239. MOD_REG_BIT(w, DAVINCI_I2C_IMR_RRDY, 1);
  240. else
  241. MOD_REG_BIT(w, DAVINCI_I2C_IMR_XRDY, 1);
  242. davinci_i2c_write_reg(dev, DAVINCI_I2C_IMR_REG, w);
  243. /* write the data into mode register */
  244. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
  245. r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
  246. DAVINCI_I2C_TIMEOUT);
  247. dev->buf_len = 0;
  248. if (r < 0)
  249. return r;
  250. if (r == 0) {
  251. dev_err(dev->dev, "controller timed out\n");
  252. i2c_davinci_init(dev);
  253. return -ETIMEDOUT;
  254. }
  255. /* no error */
  256. if (likely(!dev->cmd_err))
  257. return msg->len;
  258. /* We have an error */
  259. if (dev->cmd_err & DAVINCI_I2C_STR_AL) {
  260. i2c_davinci_init(dev);
  261. return -EIO;
  262. }
  263. if (dev->cmd_err & DAVINCI_I2C_STR_NACK) {
  264. if (msg->flags & I2C_M_IGNORE_NAK)
  265. return msg->len;
  266. if (stop) {
  267. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  268. MOD_REG_BIT(w, DAVINCI_I2C_MDR_STP, 1);
  269. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  270. }
  271. return -EREMOTEIO;
  272. }
  273. return -EIO;
  274. }
  275. /*
  276. * Prepare controller for a transaction and call i2c_davinci_xfer_msg
  277. */
  278. static int
  279. i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
  280. {
  281. struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
  282. int i;
  283. int ret;
  284. dev_dbg(dev->dev, "%s: msgs: %d\n", __FUNCTION__, num);
  285. ret = i2c_davinci_wait_bus_not_busy(dev, 1);
  286. if (ret < 0) {
  287. dev_warn(dev->dev, "timeout waiting for bus ready\n");
  288. return ret;
  289. }
  290. for (i = 0; i < num; i++) {
  291. ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
  292. if (ret < 0)
  293. return ret;
  294. }
  295. dev_dbg(dev->dev, "%s:%d ret: %d\n", __FUNCTION__, __LINE__, ret);
  296. return num;
  297. }
  298. static u32 i2c_davinci_func(struct i2c_adapter *adap)
  299. {
  300. return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
  301. }
  302. /*
  303. * Interrupt service routine. This gets called whenever an I2C interrupt
  304. * occurs.
  305. */
  306. static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
  307. {
  308. struct davinci_i2c_dev *dev = dev_id;
  309. u32 stat;
  310. int count = 0;
  311. u16 w;
  312. while ((stat = davinci_i2c_read_reg(dev, DAVINCI_I2C_IVR_REG))) {
  313. dev_dbg(dev->dev, "%s: stat=0x%x\n", __FUNCTION__, stat);
  314. if (count++ == 100) {
  315. dev_warn(dev->dev, "Too much work in one IRQ\n");
  316. break;
  317. }
  318. switch (stat) {
  319. case DAVINCI_I2C_IVR_AL:
  320. dev->cmd_err |= DAVINCI_I2C_STR_AL;
  321. complete(&dev->cmd_complete);
  322. break;
  323. case DAVINCI_I2C_IVR_NACK:
  324. dev->cmd_err |= DAVINCI_I2C_STR_NACK;
  325. complete(&dev->cmd_complete);
  326. break;
  327. case DAVINCI_I2C_IVR_ARDY:
  328. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG);
  329. MOD_REG_BIT(w, DAVINCI_I2C_STR_ARDY, 1);
  330. davinci_i2c_write_reg(dev, DAVINCI_I2C_STR_REG, w);
  331. complete(&dev->cmd_complete);
  332. break;
  333. case DAVINCI_I2C_IVR_RDR:
  334. if (dev->buf_len) {
  335. *dev->buf++ =
  336. davinci_i2c_read_reg(dev,
  337. DAVINCI_I2C_DRR_REG);
  338. dev->buf_len--;
  339. if (dev->buf_len)
  340. continue;
  341. w = davinci_i2c_read_reg(dev,
  342. DAVINCI_I2C_STR_REG);
  343. MOD_REG_BIT(w, DAVINCI_I2C_IMR_RRDY, 0);
  344. davinci_i2c_write_reg(dev,
  345. DAVINCI_I2C_STR_REG,
  346. w);
  347. } else
  348. dev_err(dev->dev, "RDR IRQ while no "
  349. "data requested\n");
  350. break;
  351. case DAVINCI_I2C_IVR_XRDY:
  352. if (dev->buf_len) {
  353. davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG,
  354. *dev->buf++);
  355. dev->buf_len--;
  356. if (dev->buf_len)
  357. continue;
  358. w = davinci_i2c_read_reg(dev,
  359. DAVINCI_I2C_IMR_REG);
  360. MOD_REG_BIT(w, DAVINCI_I2C_IMR_XRDY, 0);
  361. davinci_i2c_write_reg(dev,
  362. DAVINCI_I2C_IMR_REG,
  363. w);
  364. } else
  365. dev_err(dev->dev, "TDR IRQ while no data to "
  366. "send\n");
  367. break;
  368. case DAVINCI_I2C_IVR_SCD:
  369. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_STR_REG);
  370. MOD_REG_BIT(w, DAVINCI_I2C_STR_SCD, 1);
  371. davinci_i2c_write_reg(dev, DAVINCI_I2C_STR_REG, w);
  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->retries = 1;
  438. adap->nr = pdev->id;
  439. r = i2c_add_numbered_adapter(adap);
  440. if (r) {
  441. dev_err(&pdev->dev, "failure adding adapter\n");
  442. goto err_free_irq;
  443. }
  444. return 0;
  445. err_free_irq:
  446. free_irq(dev->irq, dev);
  447. err_unuse_clocks:
  448. clk_disable(dev->clk);
  449. clk_put(dev->clk);
  450. dev->clk = NULL;
  451. err_free_mem:
  452. platform_set_drvdata(pdev, NULL);
  453. put_device(&pdev->dev);
  454. kfree(dev);
  455. err_release_region:
  456. release_mem_region(mem->start, (mem->end - mem->start) + 1);
  457. return r;
  458. }
  459. static int davinci_i2c_remove(struct platform_device *pdev)
  460. {
  461. struct davinci_i2c_dev *dev = platform_get_drvdata(pdev);
  462. struct resource *mem;
  463. platform_set_drvdata(pdev, NULL);
  464. i2c_del_adapter(&dev->adapter);
  465. put_device(&pdev->dev);
  466. clk_disable(dev->clk);
  467. clk_put(dev->clk);
  468. dev->clk = NULL;
  469. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
  470. free_irq(IRQ_I2C, dev);
  471. kfree(dev);
  472. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  473. release_mem_region(mem->start, (mem->end - mem->start) + 1);
  474. return 0;
  475. }
  476. static struct platform_driver davinci_i2c_driver = {
  477. .probe = davinci_i2c_probe,
  478. .remove = davinci_i2c_remove,
  479. .driver = {
  480. .name = "i2c_davinci",
  481. .owner = THIS_MODULE,
  482. },
  483. };
  484. /* I2C may be needed to bring up other drivers */
  485. static int __init davinci_i2c_init_driver(void)
  486. {
  487. return platform_driver_register(&davinci_i2c_driver);
  488. }
  489. subsys_initcall(davinci_i2c_init_driver);
  490. static void __exit davinci_i2c_exit_driver(void)
  491. {
  492. platform_driver_unregister(&davinci_i2c_driver);
  493. }
  494. module_exit(davinci_i2c_exit_driver);
  495. MODULE_AUTHOR("Texas Instruments India");
  496. MODULE_DESCRIPTION("TI DaVinci I2C bus adapter");
  497. MODULE_LICENSE("GPL");