Chapter 59. Micron MT29F family NAND chips
Table of Contents
CYGPKG_DEVS_NAND_MICRON_MT29F driver package currently
provides support for the Micron MT29F2G08 NAND flash chip, and
is intended to be expanded to provide support for more of the MT29F family.
Most users will not need to interact with this package; it should be included as a hardware dependency on all appropriate targets. This package provides only inline code fragments which are intended to be included and instantiated by the target platform HAL and provided with appropriate board-specific low-level functions allowing it to access the hardware.
59.2. Using this driver in a board port
This driver's top-level chip support is currently provided as three files:
Prototypes the low-level chip access functions required by the chip driver and declares a private struct for use by the driver.
Implements high-level chip functions and includes mt29f_generic_lp.inl. This file is not intended to be compiled on its own, but to be included by the source file in a platform HAL which implements the low-level functions.
Implements those high-level chip functions which are specific to large-page chips, completing the driver and exposing it via the
CYG_NAND_FUNSmacro. This file is not intended to be compiled or included directly by platform code.
A platform HAL would typically make use of this driver in a single source file with the following steps:
- Declare a local private struct with contents as appropriate,
- implement the required low-level functions,
declare a list of the supported
mt29f_subtypewhich may appear on the board, terminated by
declare a static instance of the
mt29f_privstruct containing pointers to that list and to an instance of the local-private struct
finally, instantiate the chip with the
CYG_NAND_DEVICEmacro, selecting the ECC and OOB semantics to use.
If there is more than one chip available on the board, each needs its own CYG_NAND_DEVICE with a distinct name and device name, its own instance of the mt29f_priv struct.
For more details about the infrastructure provided by the NAND layer and the semantics it expects of the chip driver, refer to Chapter 52, eCos NAND Flash Library.
59.2.1. Memory usage
As discussed in Section 54.2, “High-level (chip) functions”, the chip
initialisation function must set up the
pointer in the cyg_nand_device struct. This driver does so
by including a large byte array in the mt29f_priv
struct whose size is controlled by CDL depending on the enabled
That struct is intended to be allocated as a static struct in the
data or BSS segment (one per chip), which avoids adding a dependency
59.2.2. Low-level functions required from the platform HAL
These functions are prototyped in
They have no return value ("void"), except for
read_data_1 which returns the byte it has read.
Writes a single command byte to the chip's command latch.
write_addrbytes(device, pointer to bytes, number of bytes)
Writes a number of address bytes in turn to the chip's address latch.
read_data_bulk(device, output pointer, number of bytes)
Reads data from the device, respectively a single byte and in bulk.
write_data_bulk(device, data pointer, number of bytes)
Writes data to the device, respectively a single byte and in bulk.
wait_ready_or_time(device, initial delay, fallback time)
Wait for the chip to signal READY line or, if this line is not available, fall back to a worst-case time delay (measured in microseconds).
Wait for the chip to signal READY line or, if this line is not available, enter a loop waiting for its Status register (ANDed with the given mask) to be non-zero.
Hooks for any board-specific locking which may be required in addition to the NAND library's chip-level locking. (This would be useful if, for example, access to multiple chips was mediated by a single set of GPIO lines which ought not to be invoked concurrently.)
Board-level platform initialisation hook. This is called very early on in the chip initialisation routine; it should set up any locking required by the devlock and devunlock functions, interrupts for the driver and any further lines required to access the chip as approprate. Once this has returned, the chip driver assumes that the platform is fully prepared for it to call the other chip access functions.
Board-level partition initialisation hook. This should set up the
partitionarray of the device struct in a way which is appropriate to the platform. For example, the partitions may be set as fixed ranges of blocks, or by CDL. This is called at the end of the chip initialisation routine and may, for example, call into the chip to read out a "partition table" if one is present on the board. If you do not set up partitions, applications will not be able to use the high-level chip access functions provided the NAND library.
|2019-04-28||Open Publication License|