i2c-xlp9xx.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /*
  2. * Copyright (c) 2003-2015 Broadcom Corporation
  3. *
  4. * This file is licensed under the terms of the GNU General Public
  5. * License version 2. This program is licensed "as is" without any
  6. * warranty of any kind, whether express or implied.
  7. */
  8. #include <linux/acpi.h>
  9. #include <linux/clk.h>
  10. #include <linux/completion.h>
  11. #include <linux/i2c.h>
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/io.h>
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/delay.h>
  19. #define XLP9XX_I2C_DIV 0x0
  20. #define XLP9XX_I2C_CTRL 0x1
  21. #define XLP9XX_I2C_CMD 0x2
  22. #define XLP9XX_I2C_STATUS 0x3
  23. #define XLP9XX_I2C_MTXFIFO 0x4
  24. #define XLP9XX_I2C_MRXFIFO 0x5
  25. #define XLP9XX_I2C_MFIFOCTRL 0x6
  26. #define XLP9XX_I2C_STXFIFO 0x7
  27. #define XLP9XX_I2C_SRXFIFO 0x8
  28. #define XLP9XX_I2C_SFIFOCTRL 0x9
  29. #define XLP9XX_I2C_SLAVEADDR 0xA
  30. #define XLP9XX_I2C_OWNADDR 0xB
  31. #define XLP9XX_I2C_FIFOWCNT 0xC
  32. #define XLP9XX_I2C_INTEN 0xD
  33. #define XLP9XX_I2C_INTST 0xE
  34. #define XLP9XX_I2C_WAITCNT 0xF
  35. #define XLP9XX_I2C_TIMEOUT 0X10
  36. #define XLP9XX_I2C_GENCALLADDR 0x11
  37. #define XLP9XX_I2C_STATUS_BUSY BIT(0)
  38. #define XLP9XX_I2C_CMD_START BIT(7)
  39. #define XLP9XX_I2C_CMD_STOP BIT(6)
  40. #define XLP9XX_I2C_CMD_READ BIT(5)
  41. #define XLP9XX_I2C_CMD_WRITE BIT(4)
  42. #define XLP9XX_I2C_CMD_ACK BIT(3)
  43. #define XLP9XX_I2C_CTRL_MCTLEN_SHIFT 16
  44. #define XLP9XX_I2C_CTRL_MCTLEN_MASK 0xffff0000
  45. #define XLP9XX_I2C_CTRL_RST BIT(8)
  46. #define XLP9XX_I2C_CTRL_EN BIT(6)
  47. #define XLP9XX_I2C_CTRL_MASTER BIT(4)
  48. #define XLP9XX_I2C_CTRL_FIFORD BIT(1)
  49. #define XLP9XX_I2C_CTRL_ADDMODE BIT(0)
  50. #define XLP9XX_I2C_INTEN_NACKADDR BIT(25)
  51. #define XLP9XX_I2C_INTEN_SADDR BIT(13)
  52. #define XLP9XX_I2C_INTEN_DATADONE BIT(12)
  53. #define XLP9XX_I2C_INTEN_ARLOST BIT(11)
  54. #define XLP9XX_I2C_INTEN_MFIFOFULL BIT(4)
  55. #define XLP9XX_I2C_INTEN_MFIFOEMTY BIT(3)
  56. #define XLP9XX_I2C_INTEN_MFIFOHI BIT(2)
  57. #define XLP9XX_I2C_INTEN_BUSERR BIT(0)
  58. #define XLP9XX_I2C_MFIFOCTRL_HITH_SHIFT 8
  59. #define XLP9XX_I2C_MFIFOCTRL_LOTH_SHIFT 0
  60. #define XLP9XX_I2C_MFIFOCTRL_RST BIT(16)
  61. #define XLP9XX_I2C_SLAVEADDR_RW BIT(0)
  62. #define XLP9XX_I2C_SLAVEADDR_ADDR_SHIFT 1
  63. #define XLP9XX_I2C_IP_CLK_FREQ 133000000UL
  64. #define XLP9XX_I2C_DEFAULT_FREQ 100000
  65. #define XLP9XX_I2C_HIGH_FREQ 400000
  66. #define XLP9XX_I2C_FIFO_SIZE 0x80U
  67. #define XLP9XX_I2C_TIMEOUT_MS 1000
  68. #define XLP9XX_I2C_BUSY_TIMEOUT 50
  69. #define XLP9XX_I2C_FIFO_WCNT_MASK 0xff
  70. #define XLP9XX_I2C_STATUS_ERRMASK (XLP9XX_I2C_INTEN_ARLOST | \
  71. XLP9XX_I2C_INTEN_NACKADDR | XLP9XX_I2C_INTEN_BUSERR)
  72. struct xlp9xx_i2c_dev {
  73. struct device *dev;
  74. struct i2c_adapter adapter;
  75. struct completion msg_complete;
  76. int irq;
  77. bool msg_read;
  78. bool len_recv;
  79. bool client_pec;
  80. u32 __iomem *base;
  81. u32 msg_buf_remaining;
  82. u32 msg_len;
  83. u32 ip_clk_hz;
  84. u32 clk_hz;
  85. u32 msg_err;
  86. u8 *msg_buf;
  87. };
  88. static inline void xlp9xx_write_i2c_reg(struct xlp9xx_i2c_dev *priv,
  89. unsigned long reg, u32 val)
  90. {
  91. writel(val, priv->base + reg);
  92. }
  93. static inline u32 xlp9xx_read_i2c_reg(struct xlp9xx_i2c_dev *priv,
  94. unsigned long reg)
  95. {
  96. return readl(priv->base + reg);
  97. }
  98. static void xlp9xx_i2c_mask_irq(struct xlp9xx_i2c_dev *priv, u32 mask)
  99. {
  100. u32 inten;
  101. inten = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_INTEN) & ~mask;
  102. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_INTEN, inten);
  103. }
  104. static void xlp9xx_i2c_unmask_irq(struct xlp9xx_i2c_dev *priv, u32 mask)
  105. {
  106. u32 inten;
  107. inten = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_INTEN) | mask;
  108. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_INTEN, inten);
  109. }
  110. static void xlp9xx_i2c_update_rx_fifo_thres(struct xlp9xx_i2c_dev *priv)
  111. {
  112. u32 thres;
  113. if (priv->len_recv)
  114. /* interrupt after the first read to examine
  115. * the length byte before proceeding further
  116. */
  117. thres = 1;
  118. else if (priv->msg_buf_remaining > XLP9XX_I2C_FIFO_SIZE)
  119. thres = XLP9XX_I2C_FIFO_SIZE;
  120. else
  121. thres = priv->msg_buf_remaining;
  122. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_MFIFOCTRL,
  123. thres << XLP9XX_I2C_MFIFOCTRL_HITH_SHIFT);
  124. }
  125. static void xlp9xx_i2c_fill_tx_fifo(struct xlp9xx_i2c_dev *priv)
  126. {
  127. u32 len, i;
  128. u8 *buf = priv->msg_buf;
  129. len = min(priv->msg_buf_remaining, XLP9XX_I2C_FIFO_SIZE);
  130. for (i = 0; i < len; i++)
  131. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_MTXFIFO, buf[i]);
  132. priv->msg_buf_remaining -= len;
  133. priv->msg_buf += len;
  134. }
  135. static void xlp9xx_i2c_drain_rx_fifo(struct xlp9xx_i2c_dev *priv)
  136. {
  137. u32 len, i, val;
  138. u8 rlen, *buf = priv->msg_buf;
  139. len = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_FIFOWCNT) &
  140. XLP9XX_I2C_FIFO_WCNT_MASK;
  141. if (!len)
  142. return;
  143. if (priv->len_recv) {
  144. /* read length byte */
  145. rlen = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_MRXFIFO);
  146. *buf++ = rlen;
  147. len--;
  148. if (priv->client_pec)
  149. ++rlen;
  150. /* update remaining bytes and message length */
  151. priv->msg_buf_remaining = rlen;
  152. priv->msg_len = rlen + 1;
  153. priv->len_recv = false;
  154. /* Update transfer length to read only actual data */
  155. val = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_CTRL);
  156. val = (val & ~XLP9XX_I2C_CTRL_MCTLEN_MASK) |
  157. ((rlen + 1) << XLP9XX_I2C_CTRL_MCTLEN_SHIFT);
  158. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, val);
  159. } else {
  160. len = min(priv->msg_buf_remaining, len);
  161. for (i = 0; i < len; i++, buf++)
  162. *buf = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_MRXFIFO);
  163. priv->msg_buf_remaining -= len;
  164. }
  165. priv->msg_buf = buf;
  166. if (priv->msg_buf_remaining)
  167. xlp9xx_i2c_update_rx_fifo_thres(priv);
  168. }
  169. static irqreturn_t xlp9xx_i2c_isr(int irq, void *dev_id)
  170. {
  171. struct xlp9xx_i2c_dev *priv = dev_id;
  172. u32 status;
  173. status = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_INTST);
  174. if (status == 0)
  175. return IRQ_NONE;
  176. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_INTST, status);
  177. if (status & XLP9XX_I2C_STATUS_ERRMASK) {
  178. priv->msg_err = status;
  179. goto xfer_done;
  180. }
  181. /* SADDR ACK for SMBUS_QUICK */
  182. if ((status & XLP9XX_I2C_INTEN_SADDR) && (priv->msg_len == 0))
  183. goto xfer_done;
  184. if (!priv->msg_read) {
  185. if (status & XLP9XX_I2C_INTEN_MFIFOEMTY) {
  186. /* TX FIFO got empty, fill it up again */
  187. if (priv->msg_buf_remaining)
  188. xlp9xx_i2c_fill_tx_fifo(priv);
  189. else
  190. xlp9xx_i2c_mask_irq(priv,
  191. XLP9XX_I2C_INTEN_MFIFOEMTY);
  192. }
  193. } else {
  194. if (status & (XLP9XX_I2C_INTEN_DATADONE |
  195. XLP9XX_I2C_INTEN_MFIFOHI)) {
  196. /* data is in FIFO, read it */
  197. if (priv->msg_buf_remaining)
  198. xlp9xx_i2c_drain_rx_fifo(priv);
  199. }
  200. }
  201. /* Transfer complete */
  202. if (status & XLP9XX_I2C_INTEN_DATADONE)
  203. goto xfer_done;
  204. return IRQ_HANDLED;
  205. xfer_done:
  206. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_INTEN, 0);
  207. complete(&priv->msg_complete);
  208. return IRQ_HANDLED;
  209. }
  210. static int xlp9xx_i2c_check_bus_status(struct xlp9xx_i2c_dev *priv)
  211. {
  212. u32 status;
  213. u32 busy_timeout = XLP9XX_I2C_BUSY_TIMEOUT;
  214. while (busy_timeout) {
  215. status = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_STATUS);
  216. if ((status & XLP9XX_I2C_STATUS_BUSY) == 0)
  217. break;
  218. busy_timeout--;
  219. usleep_range(1000, 1100);
  220. }
  221. if (!busy_timeout)
  222. return -EIO;
  223. return 0;
  224. }
  225. static int xlp9xx_i2c_init(struct xlp9xx_i2c_dev *priv)
  226. {
  227. u32 prescale;
  228. /*
  229. * The controller uses 5 * SCL clock internally.
  230. * So prescale value should be divided by 5.
  231. */
  232. prescale = DIV_ROUND_UP(priv->ip_clk_hz, priv->clk_hz);
  233. prescale = ((prescale - 8) / 5) - 1;
  234. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, XLP9XX_I2C_CTRL_RST);
  235. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, XLP9XX_I2C_CTRL_EN |
  236. XLP9XX_I2C_CTRL_MASTER);
  237. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_DIV, prescale);
  238. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_INTEN, 0);
  239. return 0;
  240. }
  241. static int xlp9xx_i2c_xfer_msg(struct xlp9xx_i2c_dev *priv, struct i2c_msg *msg,
  242. int last_msg)
  243. {
  244. unsigned long timeleft;
  245. u32 intr_mask, cmd, val, len;
  246. priv->msg_buf = msg->buf;
  247. priv->msg_buf_remaining = priv->msg_len = msg->len;
  248. priv->msg_err = 0;
  249. priv->msg_read = (msg->flags & I2C_M_RD);
  250. reinit_completion(&priv->msg_complete);
  251. /* Reset FIFO */
  252. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_MFIFOCTRL,
  253. XLP9XX_I2C_MFIFOCTRL_RST);
  254. /* set FIFO threshold if reading */
  255. if (priv->msg_read)
  256. xlp9xx_i2c_update_rx_fifo_thres(priv);
  257. /* set slave addr */
  258. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_SLAVEADDR,
  259. (msg->addr << XLP9XX_I2C_SLAVEADDR_ADDR_SHIFT) |
  260. (priv->msg_read ? XLP9XX_I2C_SLAVEADDR_RW : 0));
  261. /* Build control word for transfer */
  262. val = xlp9xx_read_i2c_reg(priv, XLP9XX_I2C_CTRL);
  263. if (!priv->msg_read)
  264. val &= ~XLP9XX_I2C_CTRL_FIFORD;
  265. else
  266. val |= XLP9XX_I2C_CTRL_FIFORD; /* read */
  267. if (msg->flags & I2C_M_TEN)
  268. val |= XLP9XX_I2C_CTRL_ADDMODE; /* 10-bit address mode*/
  269. else
  270. val &= ~XLP9XX_I2C_CTRL_ADDMODE;
  271. priv->len_recv = msg->flags & I2C_M_RECV_LEN;
  272. len = priv->len_recv ? XLP9XX_I2C_FIFO_SIZE : msg->len;
  273. priv->client_pec = msg->flags & I2C_CLIENT_PEC;
  274. /* set data length to be transferred */
  275. val = (val & ~XLP9XX_I2C_CTRL_MCTLEN_MASK) |
  276. (len << XLP9XX_I2C_CTRL_MCTLEN_SHIFT);
  277. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, val);
  278. /* fill fifo during tx */
  279. if (!priv->msg_read)
  280. xlp9xx_i2c_fill_tx_fifo(priv);
  281. /* set interrupt mask */
  282. intr_mask = (XLP9XX_I2C_INTEN_ARLOST | XLP9XX_I2C_INTEN_BUSERR |
  283. XLP9XX_I2C_INTEN_NACKADDR | XLP9XX_I2C_INTEN_DATADONE);
  284. if (priv->msg_read) {
  285. intr_mask |= XLP9XX_I2C_INTEN_MFIFOHI;
  286. if (msg->len == 0)
  287. intr_mask |= XLP9XX_I2C_INTEN_SADDR;
  288. } else {
  289. if (msg->len == 0)
  290. intr_mask |= XLP9XX_I2C_INTEN_SADDR;
  291. else
  292. intr_mask |= XLP9XX_I2C_INTEN_MFIFOEMTY;
  293. }
  294. xlp9xx_i2c_unmask_irq(priv, intr_mask);
  295. /* set cmd reg */
  296. cmd = XLP9XX_I2C_CMD_START;
  297. if (msg->len)
  298. cmd |= (priv->msg_read ?
  299. XLP9XX_I2C_CMD_READ : XLP9XX_I2C_CMD_WRITE);
  300. if (last_msg)
  301. cmd |= XLP9XX_I2C_CMD_STOP;
  302. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CMD, cmd);
  303. timeleft = msecs_to_jiffies(XLP9XX_I2C_TIMEOUT_MS);
  304. timeleft = wait_for_completion_timeout(&priv->msg_complete, timeleft);
  305. if (priv->msg_err & XLP9XX_I2C_INTEN_BUSERR) {
  306. dev_dbg(priv->dev, "transfer error %x!\n", priv->msg_err);
  307. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CMD, XLP9XX_I2C_CMD_STOP);
  308. return -EIO;
  309. } else if (priv->msg_err & XLP9XX_I2C_INTEN_NACKADDR) {
  310. return -ENXIO;
  311. }
  312. if (timeleft == 0) {
  313. dev_dbg(priv->dev, "i2c transfer timed out!\n");
  314. xlp9xx_i2c_init(priv);
  315. return -ETIMEDOUT;
  316. }
  317. /* update msg->len with actual received length */
  318. if (msg->flags & I2C_M_RECV_LEN)
  319. msg->len = priv->msg_len;
  320. return 0;
  321. }
  322. static int xlp9xx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
  323. int num)
  324. {
  325. int i, ret;
  326. struct xlp9xx_i2c_dev *priv = i2c_get_adapdata(adap);
  327. ret = xlp9xx_i2c_check_bus_status(priv);
  328. if (ret) {
  329. xlp9xx_i2c_init(priv);
  330. ret = xlp9xx_i2c_check_bus_status(priv);
  331. if (ret)
  332. return ret;
  333. }
  334. for (i = 0; i < num; i++) {
  335. ret = xlp9xx_i2c_xfer_msg(priv, &msgs[i], i == num - 1);
  336. if (ret != 0)
  337. return ret;
  338. }
  339. return num;
  340. }
  341. static u32 xlp9xx_i2c_functionality(struct i2c_adapter *adapter)
  342. {
  343. return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_READ_BLOCK_DATA |
  344. I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR;
  345. }
  346. static const struct i2c_algorithm xlp9xx_i2c_algo = {
  347. .master_xfer = xlp9xx_i2c_xfer,
  348. .functionality = xlp9xx_i2c_functionality,
  349. };
  350. static int xlp9xx_i2c_get_frequency(struct platform_device *pdev,
  351. struct xlp9xx_i2c_dev *priv)
  352. {
  353. struct clk *clk;
  354. u32 freq;
  355. int err;
  356. clk = devm_clk_get(&pdev->dev, NULL);
  357. if (IS_ERR(clk)) {
  358. priv->ip_clk_hz = XLP9XX_I2C_IP_CLK_FREQ;
  359. dev_dbg(&pdev->dev, "using default input frequency %u\n",
  360. priv->ip_clk_hz);
  361. } else {
  362. priv->ip_clk_hz = clk_get_rate(clk);
  363. }
  364. err = device_property_read_u32(&pdev->dev, "clock-frequency", &freq);
  365. if (err) {
  366. freq = XLP9XX_I2C_DEFAULT_FREQ;
  367. dev_dbg(&pdev->dev, "using default frequency %u\n", freq);
  368. } else if (freq == 0 || freq > XLP9XX_I2C_HIGH_FREQ) {
  369. dev_warn(&pdev->dev, "invalid frequency %u, using default\n",
  370. freq);
  371. freq = XLP9XX_I2C_DEFAULT_FREQ;
  372. }
  373. priv->clk_hz = freq;
  374. return 0;
  375. }
  376. static int xlp9xx_i2c_probe(struct platform_device *pdev)
  377. {
  378. struct xlp9xx_i2c_dev *priv;
  379. struct resource *res;
  380. int err = 0;
  381. priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
  382. if (!priv)
  383. return -ENOMEM;
  384. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  385. priv->base = devm_ioremap_resource(&pdev->dev, res);
  386. if (IS_ERR(priv->base))
  387. return PTR_ERR(priv->base);
  388. priv->irq = platform_get_irq(pdev, 0);
  389. if (priv->irq <= 0) {
  390. dev_err(&pdev->dev, "invalid irq!\n");
  391. return priv->irq;
  392. }
  393. xlp9xx_i2c_get_frequency(pdev, priv);
  394. xlp9xx_i2c_init(priv);
  395. err = devm_request_irq(&pdev->dev, priv->irq, xlp9xx_i2c_isr, 0,
  396. pdev->name, priv);
  397. if (err) {
  398. dev_err(&pdev->dev, "IRQ request failed!\n");
  399. return err;
  400. }
  401. init_completion(&priv->msg_complete);
  402. priv->adapter.dev.parent = &pdev->dev;
  403. priv->adapter.algo = &xlp9xx_i2c_algo;
  404. priv->adapter.class = I2C_CLASS_HWMON;
  405. ACPI_COMPANION_SET(&priv->adapter.dev, ACPI_COMPANION(&pdev->dev));
  406. priv->adapter.dev.of_node = pdev->dev.of_node;
  407. priv->dev = &pdev->dev;
  408. snprintf(priv->adapter.name, sizeof(priv->adapter.name), "xlp9xx-i2c");
  409. i2c_set_adapdata(&priv->adapter, priv);
  410. err = i2c_add_adapter(&priv->adapter);
  411. if (err)
  412. return err;
  413. platform_set_drvdata(pdev, priv);
  414. dev_dbg(&pdev->dev, "I2C bus:%d added\n", priv->adapter.nr);
  415. return 0;
  416. }
  417. static int xlp9xx_i2c_remove(struct platform_device *pdev)
  418. {
  419. struct xlp9xx_i2c_dev *priv;
  420. priv = platform_get_drvdata(pdev);
  421. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_INTEN, 0);
  422. synchronize_irq(priv->irq);
  423. i2c_del_adapter(&priv->adapter);
  424. xlp9xx_write_i2c_reg(priv, XLP9XX_I2C_CTRL, 0);
  425. return 0;
  426. }
  427. static const struct of_device_id xlp9xx_i2c_of_match[] = {
  428. { .compatible = "netlogic,xlp980-i2c", },
  429. { /* sentinel */ },
  430. };
  431. MODULE_DEVICE_TABLE(of, xlp9xx_i2c_of_match);
  432. #ifdef CONFIG_ACPI
  433. static const struct acpi_device_id xlp9xx_i2c_acpi_ids[] = {
  434. {"BRCM9007", 0},
  435. {"CAV9007", 0},
  436. {}
  437. };
  438. MODULE_DEVICE_TABLE(acpi, xlp9xx_i2c_acpi_ids);
  439. #endif
  440. static struct platform_driver xlp9xx_i2c_driver = {
  441. .probe = xlp9xx_i2c_probe,
  442. .remove = xlp9xx_i2c_remove,
  443. .driver = {
  444. .name = "xlp9xx-i2c",
  445. .of_match_table = xlp9xx_i2c_of_match,
  446. .acpi_match_table = ACPI_PTR(xlp9xx_i2c_acpi_ids),
  447. },
  448. };
  449. module_platform_driver(xlp9xx_i2c_driver);
  450. MODULE_AUTHOR("Subhendu Sekhar Behera <sbehera@broadcom.com>");
  451. MODULE_DESCRIPTION("XLP9XX/5XX I2C Bus Controller Driver");
  452. MODULE_LICENSE("GPL v2");