1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <common.h>
27#include <netdev.h>
28#include <asm/io.h>
29#include <asm/arch/mem.h>
30#include <asm/arch/mux.h>
31#include <asm/arch/sys_proto.h>
32#include <asm/omap_gpio.h>
33#include <asm/arch/mmc_host_def.h>
34#include <i2c.h>
35#include <asm/gpio.h>
36#ifdef CONFIG_USB_EHCI
37#include <usb.h>
38#include <asm/ehci-omap.h>
39#endif
40#include "twister.h"
41
42DECLARE_GLOBAL_DATA_PTR;
43
44
45static const u32 gpmc_smc911[] = {
46 NET_GPMC_CONFIG1,
47 NET_GPMC_CONFIG2,
48 NET_GPMC_CONFIG3,
49 NET_GPMC_CONFIG4,
50 NET_GPMC_CONFIG5,
51 NET_GPMC_CONFIG6,
52};
53
54static const u32 gpmc_XR16L2751[] = {
55 XR16L2751_GPMC_CONFIG1,
56 XR16L2751_GPMC_CONFIG2,
57 XR16L2751_GPMC_CONFIG3,
58 XR16L2751_GPMC_CONFIG4,
59 XR16L2751_GPMC_CONFIG5,
60 XR16L2751_GPMC_CONFIG6,
61};
62
63#ifdef CONFIG_USB_EHCI
64static struct omap_usbhs_board_data usbhs_bdata = {
65 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
66 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
67 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
68};
69
70int ehci_hcd_init(void)
71{
72 return omap_ehci_hcd_init(&usbhs_bdata);
73}
74
75int ehci_hcd_stop(void)
76{
77 return omap_ehci_hcd_stop();
78}
79#endif
80
81int board_init(void)
82{
83 gpmc_init();
84
85
86 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
87
88
89 enable_gpmc_cs_config(gpmc_XR16L2751, &gpmc_cfg->cs[1],
90 XR16L2751_UART1_BASE, GPMC_SIZE_16M);
91
92 enable_gpmc_cs_config(gpmc_XR16L2751, &gpmc_cfg->cs[3],
93 XR16L2751_UART2_BASE, GPMC_SIZE_16M);
94
95 gpio_request(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO, "USB_PHY1_RESET");
96 gpio_direction_output(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO, 1);
97
98 return 0;
99}
100
101int misc_init_r(void)
102{
103 dieid_num_r();
104
105 return 0;
106}
107
108
109
110
111
112
113
114void set_muxconf_regs(void)
115{
116 MUX_TWISTER();
117}
118
119int board_eth_init(bd_t *bis)
120{
121 davinci_emac_initialize();
122
123
124 enable_gpmc_cs_config(gpmc_smc911, &gpmc_cfg->cs[5],
125 CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
126 if (smc911x_initialize(0, CONFIG_SMC911X_BASE) <= 0)
127 printf("\nError initializing SMC911x controlleri\n");
128
129 return 0;
130}
131
132#if defined(CONFIG_OMAP_HSMMC) && \
133 !defined(CONFIG_SPL_BUILD)
134int board_mmc_init(bd_t *bis)
135{
136 return omap_mmc_init(0, 0, 0);
137}
138#endif
139
140#ifdef CONFIG_SPL_OS_BOOT
141
142
143
144
145void spl_board_prepare_for_linux(void)
146{
147
148 enable_gpmc_cs_config(gpmc_smc911, &gpmc_cfg->cs[5],
149 CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
150}
151int spl_start_uboot(void)
152{
153 int val = 0;
154 if (!gpio_request(CONFIG_SPL_OS_BOOT_KEY, "U-Boot key")) {
155 gpio_direction_input(CONFIG_SPL_OS_BOOT_KEY);
156 val = gpio_get_value(CONFIG_SPL_OS_BOOT_KEY);
157 gpio_free(CONFIG_SPL_OS_BOOT_KEY);
158 }
159 return val;
160}
161#endif
162