1
2
3
4
5
6
7
8#include <common.h>
9#include <netdev.h>
10#include <twl4030.h>
11#include <asm/io.h>
12#include <asm/arch/mmc_host_def.h>
13#include <asm/arch/mux.h>
14#include <asm/arch/mem.h>
15#include <asm/arch/sys_proto.h>
16#include <asm/mach-types.h>
17#include "sdp.h"
18
19DECLARE_GLOBAL_DATA_PTR;
20
21const omap3_sysinfo sysinfo = {
22 DDR_DISCRETE,
23 "OMAP3 SDP3430 board",
24#if defined(CONFIG_ENV_IS_IN_ONENAND)
25 "OneNAND",
26#elif defined(CONFIG_ENV_IS_IN_NAND)
27 "NAND",
28#else
29 "NOR",
30#endif
31};
32
33
34static const u32 gpmc_sdp_nor[] = {
35 SDP3430_NOR_GPMC_CONF1,
36 SDP3430_NOR_GPMC_CONF2,
37 SDP3430_NOR_GPMC_CONF3,
38 SDP3430_NOR_GPMC_CONF4,
39 SDP3430_NOR_GPMC_CONF5,
40 SDP3430_NOR_GPMC_CONF6,
41
42};
43
44
45
46
47
48
49static const u32 gpmc_sdp_debug[] = {
50 SDP3430_DEBUG_GPMC_CONF1,
51 SDP3430_DEBUG_GPMC_CONF2,
52 SDP3430_DEBUG_GPMC_CONF3,
53 SDP3430_DEBUG_GPMC_CONF4,
54 SDP3430_DEBUG_GPMC_CONF5,
55 SDP3430_DEBUG_GPMC_CONF6,
56
57};
58
59
60static const u32 gpmc_sdp_onenand[] = {
61 SDP3430_ONENAND_GPMC_CONF1,
62 SDP3430_ONENAND_GPMC_CONF2,
63 SDP3430_ONENAND_GPMC_CONF3,
64 SDP3430_ONENAND_GPMC_CONF4,
65 SDP3430_ONENAND_GPMC_CONF5,
66 SDP3430_ONENAND_GPMC_CONF6,
67
68};
69
70
71static const u32 gpmc_sdp_nand[] = {
72 SDP3430_NAND_GPMC_CONF1,
73 SDP3430_NAND_GPMC_CONF2,
74 SDP3430_NAND_GPMC_CONF3,
75 SDP3430_NAND_GPMC_CONF4,
76 SDP3430_NAND_GPMC_CONF5,
77 SDP3430_NAND_GPMC_CONF6,
78
79};
80
81
82extern struct gpmc *gpmc_cfg;
83
84
85
86
87
88
89int board_init(void)
90{
91 gpmc_init();
92
93
94 enable_gpmc_cs_config(gpmc_sdp_nor, &gpmc_cfg->cs[0],
95 CONFIG_SYS_FLASH_BASE, GPMC_SIZE_128M);
96 enable_gpmc_cs_config(gpmc_sdp_nand, &gpmc_cfg->cs[1], 0x28000000,
97 GPMC_SIZE_16M);
98 enable_gpmc_cs_config(gpmc_sdp_onenand, &gpmc_cfg->cs[2], 0x20000000,
99 GPMC_SIZE_16M);
100 enable_gpmc_cs_config(gpmc_sdp_debug, &gpmc_cfg->cs[3], DEBUG_BASE,
101 GPMC_SIZE_16M);
102
103 gd->bd->bi_arch_number = MACH_TYPE_OMAP_3430SDP;
104
105 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
106
107 return 0;
108}
109
110#define LAN_RESET_REGISTER (CONFIG_LAN91C96_BASE + 0x01c)
111#define ETH_CONTROL_REG (CONFIG_LAN91C96_BASE + 0x30b)
112
113
114
115
116
117int board_eth_init(bd_t *bis)
118{
119 int rc = 0;
120#ifdef CONFIG_LAN91C96
121 int cnt = 20;
122
123 writew(0x0, LAN_RESET_REGISTER);
124 do {
125 writew(0x1, LAN_RESET_REGISTER);
126 udelay(100);
127 if (cnt == 0)
128 goto reset_err_out;
129 --cnt;
130 } while (readw(LAN_RESET_REGISTER) != 0x1);
131
132 cnt = 20;
133
134 do {
135 writew(0x0, LAN_RESET_REGISTER);
136 udelay(100);
137 if (cnt == 0)
138 goto reset_err_out;
139 --cnt;
140 } while (readw(LAN_RESET_REGISTER) != 0x0000);
141 udelay(1000);
142
143 writeb(readb(ETH_CONTROL_REG) & ~0x1, ETH_CONTROL_REG);
144 udelay(1000);
145 rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
146reset_err_out:
147
148#endif
149 return rc;
150}
151
152
153
154
155
156
157
158
159int misc_init_r(void)
160{
161
162
163
164
165
166
167 twl4030_power_init();
168
169
170
171
172
173
174
175
176
177
178
179 return 0;
180}
181
182
183
184
185
186
187void set_muxconf_regs(void)
188{
189
190 MUX_SDP3430();
191}
192
193#ifdef CONFIG_GENERIC_MMC
194int board_mmc_init(bd_t *bis)
195{
196 return omap_mmc_init(0, 0, 0, -1, -1);
197}
198
199void board_mmc_power_init(void)
200{
201 twl4030_power_mmc_init(0);
202}
203#endif
204