189#include "xil_cache.h"
191#if defined (XCLOCKING)
192#include "xil_clocking.h"
195#include <bsp/xil-compat.h>
247#if defined (XCLOCKING)
290#define BYTES256_PER_PAGE 256U
291#define BYTES512_PER_PAGE 512U
292#define BYTES1024_PER_PAGE 1024U
293#define PAGES16_PER_SECTOR 16U
294#define PAGES128_PER_SECTOR 128U
295#define PAGES256_PER_SECTOR 256U
296#define PAGES512_PER_SECTOR 512U
297#define PAGES1024_PER_SECTOR 1024U
298#define NUM_OF_SECTORS2 2U
299#define NUM_OF_SECTORS4 4U
300#define NUM_OF_SECTORS8 8U
301#define NUM_OF_SECTORS16 16U
302#define NUM_OF_SECTORS32 32U
303#define NUM_OF_SECTORS64 64U
304#define NUM_OF_SECTORS128 128U
305#define NUM_OF_SECTORS256 256U
306#define NUM_OF_SECTORS512 512U
307#define NUM_OF_SECTORS1024 1024U
308#define NUM_OF_SECTORS2048 2048U
309#define NUM_OF_SECTORS4096 4096U
310#define NUM_OF_SECTORS8192 8192U
311#define SECTOR_SIZE_64K 0X10000U
312#define SECTOR_SIZE_128K 0X20000U
313#define SECTOR_SIZE_256K 0X40000U
314#define SECTOR_SIZE_512K 0X80000U
317#define XQSPIPSU_READMODE_DMA 0x0U
318#define XQSPIPSU_READMODE_IO 0x1U
320#define XQSPIPSU_SELECT_FLASH_CS_LOWER 0x1U
321#define XQSPIPSU_SELECT_FLASH_CS_UPPER 0x2U
322#define XQSPIPSU_SELECT_FLASH_CS_BOTH 0x3U
324#define XQSPIPSU_SELECT_FLASH_BUS_LOWER 0x1U
325#define XQSPIPSU_SELECT_FLASH_BUS_UPPER 0x2U
326#define XQSPIPSU_SELECT_FLASH_BUS_BOTH 0x3U
328#define XQSPIPSU_SELECT_MODE_SPI 0x1U
329#define XQSPIPSU_SELECT_MODE_DUALSPI 0x2U
330#define XQSPIPSU_SELECT_MODE_QUADSPI 0x4U
332#define XQSPIPSU_GENFIFO_CS_SETUP 0x05U
333#define XQSPIPSU_GENFIFO_CS_HOLD 0x04U
335#define XQSPIPSU_CLK_ACTIVE_LOW_OPTION 0x2U
336#define XQSPIPSU_CLK_PHASE_1_OPTION 0x4U
337#define XQSPIPSU_MANUAL_START_OPTION 0x8U
339#define XQSPIPSU_LQSPI_MODE_OPTION 0x20U
341#define XQSPIPSU_LQSPI_LESS_THEN_SIXTEENMB 1U
344#define XQSPIPSU_GENFIFO_EXP_START 0x100U
346#define XQSPIPSU_DMA_BYTES_MAX 0x10000000U
348#define XQSPIPSU_CLK_PRESCALE_2 0x00U
349#define XQSPIPSU_CLK_PRESCALE_4 0x01U
350#define XQSPIPSU_CLK_PRESCALE_8 0x02U
351#define XQSPIPSU_CLK_PRESCALE_16 0x03U
352#define XQSPIPSU_CLK_PRESCALE_32 0x04U
353#define XQSPIPSU_CLK_PRESCALE_64 0x05U
354#define XQSPIPSU_CLK_PRESCALE_128 0x06U
355#define XQSPIPSU_CLK_PRESCALE_256 0x07U
356#define XQSPIPSU_CR_PRESC_MAXIMUM 7U
358#define XQSPIPSU_CONNECTION_MODE_SINGLE 0U
359#define XQSPIPSU_CONNECTION_MODE_STACKED 1U
360#define XQSPIPSU_CONNECTION_MODE_PARALLEL 2U
363#define XQSPIPSU_FREQ_37_5MHZ 37500000U
364#define XQSPIPSU_FREQ_40MHZ 40000000U
365#define XQSPIPSU_FREQ_100MHZ 100000000U
366#define XQSPIPSU_FREQ_150MHZ 150000000U
369#define XQSPIPSU_MSG_FLAG_STRIPE 0x1U
370#define XQSPIPSU_MSG_FLAG_RX 0x2U
371#define XQSPIPSU_MSG_FLAG_TX 0x4U
372#define XQSPIPSU_MSG_FLAG_POLL 0x8U
374#define XQSPIPSU_RXADDR_OVER_32BIT 0x100000000U
376#define XQSPIPSU_SET_WP 1
381#define XQspiPsu_Select(InstancePtr, Mask) \
382 XQspiPsu_Out32(((InstancePtr)->Config.BaseAddress) + \
383 XQSPIPSU_SEL_OFFSET, (Mask))
388#define XQspiPsu_Enable(InstancePtr) \
389 XQspiPsu_Out32(((InstancePtr)->Config.BaseAddress) + \
390 XQSPIPSU_EN_OFFSET, XQSPIPSU_EN_MASK)
394#define XQspiPsu_Disable(InstancePtr) \
395 XQspiPsu_Out32(((InstancePtr)->Config.BaseAddress) + \
396 XQSPIPSU_EN_OFFSET, 0x0U)
402#define XQspiPsu_GetLqspiConfigReg(InstancePtr) \
403 XQspiPsu_In32((XQSPIPS_BASEADDR) + \
404 XQSPIPSU_LQSPI_CR_OFFSET)
419static inline void XQspiPsu_ManualStartEnable(
XQspiPsu *InstancePtr)
421 Xil_AssertVoid(InstancePtr != NULL);
422 Xil_AssertVoid(InstancePtr->
IsReady == XIL_COMPONENT_IS_READY);
424 xil_printf(
"\nXQspiPsu_ManualStartEnable\r\n");
429 xil_printf(
"\nManual Start\r\n");
433 XQSPIPSU_CFG_START_GEN_FIFO_MASK);
448static inline void XQspiPsu_GenFifoEntryCSAssert(
const XQspiPsu *InstancePtr)
452 Xil_AssertVoid(InstancePtr != NULL);
453 Xil_AssertVoid(InstancePtr->
IsReady == XIL_COMPONENT_IS_READY);
455 xil_printf(
"\nXQspiPsu_GenFifoEntryCSAssert\r\n");
459 GenFifoEntry |= (XQSPIPSU_GENFIFO_MODE_SPI | InstancePtr->
GenFifoCS |
462 xil_printf(
"\nFifoEntry=%08x\r\n", GenFifoEntry);
480static inline void XQspiPsu_GenFifoEntryCSDeAssert(
const XQspiPsu *InstancePtr)
484 Xil_AssertVoid(InstancePtr != NULL);
485 Xil_AssertVoid(InstancePtr->
IsReady == XIL_COMPONENT_IS_READY);
487 xil_printf(
"\nXQspiPsu_GenFifoEntryCSDeAssert\r\n");
491 GenFifoEntry |= (XQSPIPSU_GENFIFO_MODE_SPI | InstancePtr->
GenFifoBus |
494 xil_printf(
"\nFifoEntry=%08x\r\n", GenFifoEntry);
516static inline void StubStatusHandler(
const void *CallBackRef, u32 StatusEvent,
519 (
const void) CallBackRef;
523 Xil_AssertVoidAlways();
531 UINTPTR EffectiveAddr);
void XQspiPsu_SetStatusHandler(XQspiPsu *InstancePtr, void *CallBackRef, XQspiPsu_StatusHandler FuncPointer)
Definition: xqspipsu.c:890
s32 XQspiPsu_ClearOptions(XQspiPsu *InstancePtr, u32 Options)
Definition: xqspipsu_options.c:214
XQspiPsu_Config XQspiPsu_ConfigTable[XPAR_XQSPIPSU_NUM_INSTANCES]
void XQspiPsu_WriteProtectToggle(const XQspiPsu *InstancePtr, u32 Toggle)
This API enables/ disables Write Protect pin on the flash parts.
Definition: xqspipsu.c:918
#define XQSPIPSU_CFG_OFFSET
Definition: xqspipsu_hw.h:100
void XQspiPsu_SelectFlash(XQspiPsu *InstancePtr, u8 FlashCS, u8 FlashBus)
Definition: xqspipsu_options.c:381
s32 XQspiPsu_SetReadMode(XQspiPsu *InstancePtr, u32 Mode)
Definition: xqspipsu_options.c:457
#define XQSPIPSU_GEN_FIFO_OFFSET
Definition: xqspipsu_hw.h:491
void XQspiPsu_Idle(const XQspiPsu *InstancePtr)
Definition: xqspipsu.c:211
void XQspiPsu_SetWP(const XQspiPsu *InstancePtr, u8 Value)
Definition: xqspipsu_options.c:519
#define XQspiPsu_WriteReg(BaseAddress, RegOffset, RegisterValue)
Definition: xqspipsu_hw.h:1001
s32 XQspiPsu_PolledTransfer(XQspiPsu *InstancePtr, XQspiPsu_Msg *Msg, u32 NumMsg)
Definition: xqspipsu.c:449
s32 XQspiPsu_InterruptTransfer(XQspiPsu *InstancePtr, XQspiPsu_Msg *Msg, u32 NumMsg)
Definition: xqspipsu.c:604
s32 XQspiPsu_CheckDmaDone(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:1047
#define XQSPIPSU_GENFIFO_CS_HOLD
Definition: xqspipsu.h:333
s32 XQspiPsu_StartDmaTransfer(XQspiPsu *InstancePtr, XQspiPsu_Msg *Msg, u32 NumMsg)
Definition: xqspipsu.c:958
void XQspiPsu_Reset(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:251
s32 XQspiPsu_CfgInitialize(XQspiPsu *InstancePtr, const XQspiPsu_Config *ConfigPtr, UINTPTR EffectiveAddr)
Definition: xqspipsu.c:131
void(* XQspiPsu_StatusHandler)(const void *CallBackRef, u32 StatusEvent, u32 ByteCount)
Definition: xqspipsu.h:217
s32 XQspiPsu_SetClkPrescaler(const XQspiPsu *InstancePtr, u8 Prescaler)
Definition: xqspipsu_options.c:319
#define XQSPIPSU_GENFIFO_CS_SETUP
Definition: xqspipsu.h:332
s32 XQspiPsu_InterruptHandler(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:700
void XQspiPsu_Abort(XQspiPsu *InstancePtr)
Definition: xqspipsu.c:278
u32 XQspiPsu_GetOptions(const XQspiPsu *InstancePtr)
Definition: xqspipsu_options.c:278
#define XQspiPsu_ReadReg(BaseAddress, RegOffset)
Definition: xqspipsu_hw.h:983
s32 XQspiPsu_SetOptions(XQspiPsu *InstancePtr, u32 Options)
Definition: xqspipsu_options.c:116
Definition: xqspipsu.h:240
u8 IsCacheCoherent
Definition: xqspipsu.h:246
UINTPTR BaseAddress
Definition: xqspipsu.h:242
u16 DeviceId
Definition: xqspipsu.h:241
u32 InputClockHz
Definition: xqspipsu.h:243
u8 ConnectionMode
Definition: xqspipsu.h:244
u8 BusWidth
Definition: xqspipsu.h:245
Definition: xqspipsu.h:223
u8 * TxBfrPtr
Definition: xqspipsu.h:224
u8 PollData
Definition: xqspipsu.h:229
u8 * RxBfrPtr
Definition: xqspipsu.h:225
u32 Flags
Definition: xqspipsu.h:228
u8 PollBusMask
Definition: xqspipsu.h:232
u32 ByteCount
Definition: xqspipsu.h:226
u8 PollStatusCmd
Definition: xqspipsu.h:231
u64 RxAddr64bit
Definition: xqspipsu.h:233
u32 PollTimeout
Definition: xqspipsu.h:230
u8 Xfer64bit
Definition: xqspipsu.h:234
u32 BusWidth
Definition: xqspipsu.h:227
Definition: xqspipsu.h:257
u32 GenFifoBus
Definition: xqspipsu.h:274
u8 IsManualstart
Definition: xqspipsu.h:278
s32 IsUnaligned
Definition: xqspipsu.h:277
XQspiPsu_Msg * Msg
Definition: xqspipsu.h:279
u8 * SendBufferPtr
Definition: xqspipsu.h:261
XQspiPsu_StatusHandler StatusHandler
Definition: xqspipsu.h:280
s32 TxBytes
Definition: xqspipsu.h:265
u8 * RecvBufferPtr
Definition: xqspipsu.h:262
u64 RecvBuffer
Definition: xqspipsu.h:263
XQspiPsu_Config Config
Definition: xqspipsu.h:258
void * StatusRef
Definition: xqspipsu.h:281
u32 IsBusy
Definition: xqspipsu.h:271
u32 ReadMode
Definition: xqspipsu.h:272
s32 GenFifoEntries
Definition: xqspipsu.h:267
s32 RxBytes
Definition: xqspipsu.h:266
s32 MsgCnt
Definition: xqspipsu.h:276
u32 GenFifoCS
Definition: xqspipsu.h:273
u8 * GenFifoBufferPtr
Definition: xqspipsu.h:264
u32 IsReady
Definition: xqspipsu.h:259
s32 NumMsg
Definition: xqspipsu.h:275