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 dependend members in the nand chip description structure. See drivers/mtd/nand/skeleton for reference.

Basic defines

At least you have to provide a mtd structure and a storage for the ioremap'ed chip address. You can allocate the mtd structure using kmalloc or you can allocate it statically. In case of static allocation you have to allocate a nand_chip structure too.

Kmalloc based example

static struct mtd_info *board_mtd;
static unsigned long baseaddr;
		

Static example

static struct mtd_info board_mtd;
static struct nand_chip board_chip;
static unsigned long baseaddr;