]> git.sur5r.net Git - u-boot/blob - board/davinci/dm365evm/dm365evm.c
Merge branch 'arm/master' into arm/next
[u-boot] / board / davinci / dm365evm / dm365evm.c
1 /*
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 <asm/arch/hardware.h>
21 #include <asm/arch/emif_defs.h>
22 #include <asm/arch/nand_defs.h>
23 #include "../common/misc.h"
24
25 DECLARE_GLOBAL_DATA_PTR;
26
27 int board_init(void)
28 {
29         gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DM365_EVM;
30         gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
31
32         return 0;
33 }
34
35 #ifdef CONFIG_NAND_DAVINCI
36 static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
37 {
38         struct nand_chip        *this = mtd->priv;
39         u32                     wbase = (u32) this->IO_ADDR_W;
40         u32                     rbase = (u32) this->IO_ADDR_R;
41
42         if (chip == 1) {
43                 __set_bit(14, &wbase);
44                 __set_bit(14, &rbase);
45         } else {
46                 __clear_bit(14, &wbase);
47                 __clear_bit(14, &rbase);
48         }
49         this->IO_ADDR_W = (void *)wbase;
50         this->IO_ADDR_R = (void *)rbase;
51 }
52
53 int board_nand_init(struct nand_chip *nand)
54 {
55         davinci_nand_init(nand);
56         nand->select_chip = nand_dm365evm_select_chip;
57         return 0;
58 }
59 #endif