Lines Matching +full:conf +full:- +full:tx

4  * SPDX-License-Identifier: Apache-2.0
18 uint32_t conf; member
22 uint32_t tx; member
35 #define SPI_DATA(dev) ((struct data *) ((dev)->data))
48 if (config->slave != 0) { in spi_config()
50 return -ENOTSUP; in spi_config()
53 if (SPI_WORD_SIZE_GET(config->operation) != 8) { in spi_config()
55 return -ENOTSUP; in spi_config()
58 if (config->operation & SPI_CS_ACTIVE_HIGH) { in spi_config()
60 return -ENOTSUP; in spi_config()
63 if (config->operation & SPI_LOCK_ON) { in spi_config()
65 return -ENOTSUP; in spi_config()
68 if ((config->operation & SPI_LINES_MASK) != SPI_LINES_SINGLE) { in spi_config()
70 return -ENOTSUP; in spi_config()
73 if (config->operation & SPI_TRANSFER_LSB) { in spi_config()
75 return -ENOTSUP; in spi_config()
78 if (config->operation & (SPI_MODE_CPOL | SPI_MODE_CPHA)) { in spi_config()
80 return -ENOTSUP; in spi_config()
83 if (config->operation & SPI_OP_MODE_SLAVE) { in spi_config()
85 return -ENOTSUP; in spi_config()
88 if (config->operation & SPI_MODE_LOOP) { in spi_config()
90 return -ENOTSUP; in spi_config()
93 ctx->config = config; in spi_config()
103 const struct cfg *const cfg = dev->config; in transceive()
104 volatile struct spimctrl_regs *const regs = cfg->regs; in transceive()
105 struct spi_context *ctx = &SPI_DATA(dev)->ctx; in transceive()
120 regs->ctrl |= (CTRL_USRC | CTRL_IEN); in transceive()
121 regs->ctrl &= ~CTRL_CSN; in transceive()
124 txval = *ctx->tx_buf; in transceive()
130 regs->tx = txval; in transceive()
134 regs->ctrl |= CTRL_CSN; in transceive()
135 regs->ctrl &= ~CTRL_USRC; in transceive()
148 return -ENOTSUP; in transceive_async()
154 spi_context_unlock_unconditionally(&SPI_DATA(dev)->ctx); in release()
160 const struct cfg *const cfg = dev->config; in spim_isr()
161 volatile struct spimctrl_regs *const regs = cfg->regs; in spim_isr()
162 struct spi_context *ctx = &SPI_DATA(dev)->ctx; in spim_isr()
166 if ((regs->stat & STAT_DONE) == 0) { in spim_isr()
170 regs->stat = STAT_DONE; in spim_isr()
173 rx_byte = regs->rx; in spim_isr()
175 *ctx->rx_buf = rx_byte; in spim_isr()
180 regs->ctrl &= ~CTRL_IEN; in spim_isr()
187 val = *ctx->tx_buf; in spim_isr()
190 regs->tx = val; in spim_isr()
195 const struct cfg *const cfg = dev->config; in init()
196 volatile struct spimctrl_regs *const regs = cfg->regs; in init()
198 regs->ctrl = CTRL_CSN; in init()
199 while (regs->stat & STAT_BUSY) { in init()
202 regs->stat = STAT_DONE; in init()
205 cfg->interrupt, in init()
211 irq_enable(cfg->interrupt); in init()
213 spi_context_unlock_unconditionally(&SPI_DATA(dev)->ctx); in init()