Subject: Re: NAND flash support
To: Maen Suleiman <>
From: David Young <>
List: tech-embed
Date: 03/08/2007 15:51:26
On Tue, Mar 06, 2007 at 12:26:29AM +0200, Maen Suleiman wrote:
> Hi,
> How can I get please the status of the "NetBSD block device driver
> for NAND flash chips" project . is it possible to contribute to this
> project ?


I am preparing to write a driver for the 64-megabyte Hynix HY27US08121A
NAND Flash chip.  I will tell you what information appears essential so
far; maybe it will help you to start development on another chip.

The HY27US08121A has 4096 sectors of 16 kB bytes.  The sector is the
smallest erasable unit.  Each sector consists of 32 512-byte pages.  For
most practical purposes, the page is the smallest readable/writable unit.
Each page has 16 "spare" bytes.  That is, there are 528 bytes per page.
We can use the spare bytes for an error-correcting code or other page

My HY27US08121A is attached to the ADM5120 system on a chip on the
RouterBOARD 153, <>.

The ADM5120 registers for controlling the NAND Flash are not described
in the datasheet, however, this is what I surmise by reading some Linux

        Registers for controlling the NAND Flash begin at the 0th byte
            of the 'SRAM_1' region of physical memory
            (phys. addr. 0x10000000; see ADM5120 datasheet).
            The registers are 1 byte wide.

        Data is read/written from/to register 0.  Commands are written
            to register 0.

        CE# is lowered/raised by writing a 1 to register 1 or 2,
        CLE is likewise lowered/raised by registers 3 and 4.
        ALE, registers 5 and 6.
        SP#, registers 7 and 8 (note that the Hynix part has no SP#).
        WP#, registers 9 and 10.

        Status is read from register 11.

Jared McNeill has written a kernel framework for NAND/NOR Flash.  I will
start with that.

Once there are drivers for two or more NAND chips in NetBSD, we can
extract the functions that the drivers have in common and produce a
NAND framework.  (There may already be NAND drivers in the kernel that
I have overlooked.)


David Young             OJC Technologies      Urbana, IL * (217) 278-3933