mtk-cmdq-mailbox.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright (c) 2018 MediaTek Inc.
  4. #include <linux/bitops.h>
  5. #include <linux/clk.h>
  6. #include <linux/clk-provider.h>
  7. #include <linux/dma-mapping.h>
  8. #include <linux/errno.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/iopoll.h>
  11. #include <linux/kernel.h>
  12. #include <linux/module.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/mailbox_controller.h>
  15. #include <linux/mailbox/mtk-cmdq-mailbox.h>
  16. #include <linux/of_device.h>
  17. #define CMDQ_OP_CODE_MASK (0xff << CMDQ_OP_CODE_SHIFT)
  18. #define CMDQ_IRQ_MASK 0xffff
  19. #define CMDQ_NUM_CMD(t) (t->cmd_buf_size / CMDQ_INST_SIZE)
  20. #define CMDQ_CURR_IRQ_STATUS 0x10
  21. #define CMDQ_THR_SLOT_CYCLES 0x30
  22. #define CMDQ_THR_BASE 0x100
  23. #define CMDQ_THR_SIZE 0x80
  24. #define CMDQ_THR_WARM_RESET 0x00
  25. #define CMDQ_THR_ENABLE_TASK 0x04
  26. #define CMDQ_THR_SUSPEND_TASK 0x08
  27. #define CMDQ_THR_CURR_STATUS 0x0c
  28. #define CMDQ_THR_IRQ_STATUS 0x10
  29. #define CMDQ_THR_IRQ_ENABLE 0x14
  30. #define CMDQ_THR_CURR_ADDR 0x20
  31. #define CMDQ_THR_END_ADDR 0x24
  32. #define CMDQ_THR_WAIT_TOKEN 0x30
  33. #define CMDQ_THR_PRIORITY 0x40
  34. #define CMDQ_THR_ACTIVE_SLOT_CYCLES 0x3200
  35. #define CMDQ_THR_ENABLED 0x1
  36. #define CMDQ_THR_DISABLED 0x0
  37. #define CMDQ_THR_SUSPEND 0x1
  38. #define CMDQ_THR_RESUME 0x0
  39. #define CMDQ_THR_STATUS_SUSPENDED BIT(1)
  40. #define CMDQ_THR_DO_WARM_RESET BIT(0)
  41. #define CMDQ_THR_IRQ_DONE 0x1
  42. #define CMDQ_THR_IRQ_ERROR 0x12
  43. #define CMDQ_THR_IRQ_EN (CMDQ_THR_IRQ_ERROR | CMDQ_THR_IRQ_DONE)
  44. #define CMDQ_THR_IS_WAITING BIT(31)
  45. #define CMDQ_JUMP_BY_OFFSET 0x10000000
  46. #define CMDQ_JUMP_BY_PA 0x10000001
  47. struct cmdq_thread {
  48. struct mbox_chan *chan;
  49. void __iomem *base;
  50. struct list_head task_busy_list;
  51. u32 priority;
  52. bool atomic_exec;
  53. };
  54. struct cmdq_task {
  55. struct cmdq *cmdq;
  56. struct list_head list_entry;
  57. dma_addr_t pa_base;
  58. struct cmdq_thread *thread;
  59. struct cmdq_pkt *pkt; /* the packet sent from mailbox client */
  60. };
  61. struct cmdq {
  62. struct mbox_controller mbox;
  63. void __iomem *base;
  64. u32 irq;
  65. u32 thread_nr;
  66. struct cmdq_thread *thread;
  67. struct clk *clock;
  68. bool suspended;
  69. };
  70. static int cmdq_thread_suspend(struct cmdq *cmdq, struct cmdq_thread *thread)
  71. {
  72. u32 status;
  73. writel(CMDQ_THR_SUSPEND, thread->base + CMDQ_THR_SUSPEND_TASK);
  74. /* If already disabled, treat as suspended successful. */
  75. if (!(readl(thread->base + CMDQ_THR_ENABLE_TASK) & CMDQ_THR_ENABLED))
  76. return 0;
  77. if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_CURR_STATUS,
  78. status, status & CMDQ_THR_STATUS_SUSPENDED, 0, 10)) {
  79. dev_err(cmdq->mbox.dev, "suspend GCE thread 0x%x failed\n",
  80. (u32)(thread->base - cmdq->base));
  81. return -EFAULT;
  82. }
  83. return 0;
  84. }
  85. static void cmdq_thread_resume(struct cmdq_thread *thread)
  86. {
  87. writel(CMDQ_THR_RESUME, thread->base + CMDQ_THR_SUSPEND_TASK);
  88. }
  89. static void cmdq_init(struct cmdq *cmdq)
  90. {
  91. WARN_ON(clk_enable(cmdq->clock) < 0);
  92. writel(CMDQ_THR_ACTIVE_SLOT_CYCLES, cmdq->base + CMDQ_THR_SLOT_CYCLES);
  93. clk_disable(cmdq->clock);
  94. }
  95. static int cmdq_thread_reset(struct cmdq *cmdq, struct cmdq_thread *thread)
  96. {
  97. u32 warm_reset;
  98. writel(CMDQ_THR_DO_WARM_RESET, thread->base + CMDQ_THR_WARM_RESET);
  99. if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_WARM_RESET,
  100. warm_reset, !(warm_reset & CMDQ_THR_DO_WARM_RESET),
  101. 0, 10)) {
  102. dev_err(cmdq->mbox.dev, "reset GCE thread 0x%x failed\n",
  103. (u32)(thread->base - cmdq->base));
  104. return -EFAULT;
  105. }
  106. return 0;
  107. }
  108. static void cmdq_thread_disable(struct cmdq *cmdq, struct cmdq_thread *thread)
  109. {
  110. cmdq_thread_reset(cmdq, thread);
  111. writel(CMDQ_THR_DISABLED, thread->base + CMDQ_THR_ENABLE_TASK);
  112. }
  113. /* notify GCE to re-fetch commands by setting GCE thread PC */
  114. static void cmdq_thread_invalidate_fetched_data(struct cmdq_thread *thread)
  115. {
  116. writel(readl(thread->base + CMDQ_THR_CURR_ADDR),
  117. thread->base + CMDQ_THR_CURR_ADDR);
  118. }
  119. static void cmdq_task_insert_into_thread(struct cmdq_task *task)
  120. {
  121. struct device *dev = task->cmdq->mbox.dev;
  122. struct cmdq_thread *thread = task->thread;
  123. struct cmdq_task *prev_task = list_last_entry(
  124. &thread->task_busy_list, typeof(*task), list_entry);
  125. u64 *prev_task_base = prev_task->pkt->va_base;
  126. /* let previous task jump to this task */
  127. dma_sync_single_for_cpu(dev, prev_task->pa_base,
  128. prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
  129. prev_task_base[CMDQ_NUM_CMD(prev_task->pkt) - 1] =
  130. (u64)CMDQ_JUMP_BY_PA << 32 | task->pa_base;
  131. dma_sync_single_for_device(dev, prev_task->pa_base,
  132. prev_task->pkt->cmd_buf_size, DMA_TO_DEVICE);
  133. cmdq_thread_invalidate_fetched_data(thread);
  134. }
  135. static bool cmdq_command_is_wfe(u64 cmd)
  136. {
  137. u64 wfe_option = CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE;
  138. u64 wfe_op = (u64)(CMDQ_CODE_WFE << CMDQ_OP_CODE_SHIFT) << 32;
  139. u64 wfe_mask = (u64)CMDQ_OP_CODE_MASK << 32 | 0xffffffff;
  140. return ((cmd & wfe_mask) == (wfe_op | wfe_option));
  141. }
  142. /* we assume tasks in the same display GCE thread are waiting the same event. */
  143. static void cmdq_task_remove_wfe(struct cmdq_task *task)
  144. {
  145. struct device *dev = task->cmdq->mbox.dev;
  146. u64 *base = task->pkt->va_base;
  147. int i;
  148. dma_sync_single_for_cpu(dev, task->pa_base, task->pkt->cmd_buf_size,
  149. DMA_TO_DEVICE);
  150. for (i = 0; i < CMDQ_NUM_CMD(task->pkt); i++)
  151. if (cmdq_command_is_wfe(base[i]))
  152. base[i] = (u64)CMDQ_JUMP_BY_OFFSET << 32 |
  153. CMDQ_JUMP_PASS;
  154. dma_sync_single_for_device(dev, task->pa_base, task->pkt->cmd_buf_size,
  155. DMA_TO_DEVICE);
  156. }
  157. static bool cmdq_thread_is_in_wfe(struct cmdq_thread *thread)
  158. {
  159. return readl(thread->base + CMDQ_THR_WAIT_TOKEN) & CMDQ_THR_IS_WAITING;
  160. }
  161. static void cmdq_thread_wait_end(struct cmdq_thread *thread,
  162. unsigned long end_pa)
  163. {
  164. struct device *dev = thread->chan->mbox->dev;
  165. unsigned long curr_pa;
  166. if (readl_poll_timeout_atomic(thread->base + CMDQ_THR_CURR_ADDR,
  167. curr_pa, curr_pa == end_pa, 1, 20))
  168. dev_err(dev, "GCE thread cannot run to end.\n");
  169. }
  170. static void cmdq_task_exec_done(struct cmdq_task *task, enum cmdq_cb_status sta)
  171. {
  172. struct cmdq_task_cb *cb = &task->pkt->async_cb;
  173. struct cmdq_cb_data data;
  174. WARN_ON(cb->cb == (cmdq_async_flush_cb)NULL);
  175. data.sta = sta;
  176. data.data = cb->data;
  177. cb->cb(data);
  178. list_del(&task->list_entry);
  179. }
  180. static void cmdq_task_handle_error(struct cmdq_task *task)
  181. {
  182. struct cmdq_thread *thread = task->thread;
  183. struct cmdq_task *next_task;
  184. dev_err(task->cmdq->mbox.dev, "task 0x%p error\n", task);
  185. WARN_ON(cmdq_thread_suspend(task->cmdq, thread) < 0);
  186. next_task = list_first_entry_or_null(&thread->task_busy_list,
  187. struct cmdq_task, list_entry);
  188. if (next_task)
  189. writel(next_task->pa_base, thread->base + CMDQ_THR_CURR_ADDR);
  190. cmdq_thread_resume(thread);
  191. }
  192. static void cmdq_thread_irq_handler(struct cmdq *cmdq,
  193. struct cmdq_thread *thread)
  194. {
  195. struct cmdq_task *task, *tmp, *curr_task = NULL;
  196. u32 curr_pa, irq_flag, task_end_pa;
  197. bool err;
  198. irq_flag = readl(thread->base + CMDQ_THR_IRQ_STATUS);
  199. writel(~irq_flag, thread->base + CMDQ_THR_IRQ_STATUS);
  200. /*
  201. * When ISR call this function, another CPU core could run
  202. * "release task" right before we acquire the spin lock, and thus
  203. * reset / disable this GCE thread, so we need to check the enable
  204. * bit of this GCE thread.
  205. */
  206. if (!(readl(thread->base + CMDQ_THR_ENABLE_TASK) & CMDQ_THR_ENABLED))
  207. return;
  208. if (irq_flag & CMDQ_THR_IRQ_ERROR)
  209. err = true;
  210. else if (irq_flag & CMDQ_THR_IRQ_DONE)
  211. err = false;
  212. else
  213. return;
  214. curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR);
  215. list_for_each_entry_safe(task, tmp, &thread->task_busy_list,
  216. list_entry) {
  217. task_end_pa = task->pa_base + task->pkt->cmd_buf_size;
  218. if (curr_pa >= task->pa_base && curr_pa < task_end_pa)
  219. curr_task = task;
  220. if (!curr_task || curr_pa == task_end_pa - CMDQ_INST_SIZE) {
  221. cmdq_task_exec_done(task, CMDQ_CB_NORMAL);
  222. kfree(task);
  223. } else if (err) {
  224. cmdq_task_exec_done(task, CMDQ_CB_ERROR);
  225. cmdq_task_handle_error(curr_task);
  226. kfree(task);
  227. }
  228. if (curr_task)
  229. break;
  230. }
  231. if (list_empty(&thread->task_busy_list)) {
  232. cmdq_thread_disable(cmdq, thread);
  233. clk_disable(cmdq->clock);
  234. }
  235. }
  236. static irqreturn_t cmdq_irq_handler(int irq, void *dev)
  237. {
  238. struct cmdq *cmdq = dev;
  239. unsigned long irq_status, flags = 0L;
  240. int bit;
  241. irq_status = readl(cmdq->base + CMDQ_CURR_IRQ_STATUS) & CMDQ_IRQ_MASK;
  242. if (!(irq_status ^ CMDQ_IRQ_MASK))
  243. return IRQ_NONE;
  244. for_each_clear_bit(bit, &irq_status, fls(CMDQ_IRQ_MASK)) {
  245. struct cmdq_thread *thread = &cmdq->thread[bit];
  246. spin_lock_irqsave(&thread->chan->lock, flags);
  247. cmdq_thread_irq_handler(cmdq, thread);
  248. spin_unlock_irqrestore(&thread->chan->lock, flags);
  249. }
  250. return IRQ_HANDLED;
  251. }
  252. static int cmdq_suspend(struct device *dev)
  253. {
  254. struct cmdq *cmdq = dev_get_drvdata(dev);
  255. struct cmdq_thread *thread;
  256. int i;
  257. bool task_running = false;
  258. cmdq->suspended = true;
  259. for (i = 0; i < cmdq->thread_nr; i++) {
  260. thread = &cmdq->thread[i];
  261. if (!list_empty(&thread->task_busy_list)) {
  262. task_running = true;
  263. break;
  264. }
  265. }
  266. if (task_running)
  267. dev_warn(dev, "exist running task(s) in suspend\n");
  268. clk_unprepare(cmdq->clock);
  269. return 0;
  270. }
  271. static int cmdq_resume(struct device *dev)
  272. {
  273. struct cmdq *cmdq = dev_get_drvdata(dev);
  274. WARN_ON(clk_prepare(cmdq->clock) < 0);
  275. cmdq->suspended = false;
  276. return 0;
  277. }
  278. static int cmdq_remove(struct platform_device *pdev)
  279. {
  280. struct cmdq *cmdq = platform_get_drvdata(pdev);
  281. mbox_controller_unregister(&cmdq->mbox);
  282. clk_unprepare(cmdq->clock);
  283. if (cmdq->mbox.chans)
  284. devm_kfree(&pdev->dev, cmdq->mbox.chans);
  285. if (cmdq->thread)
  286. devm_kfree(&pdev->dev, cmdq->thread);
  287. devm_kfree(&pdev->dev, cmdq);
  288. return 0;
  289. }
  290. static int cmdq_mbox_send_data(struct mbox_chan *chan, void *data)
  291. {
  292. struct cmdq_pkt *pkt = (struct cmdq_pkt *)data;
  293. struct cmdq_thread *thread = (struct cmdq_thread *)chan->con_priv;
  294. struct cmdq *cmdq = dev_get_drvdata(chan->mbox->dev);
  295. struct cmdq_task *task;
  296. unsigned long curr_pa, end_pa;
  297. /* Client should not flush new tasks if suspended. */
  298. WARN_ON(cmdq->suspended);
  299. task = kzalloc(sizeof(*task), GFP_ATOMIC);
  300. if (!task)
  301. return -ENOMEM;
  302. task->cmdq = cmdq;
  303. INIT_LIST_HEAD(&task->list_entry);
  304. task->pa_base = pkt->pa_base;
  305. task->thread = thread;
  306. task->pkt = pkt;
  307. if (list_empty(&thread->task_busy_list)) {
  308. WARN_ON(clk_enable(cmdq->clock) < 0);
  309. WARN_ON(cmdq_thread_reset(cmdq, thread) < 0);
  310. writel(task->pa_base, thread->base + CMDQ_THR_CURR_ADDR);
  311. writel(task->pa_base + pkt->cmd_buf_size,
  312. thread->base + CMDQ_THR_END_ADDR);
  313. writel(thread->priority, thread->base + CMDQ_THR_PRIORITY);
  314. writel(CMDQ_THR_IRQ_EN, thread->base + CMDQ_THR_IRQ_ENABLE);
  315. writel(CMDQ_THR_ENABLED, thread->base + CMDQ_THR_ENABLE_TASK);
  316. } else {
  317. WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
  318. curr_pa = readl(thread->base + CMDQ_THR_CURR_ADDR);
  319. end_pa = readl(thread->base + CMDQ_THR_END_ADDR);
  320. /*
  321. * Atomic execution should remove the following wfe, i.e. only
  322. * wait event at first task, and prevent to pause when running.
  323. */
  324. if (thread->atomic_exec) {
  325. /* GCE is executing if command is not WFE */
  326. if (!cmdq_thread_is_in_wfe(thread)) {
  327. cmdq_thread_resume(thread);
  328. cmdq_thread_wait_end(thread, end_pa);
  329. WARN_ON(cmdq_thread_suspend(cmdq, thread) < 0);
  330. /* set to this task directly */
  331. writel(task->pa_base,
  332. thread->base + CMDQ_THR_CURR_ADDR);
  333. } else {
  334. cmdq_task_insert_into_thread(task);
  335. cmdq_task_remove_wfe(task);
  336. smp_mb(); /* modify jump before enable thread */
  337. }
  338. } else {
  339. /* check boundary */
  340. if (curr_pa == end_pa - CMDQ_INST_SIZE ||
  341. curr_pa == end_pa) {
  342. /* set to this task directly */
  343. writel(task->pa_base,
  344. thread->base + CMDQ_THR_CURR_ADDR);
  345. } else {
  346. cmdq_task_insert_into_thread(task);
  347. smp_mb(); /* modify jump before enable thread */
  348. }
  349. }
  350. writel(task->pa_base + pkt->cmd_buf_size,
  351. thread->base + CMDQ_THR_END_ADDR);
  352. cmdq_thread_resume(thread);
  353. }
  354. list_move_tail(&task->list_entry, &thread->task_busy_list);
  355. return 0;
  356. }
  357. static int cmdq_mbox_startup(struct mbox_chan *chan)
  358. {
  359. return 0;
  360. }
  361. static void cmdq_mbox_shutdown(struct mbox_chan *chan)
  362. {
  363. }
  364. static const struct mbox_chan_ops cmdq_mbox_chan_ops = {
  365. .send_data = cmdq_mbox_send_data,
  366. .startup = cmdq_mbox_startup,
  367. .shutdown = cmdq_mbox_shutdown,
  368. };
  369. static struct mbox_chan *cmdq_xlate(struct mbox_controller *mbox,
  370. const struct of_phandle_args *sp)
  371. {
  372. int ind = sp->args[0];
  373. struct cmdq_thread *thread;
  374. if (ind >= mbox->num_chans)
  375. return ERR_PTR(-EINVAL);
  376. thread = (struct cmdq_thread *)mbox->chans[ind].con_priv;
  377. thread->priority = sp->args[1];
  378. thread->atomic_exec = (sp->args[2] != 0);
  379. thread->chan = &mbox->chans[ind];
  380. return &mbox->chans[ind];
  381. }
  382. static int cmdq_probe(struct platform_device *pdev)
  383. {
  384. struct device *dev = &pdev->dev;
  385. struct resource *res;
  386. struct cmdq *cmdq;
  387. int err, i;
  388. cmdq = devm_kzalloc(dev, sizeof(*cmdq), GFP_KERNEL);
  389. if (!cmdq)
  390. return -ENOMEM;
  391. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  392. cmdq->base = devm_ioremap_resource(dev, res);
  393. if (IS_ERR(cmdq->base)) {
  394. dev_err(dev, "failed to ioremap gce\n");
  395. return PTR_ERR(cmdq->base);
  396. }
  397. cmdq->irq = platform_get_irq(pdev, 0);
  398. if (!cmdq->irq) {
  399. dev_err(dev, "failed to get irq\n");
  400. return -EINVAL;
  401. }
  402. err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
  403. "mtk_cmdq", cmdq);
  404. if (err < 0) {
  405. dev_err(dev, "failed to register ISR (%d)\n", err);
  406. return err;
  407. }
  408. dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n",
  409. dev, cmdq->base, cmdq->irq);
  410. cmdq->clock = devm_clk_get(dev, "gce");
  411. if (IS_ERR(cmdq->clock)) {
  412. dev_err(dev, "failed to get gce clk\n");
  413. return PTR_ERR(cmdq->clock);
  414. }
  415. cmdq->thread_nr = (u32)(unsigned long)of_device_get_match_data(dev);
  416. cmdq->mbox.dev = dev;
  417. cmdq->mbox.chans = devm_kcalloc(dev, cmdq->thread_nr,
  418. sizeof(*cmdq->mbox.chans), GFP_KERNEL);
  419. if (!cmdq->mbox.chans)
  420. return -ENOMEM;
  421. cmdq->mbox.num_chans = cmdq->thread_nr;
  422. cmdq->mbox.ops = &cmdq_mbox_chan_ops;
  423. cmdq->mbox.of_xlate = cmdq_xlate;
  424. /* make use of TXDONE_BY_ACK */
  425. cmdq->mbox.txdone_irq = false;
  426. cmdq->mbox.txdone_poll = false;
  427. cmdq->thread = devm_kcalloc(dev, cmdq->thread_nr,
  428. sizeof(*cmdq->thread), GFP_KERNEL);
  429. if (!cmdq->thread)
  430. return -ENOMEM;
  431. for (i = 0; i < cmdq->thread_nr; i++) {
  432. cmdq->thread[i].base = cmdq->base + CMDQ_THR_BASE +
  433. CMDQ_THR_SIZE * i;
  434. INIT_LIST_HEAD(&cmdq->thread[i].task_busy_list);
  435. cmdq->mbox.chans[i].con_priv = (void *)&cmdq->thread[i];
  436. }
  437. err = mbox_controller_register(&cmdq->mbox);
  438. if (err < 0) {
  439. dev_err(dev, "failed to register mailbox: %d\n", err);
  440. return err;
  441. }
  442. platform_set_drvdata(pdev, cmdq);
  443. WARN_ON(clk_prepare(cmdq->clock) < 0);
  444. cmdq_init(cmdq);
  445. return 0;
  446. }
  447. static const struct dev_pm_ops cmdq_pm_ops = {
  448. .suspend = cmdq_suspend,
  449. .resume = cmdq_resume,
  450. };
  451. static const struct of_device_id cmdq_of_ids[] = {
  452. {.compatible = "mediatek,mt8173-gce", .data = (void *)16},
  453. {}
  454. };
  455. static struct platform_driver cmdq_drv = {
  456. .probe = cmdq_probe,
  457. .remove = cmdq_remove,
  458. .driver = {
  459. .name = "mtk_cmdq",
  460. .pm = &cmdq_pm_ops,
  461. .of_match_table = cmdq_of_ids,
  462. }
  463. };
  464. static int __init cmdq_drv_init(void)
  465. {
  466. return platform_driver_register(&cmdq_drv);
  467. }
  468. static void __exit cmdq_drv_exit(void)
  469. {
  470. platform_driver_unregister(&cmdq_drv);
  471. }
  472. subsys_initcall(cmdq_drv_init);
  473. module_exit(cmdq_drv_exit);
  474. MODULE_LICENSE("GPL v2");