Lines Matching refs:regs

22 	QMSPI_Type *regs;  member
40 static inline uint32_t descr_rd(QMSPI_Type *regs, uint32_t did) in descr_rd() argument
42 uintptr_t raddr = (uintptr_t)regs + MCHP_QMSPI_DESC0_OFS + in descr_rd()
48 static inline void descr_wr(QMSPI_Type *regs, uint32_t did, uint32_t val) in descr_wr() argument
50 uintptr_t raddr = (uintptr_t)regs + MCHP_QMSPI_DESC0_OFS + in descr_wr()
56 static inline void txb_wr8(QMSPI_Type *regs, uint8_t data8) in txb_wr8() argument
58 REG8(&regs->TX_FIFO) = data8; in txb_wr8()
61 static inline uint8_t rxb_rd8(QMSPI_Type *regs) in rxb_rd8() argument
63 return REG8(&regs->RX_FIFO); in rxb_rd8()
72 static void qmspi_set_frequency(QMSPI_Type *regs, uint32_t freq_hz) in qmspi_set_frequency() argument
87 qmode = regs->MODE & ~(MCHP_QMSPI_M_FDIV_MASK); in qmspi_set_frequency()
89 regs->MODE = qmode; in qmspi_set_frequency()
123 static void qmspi_set_signalling_mode(QMSPI_Type *regs, uint32_t smode) in qmspi_set_signalling_mode() argument
129 if (((regs->MODE >> MCHP_QMSPI_M_FDIV_POS) & in qmspi_set_signalling_mode()
135 regs->MODE = (regs->MODE & ~(MCHP_QMSPI_M_SIG_MASK)) in qmspi_set_signalling_mode()
181 QMSPI_Type *regs = cfg->regs; in qmspi_configure() local
202 regs->CTRL = smode; in qmspi_configure()
205 qmspi_set_frequency(regs, config->frequency); in qmspi_configure()
216 qmspi_set_signalling_mode(regs, smode); in qmspi_configure()
223 smode = regs->MODE & ~(MCHP_QMSPI_M_CS_MASK); in qmspi_configure()
229 regs->MODE = smode; in qmspi_configure()
232 regs->CSTM = cfg->cs_timing; in qmspi_configure()
236 regs->MODE |= MCHP_QMSPI_M_ACTIVATE; in qmspi_configure()
249 static int qmspi_tx_dummy_clocks(QMSPI_Type *regs, uint32_t nclocks) in qmspi_tx_dummy_clocks() argument
253 ifm = regs->CTRL & MCHP_QMSPI_C_IFM_MASK; in qmspi_tx_dummy_clocks()
264 descr_wr(regs, 0, descr); in qmspi_tx_dummy_clocks()
266 regs->CTRL |= MCHP_QMSPI_C_DESCR_EN; in qmspi_tx_dummy_clocks()
267 regs->IEN = 0; in qmspi_tx_dummy_clocks()
268 regs->STS = 0xfffffffful; in qmspi_tx_dummy_clocks()
270 regs->EXE = MCHP_QMSPI_EXE_START; in qmspi_tx_dummy_clocks()
272 qstatus = regs->STS; in qmspi_tx_dummy_clocks()
327 static int qmspi_descr_alloc(QMSPI_Type *regs, const struct spi_buf *txb, in qmspi_descr_alloc() argument
342 descr = (regs->CTRL & MCHP_QMSPI_C_IFM_MASK); in qmspi_descr_alloc()
368 descr_wr(regs, didx, descr); in qmspi_descr_alloc()
382 static int qmspi_tx(QMSPI_Type *regs, const struct spi_buf *tx_buf, in qmspi_tx() argument
396 return qmspi_tx_dummy_clocks(regs, tlen); in qmspi_tx()
399 didx = qmspi_descr_alloc(regs, tx_buf, 0, true); in qmspi_tx()
408 descr = descr_rd(regs, didx) | MCHP_QMSPI_C_DESCR_LAST; in qmspi_tx()
412 descr_wr(regs, didx, descr); in qmspi_tx()
414 regs->CTRL = (regs->CTRL & MCHP_QMSPI_C_IFM_MASK) | in qmspi_tx()
416 regs->IEN = 0; in qmspi_tx()
417 regs->STS = 0xfffffffful; in qmspi_tx()
422 txb_wr8(regs, *p); in qmspi_tx()
425 if (regs->STS & MCHP_QMSPI_STS_TXBF_RO) { in qmspi_tx()
430 regs->EXE = MCHP_QMSPI_EXE_START; in qmspi_tx()
432 if (regs->STS & MCHP_QMSPI_STS_PROG_ERR) { in qmspi_tx()
438 while (regs->STS & MCHP_QMSPI_STS_TXBF_RO) { in qmspi_tx()
441 txb_wr8(regs, *p); in qmspi_tx()
448 if (regs->STS & MCHP_QMSPI_STS_DONE) { in qmspi_tx()
456 static int qmspi_rx(QMSPI_Type *regs, const struct spi_buf *rx_buf, in qmspi_rx() argument
469 didx = qmspi_descr_alloc(regs, rx_buf, 0, false); in qmspi_rx()
478 descr = descr_rd(regs, didx) | MCHP_QMSPI_C_DESCR_LAST; in qmspi_rx()
482 descr_wr(regs, didx, descr); in qmspi_rx()
484 regs->CTRL = (regs->CTRL & MCHP_QMSPI_C_IFM_MASK) in qmspi_rx()
486 regs->IEN = 0; in qmspi_rx()
487 regs->STS = 0xfffffffful; in qmspi_rx()
497 regs->EXE = MCHP_QMSPI_EXE_START; in qmspi_rx()
498 if (regs->STS & MCHP_QMSPI_STS_PROG_ERR) { in qmspi_rx()
503 if (!(regs->STS & MCHP_QMSPI_STS_RXBE_RO)) { in qmspi_rx()
504 data_byte = rxb_rd8(regs); in qmspi_rx()
522 QMSPI_Type *regs = cfg->regs; in qmspi_transceive() local
542 err = qmspi_tx(regs, ptx, false); in qmspi_transceive()
554 err = qmspi_rx(regs, prx, false); in qmspi_transceive()
568 last_didx = (regs->STS >> MCHP_QMSPI_C_NEXT_DESCR_POS) in qmspi_transceive()
570 descr = descr_rd(regs, last_didx) | MCHP_QMSPI_C_CLOSE; in qmspi_transceive()
571 descr_wr(regs, last_didx, descr); in qmspi_transceive()
572 regs->EXE = MCHP_QMSPI_EXE_STOP; in qmspi_transceive()
606 QMSPI_Type *regs = cfg->regs; in qmspi_release() local
609 regs->EXE = MCHP_QMSPI_EXE_STOP; in qmspi_release()
611 while (regs->STS & MCHP_QMSPI_STS_ACTIVE_RO) { in qmspi_release()
631 QMSPI_Type *regs = cfg->regs; in qmspi_init() local
642 regs->MODE = MCHP_QMSPI_M_SRST; in qmspi_init()
689 .regs = (QMSPI_Type *)DT_INST_REG_ADDR(0),