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
27
28
29
30
31
32
33
34
35
36#include <common.h>
37#include <netdev.h>
38#include <twl4030.h>
39#include <asm/io.h>
40#include <asm/arch/mmc_host_def.h>
41#include <asm/arch/omap3-regs.h>
42#include <asm/arch/mux.h>
43#include <asm/arch/mem.h>
44#include <asm/arch/sys_proto.h>
45#include <asm/gpio.h>
46#include <asm/mach-types.h>
47#include "dig297.h"
48
49DECLARE_GLOBAL_DATA_PTR;
50
51#ifdef CONFIG_CMD_NET
52static void setup_net_chip(void);
53
54#define NET_LAN9221_RESET_GPIO 12
55
56
57#define NET_LAN9220_GPMC_CONFIG1 (DEVICESIZE_16BIT)
58#define NET_LAN9220_GPMC_CONFIG2 (CSWROFFTIME(8) | \
59 CSRDOFFTIME(7) | \
60 ADVONTIME(1))
61#define NET_LAN9220_GPMC_CONFIG3 (ADVWROFFTIME(2) | \
62 ADVRDOFFTIME(2) | \
63 ADVONTIME(1))
64#define NET_LAN9220_GPMC_CONFIG4 (WEOFFTIME(8) | \
65 WEONTIME(1) | \
66 OEOFFTIME(7)| \
67 OEONTIME(1))
68#define NET_LAN9220_GPMC_CONFIG5 (PAGEBURSTACCESSTIME(0) | \
69 RDACCESSTIME(6) | \
70 WRCYCLETIME(0x1D) | \
71 RDCYCLETIME(0x1D))
72#define NET_LAN9220_GPMC_CONFIG6 ((1 << 31) | \
73 WRACCESSTIME(0x1D) | \
74 WRDATAONADMUXBUS(3))
75
76static const u32 gpmc_lan_config[] = {
77 NET_LAN9220_GPMC_CONFIG1,
78 NET_LAN9220_GPMC_CONFIG2,
79 NET_LAN9220_GPMC_CONFIG3,
80 NET_LAN9220_GPMC_CONFIG4,
81 NET_LAN9220_GPMC_CONFIG5,
82 NET_LAN9220_GPMC_CONFIG6,
83
84};
85#endif
86
87
88
89
90
91int board_init(void)
92{
93 gpmc_init();
94
95 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
96
97 return 0;
98}
99
100
101
102
103
104int misc_init_r(void)
105{
106 struct gpio *gpio1_base = (struct gpio *)OMAP34XX_GPIO1_BASE;
107 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
108
109 twl4030_power_init();
110 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
111
112
113
114
115
116
117
118
119
120 writel(~(GPIO19 | GPIO20), &gpio1_base->oe);
121 writel(~(GPIO31), &gpio5_base->oe);
122
123
124 writel((GPIO19 | GPIO20), &gpio1_base->setdataout);
125 writel(0, &gpio5_base->setdataout);
126
127#if defined(CONFIG_CMD_NET)
128 setup_net_chip();
129#endif
130
131 dieid_num_r();
132
133 return 0;
134}
135
136
137
138
139
140
141
142void set_muxconf_regs(void)
143{
144 MUX_DIG297();
145}
146
147#ifdef CONFIG_GENERIC_MMC
148int board_mmc_init(bd_t *bis)
149{
150 omap_mmc_init(0);
151 return 0;
152}
153#endif
154
155#ifdef CONFIG_CMD_NET
156
157
158
159
160
161static void setup_net_chip(void)
162{
163 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
164
165
166 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5],
167 CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
168
169
170 writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
171
172 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
173
174 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
175 &ctrl_base->gpmc_nadv_ale);
176
177
178 if (!gpio_request(NET_LAN9221_RESET_GPIO, "")) {
179 gpio_direction_output(NET_LAN9221_RESET_GPIO, 0);
180 gpio_set_value(NET_LAN9221_RESET_GPIO, 1);
181 udelay(1);
182 gpio_set_value(NET_LAN9221_RESET_GPIO, 0);
183 udelay(31000);
184 gpio_set_value(NET_LAN9221_RESET_GPIO, 1);
185 }
186}
187#endif
188
189int board_eth_init(bd_t *bis)
190{
191 int rc = 0;
192 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
193 return rc;
194}
195