Chapter 4. Basic board driver

Table of Contents

Basic defines
Partition defines
Hardware control function
Device ready function
Init function
Exit function

For most boards it will be sufficient to provide just the basic functions and fill out some really board dependent members in the nand chip description structure.

Basic defines

At least you have to provide a nand_chip structure and a storage for the ioremap'ed chip address. You can allocate the nand_chip structure using kmalloc or you can allocate it statically. The NAND chip structure embeds an mtd structure which will be registered to the MTD subsystem. You can extract a pointer to the mtd structure from a nand_chip pointer using the nand_to_mtd() helper.

Kmalloc based example

static struct mtd_info *board_mtd;
static void __iomem *baseaddr;
		

Static example

static struct nand_chip board_chip;
static void __iomem *baseaddr;