diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-05-10 15:43:01 -0700 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2009-07-07 17:58:03 -0500 |
commit | 154b5484ac7dcbcd0fb5ba388d930b02f87fa302 (patch) | |
tree | 84e4960c2c10d441ec2a287447214d8ae51ac194 /board | |
parent | 496863b2440dd7cd69a1ad2443a9badd5f8968d1 (diff) | |
download | u-boot-imx-154b5484ac7dcbcd0fb5ba388d930b02f87fa302.zip u-boot-imx-154b5484ac7dcbcd0fb5ba388d930b02f87fa302.tar.gz u-boot-imx-154b5484ac7dcbcd0fb5ba388d930b02f87fa302.tar.bz2 |
davinci_nand chipselect/init cleanup
Update chipselect handling in davinci_nand.c so that it can
handle 2 GByte chips the same way Linux does: as one device,
even though it has two halves with independent chip selects.
For such chips the "nand info" command reports:
Device 0: 2x nand0, sector size 128 KiB
Switch to use the default chipselect function unless the board
really needs its own. The logic for the Sonata board moves out
of the driver into board-specific code. (Which doesn't affect
current build breakage if its NAND support is enabled...)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/davinci/sonata/sonata.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/board/davinci/sonata/sonata.c b/board/davinci/sonata/sonata.c index 7f9d9bb..817970a 100644 --- a/board/davinci/sonata/sonata.c +++ b/board/davinci/sonata/sonata.c @@ -25,6 +25,8 @@ */ #include <common.h> +#include <nand.h> +#include <asm/arch/nand_defs.h> #include <asm/arch/hardware.h> #include "../common/misc.h" @@ -72,3 +74,29 @@ int misc_init_r(void) return(0); } + +#ifdef CONFIG_NAND_DAVINCI + +/* Set WP on deselect, write enable on select */ +static void nand_sonata_select_chip(struct mtd_info *mtd, int chip) +{ +#define GPIO_SET_DATA01 0x01c67018 +#define GPIO_CLR_DATA01 0x01c6701c +#define GPIO_NAND_WP (1 << 4) +#ifdef SONATA_BOARD_GPIOWP + if (chip < 0) { + REG(GPIO_CLR_DATA01) |= GPIO_NAND_WP; + } else { + REG(GPIO_SET_DATA01) |= GPIO_NAND_WP; + } +#endif +} + +int board_nand_init(struct nand_chip *nand) +{ + davinci_nand_init(nand); + nand->select_chip = nand_sonata_select_chip; + return 0; +} + +#endif /* CONFIG_NAND_DAVINCI */ |