3 * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de
5 * SPDX-License-Identifier: GPL-2.0+
10 #if defined(CONFIG_CMD_NAND)
11 #include <asm/ppc4xx-gpio.h>
16 * hardware specific access to control-lines
18 static void quad100hd_hwcontrol(struct mtd_info *mtd,
19 int cmd, unsigned int ctrl)
21 struct nand_chip *this = mtd->priv;
23 if (ctrl & NAND_CTRL_CHANGE) {
24 gpio_write_bit(CONFIG_SYS_NAND_CLE, !!(ctrl & NAND_CLE));
25 gpio_write_bit(CONFIG_SYS_NAND_ALE, !!(ctrl & NAND_ALE));
26 gpio_write_bit(CONFIG_SYS_NAND_CE, !(ctrl & NAND_NCE));
29 if (cmd != NAND_CMD_NONE)
30 writeb(cmd, this->IO_ADDR_W);
33 static int quad100hd_nand_ready(struct mtd_info *mtd)
35 return gpio_read_in_bit(CONFIG_SYS_NAND_RDY);
39 * Main initialization routine
41 int board_nand_init(struct nand_chip *nand)
43 /* Set address of hardware control function */
44 nand->cmd_ctrl = quad100hd_hwcontrol;
45 nand->dev_ready = quad100hd_nand_ready;
46 nand->ecc.mode = NAND_ECC_SOFT;
47 /* 15 us command delay time */
48 nand->chip_delay = 20;
53 #endif /* CONFIG_CMD_NAND */