NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

StarterWare NAND Driver

From Texas Instruments Wiki
Jump to: navigation, search

TIBanner.png

Features supported[edit]

  • Support for NAND ONFI standard
  • DMA mode of operation

Features not supported[edit]

  • No support for BCH 4 Bit 16 Bit ECC.
  • No support for small page NAND.

StarterWare NAND Support[edit]

Memory controller like GPMC, EMIFA, which supports NAND protolcols for NAND data read/write. StarterWare contains software support for NAND by providing:

  • Device Abstraction Layer
  • NAND protocol abstraction layer
  • NAND controller abstraction layer
  • Application
  • NAND Boot support


NANDFrameWork.JPG

Device Abstraction Layer[edit]

The memory controller device abstration layer provides register layer access for the controller on the SoC. This layer only contains APIs for register level access.

NAND Abstraction Layer[edit]

Overview[edit]

The NAND Abstraction Layer contains two parts.

  • NAND controller abstraction

The NAND controller abstraction layer provides a method for abstracting the controller specifics from the application and also increase reusability and quick start for the application. Thus, the application need not worry about every step to initialize the controller, need not worry about mapping the NAND commands to be sent to the controller. The controller abstraction layer takes care of the controller specifics

  • NAND protocol abstraction

The NAND protocol abstraction layer provides a method for abstracting the NAND protocol specifics from the application and also increase reusability and quick start for the application. Thus, the application need not worry about each command to be sent to the NAND. The NAND protocol abstraction layer provides APIs that can be used to perform operations (like erase, write, read etc). The NAND protocol abstraction layer then maps the NAND commands to controller specifics and sends the command via the controller.


Design[edit]

The NAND abstraction layer is designed two facilitate mainly

  • Abstract the user/application from NAND protocol, to quickstart application development
  • Easy Integration with the lower level controller specifics and support multiple NAND controllers
  • A simple stack like approach for easy enhancements/improvements
  • Two files make up the abstraction layer

Two files make up the abstraction layer

  • nandlib.c - contains abstraction layer/APIs for the NAND protocol. This layer implements the commands for reset, read id, block erase, page read, page write, and so on.
  • nand_gpmc.c - contains abstraction layer/APIs for the GPMC controller on the SoC. This layer implements a mapping from the NAND protocol to suit the controller register layer. This involves controller initialization sequence, and so on

The NAND abstraction layer contains the following main data objects.

  • nandDevInfo - This holds the NAND specific details like pagesize, blkSize, waitpin, chip select region address, chip select region size, data, command and address register etc. Some are populated by the user about the device connected like chip select on which device is interfaced, data/cmd/address register address etcand some are initialized as part read id command. These details are used to initialize the controller, to send commands etc. For example, using page size, ECC calculation iterations can be calculated as controller expects only 512 bytes for the ECC calculation. Also NAND protocal layer uses data, address and commmand register address to send command, address and data. Bus width can be used to setup the bus for transfer.
  • nandCtrlInfo - This holds the controller specific details that are populated by the user about the underlying controller. Details like the memory base address of the controller, current active chip select and ecc supported by the controller.
  • nandInfo - This holds the consolidated information(nand device and controller info). It also contains the controller specific method hooks for various operations like, controller initialization, controller ecc initialization, controller data transfer/DMA preparation, ECC enable/disable, ECC read/write set, ECC calculation and correction and so on.

Though the abstraction layer is intended to increase reusability of code acrros platforms, owing to the principles of StarterWare, the application still have a major role to play. Neither the DAL nor the abstraction layers are concerned/impose any restriction of the mode of data transfer (DMA/Polled), type of DMA of used etc. Thus the application/user - the sole owner and cognizant of these details/methods, is required to provide these details/implemenent these methods. These are provided as part of the callback functions in the nandInfo. Also application/user is responsible for initialization the fields in nandInfo structure.

Multiple NAND support[edit]

GPMC supports interfacing multiple NAND in the system. Current NAND driver design is such that application can communicate with any NAND device by just initializing/changing the curCS (current active chip select) in the controller info(nandCtrlInfo) data object.

Programming Sequence[edit]

Following are the steps need to follow to use the NANDLIB services in the application.

  1. Instantiate the NANDInfo object.
  2. Put the default value of chip select in NANDDevInfo object using NANDDevInfoDefaultValSet().
  3. Initialize the members of NANDDevInfo and NANDCtrlInfo objects.
  4. Assign/Initialize the proper controller abstraction layer functions to the hookfunctions of NANDInfo object.
  5. Initialize the controller using NANDCtrlInit() which inturn calls register controller abstraction layer function.
  6. Initialize the ECC using NANDECCInit() which inturn calls register controller abstraction layer function.
  7. Reset the NAND using NANDResetDevice().
  8. Read the device ID of the NAND using NANDIdRead() which initializes some members of NANDDevInfo like devId, manId, busWidth, pageSize, blkSize, pagesPerBlk.
  9. For read/write, do the follwoing --
    1. Check whether block is bad or not using NANDBadBlockCheck().
    2. Erase the block using NANDBlockErase().
    3. If erase operation fails, then mark that block as BAD using NANDMarkBlockAsBad().
    4. Write the page data to NAND using NANDPageWrite().
    5. Read the page data of NAND using NANDPageRead().

NOTE : Mode of operation(DMA or Polled), ECC algorithm to use need to initialize (before calling NANDCtrlInit()) as part of object initialization.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article StarterWare NAND Driver here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article StarterWare NAND Driver here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article StarterWare NAND Driver here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article StarterWare NAND Driver here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article StarterWare NAND Driver here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article StarterWare NAND Driver here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article StarterWare NAND Driver here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article StarterWare NAND Driver here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article StarterWare NAND Driver here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity