blob: ff372d836fe382226ace709b8597798bf0a4695f [file] [log] [blame]
Mike Rapoport36b4e2d2010-12-18 17:43:19 -05001/*
Nikita Kiryanovce15ec92012-01-02 04:01:31 +00002 * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il>
Mike Rapoport36b4e2d2010-12-18 17:43:19 -05003 *
Igor Grinbergdccd9a02011-04-18 17:48:31 -04004 * Authors: Mike Rapoport <mike@compulab.co.il>
5 * Igor Grinberg <grinberg@compulab.co.il>
Mike Rapoport36b4e2d2010-12-18 17:43:19 -05006 *
7 * Derived from omap3evm and Beagle Board by
8 * Manikandan Pillai <mani.pillai@ti.com>
9 * Richard Woodruff <r-woodruff2@ti.com>
10 * Syed Mohammed Khasim <x0khasim@ti.com>
11 *
12 * See file CREDITS for list of people who contributed to this
13 * project.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
Igor Grinbergdccd9a02011-04-18 17:48:31 -040027 * Foundation, Inc.
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050028 */
29
30#include <common.h>
Igor Grinberg2b8754b2011-04-18 17:54:33 -040031#include <status_led.h>
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050032#include <netdev.h>
33#include <net.h>
34#include <i2c.h>
35#include <twl4030.h>
36
37#include <asm/io.h>
38#include <asm/arch/mem.h>
39#include <asm/arch/mux.h>
40#include <asm/arch/mmc_host_def.h>
41#include <asm/arch/sys_proto.h>
42#include <asm/mach-types.h>
43
Igor Grinberg557aa152011-04-18 17:43:26 -040044DECLARE_GLOBAL_DATA_PTR;
45
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050046const omap3_sysinfo sysinfo = {
47 DDR_DISCRETE,
Igor Grinbergb65a77a2011-04-18 17:55:21 -040048 "CM-T3x board",
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050049 "NAND",
50};
51
52static u32 gpmc_net_config[GPMC_MAX_REG] = {
53 NET_GPMC_CONFIG1,
54 NET_GPMC_CONFIG2,
55 NET_GPMC_CONFIG3,
56 NET_GPMC_CONFIG4,
57 NET_GPMC_CONFIG5,
58 NET_GPMC_CONFIG6,
59 0
60};
61
62static u32 gpmc_nand_config[GPMC_MAX_REG] = {
63 SMNAND_GPMC_CONFIG1,
64 SMNAND_GPMC_CONFIG2,
65 SMNAND_GPMC_CONFIG3,
66 SMNAND_GPMC_CONFIG4,
67 SMNAND_GPMC_CONFIG5,
68 SMNAND_GPMC_CONFIG6,
69 0,
70};
71
72/*
73 * Routine: board_init
74 * Description: Early hardware init.
75 */
76int board_init(void)
77{
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050078 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
79
80 enable_gpmc_cs_config(gpmc_nand_config, &gpmc_cfg->cs[0],
81 CONFIG_SYS_NAND_BASE, GPMC_SIZE_16M);
82
83 /* board id for Linux */
Igor Grinbergb65a77a2011-04-18 17:55:21 -040084 if (get_cpu_family() == CPU_OMAP34XX)
85 gd->bd->bi_arch_number = MACH_TYPE_CM_T35;
86 else
87 gd->bd->bi_arch_number = MACH_TYPE_CM_T3730;
88
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050089 /* boot param addr */
90 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
91
Igor Grinberg2b8754b2011-04-18 17:54:33 -040092#if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
93 status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
94#endif
95
Mike Rapoport36b4e2d2010-12-18 17:43:19 -050096 return 0;
97}
98
99/*
100 * Routine: misc_init_r
Igor Grinbergafff1fc2011-04-18 17:53:33 -0400101 * Description: display die ID
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500102 */
103int misc_init_r(void)
104{
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500105 dieid_num_r();
106
107 return 0;
108}
109
110/*
111 * Routine: set_muxconf_regs
112 * Description: Setting up the configuration Mux registers specific to the
113 * hardware. Many pins need to be moved from protect to primary
114 * mode.
115 */
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400116static void cm_t3x_set_common_muxconf(void)
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500117{
118 /* SDRC */
119 MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)); /*SDRC_D0*/
120 MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)); /*SDRC_D1*/
121 MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)); /*SDRC_D2*/
122 MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)); /*SDRC_D3*/
123 MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)); /*SDRC_D4*/
124 MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)); /*SDRC_D5*/
125 MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)); /*SDRC_D6*/
126 MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)); /*SDRC_D7*/
127 MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)); /*SDRC_D8*/
128 MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)); /*SDRC_D9*/
129 MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)); /*SDRC_D10*/
130 MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)); /*SDRC_D11*/
131 MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)); /*SDRC_D12*/
132 MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)); /*SDRC_D13*/
133 MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)); /*SDRC_D14*/
134 MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)); /*SDRC_D15*/
135 MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)); /*SDRC_D16*/
136 MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)); /*SDRC_D17*/
137 MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)); /*SDRC_D18*/
138 MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)); /*SDRC_D19*/
139 MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)); /*SDRC_D20*/
140 MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)); /*SDRC_D21*/
141 MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)); /*SDRC_D22*/
142 MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)); /*SDRC_D23*/
143 MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)); /*SDRC_D24*/
144 MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)); /*SDRC_D25*/
145 MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)); /*SDRC_D26*/
146 MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)); /*SDRC_D27*/
147 MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)); /*SDRC_D28*/
148 MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)); /*SDRC_D29*/
149 MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)); /*SDRC_D30*/
150 MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)); /*SDRC_D31*/
151 MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)); /*SDRC_CLK*/
152 MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)); /*SDRC_DQS0*/
153 MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)); /*SDRC_DQS1*/
154 MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)); /*SDRC_DQS2*/
155 MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)); /*SDRC_DQS3*/
156 MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)); /*SDRC_CKE0*/
157 MUX_VAL(CP(SDRC_CKE1), (IDIS | PTD | DIS | M7)); /*SDRC_CKE1*/
158
159 /* GPMC */
160 MUX_VAL(CP(GPMC_A1), (IDIS | PTU | EN | M0)); /*GPMC_A1*/
161 MUX_VAL(CP(GPMC_A2), (IDIS | PTU | EN | M0)); /*GPMC_A2*/
162 MUX_VAL(CP(GPMC_A3), (IDIS | PTU | EN | M0)); /*GPMC_A3*/
163 MUX_VAL(CP(GPMC_A4), (IDIS | PTU | EN | M0)); /*GPMC_A4*/
164 MUX_VAL(CP(GPMC_A5), (IDIS | PTU | EN | M0)); /*GPMC_A5*/
165 MUX_VAL(CP(GPMC_A6), (IDIS | PTU | EN | M0)); /*GPMC_A6*/
166 MUX_VAL(CP(GPMC_A7), (IDIS | PTU | EN | M0)); /*GPMC_A7*/
167 MUX_VAL(CP(GPMC_A8), (IDIS | PTU | EN | M0)); /*GPMC_A8*/
168 MUX_VAL(CP(GPMC_A9), (IDIS | PTU | EN | M0)); /*GPMC_A9*/
169 MUX_VAL(CP(GPMC_A10), (IDIS | PTU | EN | M0)); /*GPMC_A10*/
170 MUX_VAL(CP(GPMC_D0), (IEN | PTU | EN | M0)); /*GPMC_D0*/
171 MUX_VAL(CP(GPMC_D1), (IEN | PTU | EN | M0)); /*GPMC_D1*/
172 MUX_VAL(CP(GPMC_D2), (IEN | PTU | EN | M0)); /*GPMC_D2*/
173 MUX_VAL(CP(GPMC_D3), (IEN | PTU | EN | M0)); /*GPMC_D3*/
174 MUX_VAL(CP(GPMC_D4), (IEN | PTU | EN | M0)); /*GPMC_D4*/
175 MUX_VAL(CP(GPMC_D5), (IEN | PTU | EN | M0)); /*GPMC_D5*/
176 MUX_VAL(CP(GPMC_D6), (IEN | PTU | EN | M0)); /*GPMC_D6*/
177 MUX_VAL(CP(GPMC_D7), (IEN | PTU | EN | M0)); /*GPMC_D7*/
178 MUX_VAL(CP(GPMC_D8), (IEN | PTU | EN | M0)); /*GPMC_D8*/
179 MUX_VAL(CP(GPMC_D9), (IEN | PTU | EN | M0)); /*GPMC_D9*/
180 MUX_VAL(CP(GPMC_D10), (IEN | PTU | EN | M0)); /*GPMC_D10*/
181 MUX_VAL(CP(GPMC_D11), (IEN | PTU | EN | M0)); /*GPMC_D11*/
182 MUX_VAL(CP(GPMC_D12), (IEN | PTU | EN | M0)); /*GPMC_D12*/
183 MUX_VAL(CP(GPMC_D13), (IEN | PTU | EN | M0)); /*GPMC_D13*/
184 MUX_VAL(CP(GPMC_D14), (IEN | PTU | EN | M0)); /*GPMC_D14*/
185 MUX_VAL(CP(GPMC_D15), (IEN | PTU | EN | M0)); /*GPMC_D15*/
186 MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)); /*GPMC_nCS0*/
187
188 /* SB-T35 Ethernet */
189 MUX_VAL(CP(GPMC_NCS4), (IEN | PTU | EN | M0)); /*GPMC_nCS4*/
190
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400191 /* CM-T3x Ethernet */
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500192 MUX_VAL(CP(GPMC_NCS5), (IDIS | PTU | DIS | M0)); /*GPMC_nCS5*/
193 MUX_VAL(CP(GPMC_CLK), (IEN | PTD | DIS | M4)); /*GPIO_59*/
194 MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)); /*nADV_ALE*/
195 MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)); /*nOE*/
196 MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)); /*nWE*/
197 MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTU | EN | M0)); /*nBE0_CLE*/
198 MUX_VAL(CP(GPMC_NBE1), (IDIS | PTD | DIS | M4)); /*GPIO_61*/
199 MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)); /*nWP*/
200 MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)); /*WAIT0*/
201
202 /* DSS */
203 MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)); /*DSS_PCLK*/
204 MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)); /*DSS_HSYNC*/
205 MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)); /*DSS_VSYNC*/
206 MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)); /*DSS_ACBIAS*/
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500207 MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)); /*DSS_DATA6*/
208 MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)); /*DSS_DATA7*/
209 MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)); /*DSS_DATA8*/
210 MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)); /*DSS_DATA9*/
211 MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)); /*DSS_DATA10*/
212 MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)); /*DSS_DATA11*/
213 MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)); /*DSS_DATA12*/
214 MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)); /*DSS_DATA13*/
215 MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)); /*DSS_DATA14*/
216 MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)); /*DSS_DATA15*/
217 MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)); /*DSS_DATA16*/
218 MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)); /*DSS_DATA17*/
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500219
220 /* serial interface */
221 MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)); /*UART3_RX*/
222 MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)); /*UART3_TX*/
223
224 /* mUSB */
225 MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)); /*HSUSB0_CLK*/
226 MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)); /*HSUSB0_STP*/
227 MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)); /*HSUSB0_DIR*/
228 MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)); /*HSUSB0_NXT*/
229 MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA0*/
230 MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA1*/
231 MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA2*/
232 MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA3*/
233 MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA4*/
234 MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA5*/
235 MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA6*/
236 MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA7*/
237
238 /* I2C1 */
239 MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)); /*I2C1_SCL*/
240 MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)); /*I2C1_SDA*/
241
242 /* control and debug */
243 MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)); /*SYS_32K*/
244 MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)); /*SYS_CLKREQ*/
245 MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)); /*SYS_nIRQ*/
246 MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)); /*OFF_MODE*/
247 MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)); /*CLKOUT1*/
Igor Grinberg2b8754b2011-04-18 17:54:33 -0400248 MUX_VAL(CP(SYS_CLKOUT2), (IDIS | PTU | DIS | M4)); /*green LED*/
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500249 MUX_VAL(CP(JTAG_nTRST), (IEN | PTD | DIS | M0)); /*JTAG_nTRST*/
250 MUX_VAL(CP(JTAG_TCK), (IEN | PTD | DIS | M0)); /*JTAG_TCK*/
251 MUX_VAL(CP(JTAG_TMS), (IEN | PTD | DIS | M0)); /*JTAG_TMS*/
252 MUX_VAL(CP(JTAG_TDI), (IEN | PTD | DIS | M0)); /*JTAG_TDI*/
Igor Grinbergeec70c22011-04-18 17:50:07 -0400253
254 /* MMC1 */
255 MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)); /*MMC1_CLK*/
256 MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)); /*MMC1_CMD*/
257 MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)); /*MMC1_DAT0*/
258 MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)); /*MMC1_DAT1*/
259 MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)); /*MMC1_DAT2*/
260 MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)); /*MMC1_DAT3*/
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400261}
262
263static void cm_t35_set_muxconf(void)
264{
265 /* DSS */
266 MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)); /*DSS_DATA0*/
267 MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)); /*DSS_DATA1*/
268 MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)); /*DSS_DATA2*/
269 MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)); /*DSS_DATA3*/
270 MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)); /*DSS_DATA4*/
271 MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)); /*DSS_DATA5*/
272
273 MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)); /*DSS_DATA18*/
274 MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)); /*DSS_DATA19*/
275 MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)); /*DSS_DATA20*/
276 MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)); /*DSS_DATA21*/
277 MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)); /*DSS_DATA22*/
278 MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)); /*DSS_DATA23*/
279
280 /* MMC1 */
Igor Grinbergeec70c22011-04-18 17:50:07 -0400281 MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)); /*MMC1_DAT4*/
282 MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)); /*MMC1_DAT5*/
283 MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)); /*MMC1_DAT6*/
284 MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)); /*MMC1_DAT7*/
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500285}
286
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400287static void cm_t3730_set_muxconf(void)
288{
289 /* DSS */
290 MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M3)); /*DSS_DATA0*/
291 MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M3)); /*DSS_DATA1*/
292 MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M3)); /*DSS_DATA2*/
293 MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M3)); /*DSS_DATA3*/
294 MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M3)); /*DSS_DATA4*/
295 MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M3)); /*DSS_DATA5*/
296
297 MUX_VAL(CP(SYS_BOOT0), (IDIS | PTD | DIS | M3)); /*DSS_DATA18*/
298 MUX_VAL(CP(SYS_BOOT1), (IDIS | PTD | DIS | M3)); /*DSS_DATA19*/
299 MUX_VAL(CP(SYS_BOOT3), (IDIS | PTD | DIS | M3)); /*DSS_DATA20*/
300 MUX_VAL(CP(SYS_BOOT4), (IDIS | PTD | DIS | M3)); /*DSS_DATA21*/
301 MUX_VAL(CP(SYS_BOOT5), (IDIS | PTD | DIS | M3)); /*DSS_DATA22*/
302 MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M3)); /*DSS_DATA23*/
303}
304
305void set_muxconf_regs(void)
306{
307 cm_t3x_set_common_muxconf();
308
309 if (get_cpu_family() == CPU_OMAP34XX)
310 cm_t35_set_muxconf();
311 else
312 cm_t3730_set_muxconf();
313}
314
Tom Rini28fed362011-09-03 21:49:24 -0400315#ifdef CONFIG_GENERIC_MMC
316int board_mmc_init(bd_t *bis)
317{
Nikita Kiryanovce15ec92012-01-02 04:01:31 +0000318 return omap_mmc_init(0);
Tom Rini28fed362011-09-03 21:49:24 -0400319}
320#endif
321
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500322/*
323 * Routine: setup_net_chip_gmpc
324 * Description: Setting up the configuration GPMC registers specific to the
325 * Ethernet hardware.
326 */
327static void setup_net_chip_gmpc(void)
328{
329 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
330
331 enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[5],
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400332 CM_T3X_SMC911X_BASE, GPMC_SIZE_16M);
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500333 enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[4],
334 SB_T35_SMC911X_BASE, GPMC_SIZE_16M);
335
336 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
337 writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
338
339 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
340 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
341
342 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
343 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
344 &ctrl_base->gpmc_nadv_ale);
345}
346
347#ifdef CONFIG_DRIVER_OMAP34XX_I2C
348/*
349 * Routine: reset_net_chip
350 * Description: reset the Ethernet controller via TPS65930 GPIO
351 */
352static void reset_net_chip(void)
353{
354 /* Set GPIO1 of TPS65930 as output */
355 twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
356 TWL4030_BASEADD_GPIO+0x03);
357 /* Send a pulse on the GPIO pin */
358 twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
359 TWL4030_BASEADD_GPIO+0x0C);
360 udelay(1);
361 twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
362 TWL4030_BASEADD_GPIO+0x09);
363 udelay(1);
364 twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02,
365 TWL4030_BASEADD_GPIO+0x0C);
366}
367#else
368static inline void reset_net_chip(void) {}
369#endif
370
Nikita Kiryanovce15ec92012-01-02 04:01:31 +0000371#ifdef CONFIG_SMC911X
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500372/*
373 * Routine: handle_mac_address
374 * Description: prepare MAC address for on-board Ethernet.
375 */
376static int handle_mac_address(void)
377{
378 unsigned char enetaddr[6];
379 int rc;
380
381 rc = eth_getenv_enetaddr("ethaddr", enetaddr);
382 if (rc)
383 return 0;
384
385#ifdef CONFIG_DRIVER_OMAP34XX_I2C
386 rc = i2c_read(0x50, 0, 1, enetaddr, 6);
387 if (rc)
388 return rc;
389#endif
390
391 if (!is_valid_ether_addr(enetaddr))
392 return -1;
393
394 return eth_setenv_enetaddr("ethaddr", enetaddr);
395}
396
397
398/*
399 * Routine: board_eth_init
400 * Description: initialize module and base-board Ethernet chips
401 */
402int board_eth_init(bd_t *bis)
403{
404 int rc = 0, rc1 = 0;
405
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500406 setup_net_chip_gmpc();
407 reset_net_chip();
408
409 rc1 = handle_mac_address();
410 if (rc1)
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400411 printf("CM-T3x: No MAC address found\n");
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500412
Igor Grinbergb65a77a2011-04-18 17:55:21 -0400413 rc1 = smc911x_initialize(0, CM_T3X_SMC911X_BASE);
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500414 if (rc1 > 0)
415 rc++;
416
417 rc1 = smc911x_initialize(1, SB_T35_SMC911X_BASE);
418 if (rc1 > 0)
419 rc++;
Mike Rapoport36b4e2d2010-12-18 17:43:19 -0500420
421 return rc;
422}
Nikita Kiryanovce15ec92012-01-02 04:01:31 +0000423#endif