spi-microchip-core-qspi.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. // SPDX-License-Identifier: (GPL-2.0)
  2. /*
  3. * Microchip coreQSPI QSPI controller driver
  4. *
  5. * Copyright (C) 2018-2022 Microchip Technology Inc. and its subsidiaries
  6. *
  7. * Author: Naga Sureshkumar Relli <nagasuresh.relli@microchip.com>
  8. *
  9. */
  10. #include <linux/clk.h>
  11. #include <linux/err.h>
  12. #include <linux/init.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/io.h>
  15. #include <linux/iopoll.h>
  16. #include <linux/module.h>
  17. #include <linux/of.h>
  18. #include <linux/of_irq.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/spi/spi.h>
  21. #include <linux/spi/spi-mem.h>
  22. /*
  23. * QSPI Control register mask defines
  24. */
  25. #define CONTROL_ENABLE BIT(0)
  26. #define CONTROL_MASTER BIT(1)
  27. #define CONTROL_XIP BIT(2)
  28. #define CONTROL_XIPADDR BIT(3)
  29. #define CONTROL_CLKIDLE BIT(10)
  30. #define CONTROL_SAMPLE_MASK GENMASK(12, 11)
  31. #define CONTROL_MODE0 BIT(13)
  32. #define CONTROL_MODE12_MASK GENMASK(15, 14)
  33. #define CONTROL_MODE12_EX_RO BIT(14)
  34. #define CONTROL_MODE12_EX_RW BIT(15)
  35. #define CONTROL_MODE12_FULL GENMASK(15, 14)
  36. #define CONTROL_FLAGSX4 BIT(16)
  37. #define CONTROL_CLKRATE_MASK GENMASK(27, 24)
  38. #define CONTROL_CLKRATE_SHIFT 24
  39. /*
  40. * QSPI Frames register mask defines
  41. */
  42. #define FRAMES_TOTALBYTES_MASK GENMASK(15, 0)
  43. #define FRAMES_CMDBYTES_MASK GENMASK(24, 16)
  44. #define FRAMES_CMDBYTES_SHIFT 16
  45. #define FRAMES_SHIFT 25
  46. #define FRAMES_IDLE_MASK GENMASK(29, 26)
  47. #define FRAMES_IDLE_SHIFT 26
  48. #define FRAMES_FLAGBYTE BIT(30)
  49. #define FRAMES_FLAGWORD BIT(31)
  50. /*
  51. * QSPI Interrupt Enable register mask defines
  52. */
  53. #define IEN_TXDONE BIT(0)
  54. #define IEN_RXDONE BIT(1)
  55. #define IEN_RXAVAILABLE BIT(2)
  56. #define IEN_TXAVAILABLE BIT(3)
  57. #define IEN_RXFIFOEMPTY BIT(4)
  58. #define IEN_TXFIFOFULL BIT(5)
  59. /*
  60. * QSPI Status register mask defines
  61. */
  62. #define STATUS_TXDONE BIT(0)
  63. #define STATUS_RXDONE BIT(1)
  64. #define STATUS_RXAVAILABLE BIT(2)
  65. #define STATUS_TXAVAILABLE BIT(3)
  66. #define STATUS_RXFIFOEMPTY BIT(4)
  67. #define STATUS_TXFIFOFULL BIT(5)
  68. #define STATUS_READY BIT(7)
  69. #define STATUS_FLAGSX4 BIT(8)
  70. #define STATUS_MASK GENMASK(8, 0)
  71. #define BYTESUPPER_MASK GENMASK(31, 16)
  72. #define BYTESLOWER_MASK GENMASK(15, 0)
  73. #define MAX_DIVIDER 16
  74. #define MIN_DIVIDER 0
  75. #define MAX_DATA_CMD_LEN 256
  76. /* QSPI ready time out value */
  77. #define TIMEOUT_MS 500
  78. /*
  79. * QSPI Register offsets.
  80. */
  81. #define REG_CONTROL (0x00)
  82. #define REG_FRAMES (0x04)
  83. #define REG_IEN (0x0c)
  84. #define REG_STATUS (0x10)
  85. #define REG_DIRECT_ACCESS (0x14)
  86. #define REG_UPPER_ACCESS (0x18)
  87. #define REG_RX_DATA (0x40)
  88. #define REG_TX_DATA (0x44)
  89. #define REG_X4_RX_DATA (0x48)
  90. #define REG_X4_TX_DATA (0x4c)
  91. #define REG_FRAMESUP (0x50)
  92. /**
  93. * struct mchp_coreqspi - Defines qspi driver instance
  94. * @regs: Virtual address of the QSPI controller registers
  95. * @clk: QSPI Operating clock
  96. * @data_completion: completion structure
  97. * @op_lock: lock access to the device
  98. * @txbuf: TX buffer
  99. * @rxbuf: RX buffer
  100. * @irq: IRQ number
  101. * @tx_len: Number of bytes left to transfer
  102. * @rx_len: Number of bytes left to receive
  103. */
  104. struct mchp_coreqspi {
  105. void __iomem *regs;
  106. struct clk *clk;
  107. struct completion data_completion;
  108. struct mutex op_lock; /* lock access to the device */
  109. u8 *txbuf;
  110. u8 *rxbuf;
  111. int irq;
  112. int tx_len;
  113. int rx_len;
  114. };
  115. static int mchp_coreqspi_set_mode(struct mchp_coreqspi *qspi, const struct spi_mem_op *op)
  116. {
  117. u32 control = readl_relaxed(qspi->regs + REG_CONTROL);
  118. /*
  119. * The operating mode can be configured based on the command that needs to be send.
  120. * bits[15:14]: Sets whether multiple bit SPI operates in normal, extended or full modes.
  121. * 00: Normal (single DQ0 TX and single DQ1 RX lines)
  122. * 01: Extended RO (command and address bytes on DQ0 only)
  123. * 10: Extended RW (command byte on DQ0 only)
  124. * 11: Full. (command and address are on all DQ lines)
  125. * bit[13]: Sets whether multiple bit SPI uses 2 or 4 bits of data
  126. * 0: 2-bits (BSPI)
  127. * 1: 4-bits (QSPI)
  128. */
  129. if (op->data.buswidth == 4 || op->data.buswidth == 2) {
  130. control &= ~CONTROL_MODE12_MASK;
  131. if (op->cmd.buswidth == 1 && (op->addr.buswidth == 1 || op->addr.buswidth == 0))
  132. control |= CONTROL_MODE12_EX_RO;
  133. else if (op->cmd.buswidth == 1)
  134. control |= CONTROL_MODE12_EX_RW;
  135. else
  136. control |= CONTROL_MODE12_FULL;
  137. control |= CONTROL_MODE0;
  138. } else {
  139. control &= ~(CONTROL_MODE12_MASK |
  140. CONTROL_MODE0);
  141. }
  142. writel_relaxed(control, qspi->regs + REG_CONTROL);
  143. return 0;
  144. }
  145. static inline void mchp_coreqspi_read_op(struct mchp_coreqspi *qspi)
  146. {
  147. u32 control, data;
  148. if (!qspi->rx_len)
  149. return;
  150. control = readl_relaxed(qspi->regs + REG_CONTROL);
  151. /*
  152. * Read 4-bytes from the SPI FIFO in single transaction and then read
  153. * the reamaining data byte wise.
  154. */
  155. control |= CONTROL_FLAGSX4;
  156. writel_relaxed(control, qspi->regs + REG_CONTROL);
  157. while (qspi->rx_len >= 4) {
  158. while (readl_relaxed(qspi->regs + REG_STATUS) & STATUS_RXFIFOEMPTY)
  159. ;
  160. data = readl_relaxed(qspi->regs + REG_X4_RX_DATA);
  161. *(u32 *)qspi->rxbuf = data;
  162. qspi->rxbuf += 4;
  163. qspi->rx_len -= 4;
  164. }
  165. control &= ~CONTROL_FLAGSX4;
  166. writel_relaxed(control, qspi->regs + REG_CONTROL);
  167. while (qspi->rx_len--) {
  168. while (readl_relaxed(qspi->regs + REG_STATUS) & STATUS_RXFIFOEMPTY)
  169. ;
  170. data = readl_relaxed(qspi->regs + REG_RX_DATA);
  171. *qspi->rxbuf++ = (data & 0xFF);
  172. }
  173. }
  174. static inline void mchp_coreqspi_write_op(struct mchp_coreqspi *qspi, bool word)
  175. {
  176. u32 control, data;
  177. control = readl_relaxed(qspi->regs + REG_CONTROL);
  178. control |= CONTROL_FLAGSX4;
  179. writel_relaxed(control, qspi->regs + REG_CONTROL);
  180. while (qspi->tx_len >= 4) {
  181. while (readl_relaxed(qspi->regs + REG_STATUS) & STATUS_TXFIFOFULL)
  182. ;
  183. data = *(u32 *)qspi->txbuf;
  184. qspi->txbuf += 4;
  185. qspi->tx_len -= 4;
  186. writel_relaxed(data, qspi->regs + REG_X4_TX_DATA);
  187. }
  188. control &= ~CONTROL_FLAGSX4;
  189. writel_relaxed(control, qspi->regs + REG_CONTROL);
  190. while (qspi->tx_len--) {
  191. while (readl_relaxed(qspi->regs + REG_STATUS) & STATUS_TXFIFOFULL)
  192. ;
  193. data = *qspi->txbuf++;
  194. writel_relaxed(data, qspi->regs + REG_TX_DATA);
  195. }
  196. }
  197. static void mchp_coreqspi_enable_ints(struct mchp_coreqspi *qspi)
  198. {
  199. u32 mask = IEN_TXDONE |
  200. IEN_RXDONE |
  201. IEN_RXAVAILABLE;
  202. writel_relaxed(mask, qspi->regs + REG_IEN);
  203. }
  204. static void mchp_coreqspi_disable_ints(struct mchp_coreqspi *qspi)
  205. {
  206. writel_relaxed(0, qspi->regs + REG_IEN);
  207. }
  208. static irqreturn_t mchp_coreqspi_isr(int irq, void *dev_id)
  209. {
  210. struct mchp_coreqspi *qspi = (struct mchp_coreqspi *)dev_id;
  211. irqreturn_t ret = IRQ_NONE;
  212. int intfield = readl_relaxed(qspi->regs + REG_STATUS) & STATUS_MASK;
  213. if (intfield == 0)
  214. return ret;
  215. if (intfield & IEN_TXDONE) {
  216. writel_relaxed(IEN_TXDONE, qspi->regs + REG_STATUS);
  217. ret = IRQ_HANDLED;
  218. }
  219. if (intfield & IEN_RXAVAILABLE) {
  220. writel_relaxed(IEN_RXAVAILABLE, qspi->regs + REG_STATUS);
  221. mchp_coreqspi_read_op(qspi);
  222. ret = IRQ_HANDLED;
  223. }
  224. if (intfield & IEN_RXDONE) {
  225. writel_relaxed(IEN_RXDONE, qspi->regs + REG_STATUS);
  226. complete(&qspi->data_completion);
  227. ret = IRQ_HANDLED;
  228. }
  229. return ret;
  230. }
  231. static int mchp_coreqspi_setup_clock(struct mchp_coreqspi *qspi, struct spi_device *spi)
  232. {
  233. unsigned long clk_hz;
  234. u32 control, baud_rate_val = 0;
  235. clk_hz = clk_get_rate(qspi->clk);
  236. if (!clk_hz)
  237. return -EINVAL;
  238. baud_rate_val = DIV_ROUND_UP(clk_hz, 2 * spi->max_speed_hz);
  239. if (baud_rate_val > MAX_DIVIDER || baud_rate_val < MIN_DIVIDER) {
  240. dev_err(&spi->dev,
  241. "could not configure the clock for spi clock %d Hz & system clock %ld Hz\n",
  242. spi->max_speed_hz, clk_hz);
  243. return -EINVAL;
  244. }
  245. control = readl_relaxed(qspi->regs + REG_CONTROL);
  246. control &= ~CONTROL_CLKRATE_MASK;
  247. control |= baud_rate_val << CONTROL_CLKRATE_SHIFT;
  248. writel_relaxed(control, qspi->regs + REG_CONTROL);
  249. control = readl_relaxed(qspi->regs + REG_CONTROL);
  250. if ((spi->mode & SPI_CPOL) && (spi->mode & SPI_CPHA))
  251. control |= CONTROL_CLKIDLE;
  252. else
  253. control &= ~CONTROL_CLKIDLE;
  254. writel_relaxed(control, qspi->regs + REG_CONTROL);
  255. return 0;
  256. }
  257. static int mchp_coreqspi_setup_op(struct spi_device *spi_dev)
  258. {
  259. struct spi_controller *ctlr = spi_dev->controller;
  260. struct mchp_coreqspi *qspi = spi_controller_get_devdata(ctlr);
  261. u32 control = readl_relaxed(qspi->regs + REG_CONTROL);
  262. control |= (CONTROL_MASTER | CONTROL_ENABLE);
  263. control &= ~CONTROL_CLKIDLE;
  264. writel_relaxed(control, qspi->regs + REG_CONTROL);
  265. return 0;
  266. }
  267. static inline void mchp_coreqspi_config_op(struct mchp_coreqspi *qspi, const struct spi_mem_op *op)
  268. {
  269. u32 idle_cycles = 0;
  270. int total_bytes, cmd_bytes, frames, ctrl;
  271. cmd_bytes = op->cmd.nbytes + op->addr.nbytes;
  272. total_bytes = cmd_bytes + op->data.nbytes;
  273. /*
  274. * As per the coreQSPI IP spec,the number of command and data bytes are
  275. * controlled by the frames register for each SPI sequence. This supports
  276. * the SPI flash memory read and writes sequences as below. so configure
  277. * the cmd and total bytes accordingly.
  278. * ---------------------------------------------------------------------
  279. * TOTAL BYTES | CMD BYTES | What happens |
  280. * ______________________________________________________________________
  281. * | | |
  282. * 1 | 1 | The SPI core will transmit a single byte |
  283. * | | and receive data is discarded |
  284. * | | |
  285. * 1 | 0 | The SPI core will transmit a single byte |
  286. * | | and return a single byte |
  287. * | | |
  288. * 10 | 4 | The SPI core will transmit 4 command |
  289. * | | bytes discarding the receive data and |
  290. * | | transmits 6 dummy bytes returning the 6 |
  291. * | | received bytes and return a single byte |
  292. * | | |
  293. * 10 | 10 | The SPI core will transmit 10 command |
  294. * | | |
  295. * 10 | 0 | The SPI core will transmit 10 command |
  296. * | | bytes and returning 10 received bytes |
  297. * ______________________________________________________________________
  298. */
  299. if (!(op->data.dir == SPI_MEM_DATA_IN))
  300. cmd_bytes = total_bytes;
  301. frames = total_bytes & BYTESUPPER_MASK;
  302. writel_relaxed(frames, qspi->regs + REG_FRAMESUP);
  303. frames = total_bytes & BYTESLOWER_MASK;
  304. frames |= cmd_bytes << FRAMES_CMDBYTES_SHIFT;
  305. if (op->dummy.buswidth)
  306. idle_cycles = op->dummy.nbytes * 8 / op->dummy.buswidth;
  307. frames |= idle_cycles << FRAMES_IDLE_SHIFT;
  308. ctrl = readl_relaxed(qspi->regs + REG_CONTROL);
  309. if (ctrl & CONTROL_MODE12_MASK)
  310. frames |= (1 << FRAMES_SHIFT);
  311. frames |= FRAMES_FLAGWORD;
  312. writel_relaxed(frames, qspi->regs + REG_FRAMES);
  313. }
  314. static int mchp_qspi_wait_for_ready(struct spi_mem *mem)
  315. {
  316. struct mchp_coreqspi *qspi = spi_controller_get_devdata
  317. (mem->spi->controller);
  318. u32 status;
  319. int ret;
  320. ret = readl_poll_timeout(qspi->regs + REG_STATUS, status,
  321. (status & STATUS_READY), 0,
  322. TIMEOUT_MS);
  323. if (ret) {
  324. dev_err(&mem->spi->dev,
  325. "Timeout waiting on QSPI ready.\n");
  326. return -ETIMEDOUT;
  327. }
  328. return ret;
  329. }
  330. static int mchp_coreqspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
  331. {
  332. struct mchp_coreqspi *qspi = spi_controller_get_devdata
  333. (mem->spi->controller);
  334. u32 address = op->addr.val;
  335. u8 opcode = op->cmd.opcode;
  336. u8 opaddr[5];
  337. int err, i;
  338. mutex_lock(&qspi->op_lock);
  339. err = mchp_qspi_wait_for_ready(mem);
  340. if (err)
  341. goto error;
  342. err = mchp_coreqspi_setup_clock(qspi, mem->spi);
  343. if (err)
  344. goto error;
  345. err = mchp_coreqspi_set_mode(qspi, op);
  346. if (err)
  347. goto error;
  348. reinit_completion(&qspi->data_completion);
  349. mchp_coreqspi_config_op(qspi, op);
  350. if (op->cmd.opcode) {
  351. qspi->txbuf = &opcode;
  352. qspi->rxbuf = NULL;
  353. qspi->tx_len = op->cmd.nbytes;
  354. qspi->rx_len = 0;
  355. mchp_coreqspi_write_op(qspi, false);
  356. }
  357. qspi->txbuf = &opaddr[0];
  358. if (op->addr.nbytes) {
  359. for (i = 0; i < op->addr.nbytes; i++)
  360. qspi->txbuf[i] = address >> (8 * (op->addr.nbytes - i - 1));
  361. qspi->rxbuf = NULL;
  362. qspi->tx_len = op->addr.nbytes;
  363. qspi->rx_len = 0;
  364. mchp_coreqspi_write_op(qspi, false);
  365. }
  366. if (op->data.nbytes) {
  367. if (op->data.dir == SPI_MEM_DATA_OUT) {
  368. qspi->txbuf = (u8 *)op->data.buf.out;
  369. qspi->rxbuf = NULL;
  370. qspi->rx_len = 0;
  371. qspi->tx_len = op->data.nbytes;
  372. mchp_coreqspi_write_op(qspi, true);
  373. } else {
  374. qspi->txbuf = NULL;
  375. qspi->rxbuf = (u8 *)op->data.buf.in;
  376. qspi->rx_len = op->data.nbytes;
  377. qspi->tx_len = 0;
  378. }
  379. }
  380. mchp_coreqspi_enable_ints(qspi);
  381. if (!wait_for_completion_timeout(&qspi->data_completion, msecs_to_jiffies(1000)))
  382. err = -ETIMEDOUT;
  383. error:
  384. mutex_unlock(&qspi->op_lock);
  385. mchp_coreqspi_disable_ints(qspi);
  386. return err;
  387. }
  388. static bool mchp_coreqspi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op)
  389. {
  390. if (!spi_mem_default_supports_op(mem, op))
  391. return false;
  392. if ((op->data.buswidth == 4 || op->data.buswidth == 2) &&
  393. (op->cmd.buswidth == 1 && (op->addr.buswidth == 1 || op->addr.buswidth == 0))) {
  394. /*
  395. * If the command and address are on DQ0 only, then this
  396. * controller doesn't support sending data on dual and
  397. * quad lines. but it supports reading data on dual and
  398. * quad lines with same configuration as command and
  399. * address on DQ0.
  400. * i.e. The control register[15:13] :EX_RO(read only) is
  401. * meant only for the command and address are on DQ0 but
  402. * not to write data, it is just to read.
  403. * Ex: 0x34h is Quad Load Program Data which is not
  404. * supported. Then the spi-mem layer will iterate over
  405. * each command and it will chose the supported one.
  406. */
  407. if (op->data.dir == SPI_MEM_DATA_OUT)
  408. return false;
  409. }
  410. return true;
  411. }
  412. static int mchp_coreqspi_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
  413. {
  414. if (op->data.dir == SPI_MEM_DATA_OUT || op->data.dir == SPI_MEM_DATA_IN) {
  415. if (op->data.nbytes > MAX_DATA_CMD_LEN)
  416. op->data.nbytes = MAX_DATA_CMD_LEN;
  417. }
  418. return 0;
  419. }
  420. static const struct spi_controller_mem_ops mchp_coreqspi_mem_ops = {
  421. .adjust_op_size = mchp_coreqspi_adjust_op_size,
  422. .supports_op = mchp_coreqspi_supports_op,
  423. .exec_op = mchp_coreqspi_exec_op,
  424. };
  425. static int mchp_coreqspi_probe(struct platform_device *pdev)
  426. {
  427. struct spi_controller *ctlr;
  428. struct mchp_coreqspi *qspi;
  429. struct device *dev = &pdev->dev;
  430. struct device_node *np = dev->of_node;
  431. int ret;
  432. ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*qspi));
  433. if (!ctlr)
  434. return dev_err_probe(&pdev->dev, -ENOMEM,
  435. "unable to allocate host for QSPI controller\n");
  436. qspi = spi_controller_get_devdata(ctlr);
  437. platform_set_drvdata(pdev, qspi);
  438. qspi->regs = devm_platform_ioremap_resource(pdev, 0);
  439. if (IS_ERR(qspi->regs))
  440. return dev_err_probe(&pdev->dev, PTR_ERR(qspi->regs),
  441. "failed to map registers\n");
  442. qspi->clk = devm_clk_get_enabled(&pdev->dev, NULL);
  443. if (IS_ERR(qspi->clk))
  444. return dev_err_probe(&pdev->dev, PTR_ERR(qspi->clk),
  445. "could not get clock\n");
  446. init_completion(&qspi->data_completion);
  447. mutex_init(&qspi->op_lock);
  448. qspi->irq = platform_get_irq(pdev, 0);
  449. if (qspi->irq < 0)
  450. return qspi->irq;
  451. ret = devm_request_irq(&pdev->dev, qspi->irq, mchp_coreqspi_isr,
  452. IRQF_SHARED, pdev->name, qspi);
  453. if (ret) {
  454. dev_err(&pdev->dev, "request_irq failed %d\n", ret);
  455. return ret;
  456. }
  457. ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
  458. ctlr->mem_ops = &mchp_coreqspi_mem_ops;
  459. ctlr->setup = mchp_coreqspi_setup_op;
  460. ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD |
  461. SPI_TX_DUAL | SPI_TX_QUAD;
  462. ctlr->dev.of_node = np;
  463. ret = devm_spi_register_controller(&pdev->dev, ctlr);
  464. if (ret)
  465. return dev_err_probe(&pdev->dev, ret,
  466. "spi_register_controller failed\n");
  467. return 0;
  468. }
  469. static void mchp_coreqspi_remove(struct platform_device *pdev)
  470. {
  471. struct mchp_coreqspi *qspi = platform_get_drvdata(pdev);
  472. u32 control = readl_relaxed(qspi->regs + REG_CONTROL);
  473. mchp_coreqspi_disable_ints(qspi);
  474. control &= ~CONTROL_ENABLE;
  475. writel_relaxed(control, qspi->regs + REG_CONTROL);
  476. }
  477. static const struct of_device_id mchp_coreqspi_of_match[] = {
  478. { .compatible = "microchip,coreqspi-rtl-v2" },
  479. { /* sentinel */ }
  480. };
  481. MODULE_DEVICE_TABLE(of, mchp_coreqspi_of_match);
  482. static struct platform_driver mchp_coreqspi_driver = {
  483. .probe = mchp_coreqspi_probe,
  484. .driver = {
  485. .name = "microchip,coreqspi",
  486. .of_match_table = mchp_coreqspi_of_match,
  487. },
  488. .remove_new = mchp_coreqspi_remove,
  489. };
  490. module_platform_driver(mchp_coreqspi_driver);
  491. MODULE_AUTHOR("Naga Sureshkumar Relli <nagasuresh.relli@microchip.com");
  492. MODULE_DESCRIPTION("Microchip coreQSPI QSPI controller driver");
  493. MODULE_LICENSE("GPL");