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. unsigned long i2c_clk;
  152. u_int32_t num;
  153. u_int32_t denom;
  154. u_int32_t tmp;
  155. /* Make sure the clock is enabled */
  156. clk_enable(pd->clk);
  157. /* Get clock rate after clock is enabled */
  158. i2c_clk = clk_get_rate(pd->clk);
  159. /* Calculate the value for iccl. From the data sheet:
  160. * iccl = (p clock / transfer rate) * (L / (L + H))
  161. * where L and H are the SCL low/high ratio (5/4 in this case).
  162. * We also round off the result.
  163. */
  164. num = i2c_clk * 5;
  165. denom = NORMAL_SPEED * 9;
  166. tmp = num * 10 / denom;
  167. if (tmp % 10 >= 5)
  168. pd->iccl = (u_int8_t)((num/denom) + 1);
  169. else
  170. pd->iccl = (u_int8_t)(num/denom);
  171. /* Calculate the value for icch. From the data sheet:
  172. icch = (p clock / transfer rate) * (H / (L + H)) */
  173. num = i2c_clk * 4;
  174. tmp = num * 10 / denom;
  175. if (tmp % 10 >= 5)
  176. pd->icch = (u_int8_t)((num/denom) + 1);
  177. else
  178. pd->icch = (u_int8_t)(num/denom);
  179. /* Enable channel and configure rx ack */
  180. iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
  181. /* Mask all interrupts */
  182. iowrite8(0, ICIC(pd));
  183. /* Set the clock */
  184. iowrite8(pd->iccl, ICCL(pd));
  185. iowrite8(pd->icch, ICCH(pd));
  186. }
  187. static void deactivate_ch(struct sh_mobile_i2c_data *pd)
  188. {
  189. /* Clear/disable interrupts */
  190. iowrite8(0, ICSR(pd));
  191. iowrite8(0, ICIC(pd));
  192. /* Disable channel */
  193. iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
  194. /* Disable clock */
  195. clk_disable(pd->clk);
  196. }
  197. static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
  198. enum sh_mobile_i2c_op op, unsigned char data)
  199. {
  200. unsigned char ret = 0;
  201. unsigned long flags;
  202. dev_dbg(pd->dev, "op %d, data in 0x%02x\n", op, data);
  203. spin_lock_irqsave(&pd->lock, flags);
  204. switch (op) {
  205. case OP_START: /* issue start and trigger DTE interrupt */
  206. iowrite8(0x94, ICCR(pd));
  207. break;
  208. case OP_TX_FIRST: /* disable DTE interrupt and write data */
  209. iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE, ICIC(pd));
  210. iowrite8(data, ICDR(pd));
  211. break;
  212. case OP_TX: /* write data */
  213. iowrite8(data, ICDR(pd));
  214. break;
  215. case OP_TX_STOP: /* write data and issue a stop afterwards */
  216. iowrite8(data, ICDR(pd));
  217. iowrite8(0x90, ICCR(pd));
  218. break;
  219. case OP_TX_TO_RX: /* select read mode */
  220. iowrite8(0x81, ICCR(pd));
  221. break;
  222. case OP_RX: /* just read data */
  223. ret = ioread8(ICDR(pd));
  224. break;
  225. case OP_RX_STOP: /* enable DTE interrupt, issue stop */
  226. iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
  227. ICIC(pd));
  228. iowrite8(0xc0, ICCR(pd));
  229. break;
  230. case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
  231. iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
  232. ICIC(pd));
  233. ret = ioread8(ICDR(pd));
  234. iowrite8(0xc0, ICCR(pd));
  235. break;
  236. }
  237. spin_unlock_irqrestore(&pd->lock, flags);
  238. dev_dbg(pd->dev, "op %d, data out 0x%02x\n", op, ret);
  239. return ret;
  240. }
  241. static int sh_mobile_i2c_is_first_byte(struct sh_mobile_i2c_data *pd)
  242. {
  243. if (pd->pos == -1)
  244. return 1;
  245. return 0;
  246. }
  247. static int sh_mobile_i2c_is_last_byte(struct sh_mobile_i2c_data *pd)
  248. {
  249. if (pd->pos == (pd->msg->len - 1))
  250. return 1;
  251. return 0;
  252. }
  253. static void sh_mobile_i2c_get_data(struct sh_mobile_i2c_data *pd,
  254. unsigned char *buf)
  255. {
  256. switch (pd->pos) {
  257. case -1:
  258. *buf = (pd->msg->addr & 0x7f) << 1;
  259. *buf |= (pd->msg->flags & I2C_M_RD) ? 1 : 0;
  260. break;
  261. default:
  262. *buf = pd->msg->buf[pd->pos];
  263. }
  264. }
  265. static int sh_mobile_i2c_isr_tx(struct sh_mobile_i2c_data *pd)
  266. {
  267. unsigned char data;
  268. if (pd->pos == pd->msg->len)
  269. return 1;
  270. sh_mobile_i2c_get_data(pd, &data);
  271. if (sh_mobile_i2c_is_last_byte(pd))
  272. i2c_op(pd, OP_TX_STOP, data);
  273. else if (sh_mobile_i2c_is_first_byte(pd))
  274. i2c_op(pd, OP_TX_FIRST, data);
  275. else
  276. i2c_op(pd, OP_TX, data);
  277. pd->pos++;
  278. return 0;
  279. }
  280. static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd)
  281. {
  282. unsigned char data;
  283. int real_pos;
  284. do {
  285. if (pd->pos <= -1) {
  286. sh_mobile_i2c_get_data(pd, &data);
  287. if (sh_mobile_i2c_is_first_byte(pd))
  288. i2c_op(pd, OP_TX_FIRST, data);
  289. else
  290. i2c_op(pd, OP_TX, data);
  291. break;
  292. }
  293. if (pd->pos == 0) {
  294. i2c_op(pd, OP_TX_TO_RX, 0);
  295. break;
  296. }
  297. real_pos = pd->pos - 2;
  298. if (pd->pos == pd->msg->len) {
  299. if (real_pos < 0) {
  300. i2c_op(pd, OP_RX_STOP, 0);
  301. break;
  302. }
  303. data = i2c_op(pd, OP_RX_STOP_DATA, 0);
  304. } else
  305. data = i2c_op(pd, OP_RX, 0);
  306. if (real_pos >= 0)
  307. pd->msg->buf[real_pos] = data;
  308. } while (0);
  309. pd->pos++;
  310. return pd->pos == (pd->msg->len + 2);
  311. }
  312. static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)
  313. {
  314. struct platform_device *dev = dev_id;
  315. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  316. unsigned char sr;
  317. int wakeup;
  318. sr = ioread8(ICSR(pd));
  319. pd->sr |= sr; /* remember state */
  320. dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr,
  321. (pd->msg->flags & I2C_M_RD) ? "read" : "write",
  322. pd->pos, pd->msg->len);
  323. if (sr & (ICSR_AL | ICSR_TACK)) {
  324. /* don't interrupt transaction - continue to issue stop */
  325. iowrite8(sr & ~(ICSR_AL | ICSR_TACK), ICSR(pd));
  326. wakeup = 0;
  327. } else if (pd->msg->flags & I2C_M_RD)
  328. wakeup = sh_mobile_i2c_isr_rx(pd);
  329. else
  330. wakeup = sh_mobile_i2c_isr_tx(pd);
  331. if (sr & ICSR_WAIT) /* TODO: add delay here to support slow acks */
  332. iowrite8(sr & ~ICSR_WAIT, ICSR(pd));
  333. if (wakeup) {
  334. pd->sr |= SW_DONE;
  335. wake_up(&pd->wait);
  336. }
  337. return IRQ_HANDLED;
  338. }
  339. static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg)
  340. {
  341. if (usr_msg->len == 0 && (usr_msg->flags & I2C_M_RD)) {
  342. dev_err(pd->dev, "Unsupported zero length i2c read\n");
  343. return -EIO;
  344. }
  345. /* Initialize channel registers */
  346. iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
  347. /* Enable channel and configure rx ack */
  348. iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
  349. /* Set the clock */
  350. iowrite8(pd->iccl, ICCL(pd));
  351. iowrite8(pd->icch, ICCH(pd));
  352. pd->msg = usr_msg;
  353. pd->pos = -1;
  354. pd->sr = 0;
  355. /* Enable all interrupts to begin with */
  356. iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, ICIC(pd));
  357. return 0;
  358. }
  359. static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
  360. struct i2c_msg *msgs,
  361. int num)
  362. {
  363. struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
  364. struct i2c_msg *msg;
  365. int err = 0;
  366. u_int8_t val;
  367. int i, k, retry_count;
  368. activate_ch(pd);
  369. /* Process all messages */
  370. for (i = 0; i < num; i++) {
  371. msg = &msgs[i];
  372. err = start_ch(pd, msg);
  373. if (err)
  374. break;
  375. i2c_op(pd, OP_START, 0);
  376. /* The interrupt handler takes care of the rest... */
  377. k = wait_event_timeout(pd->wait,
  378. pd->sr & (ICSR_TACK | SW_DONE),
  379. 5 * HZ);
  380. if (!k)
  381. dev_err(pd->dev, "Transfer request timed out\n");
  382. retry_count = 1000;
  383. again:
  384. val = ioread8(ICSR(pd));
  385. dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr);
  386. /* the interrupt handler may wake us up before the
  387. * transfer is finished, so poll the hardware
  388. * until we're done.
  389. */
  390. if (val & ICSR_BUSY) {
  391. udelay(10);
  392. if (retry_count--)
  393. goto again;
  394. err = -EIO;
  395. dev_err(pd->dev, "Polling timed out\n");
  396. break;
  397. }
  398. /* handle missing acknowledge and arbitration lost */
  399. if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) {
  400. err = -EIO;
  401. break;
  402. }
  403. }
  404. deactivate_ch(pd);
  405. if (!err)
  406. err = num;
  407. return err;
  408. }
  409. static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter)
  410. {
  411. return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
  412. }
  413. static struct i2c_algorithm sh_mobile_i2c_algorithm = {
  414. .functionality = sh_mobile_i2c_func,
  415. .master_xfer = sh_mobile_i2c_xfer,
  416. };
  417. static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
  418. {
  419. struct resource *res;
  420. int ret = -ENXIO;
  421. int q, m;
  422. int k = 0;
  423. int n = 0;
  424. while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
  425. for (n = res->start; hook && n <= res->end; n++) {
  426. if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
  427. dev->dev.bus_id, dev))
  428. goto rollback;
  429. }
  430. k++;
  431. }
  432. if (hook)
  433. return k > 0 ? 0 : -ENOENT;
  434. k--;
  435. ret = 0;
  436. rollback:
  437. for (q = k; k >= 0; k--) {
  438. for (m = n; m >= res->start; m--)
  439. free_irq(m, dev);
  440. res = platform_get_resource(dev, IORESOURCE_IRQ, k - 1);
  441. m = res->end;
  442. }
  443. return ret;
  444. }
  445. static int sh_mobile_i2c_probe(struct platform_device *dev)
  446. {
  447. struct sh_mobile_i2c_data *pd;
  448. struct i2c_adapter *adap;
  449. struct resource *res;
  450. char clk_name[8];
  451. int size;
  452. int ret;
  453. pd = kzalloc(sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
  454. if (pd == NULL) {
  455. dev_err(&dev->dev, "cannot allocate private data\n");
  456. return -ENOMEM;
  457. }
  458. snprintf(clk_name, sizeof(clk_name), "i2c%d", dev->id);
  459. pd->clk = clk_get(&dev->dev, clk_name);
  460. if (IS_ERR(pd->clk)) {
  461. dev_err(&dev->dev, "cannot get clock \"%s\"\n", clk_name);
  462. ret = PTR_ERR(pd->clk);
  463. goto err;
  464. }
  465. ret = sh_mobile_i2c_hook_irqs(dev, 1);
  466. if (ret) {
  467. dev_err(&dev->dev, "cannot request IRQ\n");
  468. goto err_clk;
  469. }
  470. pd->dev = &dev->dev;
  471. platform_set_drvdata(dev, pd);
  472. res = platform_get_resource(dev, IORESOURCE_MEM, 0);
  473. if (res == NULL) {
  474. dev_err(&dev->dev, "cannot find IO resource\n");
  475. ret = -ENOENT;
  476. goto err_irq;
  477. }
  478. size = (res->end - res->start) + 1;
  479. pd->reg = ioremap(res->start, size);
  480. if (pd->reg == NULL) {
  481. dev_err(&dev->dev, "cannot map IO\n");
  482. ret = -ENXIO;
  483. goto err_irq;
  484. }
  485. /* setup the private data */
  486. adap = &pd->adap;
  487. i2c_set_adapdata(adap, pd);
  488. adap->owner = THIS_MODULE;
  489. adap->algo = &sh_mobile_i2c_algorithm;
  490. adap->dev.parent = &dev->dev;
  491. adap->retries = 5;
  492. adap->nr = dev->id;
  493. strlcpy(adap->name, dev->name, sizeof(adap->name));
  494. spin_lock_init(&pd->lock);
  495. init_waitqueue_head(&pd->wait);
  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");