1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <common.h>
20#include <nand.h>
21#include <asm/io.h>
22#include <asm/arch/hardware.h>
23#include <asm/arch/emif_defs.h>
24#include <asm/arch/nand_defs.h>
25#include <asm/arch/gpio_defs.h>
26#include <netdev.h>
27#include "../common/misc.h"
28
29DECLARE_GLOBAL_DATA_PTR;
30
31int board_init(void)
32{
33 gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DM365_EVM;
34 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
35
36 return 0;
37}
38
39#ifdef CONFIG_DRIVER_TI_EMAC
40int board_eth_init(bd_t *bis)
41{
42 uint8_t eeprom_enetaddr[6];
43 int i;
44 struct davinci_gpio *gpio1_base =
45 (struct davinci_gpio *)DAVINCI_GPIO_BANK01;
46
47
48 writel((readl(PINMUX3) | 0x1affff), PINMUX3);
49
50
51 writel((readl(&gpio1_base->dir) & ~(1 << 20)), &gpio1_base->dir);
52
53
54 for (i = 0; i < 20; i++) {
55
56 writel((readl(&gpio1_base->out_data) & ~(1 << 20)),
57 &gpio1_base->out_data);
58
59 udelay(1000);
60
61
62 writel((readl(&gpio1_base->out_data) | (1 << 20)),
63 &gpio1_base->out_data);
64 }
65
66
67 writel((readl(PINMUX3) | 0x01400000), PINMUX3);
68
69
70 if (dvevm_read_mac_address(eeprom_enetaddr))
71 dv_configure_mac_address(eeprom_enetaddr);
72
73 davinci_emac_initialize();
74
75 return 0;
76}
77#endif
78
79#ifdef CONFIG_NAND_DAVINCI
80static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
81{
82 struct nand_chip *this = mtd->priv;
83 unsigned long wbase = (unsigned long) this->IO_ADDR_W;
84 unsigned long rbase = (unsigned long) this->IO_ADDR_R;
85
86 if (chip == 1) {
87 __set_bit(14, &wbase);
88 __set_bit(14, &rbase);
89 } else {
90 __clear_bit(14, &wbase);
91 __clear_bit(14, &rbase);
92 }
93 this->IO_ADDR_W = (void *)wbase;
94 this->IO_ADDR_R = (void *)rbase;
95}
96
97int board_nand_init(struct nand_chip *nand)
98{
99 davinci_nand_init(nand);
100 nand->select_chip = nand_dm365evm_select_chip;
101 return 0;
102}
103#endif
104