bsps: Add Xilinx GQSPI flash helper

This adds helper functions for working with NOR flash connected to the
Xilinx GQSPI controller. The helper functions are based on Xilinx's
QSPIPSU flash interrupt example.
This commit is contained in:
Alex White
2023-01-08 14:24:25 -06:00
committed by Joel Sherrill
parent fd2f9d40b5
commit d55c131965
4 changed files with 2136 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
/******************************************************************************
* Copyright (C) 2018 - 2022 Xilinx, Inc. All rights reserved.
* SPDX-License-Identifier: MIT
******************************************************************************/
#include "xqspipsu.h"
int QspiPsu_NOR_Initialize(
XQspiPsu *QspiPsuInstancePtr,
u16 QspiPsuIntrId
);
/*****************************************************************************/
/**
*
* This function erases the sectors in the serial Flash connected to the
* QSPIPSU interface.
*
* @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
* @param Address contains the address of the first sector which needs to
* be erased.
* @param ByteCount contains the total size to be erased.
*
* @return XST_SUCCESS if successful, else XST_FAILURE.
*
* @note None.
*
******************************************************************************/
int QspiPsu_NOR_Erase(
XQspiPsu *QspiPsuPtr,
u32 Address,
u32 ByteCount
);
/*****************************************************************************/
/**
*
* This function writes to the serial Flash connected to the QSPIPSU interface.
* All the data put into the buffer must be in the same page of the device with
* page boundaries being on 256 byte boundaries.
*
* @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
* @param Address contains the address to write data to in the Flash.
* @param ByteCount contains the number of bytes to write.
* @param WriteBfrPtr is pointer to the write buffer (which is to be transmitted)
*
* @return XST_SUCCESS if successful, else XST_FAILURE.
*
* @note None.
*
******************************************************************************/
int QspiPsu_NOR_Write(
XQspiPsu *QspiPsuPtr,
u32 Address,
u32 ByteCount,
u8 *WriteBfrPtr
);
/*****************************************************************************/
/**
*
* This function performs a read. Default setting is in DMA mode.
*
* @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
* @param Address contains the address of the first sector which needs to
* be erased.
* @param ByteCount contains the total size to be erased.
* @param ReadBfrPtr is pointer to the read buffer to which valid received data
* should be written
*
* @return XST_SUCCESS if successful, else XST_FAILURE.
*
* @note None.
*
******************************************************************************/
int QspiPsu_NOR_Read(
XQspiPsu *QspiPsuPtr,
u32 Address,
u32 ByteCount,
u8 **ReadBfrPtr
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,32 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
build-type: objects
cflags: []
copyrights:
- Copyright (C) 2022 On-Line Applications Research (OAR)
cppflags: []
cxxflags: []
enabled-by: true
includes:
- bsps/include/dev/spi/
- bsps/include/xil/
- bsps/include/xil/${XIL_SUPPORT_PATH}/
install:
- destination: ${BSP_INCLUDEDIR}/dev/spi
source:
- bsps/include/dev/spi/xqspipsu_control.h
- bsps/include/dev/spi/xqspipsu_flash_config.h
- bsps/include/dev/spi/xqspipsu_hw.h
- bsps/include/dev/spi/xqspipsu-flash-helper.h
- bsps/include/dev/spi/xqspipsu.h
links:
- role: build-dependency
uid: objxilinxsupport
- role: build-dependency
uid: optxpssysctrlbaseaddress
source:
- bsps/shared/dev/spi/xqspipsu_control.c
- bsps/shared/dev/spi/xqspipsu_hw.c
- bsps/shared/dev/spi/xqspipsu_options.c
- bsps/shared/dev/spi/xqspipsu-flash-helper.c
- bsps/shared/dev/spi/xqspipsu.c
type: build

View File

@@ -0,0 +1,18 @@
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
actions:
- get-integer: null
- assert-uint32: null
- env-assign: null
- format-and-define: null
build-type: option
copyrights:
- Copyright (C) 2022 On-Line Applications Research Corporation (OAR)
default: 0xFF180000
default-by-variant: []
description: |
base address of XPS
enabled-by: true
format: '{:#010x}'
links: []
name: XPS_SYS_CTRL_BASEADDR
type: build