blob: e30184b73f4e474fdb4b8f3ce9b6d4de1b8e47de [file] [log] [blame]
Sandeep Paulraj2d4072c2009-08-15 11:20:58 -04001/*
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#include <common.h>
19#include <nand.h>
20#include <linux/io.h>
21#include <asm/arch/hardware.h>
22#include <asm/arch/emif_defs.h>
23#include <asm/arch/nand_defs.h>
24#include "../common/misc.h"
25
26DECLARE_GLOBAL_DATA_PTR;
27
28int board_init(void)
29{
30 gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DM365_EVM;
31 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
32
33 return 0;
34}
35
36#ifdef CONFIG_NAND_DAVINCI
37static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
38{
39 struct nand_chip *this = mtd->priv;
40 u32 wbase = (u32) this->IO_ADDR_W;
41 u32 rbase = (u32) this->IO_ADDR_R;
42
43 if (chip == 1) {
44 __set_bit(14, &wbase);
45 __set_bit(14, &rbase);
46 } else {
47 __clear_bit(14, &wbase);
48 __clear_bit(14, &rbase);
49 }
50 this->IO_ADDR_W = (void *)wbase;
51 this->IO_ADDR_R = (void *)rbase;
52}
53
54int board_nand_init(struct nand_chip *nand)
55{
56 davinci_nand_init(nand);
57 nand->select_chip = nand_dm365evm_select_chip;
58 return 0;
59}
60#endif