i2c-sh_mobile.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /*
  2. * SuperH Mobile I2C Controller
  3. *
  4. * Copyright (C) 2008 Magnus Damm
  5. *
  6. * Portions of the code based on out-of-tree driver i2c-sh7343.c
  7. * Copyright (c) 2006 Carlos Munoz <carlos@kenati.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. #include <linux/kernel.h>
  23. #include <linux/module.h>
  24. #include <linux/init.h>
  25. #include <linux/delay.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/i2c.h>
  29. #include <linux/err.h>
  30. #include <linux/clk.h>
  31. #include <linux/io.h>
  32. /* Transmit operation: */
  33. /* */
  34. /* 0 byte transmit */
  35. /* BUS: S A8 ACK P */
  36. /* IRQ: DTE WAIT */
  37. /* ICIC: */
  38. /* ICCR: 0x94 0x90 */
  39. /* ICDR: A8 */
  40. /* */
  41. /* 1 byte transmit */
  42. /* BUS: S A8 ACK D8(1) ACK P */
  43. /* IRQ: DTE WAIT WAIT */
  44. /* ICIC: -DTE */
  45. /* ICCR: 0x94 0x90 */
  46. /* ICDR: A8 D8(1) */
  47. /* */
  48. /* 2 byte transmit */
  49. /* BUS: S A8 ACK D8(1) ACK D8(2) ACK P */
  50. /* IRQ: DTE WAIT WAIT WAIT */
  51. /* ICIC: -DTE */
  52. /* ICCR: 0x94 0x90 */
  53. /* ICDR: A8 D8(1) D8(2) */
  54. /* */
  55. /* 3 bytes or more, +---------+ gets repeated */
  56. /* */
  57. /* */
  58. /* Receive operation: */
  59. /* */
  60. /* 0 byte receive - not supported since slave may hold SDA low */
  61. /* */
  62. /* 1 byte receive [TX] | [RX] */
  63. /* BUS: S A8 ACK | D8(1) ACK P */
  64. /* IRQ: DTE WAIT | WAIT DTE */
  65. /* ICIC: -DTE | +DTE */
  66. /* ICCR: 0x94 0x81 | 0xc0 */
  67. /* ICDR: A8 | D8(1) */
  68. /* */
  69. /* 2 byte receive [TX]| [RX] */
  70. /* BUS: S A8 ACK | D8(1) ACK D8(2) ACK P */
  71. /* IRQ: DTE WAIT | WAIT WAIT DTE */
  72. /* ICIC: -DTE | +DTE */
  73. /* ICCR: 0x94 0x81 | 0xc0 */
  74. /* ICDR: A8 | D8(1) D8(2) */
  75. /* */
  76. /* 3 byte receive [TX] | [RX] */
  77. /* BUS: S A8 ACK | D8(1) ACK D8(2) ACK D8(3) ACK P */
  78. /* IRQ: DTE WAIT | WAIT WAIT WAIT DTE */
  79. /* ICIC: -DTE | +DTE */
  80. /* ICCR: 0x94 0x81 | 0xc0 */
  81. /* ICDR: A8 | D8(1) D8(2) D8(3) */
  82. /* */
  83. /* 4 bytes or more, this part is repeated +---------+ */
  84. /* */
  85. /* */
  86. /* Interrupt order and BUSY flag */
  87. /* ___ _ */
  88. /* SDA ___\___XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAA___/ */
  89. /* SCL \_/1\_/2\_/3\_/4\_/5\_/6\_/7\_/8\___/9\_____/ */
  90. /* */
  91. /* S D7 D6 D5 D4 D3 D2 D1 D0 P */
  92. /* ___ */
  93. /* WAIT IRQ ________________________________/ \___________ */
  94. /* TACK IRQ ____________________________________/ \_______ */
  95. /* DTE IRQ __________________________________________/ \_ */
  96. /* AL IRQ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
  97. /* _______________________________________________ */
  98. /* BUSY __/ \_ */
  99. /* */
  100. enum sh_mobile_i2c_op {
  101. OP_START = 0,
  102. OP_TX_FIRST,
  103. OP_TX,
  104. OP_TX_STOP,
  105. OP_TX_TO_RX,
  106. OP_RX,
  107. OP_RX_STOP,
  108. OP_RX_STOP_DATA,
  109. };
  110. struct sh_mobile_i2c_data {
  111. struct device *dev;
  112. void __iomem *reg;
  113. struct i2c_adapter adap;
  114. struct clk *clk;
  115. u_int8_t iccl;
  116. u_int8_t icch;
  117. spinlock_t lock;
  118. wait_queue_head_t wait;
  119. struct i2c_msg *msg;
  120. int pos;
  121. int sr;
  122. };
  123. #define NORMAL_SPEED 100000 /* FAST_SPEED 400000 */
  124. /* Register offsets */
  125. #define ICDR(pd) (pd->reg + 0x00)
  126. #define ICCR(pd) (pd->reg + 0x04)
  127. #define ICSR(pd) (pd->reg + 0x08)
  128. #define ICIC(pd) (pd->reg + 0x0c)
  129. #define ICCL(pd) (pd->reg + 0x10)
  130. #define ICCH(pd) (pd->reg + 0x14)
  131. /* Register bits */
  132. #define ICCR_ICE 0x80
  133. #define ICCR_RACK 0x40
  134. #define ICCR_TRS 0x10
  135. #define ICCR_BBSY 0x04
  136. #define ICCR_SCP 0x01
  137. #define ICSR_SCLM 0x80
  138. #define ICSR_SDAM 0x40
  139. #define SW_DONE 0x20
  140. #define ICSR_BUSY 0x10
  141. #define ICSR_AL 0x08
  142. #define ICSR_TACK 0x04
  143. #define ICSR_WAIT 0x02
  144. #define ICSR_DTE 0x01
  145. #define ICIC_ALE 0x08
  146. #define ICIC_TACKE 0x04
  147. #define ICIC_WAITE 0x02
  148. #define ICIC_DTEE 0x01
  149. static void activate_ch(struct sh_mobile_i2c_data *pd)
  150. {
  151. /* Make sure the clock is enabled */
  152. clk_enable(pd->clk);
  153. /* Enable channel and configure rx ack */
  154. iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
  155. /* Mask all interrupts */
  156. iowrite8(0, ICIC(pd));
  157. /* Set the clock */
  158. iowrite8(pd->iccl, ICCL(pd));
  159. iowrite8(pd->icch, ICCH(pd));
  160. }
  161. static void deactivate_ch(struct sh_mobile_i2c_data *pd)
  162. {
  163. /* Clear/disable interrupts */
  164. iowrite8(0, ICSR(pd));
  165. iowrite8(0, ICIC(pd));
  166. /* Disable channel */
  167. iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
  168. /* Disable clock */
  169. clk_disable(pd->clk);
  170. }
  171. static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
  172. enum sh_mobile_i2c_op op, unsigned char data)
  173. {
  174. unsigned char ret = 0;
  175. unsigned long flags;
  176. dev_dbg(pd->dev, "op %d, data in 0x%02x\n", op, data);
  177. spin_lock_irqsave(&pd->lock, flags);
  178. switch (op) {
  179. case OP_START: /* issue start and trigger DTE interrupt */
  180. iowrite8(0x94, ICCR(pd));
  181. break;
  182. case OP_TX_FIRST: /* disable DTE interrupt and write data */
  183. iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE, ICIC(pd));
  184. iowrite8(data, ICDR(pd));
  185. break;
  186. case OP_TX: /* write data */
  187. iowrite8(data, ICDR(pd));
  188. break;
  189. case OP_TX_STOP: /* write data and issue a stop afterwards */
  190. iowrite8(data, ICDR(pd));
  191. iowrite8(0x90, ICCR(pd));
  192. break;
  193. case OP_TX_TO_RX: /* select read mode */
  194. iowrite8(0x81, ICCR(pd));
  195. break;
  196. case OP_RX: /* just read data */
  197. ret = ioread8(ICDR(pd));
  198. break;
  199. case OP_RX_STOP: /* enable DTE interrupt, issue stop */
  200. iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
  201. ICIC(pd));
  202. iowrite8(0xc0, ICCR(pd));
  203. break;
  204. case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
  205. iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
  206. ICIC(pd));
  207. ret = ioread8(ICDR(pd));
  208. iowrite8(0xc0, ICCR(pd));
  209. break;
  210. }
  211. spin_unlock_irqrestore(&pd->lock, flags);
  212. dev_dbg(pd->dev, "op %d, data out 0x%02x\n", op, ret);
  213. return ret;
  214. }
  215. static int sh_mobile_i2c_is_first_byte(struct sh_mobile_i2c_data *pd)
  216. {
  217. if (pd->pos == -1)
  218. return 1;
  219. return 0;
  220. }
  221. static int sh_mobile_i2c_is_last_byte(struct sh_mobile_i2c_data *pd)
  222. {
  223. if (pd->pos == (pd->msg->len - 1))
  224. return 1;
  225. return 0;
  226. }
  227. static void sh_mobile_i2c_get_data(struct sh_mobile_i2c_data *pd,
  228. unsigned char *buf)
  229. {
  230. switch (pd->pos) {
  231. case -1:
  232. *buf = (pd->msg->addr & 0x7f) << 1;
  233. *buf |= (pd->msg->flags & I2C_M_RD) ? 1 : 0;
  234. break;
  235. default:
  236. *buf = pd->msg->buf[pd->pos];
  237. }
  238. }
  239. static int sh_mobile_i2c_isr_tx(struct sh_mobile_i2c_data *pd)
  240. {
  241. unsigned char data;
  242. if (pd->pos == pd->msg->len)
  243. return 1;
  244. sh_mobile_i2c_get_data(pd, &data);
  245. if (sh_mobile_i2c_is_last_byte(pd))
  246. i2c_op(pd, OP_TX_STOP, data);
  247. else if (sh_mobile_i2c_is_first_byte(pd))
  248. i2c_op(pd, OP_TX_FIRST, data);
  249. else
  250. i2c_op(pd, OP_TX, data);
  251. pd->pos++;
  252. return 0;
  253. }
  254. static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd)
  255. {
  256. unsigned char data;
  257. int real_pos;
  258. do {
  259. if (pd->pos <= -1) {
  260. sh_mobile_i2c_get_data(pd, &data);
  261. if (sh_mobile_i2c_is_first_byte(pd))
  262. i2c_op(pd, OP_TX_FIRST, data);
  263. else
  264. i2c_op(pd, OP_TX, data);
  265. break;
  266. }
  267. if (pd->pos == 0) {
  268. i2c_op(pd, OP_TX_TO_RX, 0);
  269. break;
  270. }
  271. real_pos = pd->pos - 2;
  272. if (pd->pos == pd->msg->len) {
  273. if (real_pos < 0) {
  274. i2c_op(pd, OP_RX_STOP, 0);
  275. break;
  276. }
  277. data = i2c_op(pd, OP_RX_STOP_DATA, 0);
  278. } else
  279. data = i2c_op(pd, OP_RX, 0);
  280. pd->msg->buf[real_pos] = data;
  281. } while (0);
  282. pd->pos++;
  283. return pd->pos == (pd->msg->len + 2);
  284. }
  285. static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)
  286. {
  287. struct platform_device *dev = dev_id;
  288. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  289. unsigned char sr;
  290. int wakeup;
  291. sr = ioread8(ICSR(pd));
  292. pd->sr |= sr; /* remember state */
  293. dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr,
  294. (pd->msg->flags & I2C_M_RD) ? "read" : "write",
  295. pd->pos, pd->msg->len);
  296. if (sr & (ICSR_AL | ICSR_TACK)) {
  297. /* don't interrupt transaction - continue to issue stop */
  298. iowrite8(sr & ~(ICSR_AL | ICSR_TACK), ICSR(pd));
  299. wakeup = 0;
  300. } else if (pd->msg->flags & I2C_M_RD)
  301. wakeup = sh_mobile_i2c_isr_rx(pd);
  302. else
  303. wakeup = sh_mobile_i2c_isr_tx(pd);
  304. if (sr & ICSR_WAIT) /* TODO: add delay here to support slow acks */
  305. iowrite8(sr & ~ICSR_WAIT, ICSR(pd));
  306. if (wakeup) {
  307. pd->sr |= SW_DONE;
  308. wake_up(&pd->wait);
  309. }
  310. return IRQ_HANDLED;
  311. }
  312. static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg)
  313. {
  314. if (usr_msg->len == 0 && (usr_msg->flags & I2C_M_RD)) {
  315. dev_err(pd->dev, "Unsupported zero length i2c read\n");
  316. return -EIO;
  317. }
  318. /* Initialize channel registers */
  319. iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
  320. /* Enable channel and configure rx ack */
  321. iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
  322. /* Set the clock */
  323. iowrite8(pd->iccl, ICCL(pd));
  324. iowrite8(pd->icch, ICCH(pd));
  325. pd->msg = usr_msg;
  326. pd->pos = -1;
  327. pd->sr = 0;
  328. /* Enable all interrupts to begin with */
  329. iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, ICIC(pd));
  330. return 0;
  331. }
  332. static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
  333. struct i2c_msg *msgs,
  334. int num)
  335. {
  336. struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
  337. struct i2c_msg *msg;
  338. int err = 0;
  339. u_int8_t val;
  340. int i, k, retry_count;
  341. activate_ch(pd);
  342. /* Process all messages */
  343. for (i = 0; i < num; i++) {
  344. msg = &msgs[i];
  345. err = start_ch(pd, msg);
  346. if (err)
  347. break;
  348. i2c_op(pd, OP_START, 0);
  349. /* The interrupt handler takes care of the rest... */
  350. k = wait_event_timeout(pd->wait,
  351. pd->sr & (ICSR_TACK | SW_DONE),
  352. 5 * HZ);
  353. if (!k)
  354. dev_err(pd->dev, "Transfer request timed out\n");
  355. retry_count = 1000;
  356. again:
  357. val = ioread8(ICSR(pd));
  358. dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr);
  359. /* the interrupt handler may wake us up before the
  360. * transfer is finished, so poll the hardware
  361. * until we're done.
  362. */
  363. if (val & ICSR_BUSY) {
  364. udelay(10);
  365. if (retry_count--)
  366. goto again;
  367. err = -EIO;
  368. dev_err(pd->dev, "Polling timed out\n");
  369. break;
  370. }
  371. /* handle missing acknowledge and arbitration lost */
  372. if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) {
  373. err = -EIO;
  374. break;
  375. }
  376. }
  377. deactivate_ch(pd);
  378. if (!err)
  379. err = num;
  380. return err;
  381. }
  382. static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter)
  383. {
  384. return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
  385. }
  386. static struct i2c_algorithm sh_mobile_i2c_algorithm = {
  387. .functionality = sh_mobile_i2c_func,
  388. .master_xfer = sh_mobile_i2c_xfer,
  389. };
  390. static void sh_mobile_i2c_setup_channel(struct platform_device *dev)
  391. {
  392. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  393. unsigned long peripheral_clk = clk_get_rate(pd->clk);
  394. u_int32_t num;
  395. u_int32_t denom;
  396. u_int32_t tmp;
  397. spin_lock_init(&pd->lock);
  398. init_waitqueue_head(&pd->wait);
  399. /* Calculate the value for iccl. From the data sheet:
  400. * iccl = (p clock / transfer rate) * (L / (L + H))
  401. * where L and H are the SCL low/high ratio (5/4 in this case).
  402. * We also round off the result.
  403. */
  404. num = peripheral_clk * 5;
  405. denom = NORMAL_SPEED * 9;
  406. tmp = num * 10 / denom;
  407. if (tmp % 10 >= 5)
  408. pd->iccl = (u_int8_t)((num/denom) + 1);
  409. else
  410. pd->iccl = (u_int8_t)(num/denom);
  411. /* Calculate the value for icch. From the data sheet:
  412. icch = (p clock / transfer rate) * (H / (L + H)) */
  413. num = peripheral_clk * 4;
  414. tmp = num * 10 / denom;
  415. if (tmp % 10 >= 5)
  416. pd->icch = (u_int8_t)((num/denom) + 1);
  417. else
  418. pd->icch = (u_int8_t)(num/denom);
  419. }
  420. static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
  421. {
  422. struct resource *res;
  423. int ret = -ENXIO;
  424. int q, m;
  425. int k = 0;
  426. int n = 0;
  427. while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
  428. for (n = res->start; hook && n <= res->end; n++) {
  429. if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
  430. dev->dev.bus_id, dev))
  431. goto rollback;
  432. }
  433. k++;
  434. }
  435. if (hook)
  436. return k > 0 ? 0 : -ENOENT;
  437. k--;
  438. ret = 0;
  439. rollback:
  440. for (q = k; k >= 0; k--) {
  441. for (m = n; m >= res->start; m--)
  442. free_irq(m, dev);
  443. res = platform_get_resource(dev, IORESOURCE_IRQ, k - 1);
  444. m = res->end;
  445. }
  446. return ret;
  447. }
  448. static int sh_mobile_i2c_probe(struct platform_device *dev)
  449. {
  450. struct sh_mobile_i2c_data *pd;
  451. struct i2c_adapter *adap;
  452. struct resource *res;
  453. int size;
  454. int ret;
  455. pd = kzalloc(sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
  456. if (pd == NULL) {
  457. dev_err(&dev->dev, "cannot allocate private data\n");
  458. return -ENOMEM;
  459. }
  460. pd->clk = clk_get(&dev->dev, "peripheral_clk");
  461. if (IS_ERR(pd->clk)) {
  462. dev_err(&dev->dev, "cannot get peripheral clock\n");
  463. ret = PTR_ERR(pd->clk);
  464. goto err;
  465. }
  466. ret = sh_mobile_i2c_hook_irqs(dev, 1);
  467. if (ret) {
  468. dev_err(&dev->dev, "cannot request IRQ\n");
  469. goto err_clk;
  470. }
  471. pd->dev = &dev->dev;
  472. platform_set_drvdata(dev, pd);
  473. res = platform_get_resource(dev, IORESOURCE_MEM, 0);
  474. if (res == NULL) {
  475. dev_err(&dev->dev, "cannot find IO resource\n");
  476. ret = -ENOENT;
  477. goto err_irq;
  478. }
  479. size = (res->end - res->start) + 1;
  480. pd->reg = ioremap(res->start, size);
  481. if (pd->reg == NULL) {
  482. dev_err(&dev->dev, "cannot map IO\n");
  483. ret = -ENXIO;
  484. goto err_irq;
  485. }
  486. /* setup the private data */
  487. adap = &pd->adap;
  488. i2c_set_adapdata(adap, pd);
  489. adap->owner = THIS_MODULE;
  490. adap->algo = &sh_mobile_i2c_algorithm;
  491. adap->dev.parent = &dev->dev;
  492. adap->retries = 5;
  493. adap->nr = dev->id;
  494. strlcpy(adap->name, dev->name, sizeof(adap->name));
  495. sh_mobile_i2c_setup_channel(dev);
  496. ret = i2c_add_numbered_adapter(adap);
  497. if (ret < 0) {
  498. dev_err(&dev->dev, "cannot add numbered adapter\n");
  499. goto err_all;
  500. }
  501. return 0;
  502. err_all:
  503. iounmap(pd->reg);
  504. err_irq:
  505. sh_mobile_i2c_hook_irqs(dev, 0);
  506. err_clk:
  507. clk_put(pd->clk);
  508. err:
  509. kfree(pd);
  510. return ret;
  511. }
  512. static int sh_mobile_i2c_remove(struct platform_device *dev)
  513. {
  514. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  515. i2c_del_adapter(&pd->adap);
  516. iounmap(pd->reg);
  517. sh_mobile_i2c_hook_irqs(dev, 0);
  518. clk_put(pd->clk);
  519. kfree(pd);
  520. return 0;
  521. }
  522. static struct platform_driver sh_mobile_i2c_driver = {
  523. .driver = {
  524. .name = "i2c-sh_mobile",
  525. .owner = THIS_MODULE,
  526. },
  527. .probe = sh_mobile_i2c_probe,
  528. .remove = sh_mobile_i2c_remove,
  529. };
  530. static int __init sh_mobile_i2c_adap_init(void)
  531. {
  532. return platform_driver_register(&sh_mobile_i2c_driver);
  533. }
  534. static void __exit sh_mobile_i2c_adap_exit(void)
  535. {
  536. platform_driver_unregister(&sh_mobile_i2c_driver);
  537. }
  538. module_init(sh_mobile_i2c_adap_init);
  539. module_exit(sh_mobile_i2c_adap_exit);
  540. MODULE_DESCRIPTION("SuperH Mobile I2C Bus Controller driver");
  541. MODULE_AUTHOR("Magnus Damm");
  542. MODULE_LICENSE("GPL v2");