2 * Copyright (C) 2009 Texas Instruments Incorporated
4 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/arch/hardware.h>
11 #include <asm/ti-common/davinci_nand.h>
12 #include <asm/arch/gpio.h>
14 #include <asm/arch/davinci_misc.h>
15 #ifdef CONFIG_DAVINCI_MMC
17 #include <asm/arch/sdmmc_defs.h>
20 DECLARE_GLOBAL_DATA_PTR
;
24 gd
->bd
->bi_arch_number
= MACH_TYPE_DAVINCI_DM365_EVM
;
25 gd
->bd
->bi_boot_params
= PHYS_SDRAM_1
+ 0x100;
30 #ifdef CONFIG_DRIVER_TI_EMAC
31 int board_eth_init(bd_t
*bis
)
33 uint8_t eeprom_enetaddr
[6];
35 struct davinci_gpio
*gpio1_base
=
36 (struct davinci_gpio
*)DAVINCI_GPIO_BANK01
;
38 /* Configure PINMUX 3 to enable EMAC pins */
39 writel((readl(PINMUX3
) | 0x1affff), PINMUX3
);
41 /* Configure GPIO20 as output */
42 writel((readl(&gpio1_base
->dir
) & ~(1 << 20)), &gpio1_base
->dir
);
45 for (i
= 0; i
< 20; i
++) {
47 writel((readl(&gpio1_base
->out_data
) & ~(1 << 20)),
48 &gpio1_base
->out_data
);
53 writel((readl(&gpio1_base
->out_data
) | (1 << 20)),
54 &gpio1_base
->out_data
);
57 /* Configure I2C pins so that EEPROM can be read */
58 writel((readl(PINMUX3
) | 0x01400000), PINMUX3
);
60 /* Read Ethernet MAC address from EEPROM */
61 if (dvevm_read_mac_address(eeprom_enetaddr
))
62 davinci_sync_env_enetaddr(eeprom_enetaddr
);
64 davinci_emac_initialize();
70 #ifdef CONFIG_NAND_DAVINCI
71 static void nand_dm365evm_select_chip(struct mtd_info
*mtd
, int chip
)
73 struct nand_chip
*this = mtd
->priv
;
74 unsigned long wbase
= (unsigned long) this->IO_ADDR_W
;
75 unsigned long rbase
= (unsigned long) this->IO_ADDR_R
;
78 __set_bit(14, &wbase
);
79 __set_bit(14, &rbase
);
81 __clear_bit(14, &wbase
);
82 __clear_bit(14, &rbase
);
84 this->IO_ADDR_W
= (void *)wbase
;
85 this->IO_ADDR_R
= (void *)rbase
;
88 int board_nand_init(struct nand_chip
*nand
)
90 davinci_nand_init(nand
);
91 nand
->select_chip
= nand_dm365evm_select_chip
;
96 #ifdef CONFIG_DAVINCI_MMC
97 static struct davinci_mmc mmc_sd0
= {
98 .reg_base
= (struct davinci_mmc_regs
*)DAVINCI_MMC_SD0_BASE
,
99 .input_clk
= 121500000,
100 .host_caps
= MMC_MODE_4BIT
,
101 .voltages
= MMC_VDD_32_33
| MMC_VDD_33_34
,
102 .version
= MMC_CTLR_VERSION_2
,
105 #ifdef CONFIG_DAVINCI_MMC_SD1
106 static struct davinci_mmc mmc_sd1
= {
107 .reg_base
= (struct davinci_mmc_regs
*)DAVINCI_MMC_SD1_BASE
,
108 .input_clk
= 121500000,
109 .host_caps
= MMC_MODE_4BIT
,
110 .voltages
= MMC_VDD_32_33
| MMC_VDD_33_34
,
111 .version
= MMC_CTLR_VERSION_2
,
115 int board_mmc_init(bd_t
*bis
)
119 /* Add slot-0 to mmc subsystem */
120 err
= davinci_mmc_init(bis
, &mmc_sd0
);
124 #ifdef CONFIG_DAVINCI_MMC_SD1
125 #define PUPDCTL1 0x01c4007c
126 /* PINMUX(4)-DAT0-3/CMD; PINMUX(0)-CLK */
127 writel((readl(PINMUX4
) | 0x55400000), PINMUX4
);
128 writel((readl(PINMUX0
) | 0x00010000), PINMUX0
);
130 /* Configure MMC/SD pins as pullup */
131 writel((readl(PUPDCTL1
) & ~0x07c0), PUPDCTL1
);
133 /* Add slot-1 to mmc subsystem */
134 err
= davinci_mmc_init(bis
, &mmc_sd1
);