40 #ifndef CSL_OSPI_V0_H_ 41 #define CSL_OSPI_V0_H_ 49 #include <ti/csl/cslr_ospi.h> 92 #define CSL_OSPI_CLK_MODE_0 (0U) 94 #define CSL_OSPI_CLK_MODE_1 (CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | \ 97 #define CSL_OSPI_CLK_MODE_2 (0U | \ 98 CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK) 100 #define CSL_OSPI_CLK_MODE_3 (CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_PHASE_FLD_MASK | \ 101 CSL_OSPI_FLASH_CFG_CONFIG_REG_SEL_CLK_POL_FLD_MASK) 117 #define CSL_OSPI_CS0 ((uint32_t) 0U) 119 #define CSL_OSPI_CS1 ((uint32_t) 1U) 121 #define CSL_OSPI_CS2 ((uint32_t) 2U) 123 #define CSL_OSPI_CS3 ((uint32_t) 3U) 138 #define CSL_OSPI_DECODER_SELECT4 ((uint32_t) 0U) 140 #define CSL_OSPI_DECODER_SELECT16 ((uint32_t) 1U) 156 #define CSL_OSPI_MEM_MAP_NUM_ADDR_BYTES_1 ((uint32_t) 0U) 158 #define CSL_OSPI_MEM_MAP_NUM_ADDR_BYTES_2 ((uint32_t) 1U) 160 #define CSL_OSPI_MEM_MAP_NUM_ADDR_BYTES_3 ((uint32_t) 2U) 162 #define CSL_OSPI_MEM_MAP_NUM_ADDR_BYTES_4 ((uint32_t) 3U) 177 #define CSL_OSPI_CFG_PHY_OP_MODE_DEFAULT ((uint32_t) 0U) 179 #define CSL_OSPI_CFG_PHY_OP_MODE_MASTER ((uint32_t) 1U) 181 #define CSL_OSPI_CFG_PHY_OP_MODE_BYPASS ((uint32_t) 2U) 195 #define CSL_OSPI_CFG_PHY_DLL_MODE_DEFAULT (CSL_OSPI_LOCK_CYCLE_HALF) 197 #define CSL_OSPI_LOCK_CYCLE_FULL ((uint16_t) 0U) 199 #define CSL_OSPI_LOCK_CYCLE_HALF ((uint16_t) 1U) 212 #define CSL_OSPI_CFG_XFER_LINES_SINGLE ((uint32_t) 0U) 214 #define CSL_OSPI_CFG_XFER_LINES_DUAL ((uint32_t) 1U) 216 #define CSL_OSPI_CFG_XFER_LINES_QUAD ((uint32_t) 2U) 218 #define CSL_OSPI_CFG_XFER_LINES_OCTAL ((uint32_t) 3U) 231 #define CSL_OSPI_CFG_PHY_SAMPLE_EDGE_DEFAULT (CSL_OSPI_CFG_PHY_SAMPLE_EDGE_FALLING) 233 #define CSL_OSPI_CFG_PHY_SAMPLE_EDGE_FALLING ((uint16_t) 0U) 235 #define CSL_OSPI_CFG_PHY_SAMPLE_EDGE_RISING ((uint16_t) 1U) 250 #define CSL_OSPI_WRITE_COMP_AUTO_POLLING_ENABLE ((uint32_t) 1U) 252 #define CSL_OSPI_WRITE_COMP_AUTO_POLLING_DISABLE ((uint32_t) 0U) 267 #define CSL_OSPI_INTR_MASK_MODE_M_FAIL (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_MODE_M_FAIL_FLD_MASK) 269 #define CSL_OSPI_INTR_MASK_UNDERFLOW_DET (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_UNDERFLOW_DET_FLD_MASK) 271 #define CSL_OSPI_INTR_MASK_IND_OP_DONE (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_INDIRECT_OP_DONE_FLD_MASK) 273 #define CSL_OSPI_INTR_MASK_IND_RD_REJECT (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_INDIRECT_READ_REJECT_FLD_MASK) 275 #define CSL_OSPI_INTR_MASK_PROT_WR_ATTEMPT (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_PROT_WR_ATTEMPT_FLD_MASK) 277 #define CSL_OSPI_INTR_MASK_ILLEGAL_ACCESS_DET (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_ILLEGAL_ACCESS_DET_FLD_MASK) 279 #define CSL_OSPI_INTR_MASK_IND_XFER_LVL_BREACH (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_INDIRECT_XFER_LEVEL_BREACH_FLD_MASK) 281 #define CSL_OSPI_INTR_MASK_RECV_OVERFLOW_DET (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_RECV_OVERFLOW_FLD_MASK) 283 #define CSL_OSPI_INTR_MASK_TX_FIFO_NOT_FULL (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_TX_FIFO_NOT_FULL_FLD_MASK) 285 #define CSL_OSPI_INTR_MASK_TX_FIFO_FULL (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_TX_FIFO_FULL_FLD_MASK) 287 #define CSL_OSPI_INTR_MASK_RX_FIFO_NOT_EMPTY (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_RX_FIFO_NOT_EMPTY_FLD_MASK) 289 #define CSL_OSPI_INTR_MASK_RX_FIFO_FULL (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_RX_FIFO_FULL_FLD_MASK) 291 #define CSL_OSPI_INTR_MASK_IND_RD_SRAM_FULL (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_INDRD_SRAM_FULL_FLD_MASK) 293 #define CSL_OSPI_INTR_MASK_POLL_EXP_INT (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_POLL_EXP_INT_FLD_MASK) 295 #define CSL_OSPI_INTR_MASK_IRQ_STAT_RESV (CSL_OSPI_FLASH_CFG_IRQ_STATUS_REG_IRQ_STAT_RESV_FLD_MASK) 308 #define CSL_OSPI_POLL_IDLE_TIMEOUT (5000U) 309 #define CSL_OSPI_POLL_IDLE_DELAY (1U) 310 #define CSL_OSPI_POLL_IDLE_RETRY (3U) 311 #define CSL_OSPI_REG_RETRY (10U) 312 #define CSL_OSPI_FIFO_WIDTH (4U) 317 #define CSL_OSPI_CMD_LEN_DEFAULT (1U) 318 #define CSL_OSPI_CMD_LEN_EXTENDED (5U) 319 #define CSL_OSPI_CHIP_SELECT(x) ((~((1U) << (x))) & 0xFU) 330 #define CSL_OSPI_BAUD_RATE_DIVISOR(x) (((x) - 2U) >> 1U) 331 #define CSL_OSPI_BAUD_RATE_DIVISOR_DEFAULT (CSL_OSPI_BAUD_RATE_DIVISOR(32U)) 336 #define CSL_OSPI_DEV_DELAY_ARRAY_SIZE (4U) 341 #define CSL_OSPI_DEV_DELAY_CSSOT (46U) 342 #define CSL_OSPI_DEV_DELAY_CSEOT (46U) 343 #define CSL_OSPI_DEV_DELAY_CSDADS (192U) 344 #define CSL_OSPI_DEV_DELAY_CSDA (192U) 352 #define CSL_OSPI_SRAM_SIZE_WORDS (128U) 353 #define CSL_OSPI_SRAM_PARTITION_RD (64U) 354 #define CSL_OSPI_SRAM_PARTITION_WR (CSL_OSPI_SRAM_SIZE_WORDS - \ 355 CSL_OSPI_SRAM_PARTITION_RD) 357 #define CSL_OSPI_SRAM_PARTITION_DEFAULT (CSL_OSPI_SRAM_PARTITION_RD - 1U) 364 #define CSL_OSPI_SRAM_WARERMARK_RD_LVL (CSL_OSPI_SRAM_PARTITION_RD / 4U) 367 #define CSL_OSPI_SRAM_WATERMARK_WR_LVL (CSL_OSPI_SRAM_PARTITION_WR / 4U) 370 #define CSL_OSPI_INTR_MASK_IND_XFER (CSL_OSPI_INTR_MASK_IND_OP_DONE | \ 371 CSL_OSPI_INTR_MASK_IND_XFER_LVL_BREACH | \ 372 CSL_OSPI_INTR_MASK_IND_RD_SRAM_FULL) 374 #define CSL_OSPI_INTR_MASK_ALL (CSL_OSPI_INTR_MASK_MODE_M_FAIL | \ 375 CSL_OSPI_INTR_MASK_UNDERFLOW_DET | \ 376 CSL_OSPI_INTR_MASK_IND_OP_DONE | \ 377 CSL_OSPI_INTR_MASK_IND_RD_REJECT | \ 378 CSL_OSPI_INTR_MASK_PROT_WR_ATTEMPT | \ 379 CSL_OSPI_INTR_MASK_ILLEGAL_ACCESS_DET | \ 380 CSL_OSPI_INTR_MASK_IND_XFER_LVL_BREACH | \ 381 CSL_OSPI_INTR_MASK_IND_RD_SRAM_FULL | \ 382 CSL_OSPI_INTR_MASK_POLL_EXP_INT) 388 #define CSL_OSPI_CMD_READ_SINGLE_DUMMY_CLOCKS (0U) 390 #define CSL_OSPI_CMD_READ_OCTAL_DUMMY_CLOCKS (8U) 396 #define CSL_OSPI_FLASH_CFG_PHY_MASTER_CONTROL_REG_PHY_MASTER_MODE (0U) 398 #define CSL_OSPI_FLASH_CFG_PHY_MASTER_CONTROL_REG_PHY_BYPASS_MODE (1U) 423 void CSL_ospiEnable(
const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable);
604 uint32_t numAddrBytes,
684 void CSL_ospiIntrEnable(
const CSL_ospi_flash_cfgRegs *pRegs, uint32_t intrFlag, uint32_t enable);
754 const uint8_t *cmdBuf,
757 uint32_t dummyCycles);
774 const uint8_t *cmdBuf,
776 const uint8_t *txBuf,
1001 uint32_t masterDelay,
1002 const uint32_t *pSlaveDelay);
1081 uint32_t opcodeMode);
1125 uint32_t *opcodeUp);
void CSL_ospiIntrClear(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t intrFlag)
This Function clears the status of specified interrupts.
void CSL_ospiSetDevDelay(const CSL_ospi_flash_cfgRegs *pRegs, const uint32_t *delays)
This function configures the device delays This can only be done if OSPI controller is idle.
void CSL_ospiIndWriteExecute(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t txLen)
Execute write operation in indirect transfer mode.
void CSL_ospiFlashStig(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t cmd, uint32_t addr, uint32_t data)
Set configurations for a flash STIG command.
void CSL_ospiIntrEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t intrFlag, uint32_t enable)
This Function enables/diables only specified OSPI interrupts.
void CSL_ospiSetCsSotDelay(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t delay)
Set the Chip Select Start of Transfer delay.
void CSL_ospiPhyResyncDll(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t lockCycle)
Resync the PHY DLLs after configuring the TX delays.
void CSL_ospiIndSetStartAddr(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t startAddr, uint32_t read)
Configure the read or wrtie start address in Indirect mode.
void CSL_ospiPhyEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
This function enables/disables the OSPI PHY mode.
void CSL_ospiSetDualByteOpcodeMode(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t opcodeMode)
Set the dual byte opcode mode.
uint32_t CSL_OspiChipSelect
Definition: csl_ospi.h:116
uint32_t CSL_OspiWriteCompAutoPolling
Definition: csl_ospi.h:249
uint32_t CSL_OspiDecSelect
Definition: csl_ospi.h:137
void CSL_ospiClrIndReadComplete(const CSL_ospi_flash_cfgRegs *pRegs)
Clear indirect read operation done status.
uint32_t CSL_ospiFlashExecCmdComplete(const CSL_ospi_flash_cfgRegs *pRegs)
Check the flash command execution status.
uint32_t CSL_ospiIndReadComplete(const CSL_ospi_flash_cfgRegs *pRegs)
Check if indirect read operation is done.
void CSL_ospiExtOpcodeGet(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t *opcodeLo, uint32_t *opcodeUp)
Get the dual byte opcode parameters.
void CSL_ospiSetPreScaler(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t clkDividerVal)
Set the OSPI clock register divider value.
void CSL_ospiLoopbackClkEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
Enable the adapted loopback clock circuit.
void CSL_ospiConfigPhyDLL(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t txDelay, uint32_t rxDelay, uint32_t opMode, uint32_t lockCycle, uint32_t funcClk)
Configure the PHY TX/RX DLL delays.
int32_t CSL_ospiCmdWrite(const CSL_ospi_flash_cfgRegs *pRegs, const uint8_t *cmdBuf, uint32_t cmdLen, const uint8_t *txBuf, uint32_t txLen)
Write operation in config mode.
void CSL_ospiSetWrCompAutoPolling(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t pollingState)
Set write completion auto polling configuration.
uint32_t CSL_OspiIntrMask
Definition: csl_ospi.h:266
void CSL_ospiIndWriteCancel(const CSL_ospi_flash_cfgRegs *pRegs)
Cancel write operation in indirect transfer mode.
void CSL_ospiConfigRead(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t cmd, uint32_t mode, uint32_t dummyClk)
Setup read operation transfer mode.
void CSL_ospiWriteSetup(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t cmd, uint32_t mode)
Setup write operation transfer mode.
void CSL_ospiSetPollingDummyCycles(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t dummyCycles)
Set write completion auto polling configuration.
void CSL_ospiExtOpcodeSet(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t opcodeLo, uint32_t opcodeUp)
Set the dual byte opcode parameters.
uint32_t CSL_OspiMemMapNumAddrBytes
Definition: csl_ospi.h:155
void CSL_ospiSetChipSelect(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t chipSelect, uint32_t decSelect)
This function configures the chip select polarity for a selected chip select. This can only be done i...
void CSL_ospiIndReadExecute(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t rxLen)
Execute read operation in indirect transfer mode.
void CSL_ospiClrIndWriteComplete(const CSL_ospi_flash_cfgRegs *pRegs)
Clear indirect write operation done status.
uint32_t CSL_ospiGetSramLvl(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t read)
This Function gets the OSPI SRAM FIFO fill level bytes.
void CSL_ospiSetModeBits(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t flashModeVal)
This function sets the Mode bits which are sent to the device following address.
char mode[32]
Definition: tisci_pm_core.h:130
void CSL_ospiReadFifoData(uintptr_t indAddr, uint8_t *dest, uint32_t rdLen)
Read data from the SRAM FIFO.
void CSL_ospiEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
This function enables/disables the OSPI By definition, target can handle read/write transaction as lo...
uint64_t addr
Definition: csl_udmap_tr.h:216
void CSL_ospiXipEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
This function enables/disables the OSPI XIP Controller.
int32_t CSL_ospiCmdRead(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t cmd, uint32_t rxLen)
Read operation in config mode.
uint32_t data[13]
Definition: csl_udmap_tr.h:625
uint32_t CSL_OspiClkMode
Definition: csl_ospi.h:91
void CSL_ospiSetDevSize(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t numAddrBytes, uint32_t pageSize, uint32_t blkSize)
Set device size configrations.
int32_t CSL_ospiCmdExtRead(const CSL_ospi_flash_cfgRegs *pRegs, const uint8_t *cmdBuf, uint32_t cmdLen, uint32_t rxLen, uint32_t dummyCycles)
Extended opcode read operation in config mode.
void CSL_ospiSetClkMode(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t clkMode)
This function configures the OSPI to work in different clock modes.
void CSL_ospiDacEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
This function enables/disables the OSPI Direct Access Controller.
void CSL_ospiFlashExecCmd(const CSL_ospi_flash_cfgRegs *pRegs)
Excecute the flash read/write command.
gptp_ipc_command_t cmd
Definition: gptpipc.h:140
void CSL_ospiSetSramPartition(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t partition)
Set SRAM partition configuration.
uint32_t CSL_OspiPhyOpMode
Definition: csl_ospi.h:176
uint32_t CSL_ospiIsIdle(const CSL_ospi_flash_cfgRegs *pRegs)
Check if OSPI is idle or not.
void CSL_ospiPipelinePhyEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
This function enables/disables the OSPI pipeline PHY mode.
void CSL_ospiWriteFifoData(uintptr_t indAddr, const uint8_t *src, uint32_t wrLen)
Write data to the SRAM FIFO.
uint32_t CSL_ospiGetDualByteOpcodeMode(const CSL_ospi_flash_cfgRegs *pRegs)
Get the dual byte opcode mode.
uint32_t CSL_ospiIntrStatus(const CSL_ospi_flash_cfgRegs *pRegs)
This function returns the status of interrupts. It specifies whether an interrupt is active or inacti...
void CSL_ospiDtrEnable(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t enable)
This function enables/disables the OSPI DTR protocol.
uint32_t CSL_ospiIsIndWriteComplete(const CSL_ospi_flash_cfgRegs *pRegs)
Check if indirect write operation is done.
void CSL_ospiSetDataReadCapDelay(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t delay)
Set the read data capture delay.
void CSL_ospiSetIndTrigAddr(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t indTrigAddr)
Set Indirect Trigger Address.
void CSL_ospiConfigPhy(const CSL_ospi_flash_cfgRegs *pRegs, uint32_t lockCycle, uint32_t masterDelay, const uint32_t *pSlaveDelay)
Configure the PHY.