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.
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.
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.
21 #include <asm/arch/hardware.h>
22 #include <asm/arch/emif_defs.h>
23 #include <asm/arch/nand_defs.h>
24 #include <asm/arch/gpio_defs.h>
26 #include "../common/misc.h"
28 DECLARE_GLOBAL_DATA_PTR;
32 gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DM365_EVM;
33 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
38 #ifdef CONFIG_DRIVER_TI_EMAC
39 int board_eth_init(bd_t *bis)
41 uint8_t eeprom_enetaddr[6];
43 struct davinci_gpio *gpio1_base =
44 (struct davinci_gpio *)DAVINCI_GPIO_BANK01;
46 /* Configure PINMUX 3 to enable EMAC pins */
47 writel((readl(PINMUX3) | 0x1affff), PINMUX3);
49 /* Configure GPIO20 as output */
50 writel((readl(&gpio1_base->dir) & ~(1 << 20)), &gpio1_base->dir);
53 for (i = 0; i < 20; i++) {
55 writel((readl(&gpio1_base->out_data) & ~(1 << 20)),
56 &gpio1_base->out_data);
61 writel((readl(&gpio1_base->out_data) | (1 << 20)),
62 &gpio1_base->out_data);
65 /* Configure I2C pins so that EEPROM can be read */
66 writel((readl(PINMUX3) | 0x01400000), PINMUX3);
68 /* Read Ethernet MAC address from EEPROM */
69 if (dvevm_read_mac_address(eeprom_enetaddr))
70 dv_configure_mac_address(eeprom_enetaddr);
72 davinci_emac_initialize();
78 #ifdef CONFIG_NAND_DAVINCI
79 static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
81 struct nand_chip *this = mtd->priv;
82 unsigned long wbase = (unsigned long) this->IO_ADDR_W;
83 unsigned long rbase = (unsigned long) this->IO_ADDR_R;
86 __set_bit(14, &wbase);
87 __set_bit(14, &rbase);
89 __clear_bit(14, &wbase);
90 __clear_bit(14, &rbase);
92 this->IO_ADDR_W = (void *)wbase;
93 this->IO_ADDR_R = (void *)rbase;
96 int board_nand_init(struct nand_chip *nand)
98 davinci_nand_init(nand);
99 nand->select_chip = nand_dm365evm_select_chip;