2 * Maintainer : Steve Sakoman <steve@sakoman.com>
4 * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by
5 * Richard Woodruff <r-woodruff2@ti.com>
6 * Syed Mohammed Khasim <khasim@ti.com>
7 * Sunil Kumar <sunilsaini05@gmail.com>
8 * Shashi Ranjan <shashiranjanmca05@gmail.com>
10 * (C) Copyright 2004-2008
11 * Texas Instruments, <www.ti.com>
13 * See file CREDITS for list of people who contributed to this
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
35 #include <asm/arch/mmc_host_def.h>
36 #include <asm/arch/mux.h>
37 #include <asm/arch/mem.h>
38 #include <asm/arch/sys_proto.h>
39 #include <asm/arch/gpio.h>
40 #include <asm/mach-types.h>
43 #if defined(CONFIG_CMD_NET)
44 static void setup_net_chip(void);
47 /* GPMC definitions for LAN9221 chips on Tobi expansion boards */
48 static const u32 gpmc_lan_config[] = {
49 NET_LAN9221_GPMC_CONFIG1,
50 NET_LAN9221_GPMC_CONFIG2,
51 NET_LAN9221_GPMC_CONFIG3,
52 NET_LAN9221_GPMC_CONFIG4,
53 NET_LAN9221_GPMC_CONFIG5,
54 NET_LAN9221_GPMC_CONFIG6,
55 /*CONFIG7- computed as params */
60 * Description: Early hardware init.
64 DECLARE_GLOBAL_DATA_PTR;
66 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
67 /* board id for Linux */
68 gd->bd->bi_arch_number = MACH_TYPE_OVERO;
70 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
76 * Routine: get_board_revision
77 * Description: Returns the board revision
79 int get_board_revision(void)
83 if (!omap_request_gpio(112) &&
84 !omap_request_gpio(113) &&
85 !omap_request_gpio(115)) {
87 omap_set_gpio_direction(112, 1);
88 omap_set_gpio_direction(113, 1);
89 omap_set_gpio_direction(115, 1);
91 revision = omap_get_gpio_datain(115) << 2 |
92 omap_get_gpio_datain(113) << 1 |
93 omap_get_gpio_datain(112);
99 printf("Error: unable to acquire board revision GPIOs\n");
107 * Routine: get_sdio2_config
108 * Description: Return information about the wifi module connection
109 * Returns 0 if the module connects though a level translator
110 * Returns 1 if the module connects directly
112 int get_sdio2_config(void)
116 if (!omap_request_gpio(130) && !omap_request_gpio(139)) {
118 omap_set_gpio_direction(130, 0);
119 omap_set_gpio_direction(139, 1);
122 omap_set_gpio_dataout(130, 0);
123 if (omap_get_gpio_datain(139) == 0) {
124 omap_set_gpio_dataout(130, 1);
125 if (omap_get_gpio_datain(139) == 1)
132 printf("Error: unable to acquire sdio2 clk GPIOs\n");
140 * Routine: misc_init_r
141 * Description: Configure board specific parts
143 int misc_init_r(void)
145 twl4030_power_init();
146 twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
148 #if defined(CONFIG_CMD_NET)
152 printf("Board revision: %d\n", get_board_revision());
154 switch (get_sdio2_config()) {
156 printf("Tranceiver detected on mmc2\n");
157 MUX_OVERO_SDIO2_TRANSCEIVER();
160 printf("Direct connection on mmc2\n");
161 MUX_OVERO_SDIO2_DIRECT();
164 printf("Unable to detect mmc2 connection type\n");
173 * Routine: set_muxconf_regs
174 * Description: Setting up the configuration Mux registers specific to the
175 * hardware. Many pins need to be moved from protect to primary
178 void set_muxconf_regs(void)
183 #if defined(CONFIG_CMD_NET)
185 * Routine: setup_net_chip
186 * Description: Setting up the configuration GPMC registers specific to the
189 static void setup_net_chip(void)
191 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
194 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
197 /* second lan chip */
198 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4], 0x2B000000,
201 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
202 writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
203 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
204 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
205 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
206 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
207 &ctrl_base->gpmc_nadv_ale);
209 /* Make GPIO 64 as output pin and send a magic pulse through it */
210 if (!omap_request_gpio(64)) {
211 omap_set_gpio_direction(64, 0);
212 omap_set_gpio_dataout(64, 1);
214 omap_set_gpio_dataout(64, 0);
216 omap_set_gpio_dataout(64, 1);
221 int board_eth_init(bd_t *bis)
224 #ifdef CONFIG_SMC911X
225 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
230 #ifdef CONFIG_GENERIC_MMC
231 int board_mmc_init(bd_t *bis)