]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/quad100hd/nand.c
3 * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #if defined(CONFIG_CMD_NAND)
32 * hardware specific access to control-lines
34 static void quad100hd_hwcontrol(struct mtd_info
*mtd
,
35 int cmd
, unsigned int ctrl
)
37 struct nand_chip
*this = mtd
->priv
;
39 if (ctrl
& NAND_CTRL_CHANGE
) {
40 gpio_write_bit(CONFIG_SYS_NAND_CLE
, !!(ctrl
& NAND_CLE
));
41 gpio_write_bit(CONFIG_SYS_NAND_ALE
, !!(ctrl
& NAND_ALE
));
42 gpio_write_bit(CONFIG_SYS_NAND_CE
, !(ctrl
& NAND_NCE
));
45 if (cmd
!= NAND_CMD_NONE
)
46 writeb(cmd
, this->IO_ADDR_W
);
49 static int quad100hd_nand_ready(struct mtd_info
*mtd
)
51 return gpio_read_in_bit(CONFIG_SYS_NAND_RDY
);
55 * Main initialization routine
57 int board_nand_init(struct nand_chip
*nand
)
59 /* Set address of hardware control function */
60 nand
->cmd_ctrl
= quad100hd_hwcontrol
;
61 nand
->dev_ready
= quad100hd_nand_ready
;
62 nand
->ecc
.mode
= NAND_ECC_SOFT
;
63 /* 15 us command delay time */
64 nand
->chip_delay
= 20;
69 #endif /* CONFIG_CMD_NAND */