i2c-davinci.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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. u32 stat;
  215. u16 w;
  216. int r;
  217. if (msg->len == 0)
  218. return -EINVAL;
  219. if (!pdata)
  220. pdata = &davinci_i2c_platform_data_default;
  221. /* Introduce a delay, required for some boards (e.g Davinci EVM) */
  222. if (pdata->bus_delay)
  223. udelay(pdata->bus_delay);
  224. /* set the slave address */
  225. davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr);
  226. dev->buf = msg->buf;
  227. dev->buf_len = msg->len;
  228. davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev->buf_len);
  229. init_completion(&dev->cmd_complete);
  230. dev->cmd_err = 0;
  231. /* Clear any pending interrupts by reading the IVR */
  232. stat = davinci_i2c_read_reg(dev, DAVINCI_I2C_IVR_REG);
  233. /* Take I2C out of reset, configure it as master and set the
  234. * start bit */
  235. flag = DAVINCI_I2C_MDR_IRS | DAVINCI_I2C_MDR_MST | DAVINCI_I2C_MDR_STT;
  236. /* if the slave address is ten bit address, enable XA bit */
  237. if (msg->flags & I2C_M_TEN)
  238. flag |= DAVINCI_I2C_MDR_XA;
  239. if (!(msg->flags & I2C_M_RD))
  240. flag |= DAVINCI_I2C_MDR_TRX;
  241. if (stop)
  242. flag |= DAVINCI_I2C_MDR_STP;
  243. /* Enable receive or transmit interrupts */
  244. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_IMR_REG);
  245. if (msg->flags & I2C_M_RD)
  246. MOD_REG_BIT(w, DAVINCI_I2C_IMR_RRDY, 1);
  247. else
  248. MOD_REG_BIT(w, DAVINCI_I2C_IMR_XRDY, 1);
  249. davinci_i2c_write_reg(dev, DAVINCI_I2C_IMR_REG, w);
  250. /* write the data into mode register */
  251. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, flag);
  252. r = wait_for_completion_interruptible_timeout(&dev->cmd_complete,
  253. DAVINCI_I2C_TIMEOUT);
  254. dev->buf_len = 0;
  255. if (r < 0)
  256. return r;
  257. if (r == 0) {
  258. dev_err(dev->dev, "controller timed out\n");
  259. i2c_davinci_init(dev);
  260. return -ETIMEDOUT;
  261. }
  262. /* no error */
  263. if (likely(!dev->cmd_err))
  264. return msg->len;
  265. /* We have an error */
  266. if (dev->cmd_err & DAVINCI_I2C_STR_AL) {
  267. i2c_davinci_init(dev);
  268. return -EIO;
  269. }
  270. if (dev->cmd_err & DAVINCI_I2C_STR_NACK) {
  271. if (msg->flags & I2C_M_IGNORE_NAK)
  272. return msg->len;
  273. if (stop) {
  274. w = davinci_i2c_read_reg(dev, DAVINCI_I2C_MDR_REG);
  275. MOD_REG_BIT(w, DAVINCI_I2C_MDR_STP, 1);
  276. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
  277. }
  278. return -EREMOTEIO;
  279. }
  280. return -EIO;
  281. }
  282. /*
  283. * Prepare controller for a transaction and call i2c_davinci_xfer_msg
  284. */
  285. static int
  286. i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
  287. {
  288. struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
  289. int i;
  290. int ret;
  291. dev_dbg(dev->dev, "%s: msgs: %d\n", __func__, num);
  292. ret = i2c_davinci_wait_bus_not_busy(dev, 1);
  293. if (ret < 0) {
  294. dev_warn(dev->dev, "timeout waiting for bus ready\n");
  295. return ret;
  296. }
  297. for (i = 0; i < num; i++) {
  298. ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1)));
  299. dev_dbg(dev->dev, "%s [%d/%d] ret: %d\n", __func__, i + 1, num,
  300. ret);
  301. if (ret < 0)
  302. return ret;
  303. }
  304. return num;
  305. }
  306. static u32 i2c_davinci_func(struct i2c_adapter *adap)
  307. {
  308. return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
  309. }
  310. /*
  311. * Interrupt service routine. This gets called whenever an I2C interrupt
  312. * occurs.
  313. */
  314. static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
  315. {
  316. struct davinci_i2c_dev *dev = dev_id;
  317. u32 stat;
  318. int count = 0;
  319. u16 w;
  320. while ((stat = davinci_i2c_read_reg(dev, DAVINCI_I2C_IVR_REG))) {
  321. dev_dbg(dev->dev, "%s: stat=0x%x\n", __func__, stat);
  322. if (count++ == 100) {
  323. dev_warn(dev->dev, "Too much work in one IRQ\n");
  324. break;
  325. }
  326. switch (stat) {
  327. case DAVINCI_I2C_IVR_AL:
  328. dev->cmd_err |= DAVINCI_I2C_STR_AL;
  329. complete(&dev->cmd_complete);
  330. break;
  331. case DAVINCI_I2C_IVR_NACK:
  332. dev->cmd_err |= DAVINCI_I2C_STR_NACK;
  333. complete(&dev->cmd_complete);
  334. break;
  335. case DAVINCI_I2C_IVR_ARDY:
  336. davinci_i2c_write_reg(dev,
  337. DAVINCI_I2C_STR_REG, DAVINCI_I2C_STR_ARDY);
  338. complete(&dev->cmd_complete);
  339. break;
  340. case DAVINCI_I2C_IVR_RDR:
  341. if (dev->buf_len) {
  342. *dev->buf++ =
  343. davinci_i2c_read_reg(dev,
  344. DAVINCI_I2C_DRR_REG);
  345. dev->buf_len--;
  346. if (dev->buf_len)
  347. continue;
  348. davinci_i2c_write_reg(dev,
  349. DAVINCI_I2C_STR_REG,
  350. DAVINCI_I2C_IMR_RRDY);
  351. } else
  352. dev_err(dev->dev, "RDR IRQ while no "
  353. "data requested\n");
  354. break;
  355. case DAVINCI_I2C_IVR_XRDY:
  356. if (dev->buf_len) {
  357. davinci_i2c_write_reg(dev, DAVINCI_I2C_DXR_REG,
  358. *dev->buf++);
  359. dev->buf_len--;
  360. if (dev->buf_len)
  361. continue;
  362. w = davinci_i2c_read_reg(dev,
  363. DAVINCI_I2C_IMR_REG);
  364. MOD_REG_BIT(w, DAVINCI_I2C_IMR_XRDY, 0);
  365. davinci_i2c_write_reg(dev,
  366. DAVINCI_I2C_IMR_REG,
  367. w);
  368. } else
  369. dev_err(dev->dev, "TDR IRQ while no data to "
  370. "send\n");
  371. break;
  372. case DAVINCI_I2C_IVR_SCD:
  373. davinci_i2c_write_reg(dev,
  374. DAVINCI_I2C_STR_REG, DAVINCI_I2C_STR_SCD);
  375. complete(&dev->cmd_complete);
  376. break;
  377. case DAVINCI_I2C_IVR_AAS:
  378. dev_warn(dev->dev, "Address as slave interrupt\n");
  379. }/* switch */
  380. }/* while */
  381. return count ? IRQ_HANDLED : IRQ_NONE;
  382. }
  383. static struct i2c_algorithm i2c_davinci_algo = {
  384. .master_xfer = i2c_davinci_xfer,
  385. .functionality = i2c_davinci_func,
  386. };
  387. static int davinci_i2c_probe(struct platform_device *pdev)
  388. {
  389. struct davinci_i2c_dev *dev;
  390. struct i2c_adapter *adap;
  391. struct resource *mem, *irq, *ioarea;
  392. int r;
  393. /* NOTE: driver uses the static register mapping */
  394. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  395. if (!mem) {
  396. dev_err(&pdev->dev, "no mem resource?\n");
  397. return -ENODEV;
  398. }
  399. irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  400. if (!irq) {
  401. dev_err(&pdev->dev, "no irq resource?\n");
  402. return -ENODEV;
  403. }
  404. ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1,
  405. pdev->name);
  406. if (!ioarea) {
  407. dev_err(&pdev->dev, "I2C region already claimed\n");
  408. return -EBUSY;
  409. }
  410. dev = kzalloc(sizeof(struct davinci_i2c_dev), GFP_KERNEL);
  411. if (!dev) {
  412. r = -ENOMEM;
  413. goto err_release_region;
  414. }
  415. dev->dev = get_device(&pdev->dev);
  416. dev->irq = irq->start;
  417. platform_set_drvdata(pdev, dev);
  418. dev->clk = clk_get(&pdev->dev, "I2CCLK");
  419. if (IS_ERR(dev->clk)) {
  420. r = -ENODEV;
  421. goto err_free_mem;
  422. }
  423. clk_enable(dev->clk);
  424. dev->base = (void __iomem *)IO_ADDRESS(mem->start);
  425. i2c_davinci_init(dev);
  426. r = request_irq(dev->irq, i2c_davinci_isr, 0, pdev->name, dev);
  427. if (r) {
  428. dev_err(&pdev->dev, "failure requesting irq %i\n", dev->irq);
  429. goto err_unuse_clocks;
  430. }
  431. adap = &dev->adapter;
  432. i2c_set_adapdata(adap, dev);
  433. adap->owner = THIS_MODULE;
  434. adap->class = I2C_CLASS_HWMON;
  435. strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name));
  436. adap->algo = &i2c_davinci_algo;
  437. adap->dev.parent = &pdev->dev;
  438. /* FIXME */
  439. adap->timeout = 1;
  440. adap->nr = pdev->id;
  441. r = i2c_add_numbered_adapter(adap);
  442. if (r) {
  443. dev_err(&pdev->dev, "failure adding adapter\n");
  444. goto err_free_irq;
  445. }
  446. return 0;
  447. err_free_irq:
  448. free_irq(dev->irq, dev);
  449. err_unuse_clocks:
  450. clk_disable(dev->clk);
  451. clk_put(dev->clk);
  452. dev->clk = NULL;
  453. err_free_mem:
  454. platform_set_drvdata(pdev, NULL);
  455. put_device(&pdev->dev);
  456. kfree(dev);
  457. err_release_region:
  458. release_mem_region(mem->start, (mem->end - mem->start) + 1);
  459. return r;
  460. }
  461. static int davinci_i2c_remove(struct platform_device *pdev)
  462. {
  463. struct davinci_i2c_dev *dev = platform_get_drvdata(pdev);
  464. struct resource *mem;
  465. platform_set_drvdata(pdev, NULL);
  466. i2c_del_adapter(&dev->adapter);
  467. put_device(&pdev->dev);
  468. clk_disable(dev->clk);
  469. clk_put(dev->clk);
  470. dev->clk = NULL;
  471. davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
  472. free_irq(IRQ_I2C, dev);
  473. kfree(dev);
  474. mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  475. release_mem_region(mem->start, (mem->end - mem->start) + 1);
  476. return 0;
  477. }
  478. /* work with hotplug and coldplug */
  479. MODULE_ALIAS("platform:i2c_davinci");
  480. static struct platform_driver davinci_i2c_driver = {
  481. .probe = davinci_i2c_probe,
  482. .remove = davinci_i2c_remove,
  483. .driver = {
  484. .name = "i2c_davinci",
  485. .owner = THIS_MODULE,
  486. },
  487. };
  488. /* I2C may be needed to bring up other drivers */
  489. static int __init davinci_i2c_init_driver(void)
  490. {
  491. return platform_driver_register(&davinci_i2c_driver);
  492. }
  493. subsys_initcall(davinci_i2c_init_driver);
  494. static void __exit davinci_i2c_exit_driver(void)
  495. {
  496. platform_driver_unregister(&davinci_i2c_driver);
  497. }
  498. module_exit(davinci_i2c_exit_driver);
  499. MODULE_AUTHOR("Texas Instruments India");
  500. MODULE_DESCRIPTION("TI DaVinci I2C bus adapter");
  501. MODULE_LICENSE("GPL");