i2c-sh_mobile.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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. if (real_pos >= 0)
  281. pd->msg->buf[real_pos] = data;
  282. } while (0);
  283. pd->pos++;
  284. return pd->pos == (pd->msg->len + 2);
  285. }
  286. static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)
  287. {
  288. struct platform_device *dev = dev_id;
  289. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  290. unsigned char sr;
  291. int wakeup;
  292. sr = ioread8(ICSR(pd));
  293. pd->sr |= sr; /* remember state */
  294. dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr,
  295. (pd->msg->flags & I2C_M_RD) ? "read" : "write",
  296. pd->pos, pd->msg->len);
  297. if (sr & (ICSR_AL | ICSR_TACK)) {
  298. /* don't interrupt transaction - continue to issue stop */
  299. iowrite8(sr & ~(ICSR_AL | ICSR_TACK), ICSR(pd));
  300. wakeup = 0;
  301. } else if (pd->msg->flags & I2C_M_RD)
  302. wakeup = sh_mobile_i2c_isr_rx(pd);
  303. else
  304. wakeup = sh_mobile_i2c_isr_tx(pd);
  305. if (sr & ICSR_WAIT) /* TODO: add delay here to support slow acks */
  306. iowrite8(sr & ~ICSR_WAIT, ICSR(pd));
  307. if (wakeup) {
  308. pd->sr |= SW_DONE;
  309. wake_up(&pd->wait);
  310. }
  311. return IRQ_HANDLED;
  312. }
  313. static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg)
  314. {
  315. if (usr_msg->len == 0 && (usr_msg->flags & I2C_M_RD)) {
  316. dev_err(pd->dev, "Unsupported zero length i2c read\n");
  317. return -EIO;
  318. }
  319. /* Initialize channel registers */
  320. iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
  321. /* Enable channel and configure rx ack */
  322. iowrite8(ioread8(ICCR(pd)) | ICCR_ICE, ICCR(pd));
  323. /* Set the clock */
  324. iowrite8(pd->iccl, ICCL(pd));
  325. iowrite8(pd->icch, ICCH(pd));
  326. pd->msg = usr_msg;
  327. pd->pos = -1;
  328. pd->sr = 0;
  329. /* Enable all interrupts to begin with */
  330. iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, ICIC(pd));
  331. return 0;
  332. }
  333. static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
  334. struct i2c_msg *msgs,
  335. int num)
  336. {
  337. struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter);
  338. struct i2c_msg *msg;
  339. int err = 0;
  340. u_int8_t val;
  341. int i, k, retry_count;
  342. activate_ch(pd);
  343. /* Process all messages */
  344. for (i = 0; i < num; i++) {
  345. msg = &msgs[i];
  346. err = start_ch(pd, msg);
  347. if (err)
  348. break;
  349. i2c_op(pd, OP_START, 0);
  350. /* The interrupt handler takes care of the rest... */
  351. k = wait_event_timeout(pd->wait,
  352. pd->sr & (ICSR_TACK | SW_DONE),
  353. 5 * HZ);
  354. if (!k)
  355. dev_err(pd->dev, "Transfer request timed out\n");
  356. retry_count = 1000;
  357. again:
  358. val = ioread8(ICSR(pd));
  359. dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr);
  360. /* the interrupt handler may wake us up before the
  361. * transfer is finished, so poll the hardware
  362. * until we're done.
  363. */
  364. if (val & ICSR_BUSY) {
  365. udelay(10);
  366. if (retry_count--)
  367. goto again;
  368. err = -EIO;
  369. dev_err(pd->dev, "Polling timed out\n");
  370. break;
  371. }
  372. /* handle missing acknowledge and arbitration lost */
  373. if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) {
  374. err = -EIO;
  375. break;
  376. }
  377. }
  378. deactivate_ch(pd);
  379. if (!err)
  380. err = num;
  381. return err;
  382. }
  383. static u32 sh_mobile_i2c_func(struct i2c_adapter *adapter)
  384. {
  385. return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
  386. }
  387. static struct i2c_algorithm sh_mobile_i2c_algorithm = {
  388. .functionality = sh_mobile_i2c_func,
  389. .master_xfer = sh_mobile_i2c_xfer,
  390. };
  391. static void sh_mobile_i2c_setup_channel(struct platform_device *dev)
  392. {
  393. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  394. unsigned long peripheral_clk = clk_get_rate(pd->clk);
  395. u_int32_t num;
  396. u_int32_t denom;
  397. u_int32_t tmp;
  398. spin_lock_init(&pd->lock);
  399. init_waitqueue_head(&pd->wait);
  400. /* Calculate the value for iccl. From the data sheet:
  401. * iccl = (p clock / transfer rate) * (L / (L + H))
  402. * where L and H are the SCL low/high ratio (5/4 in this case).
  403. * We also round off the result.
  404. */
  405. num = peripheral_clk * 5;
  406. denom = NORMAL_SPEED * 9;
  407. tmp = num * 10 / denom;
  408. if (tmp % 10 >= 5)
  409. pd->iccl = (u_int8_t)((num/denom) + 1);
  410. else
  411. pd->iccl = (u_int8_t)(num/denom);
  412. /* Calculate the value for icch. From the data sheet:
  413. icch = (p clock / transfer rate) * (H / (L + H)) */
  414. num = peripheral_clk * 4;
  415. tmp = num * 10 / denom;
  416. if (tmp % 10 >= 5)
  417. pd->icch = (u_int8_t)((num/denom) + 1);
  418. else
  419. pd->icch = (u_int8_t)(num/denom);
  420. }
  421. static int sh_mobile_i2c_hook_irqs(struct platform_device *dev, int hook)
  422. {
  423. struct resource *res;
  424. int ret = -ENXIO;
  425. int q, m;
  426. int k = 0;
  427. int n = 0;
  428. while ((res = platform_get_resource(dev, IORESOURCE_IRQ, k))) {
  429. for (n = res->start; hook && n <= res->end; n++) {
  430. if (request_irq(n, sh_mobile_i2c_isr, IRQF_DISABLED,
  431. dev->dev.bus_id, dev))
  432. goto rollback;
  433. }
  434. k++;
  435. }
  436. if (hook)
  437. return k > 0 ? 0 : -ENOENT;
  438. k--;
  439. ret = 0;
  440. rollback:
  441. for (q = k; k >= 0; k--) {
  442. for (m = n; m >= res->start; m--)
  443. free_irq(m, dev);
  444. res = platform_get_resource(dev, IORESOURCE_IRQ, k - 1);
  445. m = res->end;
  446. }
  447. return ret;
  448. }
  449. static int sh_mobile_i2c_probe(struct platform_device *dev)
  450. {
  451. struct sh_mobile_i2c_data *pd;
  452. struct i2c_adapter *adap;
  453. struct resource *res;
  454. int size;
  455. int ret;
  456. pd = kzalloc(sizeof(struct sh_mobile_i2c_data), GFP_KERNEL);
  457. if (pd == NULL) {
  458. dev_err(&dev->dev, "cannot allocate private data\n");
  459. return -ENOMEM;
  460. }
  461. pd->clk = clk_get(&dev->dev, "peripheral_clk");
  462. if (IS_ERR(pd->clk)) {
  463. dev_err(&dev->dev, "cannot get peripheral clock\n");
  464. ret = PTR_ERR(pd->clk);
  465. goto err;
  466. }
  467. ret = sh_mobile_i2c_hook_irqs(dev, 1);
  468. if (ret) {
  469. dev_err(&dev->dev, "cannot request IRQ\n");
  470. goto err_clk;
  471. }
  472. pd->dev = &dev->dev;
  473. platform_set_drvdata(dev, pd);
  474. res = platform_get_resource(dev, IORESOURCE_MEM, 0);
  475. if (res == NULL) {
  476. dev_err(&dev->dev, "cannot find IO resource\n");
  477. ret = -ENOENT;
  478. goto err_irq;
  479. }
  480. size = (res->end - res->start) + 1;
  481. pd->reg = ioremap(res->start, size);
  482. if (pd->reg == NULL) {
  483. dev_err(&dev->dev, "cannot map IO\n");
  484. ret = -ENXIO;
  485. goto err_irq;
  486. }
  487. /* setup the private data */
  488. adap = &pd->adap;
  489. i2c_set_adapdata(adap, pd);
  490. adap->owner = THIS_MODULE;
  491. adap->algo = &sh_mobile_i2c_algorithm;
  492. adap->dev.parent = &dev->dev;
  493. adap->retries = 5;
  494. adap->nr = dev->id;
  495. strlcpy(adap->name, dev->name, sizeof(adap->name));
  496. sh_mobile_i2c_setup_channel(dev);
  497. ret = i2c_add_numbered_adapter(adap);
  498. if (ret < 0) {
  499. dev_err(&dev->dev, "cannot add numbered adapter\n");
  500. goto err_all;
  501. }
  502. return 0;
  503. err_all:
  504. iounmap(pd->reg);
  505. err_irq:
  506. sh_mobile_i2c_hook_irqs(dev, 0);
  507. err_clk:
  508. clk_put(pd->clk);
  509. err:
  510. kfree(pd);
  511. return ret;
  512. }
  513. static int sh_mobile_i2c_remove(struct platform_device *dev)
  514. {
  515. struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
  516. i2c_del_adapter(&pd->adap);
  517. iounmap(pd->reg);
  518. sh_mobile_i2c_hook_irqs(dev, 0);
  519. clk_put(pd->clk);
  520. kfree(pd);
  521. return 0;
  522. }
  523. static struct platform_driver sh_mobile_i2c_driver = {
  524. .driver = {
  525. .name = "i2c-sh_mobile",
  526. .owner = THIS_MODULE,
  527. },
  528. .probe = sh_mobile_i2c_probe,
  529. .remove = sh_mobile_i2c_remove,
  530. };
  531. static int __init sh_mobile_i2c_adap_init(void)
  532. {
  533. return platform_driver_register(&sh_mobile_i2c_driver);
  534. }
  535. static void __exit sh_mobile_i2c_adap_exit(void)
  536. {
  537. platform_driver_unregister(&sh_mobile_i2c_driver);
  538. }
  539. module_init(sh_mobile_i2c_adap_init);
  540. module_exit(sh_mobile_i2c_adap_exit);
  541. MODULE_DESCRIPTION("SuperH Mobile I2C Bus Controller driver");
  542. MODULE_AUTHOR("Magnus Damm");
  543. MODULE_LICENSE("GPL v2");