]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/quad100hd/nand.c
Samsung: Goni: change maintainer to Robert Baldyga
[karo-tx-uboot.git] / board / quad100hd / nand.c
1 /*
2  * (C) Copyright 2008
3  * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <config.h>
10 #if defined(CONFIG_CMD_NAND)
11 #include <asm/ppc4xx-gpio.h>
12 #include <asm/io.h>
13 #include <nand.h>
14
15 /*
16  *      hardware specific access to control-lines
17  */
18 static void quad100hd_hwcontrol(struct mtd_info *mtd,
19                                 int cmd, unsigned int ctrl)
20 {
21         struct nand_chip *this = mtd->priv;
22
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));
27         }
28
29         if (cmd != NAND_CMD_NONE)
30                 writeb(cmd, this->IO_ADDR_W);
31 }
32
33 static int quad100hd_nand_ready(struct mtd_info *mtd)
34 {
35         return gpio_read_in_bit(CONFIG_SYS_NAND_RDY);
36 }
37
38 /*
39  * Main initialization routine
40  */
41 int board_nand_init(struct nand_chip *nand)
42 {
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;
49
50         /* Return happy */
51         return 0;
52 }
53 #endif /* CONFIG_CMD_NAND */