Lines Matching defs:op
137 static int stm32_qspi_wait_cmd(const struct spi_mem_op *op)
179 static int stm32_qspi_poll(const struct spi_mem_op *op)
185 if (op->data.dir == SPI_MEM_DATA_IN) {
191 buf = (uint8_t *)op->data.buf;
193 for (len = op->data.nbytes; len != 0U; len--) {
210 static int stm32_qspi_mm(const struct spi_mem_op *op)
212 memcpy(op->data.buf,
213 (void *)(stm32_qspi.mm_base + (size_t)op->addr.val),
214 op->data.nbytes);
219 static int stm32_qspi_tx(const struct spi_mem_op *op, uint8_t mode)
221 if (op->data.nbytes == 0U) {
226 return stm32_qspi_mm(op);
229 return stm32_qspi_poll(op);
241 static int stm32_qspi_exec_op(const struct spi_mem_op *op)
250 __func__, op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
251 op->dummy.buswidth, op->data.buswidth,
252 op->addr.val, op->data.nbytes);
254 addr_max = op->addr.val + op->data.nbytes + 1U;
256 if ((op->data.dir == SPI_MEM_DATA_IN) && (op->data.nbytes != 0U)) {
258 (op->addr.buswidth != 0U)) {
265 if (op->data.nbytes != 0U) {
266 mmio_write_32(qspi_base() + QSPI_DLR, op->data.nbytes - 1U);
270 ccr |= op->cmd.opcode;
271 ccr |= stm32_qspi_get_mode(op->cmd.buswidth) << QSPI_CCR_IMODE_SHIFT;
273 if (op->addr.nbytes != 0U) {
274 ccr |= (op->addr.nbytes - 1U) << QSPI_CCR_ADSIZE_SHIFT;
275 ccr |= stm32_qspi_get_mode(op->addr.buswidth) <<
279 if ((op->dummy.buswidth != 0U) && (op->dummy.nbytes != 0U)) {
280 ccr |= (op->dummy.nbytes * 8U / op->dummy.buswidth) <<
284 if (op->data.nbytes != 0U) {
285 ccr |= stm32_qspi_get_mode(op->data.buswidth) <<
291 if ((op->addr.nbytes != 0U) && (mode != QSPI_CCR_MEM_MAP)) {
292 mmio_write_32(qspi_base() + QSPI_AR, op->addr.val);
295 ret = stm32_qspi_tx(op, mode);
309 ret = stm32_qspi_wait_cmd(op);
331 ERROR("%s: exec op error\n", __func__);