Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2016 |
| 4 | * |
| 5 | * Michael Kurz, <michi.kurz@gmail.com> |
| 6 | * |
| 7 | * STM32 QSPI driver |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 8 | */ |
| 9 | |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 10 | #define LOG_CATEGORY UCLASS_SPI |
| 11 | |
Patrice Chotard | 7188fac | 2018-05-14 15:42:51 +0200 | [diff] [blame] | 12 | #include <clk.h> |
Simon Glass | dfb7c08 | 2020-07-19 10:15:34 -0600 | [diff] [blame] | 13 | #include <dm.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 14 | #include <log.h> |
Patrice Chotard | b38c897 | 2018-05-14 15:42:56 +0200 | [diff] [blame] | 15 | #include <reset.h> |
Simon Glass | dfb7c08 | 2020-07-19 10:15:34 -0600 | [diff] [blame] | 16 | #include <spi.h> |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 17 | #include <spi-mem.h> |
Patrice Chotard | 1e49e28 | 2021-01-20 14:42:02 +0100 | [diff] [blame] | 18 | #include <watchdog.h> |
Simon Glass | 9bc1564 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 19 | #include <dm/device_compat.h> |
Simon Glass | 4dcacfc | 2020-05-10 11:40:13 -0600 | [diff] [blame] | 20 | #include <linux/bitops.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 21 | #include <linux/delay.h> |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 22 | #include <linux/iopoll.h> |
Patrice Chotard | b895478 | 2018-05-14 15:42:55 +0200 | [diff] [blame] | 23 | #include <linux/ioport.h> |
Simon Glass | bdd5f81 | 2023-09-14 18:21:46 -0600 | [diff] [blame] | 24 | #include <linux/printk.h> |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 25 | #include <linux/sizes.h> |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 26 | |
| 27 | struct stm32_qspi_regs { |
| 28 | u32 cr; /* 0x00 */ |
| 29 | u32 dcr; /* 0x04 */ |
| 30 | u32 sr; /* 0x08 */ |
| 31 | u32 fcr; /* 0x0C */ |
| 32 | u32 dlr; /* 0x10 */ |
| 33 | u32 ccr; /* 0x14 */ |
| 34 | u32 ar; /* 0x18 */ |
| 35 | u32 abr; /* 0x1C */ |
| 36 | u32 dr; /* 0x20 */ |
| 37 | u32 psmkr; /* 0x24 */ |
| 38 | u32 psmar; /* 0x28 */ |
| 39 | u32 pir; /* 0x2C */ |
| 40 | u32 lptr; /* 0x30 */ |
| 41 | }; |
| 42 | |
| 43 | /* |
| 44 | * QUADSPI control register |
| 45 | */ |
| 46 | #define STM32_QSPI_CR_EN BIT(0) |
| 47 | #define STM32_QSPI_CR_ABORT BIT(1) |
| 48 | #define STM32_QSPI_CR_DMAEN BIT(2) |
| 49 | #define STM32_QSPI_CR_TCEN BIT(3) |
| 50 | #define STM32_QSPI_CR_SSHIFT BIT(4) |
| 51 | #define STM32_QSPI_CR_DFM BIT(6) |
| 52 | #define STM32_QSPI_CR_FSEL BIT(7) |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 53 | #define STM32_QSPI_CR_FTHRES_SHIFT 8 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 54 | #define STM32_QSPI_CR_TEIE BIT(16) |
| 55 | #define STM32_QSPI_CR_TCIE BIT(17) |
| 56 | #define STM32_QSPI_CR_FTIE BIT(18) |
| 57 | #define STM32_QSPI_CR_SMIE BIT(19) |
| 58 | #define STM32_QSPI_CR_TOIE BIT(20) |
| 59 | #define STM32_QSPI_CR_APMS BIT(22) |
| 60 | #define STM32_QSPI_CR_PMM BIT(23) |
| 61 | #define STM32_QSPI_CR_PRESCALER_MASK GENMASK(7, 0) |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 62 | #define STM32_QSPI_CR_PRESCALER_SHIFT 24 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 63 | |
| 64 | /* |
| 65 | * QUADSPI device configuration register |
| 66 | */ |
| 67 | #define STM32_QSPI_DCR_CKMODE BIT(0) |
| 68 | #define STM32_QSPI_DCR_CSHT_MASK GENMASK(2, 0) |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 69 | #define STM32_QSPI_DCR_CSHT_SHIFT 8 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 70 | #define STM32_QSPI_DCR_FSIZE_MASK GENMASK(4, 0) |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 71 | #define STM32_QSPI_DCR_FSIZE_SHIFT 16 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 72 | |
| 73 | /* |
| 74 | * QUADSPI status register |
| 75 | */ |
| 76 | #define STM32_QSPI_SR_TEF BIT(0) |
| 77 | #define STM32_QSPI_SR_TCF BIT(1) |
| 78 | #define STM32_QSPI_SR_FTF BIT(2) |
| 79 | #define STM32_QSPI_SR_SMF BIT(3) |
| 80 | #define STM32_QSPI_SR_TOF BIT(4) |
| 81 | #define STM32_QSPI_SR_BUSY BIT(5) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 82 | |
| 83 | /* |
| 84 | * QUADSPI flag clear register |
| 85 | */ |
| 86 | #define STM32_QSPI_FCR_CTEF BIT(0) |
| 87 | #define STM32_QSPI_FCR_CTCF BIT(1) |
| 88 | #define STM32_QSPI_FCR_CSMF BIT(3) |
| 89 | #define STM32_QSPI_FCR_CTOF BIT(4) |
| 90 | |
| 91 | /* |
| 92 | * QUADSPI communication configuration register |
| 93 | */ |
| 94 | #define STM32_QSPI_CCR_DDRM BIT(31) |
| 95 | #define STM32_QSPI_CCR_DHHC BIT(30) |
| 96 | #define STM32_QSPI_CCR_SIOO BIT(28) |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 97 | #define STM32_QSPI_CCR_FMODE_SHIFT 26 |
| 98 | #define STM32_QSPI_CCR_DMODE_SHIFT 24 |
| 99 | #define STM32_QSPI_CCR_DCYC_SHIFT 18 |
| 100 | #define STM32_QSPI_CCR_ABSIZE_SHIFT 16 |
| 101 | #define STM32_QSPI_CCR_ABMODE_SHIFT 14 |
| 102 | #define STM32_QSPI_CCR_ADSIZE_SHIFT 12 |
| 103 | #define STM32_QSPI_CCR_ADMODE_SHIFT 10 |
| 104 | #define STM32_QSPI_CCR_IMODE_SHIFT 8 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 105 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 106 | #define STM32_QSPI_CCR_IND_WRITE 0 |
| 107 | #define STM32_QSPI_CCR_IND_READ 1 |
| 108 | #define STM32_QSPI_CCR_MEM_MAP 3 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 109 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 110 | #define STM32_QSPI_MAX_MMAP_SZ SZ_256M |
| 111 | #define STM32_QSPI_MAX_CHIP 2 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 112 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 113 | #define STM32_QSPI_FIFO_TIMEOUT_US 30000 |
| 114 | #define STM32_QSPI_CMD_TIMEOUT_US 1000000 |
| 115 | #define STM32_BUSY_TIMEOUT_US 100000 |
| 116 | #define STM32_ABT_TIMEOUT_US 100000 |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 117 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 118 | struct stm32_qspi_priv { |
| 119 | struct stm32_qspi_regs *regs; |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 120 | void __iomem *mm_base; |
| 121 | resource_size_t mm_size; |
Patrice Chotard | b8442fb | 2017-07-18 09:29:09 +0200 | [diff] [blame] | 122 | ulong clock_rate; |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 123 | int cs_used; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 124 | }; |
| 125 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 126 | static int _stm32_qspi_wait_for_not_busy(struct stm32_qspi_priv *priv) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 127 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 128 | u32 sr; |
| 129 | int ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 130 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 131 | ret = readl_poll_timeout(&priv->regs->sr, sr, |
| 132 | !(sr & STM32_QSPI_SR_BUSY), |
| 133 | STM32_BUSY_TIMEOUT_US); |
| 134 | if (ret) |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 135 | log_err("busy timeout (stat:%#x)\n", sr); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 136 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 137 | return ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 138 | } |
| 139 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 140 | static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv, |
| 141 | const struct spi_mem_op *op) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 142 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 143 | u32 sr; |
Daniil Stas | 485b4b1 | 2021-05-23 22:24:49 +0000 | [diff] [blame] | 144 | int ret = 0; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 145 | |
Patrice Chotard | f9c8b7b | 2022-05-12 09:17:37 +0200 | [diff] [blame] | 146 | ret = readl_poll_timeout(&priv->regs->sr, sr, |
| 147 | sr & STM32_QSPI_SR_TCF, |
| 148 | STM32_QSPI_CMD_TIMEOUT_US); |
| 149 | if (ret) { |
| 150 | log_err("cmd timeout (stat:%#x)\n", sr); |
| 151 | } else if (readl(&priv->regs->sr) & STM32_QSPI_SR_TEF) { |
| 152 | log_err("transfer error (stat:%#x)\n", sr); |
| 153 | ret = -EIO; |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 154 | } |
| 155 | |
Patrice Chotard | f9c8b7b | 2022-05-12 09:17:37 +0200 | [diff] [blame] | 156 | /* clear flags */ |
| 157 | writel(STM32_QSPI_FCR_CTCF | STM32_QSPI_FCR_CTEF, &priv->regs->fcr); |
| 158 | |
Daniil Stas | 485b4b1 | 2021-05-23 22:24:49 +0000 | [diff] [blame] | 159 | if (!ret) |
| 160 | ret = _stm32_qspi_wait_for_not_busy(priv); |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 161 | |
| 162 | return ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 163 | } |
| 164 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 165 | static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 166 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 167 | *val = readb(addr); |
Stefan Roese | 80877fa | 2022-09-02 14:10:46 +0200 | [diff] [blame] | 168 | schedule(); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 169 | } |
| 170 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 171 | static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr) |
Christophe Kerello | e3b34cb | 2018-05-14 15:42:54 +0200 | [diff] [blame] | 172 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 173 | writeb(*val, addr); |
Christophe Kerello | e3b34cb | 2018-05-14 15:42:54 +0200 | [diff] [blame] | 174 | } |
| 175 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 176 | static int _stm32_qspi_poll(struct stm32_qspi_priv *priv, |
| 177 | const struct spi_mem_op *op) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 178 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 179 | void (*fifo)(u8 *val, void __iomem *addr); |
| 180 | u32 len = op->data.nbytes, sr; |
| 181 | u8 *buf; |
| 182 | int ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 183 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 184 | if (op->data.dir == SPI_MEM_DATA_IN) { |
| 185 | fifo = _stm32_qspi_read_fifo; |
| 186 | buf = op->data.buf.in; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 187 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 188 | } else { |
| 189 | fifo = _stm32_qspi_write_fifo; |
| 190 | buf = (u8 *)op->data.buf.out; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 191 | } |
| 192 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 193 | while (len--) { |
| 194 | ret = readl_poll_timeout(&priv->regs->sr, sr, |
| 195 | sr & STM32_QSPI_SR_FTF, |
| 196 | STM32_QSPI_FIFO_TIMEOUT_US); |
| 197 | if (ret) { |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 198 | log_err("fifo timeout (len:%d stat:%#x)\n", len, sr); |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 199 | return ret; |
| 200 | } |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 201 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 202 | fifo(buf++, &priv->regs->dr); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 203 | } |
Christophe Kerello | a1a725a | 2018-07-09 15:32:37 +0200 | [diff] [blame] | 204 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 205 | return 0; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 206 | } |
| 207 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 208 | static int stm32_qspi_mm(struct stm32_qspi_priv *priv, |
| 209 | const struct spi_mem_op *op) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 210 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 211 | memcpy_fromio(op->data.buf.in, priv->mm_base + op->addr.val, |
| 212 | op->data.nbytes); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 213 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 214 | return 0; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 215 | } |
| 216 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 217 | static int _stm32_qspi_tx(struct stm32_qspi_priv *priv, |
| 218 | const struct spi_mem_op *op, |
| 219 | u8 mode) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 220 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 221 | if (!op->data.nbytes) |
| 222 | return 0; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 223 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 224 | if (mode == STM32_QSPI_CCR_MEM_MAP) |
| 225 | return stm32_qspi_mm(priv, op); |
| 226 | |
| 227 | return _stm32_qspi_poll(priv, op); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 228 | } |
| 229 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 230 | static int _stm32_qspi_get_mode(u8 buswidth) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 231 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 232 | if (buswidth == 4) |
| 233 | return 3; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 234 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 235 | return buswidth; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 236 | } |
| 237 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 238 | static int stm32_qspi_exec_op(struct spi_slave *slave, |
| 239 | const struct spi_mem_op *op) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 240 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 241 | struct stm32_qspi_priv *priv = dev_get_priv(slave->dev->parent); |
| 242 | u32 cr, ccr, addr_max; |
| 243 | u8 mode = STM32_QSPI_CCR_IND_WRITE; |
| 244 | int timeout, ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 245 | |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 246 | dev_dbg(slave->dev, "cmd:%#x mode:%d.%d.%d.%d addr:%#llx len:%#x\n", |
| 247 | op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth, |
| 248 | op->dummy.buswidth, op->data.buswidth, |
| 249 | op->addr.val, op->data.nbytes); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 250 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 251 | addr_max = op->addr.val + op->data.nbytes + 1; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 252 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 253 | if (op->data.dir == SPI_MEM_DATA_IN && op->data.nbytes) { |
| 254 | if (addr_max < priv->mm_size && op->addr.buswidth) |
| 255 | mode = STM32_QSPI_CCR_MEM_MAP; |
| 256 | else |
| 257 | mode = STM32_QSPI_CCR_IND_READ; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 258 | } |
| 259 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 260 | if (op->data.nbytes) |
| 261 | writel(op->data.nbytes - 1, &priv->regs->dlr); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 262 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 263 | ccr = (mode << STM32_QSPI_CCR_FMODE_SHIFT); |
| 264 | ccr |= op->cmd.opcode; |
| 265 | ccr |= (_stm32_qspi_get_mode(op->cmd.buswidth) |
| 266 | << STM32_QSPI_CCR_IMODE_SHIFT); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 267 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 268 | if (op->addr.nbytes) { |
| 269 | ccr |= ((op->addr.nbytes - 1) << STM32_QSPI_CCR_ADSIZE_SHIFT); |
| 270 | ccr |= (_stm32_qspi_get_mode(op->addr.buswidth) |
| 271 | << STM32_QSPI_CCR_ADMODE_SHIFT); |
| 272 | } |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 273 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 274 | if (op->dummy.buswidth && op->dummy.nbytes) |
| 275 | ccr |= (op->dummy.nbytes * 8 / op->dummy.buswidth |
| 276 | << STM32_QSPI_CCR_DCYC_SHIFT); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 277 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 278 | if (op->data.nbytes) |
| 279 | ccr |= (_stm32_qspi_get_mode(op->data.buswidth) |
| 280 | << STM32_QSPI_CCR_DMODE_SHIFT); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 281 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 282 | writel(ccr, &priv->regs->ccr); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 283 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 284 | if (op->addr.nbytes && mode != STM32_QSPI_CCR_MEM_MAP) |
| 285 | writel(op->addr.val, &priv->regs->ar); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 286 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 287 | ret = _stm32_qspi_tx(priv, op, mode); |
| 288 | /* |
| 289 | * Abort in: |
| 290 | * -error case |
| 291 | * -read memory map: prefetching must be stopped if we read the last |
| 292 | * byte of device (device size - fifo size). like device size is not |
| 293 | * knows, the prefetching is always stop. |
| 294 | */ |
| 295 | if (ret || mode == STM32_QSPI_CCR_MEM_MAP) |
| 296 | goto abort; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 297 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 298 | /* Wait end of tx in indirect mode */ |
| 299 | ret = _stm32_qspi_wait_cmd(priv, op); |
| 300 | if (ret) |
| 301 | goto abort; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 302 | |
| 303 | return 0; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 304 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 305 | abort: |
| 306 | setbits_le32(&priv->regs->cr, STM32_QSPI_CR_ABORT); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 307 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 308 | /* Wait clear of abort bit by hw */ |
| 309 | timeout = readl_poll_timeout(&priv->regs->cr, cr, |
| 310 | !(cr & STM32_QSPI_CR_ABORT), |
| 311 | STM32_ABT_TIMEOUT_US); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 312 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 313 | writel(STM32_QSPI_FCR_CTCF, &priv->regs->fcr); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 314 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 315 | if (ret || timeout) |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 316 | dev_err(slave->dev, "ret:%d abort timeout:%d\n", ret, timeout); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 317 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 318 | return ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | static int stm32_qspi_probe(struct udevice *bus) |
| 322 | { |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 323 | struct stm32_qspi_priv *priv = dev_get_priv(bus); |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 324 | struct resource res; |
Patrice Chotard | 8e0497a | 2018-05-14 15:42:49 +0200 | [diff] [blame] | 325 | struct clk clk; |
Patrice Chotard | b38c897 | 2018-05-14 15:42:56 +0200 | [diff] [blame] | 326 | struct reset_ctl reset_ctl; |
Patrice Chotard | 8e0497a | 2018-05-14 15:42:49 +0200 | [diff] [blame] | 327 | int ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 328 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 329 | ret = dev_read_resource_byname(bus, "qspi", &res); |
| 330 | if (ret) { |
| 331 | dev_err(bus, "can't get regs base addresses(ret = %d)!\n", ret); |
| 332 | return ret; |
| 333 | } |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 334 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 335 | priv->regs = (struct stm32_qspi_regs *)res.start; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 336 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 337 | ret = dev_read_resource_byname(bus, "qspi_mm", &res); |
| 338 | if (ret) { |
| 339 | dev_err(bus, "can't get mmap base address(ret = %d)!\n", ret); |
| 340 | return ret; |
| 341 | } |
| 342 | |
| 343 | priv->mm_base = (void __iomem *)res.start; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 344 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 345 | priv->mm_size = resource_size(&res); |
| 346 | if (priv->mm_size > STM32_QSPI_MAX_MMAP_SZ) |
| 347 | return -EINVAL; |
| 348 | |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 349 | dev_dbg(bus, "regs=<0x%p> mapped=<0x%p> mapped_size=<0x%lx>\n", |
| 350 | priv->regs, priv->mm_base, priv->mm_size); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 351 | |
Vikas Manocha | 9f28b5c | 2017-04-10 15:02:50 -0700 | [diff] [blame] | 352 | ret = clk_get_by_index(bus, 0, &clk); |
| 353 | if (ret < 0) |
| 354 | return ret; |
| 355 | |
| 356 | ret = clk_enable(&clk); |
Vikas Manocha | 9f28b5c | 2017-04-10 15:02:50 -0700 | [diff] [blame] | 357 | if (ret) { |
| 358 | dev_err(bus, "failed to enable clock\n"); |
| 359 | return ret; |
| 360 | } |
Patrice Chotard | b8442fb | 2017-07-18 09:29:09 +0200 | [diff] [blame] | 361 | |
| 362 | priv->clock_rate = clk_get_rate(&clk); |
Patrick Delaunay | 0250207 | 2019-06-21 15:26:55 +0200 | [diff] [blame] | 363 | if (!priv->clock_rate) { |
Patrice Chotard | b8442fb | 2017-07-18 09:29:09 +0200 | [diff] [blame] | 364 | clk_disable(&clk); |
Patrick Delaunay | 0250207 | 2019-06-21 15:26:55 +0200 | [diff] [blame] | 365 | return -EINVAL; |
Patrice Chotard | b8442fb | 2017-07-18 09:29:09 +0200 | [diff] [blame] | 366 | } |
| 367 | |
Patrice Chotard | b38c897 | 2018-05-14 15:42:56 +0200 | [diff] [blame] | 368 | ret = reset_get_by_index(bus, 0, &reset_ctl); |
| 369 | if (ret) { |
| 370 | if (ret != -ENOENT) { |
| 371 | dev_err(bus, "failed to get reset\n"); |
| 372 | clk_disable(&clk); |
| 373 | return ret; |
| 374 | } |
| 375 | } else { |
| 376 | /* Reset QSPI controller */ |
| 377 | reset_assert(&reset_ctl); |
| 378 | udelay(2); |
| 379 | reset_deassert(&reset_ctl); |
| 380 | } |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 381 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 382 | priv->cs_used = -1; |
| 383 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 384 | setbits_le32(&priv->regs->cr, STM32_QSPI_CR_SSHIFT); |
| 385 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 386 | /* Set dcr fsize to max address */ |
| 387 | setbits_le32(&priv->regs->dcr, |
| 388 | STM32_QSPI_DCR_FSIZE_MASK << STM32_QSPI_DCR_FSIZE_SHIFT); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 389 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | static int stm32_qspi_claim_bus(struct udevice *dev) |
| 394 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 395 | struct stm32_qspi_priv *priv = dev_get_priv(dev->parent); |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 396 | struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); |
Venkatesh Yadav Abbarapu | 91b9e37 | 2024-09-26 10:25:05 +0530 | [diff] [blame] | 397 | int slave_cs = slave_plat->cs[0]; |
Christophe Kerello | e3b34cb | 2018-05-14 15:42:54 +0200 | [diff] [blame] | 398 | |
Patrick Delaunay | 0250207 | 2019-06-21 15:26:55 +0200 | [diff] [blame] | 399 | if (slave_cs >= STM32_QSPI_MAX_CHIP) |
Christophe Kerello | e3b34cb | 2018-05-14 15:42:54 +0200 | [diff] [blame] | 400 | return -ENODEV; |
| 401 | |
Patrick Delaunay | 0250207 | 2019-06-21 15:26:55 +0200 | [diff] [blame] | 402 | if (priv->cs_used != slave_cs) { |
Patrick Delaunay | 0250207 | 2019-06-21 15:26:55 +0200 | [diff] [blame] | 403 | priv->cs_used = slave_cs; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 404 | |
Patrice Chotard | e1c8565 | 2023-04-03 08:04:43 +0200 | [diff] [blame] | 405 | /* Set chip select */ |
| 406 | clrsetbits_le32(&priv->regs->cr, STM32_QSPI_CR_FSEL, |
| 407 | priv->cs_used ? STM32_QSPI_CR_FSEL : 0); |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 408 | } |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 409 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 410 | setbits_le32(&priv->regs->cr, STM32_QSPI_CR_EN); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 411 | |
| 412 | return 0; |
| 413 | } |
| 414 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 415 | static int stm32_qspi_release_bus(struct udevice *dev) |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 416 | { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 417 | struct stm32_qspi_priv *priv = dev_get_priv(dev->parent); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 418 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 419 | clrbits_le32(&priv->regs->cr, STM32_QSPI_CR_EN); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 420 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 421 | return 0; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | static int stm32_qspi_set_speed(struct udevice *bus, uint speed) |
| 425 | { |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 426 | struct stm32_qspi_priv *priv = dev_get_priv(bus); |
Patrick Delaunay | 0a86115 | 2018-05-14 15:42:50 +0200 | [diff] [blame] | 427 | u32 qspi_clk = priv->clock_rate; |
| 428 | u32 prescaler = 255; |
| 429 | u32 csht; |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 430 | int ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 431 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 432 | if (speed > 0) { |
Patrick Delaunay | 0250207 | 2019-06-21 15:26:55 +0200 | [diff] [blame] | 433 | prescaler = 0; |
| 434 | if (qspi_clk) { |
| 435 | prescaler = DIV_ROUND_UP(qspi_clk, speed) - 1; |
| 436 | if (prescaler > 255) |
| 437 | prescaler = 255; |
| 438 | } |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 439 | } |
| 440 | |
Patrick Delaunay | 0a86115 | 2018-05-14 15:42:50 +0200 | [diff] [blame] | 441 | csht = DIV_ROUND_UP((5 * qspi_clk) / (prescaler + 1), 100000000); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 442 | csht = (csht - 1) & STM32_QSPI_DCR_CSHT_MASK; |
| 443 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 444 | ret = _stm32_qspi_wait_for_not_busy(priv); |
| 445 | if (ret) |
| 446 | return ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 447 | |
| 448 | clrsetbits_le32(&priv->regs->cr, |
| 449 | STM32_QSPI_CR_PRESCALER_MASK << |
| 450 | STM32_QSPI_CR_PRESCALER_SHIFT, |
| 451 | prescaler << STM32_QSPI_CR_PRESCALER_SHIFT); |
| 452 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 453 | clrsetbits_le32(&priv->regs->dcr, |
| 454 | STM32_QSPI_DCR_CSHT_MASK << STM32_QSPI_DCR_CSHT_SHIFT, |
| 455 | csht << STM32_QSPI_DCR_CSHT_SHIFT); |
| 456 | |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 457 | dev_dbg(bus, "regs=%p, speed=%d\n", priv->regs, |
| 458 | (qspi_clk / (prescaler + 1))); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 459 | |
| 460 | return 0; |
| 461 | } |
| 462 | |
| 463 | static int stm32_qspi_set_mode(struct udevice *bus, uint mode) |
| 464 | { |
| 465 | struct stm32_qspi_priv *priv = dev_get_priv(bus); |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 466 | int ret; |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 467 | const char *str_rx, *str_tx; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 468 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 469 | ret = _stm32_qspi_wait_for_not_busy(priv); |
| 470 | if (ret) |
| 471 | return ret; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 472 | |
| 473 | if ((mode & SPI_CPHA) && (mode & SPI_CPOL)) |
| 474 | setbits_le32(&priv->regs->dcr, STM32_QSPI_DCR_CKMODE); |
| 475 | else if (!(mode & SPI_CPHA) && !(mode & SPI_CPOL)) |
| 476 | clrbits_le32(&priv->regs->dcr, STM32_QSPI_DCR_CKMODE); |
| 477 | else |
| 478 | return -ENODEV; |
| 479 | |
| 480 | if (mode & SPI_CS_HIGH) |
| 481 | return -ENODEV; |
| 482 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 483 | if (mode & SPI_RX_QUAD) |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 484 | str_rx = "quad"; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 485 | else if (mode & SPI_RX_DUAL) |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 486 | str_rx = "dual"; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 487 | else |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 488 | str_rx = "single"; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 489 | |
| 490 | if (mode & SPI_TX_QUAD) |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 491 | str_tx = "quad"; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 492 | else if (mode & SPI_TX_DUAL) |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 493 | str_tx = "dual"; |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 494 | else |
Patrick Delaunay | 72e220c | 2020-11-06 19:01:53 +0100 | [diff] [blame] | 495 | str_tx = "single"; |
| 496 | |
| 497 | dev_dbg(bus, "regs=%p, mode=%d rx: %s, tx: %s\n", |
| 498 | priv->regs, mode, str_rx, str_tx); |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 499 | |
| 500 | return 0; |
| 501 | } |
| 502 | |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 503 | static const struct spi_controller_mem_ops stm32_qspi_mem_ops = { |
| 504 | .exec_op = stm32_qspi_exec_op, |
| 505 | }; |
| 506 | |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 507 | static const struct dm_spi_ops stm32_qspi_ops = { |
| 508 | .claim_bus = stm32_qspi_claim_bus, |
| 509 | .release_bus = stm32_qspi_release_bus, |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 510 | .set_speed = stm32_qspi_set_speed, |
| 511 | .set_mode = stm32_qspi_set_mode, |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 512 | .mem_ops = &stm32_qspi_mem_ops, |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 513 | }; |
| 514 | |
| 515 | static const struct udevice_id stm32_qspi_ids[] = { |
Christophe Kerello | 4c00d55 | 2018-05-14 15:42:53 +0200 | [diff] [blame] | 516 | { .compatible = "st,stm32f469-qspi" }, |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 517 | { } |
| 518 | }; |
| 519 | |
| 520 | U_BOOT_DRIVER(stm32_qspi) = { |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 521 | .name = "stm32_qspi", |
| 522 | .id = UCLASS_SPI, |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 523 | .of_match = stm32_qspi_ids, |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 524 | .ops = &stm32_qspi_ops, |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 525 | .priv_auto = sizeof(struct stm32_qspi_priv), |
Christophe Kerello | 6958a0d | 2019-04-05 11:46:50 +0200 | [diff] [blame] | 526 | .probe = stm32_qspi_probe, |
Michael Kurz | 337ff2a | 2017-01-22 16:04:30 +0100 | [diff] [blame] | 527 | }; |