[U-Boot] [PATCH v2] mtd: nand: new base driver for memory mapped nand devices

Wolfgang Denk wd at denx.de
Wed May 6 22:51:18 CEST 2009


Dear Mike Frysinger,

In message <1241615121-15945-1-git-send-email-vapier at gentoo.org> you wrote:
> The BF537-STAMP Blackfin board had a driver for working with NAND devices
> that are simply memory mapped.  Since there is nothing Blackfin specific
> about this, generalize the driver a bit so that everyone can leverage it.
> 
> Signed-off-by: Mike Frysinger <vapier at gentoo.org>
...

> diff --git a/drivers/mtd/nand/nand_plat.c b/drivers/mtd/nand/nand_plat.c
> new file mode 100644
> index 0000000..9a0e4c0
> --- /dev/null
> +++ b/drivers/mtd/nand/nand_plat.c
> @@ -0,0 +1,53 @@
> +/*
> + * Genericish driver for memory mapped NAND devices

Genericish ?

...
> +#define NAND_PLAT_WRITE_CMD(cmd, chip) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd)
> +#define NAND_PLAT_WRITE_ADR(cmd, chip) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd)
> +#define NAND_PLAT_DEV_READY(chip)      ((*pPORTFIO & BFIN_NAND_READY) ? 1 : 0)
> +#define NAND_PLAT_INIT() \
> +	do { \
> +		*pPORTF_FER &= ~BFIN_NAND_READY; \
> +		*pPORTFIO_DIR &= ~BFIN_NAND_READY; \
> +		*pPORTFIO_INEN |= BFIN_NAND_READY; \
> +	} while (0)

Please use I/O accessors instead of pointers.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All repairs tend to destroy the structure, to  increase  the  entropy
and  disorder  of the system. Less and less effort is spent on fixing
original design flaws; more and more is spent on fixing flaws  intro-
duced by earlier fixes.       - Fred Brooks, "The Mythical Man Month"


More information about the U-Boot mailing list