![]() |
nandpsu
Vitis Drivers API Documentation
|
This file implements a driver to support Arasan NAND controller present in Zynq Ultrascale Mp. Driver Initialization
The function call XNandPsu_CfgInitialize() should be called by the application before any other function in the driver. The initialization function takes device specific data (like device id, instance id, and base address) and initializes the XNandPsu instance with the device specific data.
Device Geometry
NAND flash device is memory device and it is segmented into areas called Logical Unit(s) (LUN) and further in to blocks and pages. A NAND flash device can have multiple LUN. LUN is sequential raw of multiple blocks of the same size. A block is the smallest erasable unit of data within the Flash array of a LUN. The size of each block is based on a power of 2. There is no restriction on the number of blocks within the LUN. A block contains a number of pages. A page is the smallest addressable unit for read and program operations. The arrangement of LUN, blocks, and pages is referred to by this module as the part's geometry.
The cells within the part can be programmed from a logic 1 to a logic 0 and not the other way around. To change a cell back to a logic 1, the entire block containing that cell must be erased. When a block is erased all bytes contain the value 0xFF. The number of times a block can be erased is finite. Eventually the block will wear out and will no longer be capable of erasure. As of this writing, the typical flash block can be erased 100,000 or more times.
The jobs done by this driver typically are:
Write Operation
The write call can be used to write a minimum of one byte and a maximum entire flash. If the address offset specified to write is out of flash or if the number of bytes specified from the offset exceed flash boundaries an error is reported back to the user. The write is blocking in nature in that the control is returned back to user only after the write operation is completed successfully or an error is reported.
Read Operation
The read call can be used to read a minimum of one byte and maximum of entire flash. If the address offset specified to read is out of flash or if the number of bytes specified from the offset exceed flash boundaries an error is reported back to the user. The read is blocking in nature in that the control is returned back to user only after the read operation is completed successfully or an error is reported.
Erase Operation
The erase operations are provided to erase a Block in the Flash memory. The erase call is blocking in nature in that the control is returned back to user only after the erase operation is completed successfully or an error is reported.
This driver is intended to be RTOS and processor independent. It works with physical addresses only. Any needs for dynamic memory management, threads, mutual exclusion, virtual memory, cache control, or HW write protection management must be satisfied by the layer above this driver.
MODIFICATION HISTORY:
Ver Who Date Changes
1.0 nm 05/06/2014 First release 2.0 sb 01/12/2015 Removed Null checks for Buffer passed as parameter to Read API's
1.6 sd 20/03/20 Added compilation flag 1.8 sg 03/18/21 Added validation check for parameter page. 1.9 akm 07/15/21 Initialize NandInstPtr with Data Interface & Timing mode info. 1.10 akm 10/20/21 Fix gcc warnings. 1.10 akm 12/21/21 Validate input parameters before use. 1.10 akm 01/05/22 Remove assert checks form static and internal APIs. 1.11 akm 03/31/22 Fix unused parameter warning. 1.11 akm 03/31/22 Fix misleading-indentation warning. 1.12 akm 06/27/23 Update the driver to support for system device-tree flow. 1.13 akm 02/13/24 Ensure buffer cache sync. 1.13 akm 02/13/24 Avoid loop counter reset. 1.13 akm 02/13/24 Always wrap page to device size.