36 #ifndef __MHAL_SPI_SLAVE__H__
37 #define __MHAL_SPI_SLAVE__H__
39 #include "mhal_osai.h"
596 #define SET_TRANSFER_H2DMB(x, y, z) \
597 ((0x1 << 6) | (x << 5) | (y << 4) | ((z) & 0xf))
602 #define SPIS_ELENGTH 2
610 #define SPIS_EH2DMB 6
spis_dma_done_callback dma_done_callback
This function is used to register user's DMA done callback to OS-HAL layer.
Definition: mhal_spis.h:792
dma_addr_t tx_dma
TX DMA physical addr, it's the PA of mtk_spis_transfer->tx_buf.
Definition: mhal_spis.h:781
int mtk_mhal_spis_handle_tx(struct mtk_spis_controller *ctlr)
This function is used to update spis TX transmisson status to d2hmb_state(defined in mtk_spis_private...
void * tx_buf
Data to be written (DMA-safe memory), or NULL.
Definition: mhal_spis.h:761
int mtk_mhal_spis_send_d2hmb(struct mtk_spis_controller *ctlr)
This function is used to update spis transmisson status.
int mtk_mhal_spis_fifo_transfer_one(struct mtk_spis_controller *ctlr, struct mtk_spis_transfer *xfer)
This function is used to perform a single mtk_spi_transfer by FIFO mode.
spis_tx_rx_flag
SPI slave's transmisson type.
Definition: mhal_spis.h:670
SPIM write data to SPIS(SPIS RX)
Definition: mhal_spis.h:674
spis_opcode
SPI slave's supported opcode.
Definition: mhal_spis.h:650
Used to record spis status and required resources during transmisson.
Definition: mhal_spis.h:775
void __iomem * base
spis controller base address
Definition: mhal_spis.h:800
Clock format is 0.
Definition: mhal_spis.h:641
void __iomem * cg_base
CG base address of this spis controller.
Definition: mhal_spis.h:802
enum spis_d2hmb_state d2hmb_state
D2HMB state, defined in spis_d2hmb_state.
Definition: mhal_spis.h:777
int mtk_mhal_spis_release_dma_chan(struct mtk_spis_controller *ctlr)
This function is used to release SPIS DMA channel.
void * user_data
user_data is a OS-HAL defined parameter provided by mtk_mhal_spim_dma_done_callback_register().
Definition: mhal_spim.h:336
int mtk_mhal_spis_get_irq_status(struct mtk_spis_controller *ctlr)
This function is used to get SPIS HW status.
Interface to SPI slave, it's used to pass arguments among OS-HAL/M-HAL/HDL.
Definition: mhal_spis.h:798
spim writes data to spis
Definition: mhal_spis.h:652
int mtk_mhal_spis_dump_reg(struct mtk_spis_controller *ctlr)
This function is used to dump spis register for debugging.
int mtk_mhal_spis_enable_irq(struct mtk_spis_controller *ctlr)
This function is used to enable SPIS HW interrupt.
struct mtk_spis_transfer * xfer
the mtk_spis_transfer
Definition: mhal_spis.h:812
int(* spis_dma_done_callback)(void *user_data)
This defines the callback function prototype.
Definition: mhal_spis.h:734
spim wants to write data
Definition: mhal_spis.h:706
spis_cpol
SPI slave's clock polarity definition.
Definition: mhal_spis.h:627
Clock format is 1.
Definition: mhal_spis.h:643
void * user_data
user_data is used to store spis hw setting.
Definition: mhal_spis.h:788
struct mtk_spis_private * mdata
M-HAL private structure, used by M-HAL only.
Definition: mhal_spis.h:814
int mtk_mhal_spis_allocate_dma_chan(struct mtk_spis_controller *ctlr)
This function is used to allocate SPIS DMA channel.
int mtk_mhal_spis_handle_rx(struct mtk_spis_controller *ctlr)
This function is used to update spis RX transmisson status to d2hmb_state(defined in mtk_spis_private...
The common configuration can be set for the SPIS HW.
Definition: mhal_spis.h:747
spis idle
Definition: mhal_spis.h:688
int mtk_mhal_spis_setup_hw(struct mtk_spis_controller *ctlr, struct mtk_spis_config *config)
This function is used to initialize SPIS HW based on *config settings.
spis_cpha
SPI slave's clock format definition.
Definition: mhal_spis.h:639
spim reads spis status
Definition: mhal_spis.h:656
spim sends H2DMB to spis
Definition: mhal_spis.h:662
spim wants to read data
Definition: mhal_spis.h:704
dma_addr_t rx_dma
RX DMA physical addr, it's the PA of mtk_spis_transfer->rx_buf.
Definition: mhal_spis.h:785
spis_direction_cmd
SPI transmission direction cmd definition.
Definition: mhal_spis.h:702
int mtk_mhal_spis_dma_transfer_one(struct mtk_spis_controller *ctlr, struct mtk_spis_transfer *xfer)
This function is used to perform a single mtk_spis_transfer by DMA mode.
int mtk_mhal_spis_enable_clk(struct mtk_spis_controller *ctlr)
This function is used to enable SPIS clock before transfer.
Clock polarity is 1.
Definition: mhal_spis.h:631
spis_d2hmb_state
SPI slave's supported transaction status.
Definition: mhal_spis.h:686
void * spis_tx_buf
Data to be written (DMA-safe memory), or NULL.
Definition: mhal_spis.h:808
int direction
Spim read or write data, 0: Read(spis TX), 1: Write(spis RX)
Definition: mhal_spis.h:767
SPIM write IRQ/MB to SPIS(SPIS RX)
Definition: mhal_spis.h:678
Clock polarity is 0.
Definition: mhal_spis.h:629
SPIM read data from SPIS(SPIS TX)
Definition: mhal_spis.h:672
void * spis_rx_buf
Data to be read (DMA-safe memory), or NULL.
Definition: mhal_spis.h:810
spis transfer error
Definition: mhal_spis.h:694
enum spis_cpol cpol
clock polarity
Definition: mhal_spis.h:749
I/O INTERFACE between SPI OS-HAL and M-HAL.
Definition: mhal_spis.h:759
int mtk_mhal_spis_clear_irq_status(struct mtk_spis_controller *ctlr)
This function is used to clear SPIS HW status.
spis preparation transfer ready
Definition: mhal_spis.h:690
int dma_rx_chan
RX DMA channel.
Definition: mhal_spis.h:806
spim sets spis irq
Definition: mhal_spis.h:658
void * rx_buf
Data to be read (DMA-safe memory), or NULL.
Definition: mhal_spis.h:763
spis transfer done
Definition: mhal_spis.h:692
int mtk_mhal_spis_disable_clk(struct mtk_spis_controller *ctlr)
This function is used to disable SPIS clock before transfer.
SPIM read SPIS_STATUS from SPIS(SPIS TX)
Definition: mhal_spis.h:676
unsigned int len
Size of rx and tx buffers (in bytes)
Definition: mhal_spis.h:765
int mtk_mhal_spis_handle_h2dmb(struct mtk_spis_controller *ctlr)
This function is used to handle H2DMB which is sent from spi master.
int use_dma
Spis support FIFO and DMA mode, 0:FIFO, 1: DMA.
Definition: mhal_spis.h:769
spim reads data from spis
Definition: mhal_spis.h:654
enum spis_cpha cpha
clock phase
Definition: mhal_spis.h:751
int mtk_mhal_spis_dma_done_callback_register(struct mtk_spis_controller *ctlr, spis_dma_done_callback callback)
This function is used to register user's DMA callback to M-HAL.
int dma_tx_chan
TX DMA channel.
Definition: mhal_spis.h:804
spim clears spis D2HMB
Definition: mhal_spis.h:660