iproc_qspi.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2020-2021 Broadcom
  4. */
  5. #include <common.h>
  6. #include <dm.h>
  7. #include <spi.h>
  8. #include <spi-mem.h>
  9. #include <asm/io.h>
  10. #include <linux/delay.h>
  11. #include <linux/err.h>
  12. #include <linux/iopoll.h>
  13. #include <linux/log2.h>
  14. /* Delay required to change the mode of operation */
  15. #define BUSY_DELAY_US 1
  16. #define BUSY_TIMEOUT_US 200000
  17. #define DWORD_ALIGNED(a) (!(((ulong)(a)) & 3))
  18. /* Chip attributes */
  19. #define QSPI_AXI_CLK 175000000
  20. #define SPBR_MIN 8U
  21. #define SPBR_MAX 255U
  22. #define NUM_CDRAM 16U
  23. #define CDRAM_PCS0 2
  24. #define CDRAM_CONT BIT(7)
  25. #define CDRAM_BITS_EN BIT(6)
  26. #define CDRAM_QUAD_MODE BIT(8)
  27. #define CDRAM_RBIT_INPUT BIT(10)
  28. #define MSPI_SPE BIT(6)
  29. #define MSPI_CONT_AFTER_CMD BIT(7)
  30. #define MSPI_MSTR BIT(7)
  31. /* Register fields */
  32. #define MSPI_SPCR0_MSB_BITS_8 0x00000020
  33. #define BSPI_RAF_CONTROL_START_MASK 0x00000001
  34. #define BSPI_RAF_STATUS_SESSION_BUSY_MASK 0x00000001
  35. #define BSPI_RAF_STATUS_FIFO_EMPTY_MASK 0x00000002
  36. #define BSPI_STRAP_OVERRIDE_DATA_QUAD_SHIFT 3
  37. #define BSPI_STRAP_OVERRIDE_4BYTE_SHIFT 2
  38. #define BSPI_STRAP_OVERRIDE_DATA_DUAL_SHIFT 1
  39. #define BSPI_STRAP_OVERRIDE_SHIFT 0
  40. #define BSPI_BPC_DATA_SHIFT 0
  41. #define BSPI_BPC_MODE_SHIFT 8
  42. #define BSPI_BPC_ADDR_SHIFT 16
  43. #define BSPI_BPC_CMD_SHIFT 24
  44. #define BSPI_BPP_ADDR_SHIFT 16
  45. /* MSPI registers */
  46. #define MSPI_SPCR0_LSB_REG 0x000
  47. #define MSPI_SPCR0_MSB_REG 0x004
  48. #define MSPI_SPCR1_LSB_REG 0x008
  49. #define MSPI_SPCR1_MSB_REG 0x00c
  50. #define MSPI_NEWQP_REG 0x010
  51. #define MSPI_ENDQP_REG 0x014
  52. #define MSPI_SPCR2_REG 0x018
  53. #define MSPI_STATUS_REG 0x020
  54. #define MSPI_CPTQP_REG 0x024
  55. #define MSPI_TX_REG 0x040
  56. #define MSPI_RX_REG 0x0c0
  57. #define MSPI_CDRAM_REG 0x140
  58. #define MSPI_WRITE_LOCK_REG 0x180
  59. #define MSPI_DISABLE_FLUSH_GEN_REG 0x184
  60. /* BSPI registers */
  61. #define BSPI_REVISION_ID_REG 0x000
  62. #define BSPI_SCRATCH_REG 0x004
  63. #define BSPI_MAST_N_BOOT_CTRL_REG 0x008
  64. #define BSPI_BUSY_STATUS_REG 0x00c
  65. #define BSPI_INTR_STATUS_REG 0x010
  66. #define BSPI_B0_STATUS_REG 0x014
  67. #define BSPI_B0_CTRL_REG 0x018
  68. #define BSPI_B1_STATUS_REG 0x01c
  69. #define BSPI_B1_CTRL_REG 0x020
  70. #define BSPI_STRAP_OVERRIDE_CTRL_REG 0x024
  71. #define BSPI_FLEX_MODE_ENABLE_REG 0x028
  72. #define BSPI_BITS_PER_CYCLE_REG 0x02C
  73. #define BSPI_BITS_PER_PHASE_REG 0x030
  74. #define BSPI_CMD_AND_MODE_BYTE_REG 0x034
  75. #define BSPI_FLASH_UPPER_ADDR_BYTE_REG 0x038
  76. #define BSPI_XOR_VALUE_REG 0x03C
  77. #define BSPI_XOR_ENABLE_REG 0x040
  78. #define BSPI_PIO_MODE_ENABLE_REG 0x044
  79. #define BSPI_PIO_IODIR_REG 0x048
  80. #define BSPI_PIO_DATA_REG 0x04C
  81. /* RAF registers */
  82. #define BSPI_RAF_START_ADDRESS_REG 0x00
  83. #define BSPI_RAF_NUM_WORDS_REG 0x04
  84. #define BSPI_RAF_CTRL_REG 0x08
  85. #define BSPI_RAF_FULLNESS_REG 0x0C
  86. #define BSPI_RAF_WATERMARK_REG 0x10
  87. #define BSPI_RAF_STATUS_REG 0x14
  88. #define BSPI_RAF_READ_DATA_REG 0x18
  89. #define BSPI_RAF_WORD_CNT_REG 0x1C
  90. #define BSPI_RAF_CURR_ADDR_REG 0x20
  91. #define XFER_DUAL BIT(30)
  92. #define XFER_QUAD BIT(31)
  93. #define FLUSH_BIT BIT(0)
  94. #define MAST_N_BOOT_BIT BIT(0)
  95. #define WRITE_LOCK_BIT BIT(0)
  96. #define CEIL(m, n) (((m) + (n) - 1) / (n))
  97. #define UPPER_BYTE_MASK 0xFF000000
  98. #define SIZE_16MB 0x001000000
  99. /*
  100. * struct bcmspi_priv - qspi private structure
  101. *
  102. * @bspi_addr: bspi read address
  103. * @bspi_4byte_addr: bspi 4 byte address mode
  104. * @mspi: mspi registers block address
  105. * @bspi: bspi registers block address
  106. * @bspi_raf: bspi raf registers block address
  107. */
  108. struct bcmspi_priv {
  109. u32 bspi_addr;
  110. bool bspi_4byte_addr;
  111. fdt_addr_t mspi;
  112. fdt_addr_t bspi;
  113. fdt_addr_t bspi_raf;
  114. };
  115. /* BSPI mode */
  116. static void bspi_flush_prefetch_buffers(struct bcmspi_priv *priv)
  117. {
  118. writel(0, priv->bspi + BSPI_B0_CTRL_REG);
  119. writel(0, priv->bspi + BSPI_B1_CTRL_REG);
  120. writel(FLUSH_BIT, priv->bspi + BSPI_B0_CTRL_REG);
  121. writel(FLUSH_BIT, priv->bspi + BSPI_B1_CTRL_REG);
  122. }
  123. static int bspi_enable(struct bcmspi_priv *priv)
  124. {
  125. /* Disable write lock */
  126. writel(0, priv->mspi + MSPI_WRITE_LOCK_REG);
  127. /* Flush prefetch buffers */
  128. bspi_flush_prefetch_buffers(priv);
  129. /* Switch to BSPI */
  130. writel(0, priv->bspi + BSPI_MAST_N_BOOT_CTRL_REG);
  131. return 0;
  132. }
  133. static int bspi_disable(struct bcmspi_priv *priv)
  134. {
  135. int ret;
  136. uint val;
  137. if ((readl(priv->bspi + BSPI_MAST_N_BOOT_CTRL_REG) & 1) == 0) {
  138. ret = readl_poll_timeout(priv->bspi + BSPI_BUSY_STATUS_REG, val, !(val & 1),
  139. BUSY_TIMEOUT_US);
  140. if (ret) {
  141. printf("%s: Failed to disable bspi, device busy\n", __func__);
  142. return ret;
  143. }
  144. /* Switch to MSPI */
  145. writel(MAST_N_BOOT_BIT, priv->bspi + BSPI_MAST_N_BOOT_CTRL_REG);
  146. udelay(BUSY_DELAY_US);
  147. val = readl(priv->bspi + BSPI_MAST_N_BOOT_CTRL_REG);
  148. if (!(val & 1)) {
  149. printf("%s: Failed to enable mspi\n", __func__);
  150. return -EBUSY;
  151. }
  152. }
  153. /* Enable write lock */
  154. writel(WRITE_LOCK_BIT, priv->mspi + MSPI_WRITE_LOCK_REG);
  155. return 0;
  156. }
  157. static int bspi_read_via_raf(struct bcmspi_priv *priv, u8 *rx, uint bytes)
  158. {
  159. u32 status;
  160. uint words;
  161. int aligned;
  162. int ret;
  163. /*
  164. * Flush data from the previous session (unlikely)
  165. * Read outstanding bits in the poll condition to empty FIFO
  166. */
  167. ret = readl_poll_timeout(priv->bspi_raf + BSPI_RAF_STATUS_REG,
  168. status,
  169. (!readl(priv->bspi_raf + BSPI_RAF_READ_DATA_REG) &&
  170. status & BSPI_RAF_STATUS_FIFO_EMPTY_MASK) &&
  171. !(status & BSPI_RAF_STATUS_SESSION_BUSY_MASK),
  172. BUSY_TIMEOUT_US);
  173. if (ret) {
  174. printf("%s: Failed to flush fifo\n", __func__);
  175. return ret;
  176. }
  177. /* Transfer is in words */
  178. words = CEIL(bytes, 4);
  179. /* Setup hardware */
  180. if (priv->bspi_4byte_addr) {
  181. u32 val = priv->bspi_addr & UPPER_BYTE_MASK;
  182. if (val != readl(priv->bspi + BSPI_FLASH_UPPER_ADDR_BYTE_REG)) {
  183. writel(val, priv->bspi + BSPI_FLASH_UPPER_ADDR_BYTE_REG);
  184. bspi_flush_prefetch_buffers(priv);
  185. }
  186. }
  187. writel(priv->bspi_addr & ~UPPER_BYTE_MASK, priv->bspi_raf + BSPI_RAF_START_ADDRESS_REG);
  188. writel(words, priv->bspi_raf + BSPI_RAF_NUM_WORDS_REG);
  189. writel(0, priv->bspi_raf + BSPI_RAF_WATERMARK_REG);
  190. /* Start reading */
  191. writel(BSPI_RAF_CONTROL_START_MASK, priv->bspi_raf + BSPI_RAF_CTRL_REG);
  192. aligned = DWORD_ALIGNED(rx);
  193. while (bytes) {
  194. status = readl(priv->bspi_raf + BSPI_RAF_STATUS_REG);
  195. if (!(status & BSPI_RAF_STATUS_FIFO_EMPTY_MASK)) {
  196. /* RAF is LE only, convert data to host endianness */
  197. u32 data = le32_to_cpu(readl(priv->bspi_raf + BSPI_RAF_READ_DATA_REG));
  198. /* Check if we can use the whole word */
  199. if (aligned && bytes >= 4) {
  200. *(u32 *)rx = data;
  201. rx += 4;
  202. bytes -= 4;
  203. } else {
  204. uint chunk = min(bytes, 4U);
  205. /* Read out bytes one by one */
  206. while (chunk) {
  207. *rx++ = (u8)data;
  208. data >>= 8;
  209. chunk--;
  210. bytes--;
  211. }
  212. }
  213. continue;
  214. }
  215. if (!(status & BSPI_RAF_STATUS_SESSION_BUSY_MASK)) {
  216. /* FIFO is empty and the session is done */
  217. break;
  218. }
  219. }
  220. return 0;
  221. }
  222. static int bspi_read(struct bcmspi_priv *priv, u8 *rx, uint bytes)
  223. {
  224. int ret;
  225. /* Transfer data */
  226. while (bytes > 0) {
  227. /* Special handing since RAF cannot go across 16MB boundary */
  228. uint trans = bytes;
  229. /* Divide into multiple transfers if it goes across the 16MB boundary */
  230. if (priv->bspi_4byte_addr && (priv->bspi_addr >> 24) !=
  231. ((priv->bspi_addr + bytes) >> 24))
  232. trans = SIZE_16MB - (priv->bspi_addr & ~UPPER_BYTE_MASK);
  233. ret = bspi_read_via_raf(priv, rx, trans);
  234. if (ret)
  235. return ret;
  236. priv->bspi_addr += trans;
  237. rx += trans;
  238. bytes -= trans;
  239. }
  240. bspi_flush_prefetch_buffers(priv);
  241. return 0;
  242. }
  243. static void bspi_set_flex_mode(struct bcmspi_priv *priv, const struct spi_mem_op *op)
  244. {
  245. int bpp = (op->dummy.nbytes * 8) / op->dummy.buswidth;
  246. int cmd = op->cmd.opcode;
  247. int bpc = ilog2(op->data.buswidth) << BSPI_BPC_DATA_SHIFT |
  248. ilog2(op->addr.buswidth) << BSPI_BPC_ADDR_SHIFT |
  249. ilog2(op->cmd.buswidth) << BSPI_BPC_CMD_SHIFT;
  250. int so = BIT(BSPI_STRAP_OVERRIDE_SHIFT) |
  251. (op->data.buswidth > 1) << BSPI_STRAP_OVERRIDE_DATA_DUAL_SHIFT |
  252. (op->addr.nbytes > 3) << BSPI_STRAP_OVERRIDE_4BYTE_SHIFT |
  253. (op->data.buswidth > 3) << BSPI_STRAP_OVERRIDE_DATA_QUAD_SHIFT;
  254. /* Disable flex mode first */
  255. writel(0, priv->bspi + BSPI_FLEX_MODE_ENABLE_REG);
  256. /* Configure single, dual or quad mode */
  257. writel(bpc, priv->bspi + BSPI_BITS_PER_CYCLE_REG);
  258. /* Opcode */
  259. writel(cmd, priv->bspi + BSPI_CMD_AND_MODE_BYTE_REG);
  260. /* Count of dummy cycles */
  261. writel(bpp, priv->bspi + BSPI_BITS_PER_PHASE_REG);
  262. /* Enable 4-byte address */
  263. if (priv->bspi_4byte_addr) {
  264. setbits_le32(priv->bspi + BSPI_BITS_PER_PHASE_REG, BIT(BSPI_BPP_ADDR_SHIFT));
  265. } else {
  266. clrbits_le32(priv->bspi + BSPI_BITS_PER_PHASE_REG, BIT(BSPI_BPP_ADDR_SHIFT));
  267. writel(0, priv->bspi + BSPI_FLASH_UPPER_ADDR_BYTE_REG);
  268. }
  269. /* Enable flex mode to take effect */
  270. writel(1, priv->bspi + BSPI_FLEX_MODE_ENABLE_REG);
  271. /* Flush prefetch buffers since 32MB window BSPI could be used */
  272. bspi_flush_prefetch_buffers(priv);
  273. /* Override the strap settings */
  274. writel(so, priv->bspi + BSPI_STRAP_OVERRIDE_CTRL_REG);
  275. }
  276. static int bspi_exec_op(struct spi_slave *slave, const struct spi_mem_op *op)
  277. {
  278. struct udevice *bus = dev_get_parent(slave->dev);
  279. struct bcmspi_priv *priv = dev_get_priv(bus);
  280. int ret = -ENOTSUPP;
  281. /* BSPI read */
  282. if (op->data.dir == SPI_MEM_DATA_IN &&
  283. op->data.nbytes && op->addr.nbytes) {
  284. priv->bspi_4byte_addr = (op->addr.nbytes > 3);
  285. priv->bspi_addr = op->addr.val;
  286. bspi_set_flex_mode(priv, op);
  287. ret = bspi_read(priv, op->data.buf.in, op->data.nbytes);
  288. }
  289. return ret;
  290. }
  291. static const struct spi_controller_mem_ops bspi_mem_ops = {
  292. .exec_op = bspi_exec_op,
  293. };
  294. /* MSPI mode */
  295. static int mspi_exec(struct bcmspi_priv *priv, uint bytes, const u8 *tx, u8 *rx, ulong flags)
  296. {
  297. u32 cdr = CDRAM_PCS0 | CDRAM_CONT;
  298. bool use_16bits = !(bytes & 1);
  299. if (flags & XFER_QUAD) {
  300. cdr |= CDRAM_QUAD_MODE;
  301. if (!tx)
  302. cdr |= CDRAM_RBIT_INPUT;
  303. }
  304. while (bytes) {
  305. uint chunk;
  306. uint queues;
  307. uint i;
  308. uint val;
  309. int ret;
  310. if (use_16bits) {
  311. chunk = min(bytes, NUM_CDRAM * 2);
  312. queues = (chunk + 1) / 2;
  313. bytes -= chunk;
  314. /* Fill CDRAMs */
  315. for (i = 0; i < queues; i++)
  316. writel(cdr | CDRAM_BITS_EN, priv->mspi + MSPI_CDRAM_REG + 4 * i);
  317. /* Fill TXRAMs */
  318. for (i = 0; i < chunk; i++)
  319. writel(tx ? tx[i] : 0xff, priv->mspi + MSPI_TX_REG + 4 * i);
  320. } else {
  321. /* Determine how many bytes to process this time */
  322. chunk = min(bytes, NUM_CDRAM);
  323. queues = chunk;
  324. bytes -= chunk;
  325. /* Fill CDRAMs and TXRAMS */
  326. for (i = 0; i < chunk; i++) {
  327. writel(cdr, priv->mspi + MSPI_CDRAM_REG + 4 * i);
  328. writel(tx ? tx[i] : 0xff, priv->mspi + MSPI_TX_REG + 8 * i);
  329. }
  330. }
  331. /* Setup queue pointers */
  332. writel(0, priv->mspi + MSPI_NEWQP_REG);
  333. writel(queues - 1, priv->mspi + MSPI_ENDQP_REG);
  334. /* Deassert CS if requested and it's the last transfer */
  335. if (bytes == 0 && (flags & SPI_XFER_END))
  336. clrbits_le32(priv->mspi + MSPI_CDRAM_REG + ((queues - 1) << 2), CDRAM_CONT);
  337. /* Kick off */
  338. writel(0, priv->mspi + MSPI_STATUS_REG);
  339. if (bytes == 0 && (flags & SPI_XFER_END))
  340. writel(MSPI_SPE, priv->mspi + MSPI_SPCR2_REG);
  341. else
  342. writel(MSPI_SPE | MSPI_CONT_AFTER_CMD,
  343. priv->mspi + MSPI_SPCR2_REG);
  344. ret = readl_poll_timeout(priv->mspi + MSPI_STATUS_REG, val, (val & 1),
  345. BUSY_TIMEOUT_US);
  346. if (ret) {
  347. printf("%s: Failed to disable bspi, device busy\n", __func__);
  348. return ret;
  349. }
  350. /* Read data out */
  351. if (rx) {
  352. if (use_16bits) {
  353. for (i = 0; i < chunk; i++)
  354. rx[i] = readl(priv->mspi + MSPI_RX_REG + 4 * i) & 0xff;
  355. } else {
  356. for (i = 0; i < chunk; i++)
  357. rx[i] = readl(priv->mspi + MSPI_RX_REG + 8 * i + 4) & 0xff;
  358. }
  359. }
  360. /* Advance pointers */
  361. if (tx)
  362. tx += chunk;
  363. if (rx)
  364. rx += chunk;
  365. }
  366. return 0;
  367. }
  368. static int mspi_xfer(struct udevice *dev, uint bitlen, const void *dout, void *din, ulong flags)
  369. {
  370. struct udevice *bus = dev_get_parent(dev);
  371. struct bcmspi_priv *priv = dev_get_priv(bus);
  372. uint bytes;
  373. int ret = 0;
  374. /* we can only transfer multiples of 8 bits */
  375. if (bitlen % 8)
  376. return -EPROTONOSUPPORT;
  377. bytes = bitlen / 8;
  378. if (flags & SPI_XFER_BEGIN) {
  379. /* Switch to MSPI */
  380. ret = bspi_disable(priv);
  381. if (ret)
  382. return ret;
  383. }
  384. /* MSPI: Transfer */
  385. if (bytes)
  386. ret = mspi_exec(priv, bytes, dout, din, flags);
  387. if (flags & SPI_XFER_END) {
  388. /* Switch back to BSPI */
  389. ret = bspi_enable(priv);
  390. if (ret)
  391. return ret;
  392. }
  393. return ret;
  394. }
  395. /* iProc interface */
  396. static int iproc_qspi_set_speed(struct udevice *bus, uint speed)
  397. {
  398. struct bcmspi_priv *priv = dev_get_priv(bus);
  399. uint spbr;
  400. /* MSPI: SCK configuration */
  401. spbr = (QSPI_AXI_CLK - 1) / (2 * speed) + 1;
  402. writel(max(min(spbr, SPBR_MAX), SPBR_MIN), priv->mspi + MSPI_SPCR0_LSB_REG);
  403. return 0;
  404. }
  405. static int iproc_qspi_set_mode(struct udevice *bus, uint mode)
  406. {
  407. struct bcmspi_priv *priv = dev_get_priv(bus);
  408. /* MSPI: set master bit and mode */
  409. writel(MSPI_MSTR /* Master */ | (mode & 3), priv->mspi + MSPI_SPCR0_MSB_REG);
  410. return 0;
  411. }
  412. static int iproc_qspi_claim_bus(struct udevice *dev)
  413. {
  414. /* Nothing to do */
  415. return 0;
  416. }
  417. static int iproc_qspi_release_bus(struct udevice *dev)
  418. {
  419. struct udevice *bus = dev_get_parent(dev);
  420. struct bcmspi_priv *priv = dev_get_priv(bus);
  421. /* Make sure no operation is in progress */
  422. writel(0, priv->mspi + MSPI_SPCR2_REG);
  423. udelay(BUSY_DELAY_US);
  424. return 0;
  425. }
  426. static int iproc_qspi_of_to_plat(struct udevice *bus)
  427. {
  428. struct bcmspi_priv *priv = dev_get_priv(bus);
  429. priv->bspi = dev_read_addr_name(bus, "bspi");
  430. if (IS_ERR((void *)priv->bspi)) {
  431. printf("%s: Failed to get bspi base address\n", __func__);
  432. return PTR_ERR((void *)priv->bspi);
  433. }
  434. priv->bspi_raf = dev_read_addr_name(bus, "bspi_raf");
  435. if (IS_ERR((void *)priv->bspi_raf)) {
  436. printf("%s: Failed to get bspi_raf base address\n", __func__);
  437. return PTR_ERR((void *)priv->bspi_raf);
  438. }
  439. priv->mspi = dev_read_addr_name(bus, "mspi");
  440. if (IS_ERR((void *)priv->mspi)) {
  441. printf("%s: Failed to get mspi base address\n", __func__);
  442. return PTR_ERR((void *)priv->mspi);
  443. }
  444. return 0;
  445. }
  446. static int iproc_qspi_probe(struct udevice *bus)
  447. {
  448. struct bcmspi_priv *priv = dev_get_priv(bus);
  449. /* configure mspi */
  450. writel(0, priv->mspi + MSPI_SPCR1_LSB_REG);
  451. writel(0, priv->mspi + MSPI_SPCR1_MSB_REG);
  452. writel(0, priv->mspi + MSPI_NEWQP_REG);
  453. writel(0, priv->mspi + MSPI_ENDQP_REG);
  454. writel(0, priv->mspi + MSPI_SPCR2_REG);
  455. /* configure bspi */
  456. bspi_enable(priv);
  457. return 0;
  458. }
  459. static const struct dm_spi_ops iproc_qspi_ops = {
  460. .claim_bus = iproc_qspi_claim_bus,
  461. .release_bus = iproc_qspi_release_bus,
  462. .xfer = mspi_xfer,
  463. .set_speed = iproc_qspi_set_speed,
  464. .set_mode = iproc_qspi_set_mode,
  465. .mem_ops = &bspi_mem_ops,
  466. };
  467. static const struct udevice_id iproc_qspi_ids[] = {
  468. { .compatible = "brcm,iproc-qspi" },
  469. { }
  470. };
  471. U_BOOT_DRIVER(iproc_qspi) = {
  472. .name = "iproc_qspi",
  473. .id = UCLASS_SPI,
  474. .of_match = iproc_qspi_ids,
  475. .ops = &iproc_qspi_ops,
  476. .of_to_plat = iproc_qspi_of_to_plat,
  477. .priv_auto = sizeof(struct bcmspi_priv),
  478. .probe = iproc_qspi_probe,
  479. };