3 * Matthias Fuchs, esd gmbh germany, matthias.fuchs@esd-electronics.com
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)
31 * hardware specific access to control-lines
33 static void esd405ep_nand_hwcontrol(struct mtd_info
*mtdinfo
, int cmd
)
37 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) | CFG_NAND_CLE
);
40 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) & ~CFG_NAND_CLE
);
43 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) | CFG_NAND_ALE
);
46 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) & ~CFG_NAND_ALE
);
49 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) & ~CFG_NAND_CE
);
52 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) | CFG_NAND_CE
);
59 * read device ready pin
61 static int esd405ep_nand_device_ready(struct mtd_info
*mtdinfo
)
63 if (in_be32((void *)GPIO0_IR
) & CFG_NAND_RDY
)
69 int board_nand_init(struct nand_chip
*nand
)
72 * Set NAND-FLASH GPIO signals to defaults
74 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) & ~(CFG_NAND_CLE
| CFG_NAND_ALE
));
75 out_be32((void *)GPIO0_OR
, in_be32((void *)GPIO0_OR
) | CFG_NAND_CE
);
78 * Initialize nand_chip structure
80 nand
->hwcontrol
= esd405ep_nand_hwcontrol
;
81 nand
->dev_ready
= esd405ep_nand_device_ready
;
82 nand
->eccmode
= NAND_ECC_SOFT
;
83 nand
->chip_delay
= NAND_BIG_DELAY_US
;
84 nand
->options
= NAND_SAMSUNG_LP_OPTIONS
;