hisi_lpc.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2017 Hisilicon Limited, All Rights Reserved.
  4. * Author: Zhichang Yuan <yuanzhichang@hisilicon.com>
  5. * Author: Zou Rongrong <zourongrong@huawei.com>
  6. * Author: John Garry <john.garry@huawei.com>
  7. */
  8. #include <linux/acpi.h>
  9. #include <linux/console.h>
  10. #include <linux/delay.h>
  11. #include <linux/io.h>
  12. #include <linux/logic_pio.h>
  13. #include <linux/mfd/core.h>
  14. #include <linux/module.h>
  15. #include <linux/of.h>
  16. #include <linux/of_address.h>
  17. #include <linux/of_platform.h>
  18. #include <linux/pci.h>
  19. #include <linux/slab.h>
  20. #define DRV_NAME "hisi-lpc"
  21. /*
  22. * Setting this bit means each IO operation will target a different port
  23. * address; 0 means repeated IO operations will use the same port,
  24. * such as BT.
  25. */
  26. #define FG_INCRADDR_LPC 0x02
  27. struct lpc_cycle_para {
  28. unsigned int opflags;
  29. unsigned int csize; /* data length of each operation */
  30. };
  31. struct hisi_lpc_dev {
  32. spinlock_t cycle_lock;
  33. void __iomem *membase;
  34. struct logic_pio_hwaddr *io_host;
  35. };
  36. /* The max IO cycle counts supported is four per operation at maximum */
  37. #define LPC_MAX_DWIDTH 4
  38. #define LPC_REG_STARTUP_SIGNAL 0x00
  39. #define LPC_REG_STARTUP_SIGNAL_START BIT(0)
  40. #define LPC_REG_OP_STATUS 0x04
  41. #define LPC_REG_OP_STATUS_IDLE BIT(0)
  42. #define LPC_REG_OP_STATUS_FINISHED BIT(1)
  43. #define LPC_REG_OP_LEN 0x10 /* LPC cycles count per start */
  44. #define LPC_REG_CMD 0x14
  45. #define LPC_REG_CMD_OP BIT(0) /* 0: read, 1: write */
  46. #define LPC_REG_CMD_SAMEADDR BIT(3)
  47. #define LPC_REG_ADDR 0x20 /* target address */
  48. #define LPC_REG_WDATA 0x24 /* write FIFO */
  49. #define LPC_REG_RDATA 0x28 /* read FIFO */
  50. /* The minimal nanosecond interval for each query on LPC cycle status */
  51. #define LPC_NSEC_PERWAIT 100
  52. /*
  53. * The maximum waiting time is about 128us. It is specific for stream I/O,
  54. * such as ins.
  55. *
  56. * The fastest IO cycle time is about 390ns, but the worst case will wait
  57. * for extra 256 lpc clocks, so (256 + 13) * 30ns = 8 us. The maximum burst
  58. * cycles is 16. So, the maximum waiting time is about 128us under worst
  59. * case.
  60. *
  61. * Choose 1300 as the maximum.
  62. */
  63. #define LPC_MAX_WAITCNT 1300
  64. /* About 10us. This is specific for single IO operations, such as inb */
  65. #define LPC_PEROP_WAITCNT 100
  66. static int wait_lpc_idle(unsigned char *mbase, unsigned int waitcnt)
  67. {
  68. u32 status;
  69. do {
  70. status = readl(mbase + LPC_REG_OP_STATUS);
  71. if (status & LPC_REG_OP_STATUS_IDLE)
  72. return (status & LPC_REG_OP_STATUS_FINISHED) ? 0 : -EIO;
  73. ndelay(LPC_NSEC_PERWAIT);
  74. } while (--waitcnt);
  75. return -ETIME;
  76. }
  77. /*
  78. * hisi_lpc_target_in - trigger a series of LPC cycles for read operation
  79. * @lpcdev: pointer to hisi lpc device
  80. * @para: some parameters used to control the lpc I/O operations
  81. * @addr: the lpc I/O target port address
  82. * @buf: where the read back data is stored
  83. * @opcnt: how many I/O operations required, i.e. data width
  84. *
  85. * Returns 0 on success, non-zero on fail.
  86. */
  87. static int hisi_lpc_target_in(struct hisi_lpc_dev *lpcdev,
  88. struct lpc_cycle_para *para, unsigned long addr,
  89. unsigned char *buf, unsigned long opcnt)
  90. {
  91. unsigned int cmd_word;
  92. unsigned int waitcnt;
  93. unsigned long flags;
  94. int ret;
  95. if (!buf || !opcnt || !para || !para->csize || !lpcdev)
  96. return -EINVAL;
  97. cmd_word = 0; /* IO mode, Read */
  98. waitcnt = LPC_PEROP_WAITCNT;
  99. if (!(para->opflags & FG_INCRADDR_LPC)) {
  100. cmd_word |= LPC_REG_CMD_SAMEADDR;
  101. waitcnt = LPC_MAX_WAITCNT;
  102. }
  103. /* whole operation must be atomic */
  104. spin_lock_irqsave(&lpcdev->cycle_lock, flags);
  105. writel_relaxed(opcnt, lpcdev->membase + LPC_REG_OP_LEN);
  106. writel_relaxed(cmd_word, lpcdev->membase + LPC_REG_CMD);
  107. writel_relaxed(addr, lpcdev->membase + LPC_REG_ADDR);
  108. writel(LPC_REG_STARTUP_SIGNAL_START,
  109. lpcdev->membase + LPC_REG_STARTUP_SIGNAL);
  110. /* whether the operation is finished */
  111. ret = wait_lpc_idle(lpcdev->membase, waitcnt);
  112. if (ret) {
  113. spin_unlock_irqrestore(&lpcdev->cycle_lock, flags);
  114. return ret;
  115. }
  116. readsb(lpcdev->membase + LPC_REG_RDATA, buf, opcnt);
  117. spin_unlock_irqrestore(&lpcdev->cycle_lock, flags);
  118. return 0;
  119. }
  120. /*
  121. * hisi_lpc_target_out - trigger a series of LPC cycles for write operation
  122. * @lpcdev: pointer to hisi lpc device
  123. * @para: some parameters used to control the lpc I/O operations
  124. * @addr: the lpc I/O target port address
  125. * @buf: where the data to be written is stored
  126. * @opcnt: how many I/O operations required, i.e. data width
  127. *
  128. * Returns 0 on success, non-zero on fail.
  129. */
  130. static int hisi_lpc_target_out(struct hisi_lpc_dev *lpcdev,
  131. struct lpc_cycle_para *para, unsigned long addr,
  132. const unsigned char *buf, unsigned long opcnt)
  133. {
  134. unsigned int waitcnt;
  135. unsigned long flags;
  136. u32 cmd_word;
  137. int ret;
  138. if (!buf || !opcnt || !para || !lpcdev)
  139. return -EINVAL;
  140. /* default is increasing address */
  141. cmd_word = LPC_REG_CMD_OP; /* IO mode, write */
  142. waitcnt = LPC_PEROP_WAITCNT;
  143. if (!(para->opflags & FG_INCRADDR_LPC)) {
  144. cmd_word |= LPC_REG_CMD_SAMEADDR;
  145. waitcnt = LPC_MAX_WAITCNT;
  146. }
  147. spin_lock_irqsave(&lpcdev->cycle_lock, flags);
  148. writel_relaxed(opcnt, lpcdev->membase + LPC_REG_OP_LEN);
  149. writel_relaxed(cmd_word, lpcdev->membase + LPC_REG_CMD);
  150. writel_relaxed(addr, lpcdev->membase + LPC_REG_ADDR);
  151. writesb(lpcdev->membase + LPC_REG_WDATA, buf, opcnt);
  152. writel(LPC_REG_STARTUP_SIGNAL_START,
  153. lpcdev->membase + LPC_REG_STARTUP_SIGNAL);
  154. /* whether the operation is finished */
  155. ret = wait_lpc_idle(lpcdev->membase, waitcnt);
  156. spin_unlock_irqrestore(&lpcdev->cycle_lock, flags);
  157. return ret;
  158. }
  159. static unsigned long hisi_lpc_pio_to_addr(struct hisi_lpc_dev *lpcdev,
  160. unsigned long pio)
  161. {
  162. return pio - lpcdev->io_host->io_start + lpcdev->io_host->hw_start;
  163. }
  164. /*
  165. * hisi_lpc_comm_in - input the data in a single operation
  166. * @hostdata: pointer to the device information relevant to LPC controller
  167. * @pio: the target I/O port address
  168. * @dwidth: the data length required to read from the target I/O port
  169. *
  170. * When success, data is returned. Otherwise, ~0 is returned.
  171. */
  172. static u32 hisi_lpc_comm_in(void *hostdata, unsigned long pio, size_t dwidth)
  173. {
  174. struct hisi_lpc_dev *lpcdev = hostdata;
  175. struct lpc_cycle_para iopara;
  176. unsigned long addr;
  177. u32 rd_data = 0;
  178. int ret;
  179. if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH)
  180. return ~0;
  181. addr = hisi_lpc_pio_to_addr(lpcdev, pio);
  182. iopara.opflags = FG_INCRADDR_LPC;
  183. iopara.csize = dwidth;
  184. ret = hisi_lpc_target_in(lpcdev, &iopara, addr,
  185. (unsigned char *)&rd_data, dwidth);
  186. if (ret)
  187. return ~0;
  188. return le32_to_cpu(rd_data);
  189. }
  190. /*
  191. * hisi_lpc_comm_out - output the data in a single operation
  192. * @hostdata: pointer to the device information relevant to LPC controller
  193. * @pio: the target I/O port address
  194. * @val: a value to be output from caller, maximum is four bytes
  195. * @dwidth: the data width required writing to the target I/O port
  196. *
  197. * This function corresponds to out(b,w,l) only.
  198. */
  199. static void hisi_lpc_comm_out(void *hostdata, unsigned long pio,
  200. u32 val, size_t dwidth)
  201. {
  202. struct hisi_lpc_dev *lpcdev = hostdata;
  203. struct lpc_cycle_para iopara;
  204. const unsigned char *buf;
  205. unsigned long addr;
  206. if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH)
  207. return;
  208. val = cpu_to_le32(val);
  209. buf = (const unsigned char *)&val;
  210. addr = hisi_lpc_pio_to_addr(lpcdev, pio);
  211. iopara.opflags = FG_INCRADDR_LPC;
  212. iopara.csize = dwidth;
  213. hisi_lpc_target_out(lpcdev, &iopara, addr, buf, dwidth);
  214. }
  215. /*
  216. * hisi_lpc_comm_ins - input the data in the buffer in multiple operations
  217. * @hostdata: pointer to the device information relevant to LPC controller
  218. * @pio: the target I/O port address
  219. * @buffer: a buffer where read/input data bytes are stored
  220. * @dwidth: the data width required writing to the target I/O port
  221. * @count: how many data units whose length is dwidth will be read
  222. *
  223. * When success, the data read back is stored in buffer pointed by buffer.
  224. * Returns 0 on success, -errno otherwise.
  225. */
  226. static u32 hisi_lpc_comm_ins(void *hostdata, unsigned long pio, void *buffer,
  227. size_t dwidth, unsigned int count)
  228. {
  229. struct hisi_lpc_dev *lpcdev = hostdata;
  230. unsigned char *buf = buffer;
  231. struct lpc_cycle_para iopara;
  232. unsigned long addr;
  233. if (!lpcdev || !buf || !count || !dwidth || dwidth > LPC_MAX_DWIDTH)
  234. return -EINVAL;
  235. iopara.opflags = 0;
  236. if (dwidth > 1)
  237. iopara.opflags |= FG_INCRADDR_LPC;
  238. iopara.csize = dwidth;
  239. addr = hisi_lpc_pio_to_addr(lpcdev, pio);
  240. do {
  241. int ret;
  242. ret = hisi_lpc_target_in(lpcdev, &iopara, addr, buf, dwidth);
  243. if (ret)
  244. return ret;
  245. buf += dwidth;
  246. } while (--count);
  247. return 0;
  248. }
  249. /*
  250. * hisi_lpc_comm_outs - output the data in the buffer in multiple operations
  251. * @hostdata: pointer to the device information relevant to LPC controller
  252. * @pio: the target I/O port address
  253. * @buffer: a buffer where write/output data bytes are stored
  254. * @dwidth: the data width required writing to the target I/O port
  255. * @count: how many data units whose length is dwidth will be written
  256. */
  257. static void hisi_lpc_comm_outs(void *hostdata, unsigned long pio,
  258. const void *buffer, size_t dwidth,
  259. unsigned int count)
  260. {
  261. struct hisi_lpc_dev *lpcdev = hostdata;
  262. struct lpc_cycle_para iopara;
  263. const unsigned char *buf = buffer;
  264. unsigned long addr;
  265. if (!lpcdev || !buf || !count || !dwidth || dwidth > LPC_MAX_DWIDTH)
  266. return;
  267. iopara.opflags = 0;
  268. if (dwidth > 1)
  269. iopara.opflags |= FG_INCRADDR_LPC;
  270. iopara.csize = dwidth;
  271. addr = hisi_lpc_pio_to_addr(lpcdev, pio);
  272. do {
  273. if (hisi_lpc_target_out(lpcdev, &iopara, addr, buf, dwidth))
  274. break;
  275. buf += dwidth;
  276. } while (--count);
  277. }
  278. static const struct logic_pio_host_ops hisi_lpc_ops = {
  279. .in = hisi_lpc_comm_in,
  280. .out = hisi_lpc_comm_out,
  281. .ins = hisi_lpc_comm_ins,
  282. .outs = hisi_lpc_comm_outs,
  283. };
  284. #ifdef CONFIG_ACPI
  285. #define MFD_CHILD_NAME_PREFIX DRV_NAME"-"
  286. #define MFD_CHILD_NAME_LEN (ACPI_ID_LEN + sizeof(MFD_CHILD_NAME_PREFIX) - 1)
  287. struct hisi_lpc_mfd_cell {
  288. struct mfd_cell_acpi_match acpi_match;
  289. char name[MFD_CHILD_NAME_LEN];
  290. char pnpid[ACPI_ID_LEN];
  291. };
  292. static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
  293. struct acpi_device *host,
  294. struct resource *res)
  295. {
  296. unsigned long sys_port;
  297. resource_size_t len = resource_size(res);
  298. sys_port = logic_pio_trans_hwaddr(&host->fwnode, res->start, len);
  299. if (sys_port == ~0UL)
  300. return -EFAULT;
  301. res->start = sys_port;
  302. res->end = sys_port + len;
  303. return 0;
  304. }
  305. /*
  306. * hisi_lpc_acpi_set_io_res - set the resources for a child's MFD
  307. * @child: the device node to be updated the I/O resource
  308. * @hostdev: the device node associated with host controller
  309. * @res: double pointer to be set to the address of translated resources
  310. * @num_res: pointer to variable to hold the number of translated resources
  311. *
  312. * Returns 0 when successful, and a negative value for failure.
  313. *
  314. * For a given host controller, each child device will have an associated
  315. * host-relative address resource. This function will return the translated
  316. * logical PIO addresses for each child devices resources.
  317. */
  318. static int hisi_lpc_acpi_set_io_res(struct device *child,
  319. struct device *hostdev,
  320. const struct resource **res, int *num_res)
  321. {
  322. struct acpi_device *adev;
  323. struct acpi_device *host;
  324. struct resource_entry *rentry;
  325. LIST_HEAD(resource_list);
  326. struct resource *resources;
  327. int count;
  328. int i;
  329. if (!child || !hostdev)
  330. return -EINVAL;
  331. host = to_acpi_device(hostdev);
  332. adev = to_acpi_device(child);
  333. if (!adev->status.present) {
  334. dev_dbg(child, "device is not present\n");
  335. return -EIO;
  336. }
  337. if (acpi_device_enumerated(adev)) {
  338. dev_dbg(child, "has been enumerated\n");
  339. return -EIO;
  340. }
  341. /*
  342. * The following code segment to retrieve the resources is common to
  343. * acpi_create_platform_device(), so consider a common helper function
  344. * in future.
  345. */
  346. count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
  347. if (count <= 0) {
  348. dev_dbg(child, "failed to get resources\n");
  349. return count ? count : -EIO;
  350. }
  351. resources = devm_kcalloc(hostdev, count, sizeof(*resources),
  352. GFP_KERNEL);
  353. if (!resources) {
  354. dev_warn(hostdev, "could not allocate memory for %d resources\n",
  355. count);
  356. acpi_dev_free_resource_list(&resource_list);
  357. return -ENOMEM;
  358. }
  359. count = 0;
  360. list_for_each_entry(rentry, &resource_list, node)
  361. resources[count++] = *rentry->res;
  362. acpi_dev_free_resource_list(&resource_list);
  363. /* translate the I/O resources */
  364. for (i = 0; i < count; i++) {
  365. int ret;
  366. if (!(resources[i].flags & IORESOURCE_IO))
  367. continue;
  368. ret = hisi_lpc_acpi_xlat_io_res(adev, host, &resources[i]);
  369. if (ret) {
  370. dev_err(child, "translate IO range %pR failed (%d)\n",
  371. &resources[i], ret);
  372. return ret;
  373. }
  374. }
  375. *res = resources;
  376. *num_res = count;
  377. return 0;
  378. }
  379. /*
  380. * hisi_lpc_acpi_probe - probe children for ACPI FW
  381. * @hostdev: LPC host device pointer
  382. *
  383. * Returns 0 when successful, and a negative value for failure.
  384. *
  385. * Scan all child devices and create a per-device MFD with
  386. * logical PIO translated IO resources.
  387. */
  388. static int hisi_lpc_acpi_probe(struct device *hostdev)
  389. {
  390. struct acpi_device *adev = ACPI_COMPANION(hostdev);
  391. struct hisi_lpc_mfd_cell *hisi_lpc_mfd_cells;
  392. struct mfd_cell *mfd_cells;
  393. struct acpi_device *child;
  394. int size, ret, count = 0, cell_num = 0;
  395. list_for_each_entry(child, &adev->children, node)
  396. cell_num++;
  397. /* allocate the mfd cell and companion ACPI info, one per child */
  398. size = sizeof(*mfd_cells) + sizeof(*hisi_lpc_mfd_cells);
  399. mfd_cells = devm_kcalloc(hostdev, cell_num, size, GFP_KERNEL);
  400. if (!mfd_cells)
  401. return -ENOMEM;
  402. hisi_lpc_mfd_cells = (struct hisi_lpc_mfd_cell *)&mfd_cells[cell_num];
  403. /* Only consider the children of the host */
  404. list_for_each_entry(child, &adev->children, node) {
  405. struct mfd_cell *mfd_cell = &mfd_cells[count];
  406. struct hisi_lpc_mfd_cell *hisi_lpc_mfd_cell =
  407. &hisi_lpc_mfd_cells[count];
  408. struct mfd_cell_acpi_match *acpi_match =
  409. &hisi_lpc_mfd_cell->acpi_match;
  410. char *name = hisi_lpc_mfd_cell[count].name;
  411. char *pnpid = hisi_lpc_mfd_cell[count].pnpid;
  412. struct mfd_cell_acpi_match match = {
  413. .pnpid = pnpid,
  414. };
  415. /*
  416. * For any instances of this host controller (Hip06 and Hip07
  417. * are the only chipsets), we would not have multiple slaves
  418. * with the same HID. And in any system we would have just one
  419. * controller active. So don't worrry about MFD name clashes.
  420. */
  421. snprintf(name, MFD_CHILD_NAME_LEN, MFD_CHILD_NAME_PREFIX"%s",
  422. acpi_device_hid(child));
  423. snprintf(pnpid, ACPI_ID_LEN, "%s", acpi_device_hid(child));
  424. memcpy(acpi_match, &match, sizeof(*acpi_match));
  425. mfd_cell->name = name;
  426. mfd_cell->acpi_match = acpi_match;
  427. ret = hisi_lpc_acpi_set_io_res(&child->dev, &adev->dev,
  428. &mfd_cell->resources,
  429. &mfd_cell->num_resources);
  430. if (ret) {
  431. dev_warn(&child->dev, "set resource fail (%d)\n", ret);
  432. return ret;
  433. }
  434. count++;
  435. }
  436. ret = mfd_add_devices(hostdev, PLATFORM_DEVID_NONE,
  437. mfd_cells, cell_num, NULL, 0, NULL);
  438. if (ret) {
  439. dev_err(hostdev, "failed to add mfd cells (%d)\n", ret);
  440. return ret;
  441. }
  442. return 0;
  443. }
  444. static const struct acpi_device_id hisi_lpc_acpi_match[] = {
  445. {"HISI0191"},
  446. {}
  447. };
  448. #else
  449. static int hisi_lpc_acpi_probe(struct device *dev)
  450. {
  451. return -ENODEV;
  452. }
  453. #endif // CONFIG_ACPI
  454. /*
  455. * hisi_lpc_probe - the probe callback function for hisi lpc host,
  456. * will finish all the initialization.
  457. * @pdev: the platform device corresponding to hisi lpc host
  458. *
  459. * Returns 0 on success, non-zero on fail.
  460. */
  461. static int hisi_lpc_probe(struct platform_device *pdev)
  462. {
  463. struct device *dev = &pdev->dev;
  464. struct acpi_device *acpi_device = ACPI_COMPANION(dev);
  465. struct logic_pio_hwaddr *range;
  466. struct hisi_lpc_dev *lpcdev;
  467. resource_size_t io_end;
  468. struct resource *res;
  469. int ret;
  470. lpcdev = devm_kzalloc(dev, sizeof(*lpcdev), GFP_KERNEL);
  471. if (!lpcdev)
  472. return -ENOMEM;
  473. spin_lock_init(&lpcdev->cycle_lock);
  474. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  475. lpcdev->membase = devm_ioremap_resource(dev, res);
  476. if (IS_ERR(lpcdev->membase))
  477. return PTR_ERR(lpcdev->membase);
  478. range = devm_kzalloc(dev, sizeof(*range), GFP_KERNEL);
  479. if (!range)
  480. return -ENOMEM;
  481. range->fwnode = dev->fwnode;
  482. range->flags = LOGIC_PIO_INDIRECT;
  483. range->size = PIO_INDIRECT_SIZE;
  484. ret = logic_pio_register_range(range);
  485. if (ret) {
  486. dev_err(dev, "register IO range failed (%d)!\n", ret);
  487. return ret;
  488. }
  489. lpcdev->io_host = range;
  490. /* register the LPC host PIO resources */
  491. if (acpi_device)
  492. ret = hisi_lpc_acpi_probe(dev);
  493. else
  494. ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
  495. if (ret)
  496. return ret;
  497. lpcdev->io_host->hostdata = lpcdev;
  498. lpcdev->io_host->ops = &hisi_lpc_ops;
  499. io_end = lpcdev->io_host->io_start + lpcdev->io_host->size;
  500. dev_info(dev, "registered range [%pa - %pa]\n",
  501. &lpcdev->io_host->io_start, &io_end);
  502. return ret;
  503. }
  504. static const struct of_device_id hisi_lpc_of_match[] = {
  505. { .compatible = "hisilicon,hip06-lpc", },
  506. { .compatible = "hisilicon,hip07-lpc", },
  507. {}
  508. };
  509. static struct platform_driver hisi_lpc_driver = {
  510. .driver = {
  511. .name = DRV_NAME,
  512. .of_match_table = hisi_lpc_of_match,
  513. .acpi_match_table = ACPI_PTR(hisi_lpc_acpi_match),
  514. },
  515. .probe = hisi_lpc_probe,
  516. };
  517. builtin_platform_driver(hisi_lpc_driver);