1127f9ae5SJean-Christophe PLAGNIOL-VILLARD /* 2127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Maintainer : Steve Sakoman <steve@sakoman.com> 3127f9ae5SJean-Christophe PLAGNIOL-VILLARD * 4127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by 5127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Richard Woodruff <r-woodruff2@ti.com> 6127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Syed Mohammed Khasim <khasim@ti.com> 7127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Sunil Kumar <sunilsaini05@gmail.com> 8127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Shashi Ranjan <shashiranjanmca05@gmail.com> 9127f9ae5SJean-Christophe PLAGNIOL-VILLARD * 10127f9ae5SJean-Christophe PLAGNIOL-VILLARD * (C) Copyright 2004-2008 11127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Texas Instruments, <www.ti.com> 12127f9ae5SJean-Christophe PLAGNIOL-VILLARD * 13127f9ae5SJean-Christophe PLAGNIOL-VILLARD * See file CREDITS for list of people who contributed to this 14127f9ae5SJean-Christophe PLAGNIOL-VILLARD * project. 15127f9ae5SJean-Christophe PLAGNIOL-VILLARD * 16127f9ae5SJean-Christophe PLAGNIOL-VILLARD * This program is free software; you can redistribute it and/or 17127f9ae5SJean-Christophe PLAGNIOL-VILLARD * modify it under the terms of the GNU General Public License as 18127f9ae5SJean-Christophe PLAGNIOL-VILLARD * published by the Free Software Foundation; either version 2 of 19127f9ae5SJean-Christophe PLAGNIOL-VILLARD * the License, or (at your option) any later version. 20127f9ae5SJean-Christophe PLAGNIOL-VILLARD * 21127f9ae5SJean-Christophe PLAGNIOL-VILLARD * This program is distributed in the hope that it will be useful, 22127f9ae5SJean-Christophe PLAGNIOL-VILLARD * but WITHOUT ANY WARRANTY; without even the implied warranty of 23127f9ae5SJean-Christophe PLAGNIOL-VILLARD * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24127f9ae5SJean-Christophe PLAGNIOL-VILLARD * GNU General Public License for more details. 25127f9ae5SJean-Christophe PLAGNIOL-VILLARD * 26127f9ae5SJean-Christophe PLAGNIOL-VILLARD * You should have received a copy of the GNU General Public License 27127f9ae5SJean-Christophe PLAGNIOL-VILLARD * along with this program; if not, write to the Free Software 28127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 29127f9ae5SJean-Christophe PLAGNIOL-VILLARD * MA 02111-1307 USA 30127f9ae5SJean-Christophe PLAGNIOL-VILLARD */ 31127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include <common.h> 32df382626SOlof Johansson #include <netdev.h> 33127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include <twl4030.h> 34127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include <asm/io.h> 35127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include <asm/arch/mux.h> 36df382626SOlof Johansson #include <asm/arch/mem.h> 37127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include <asm/arch/sys_proto.h> 38df382626SOlof Johansson #include <asm/arch/gpio.h> 39127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include <asm/mach-types.h> 40127f9ae5SJean-Christophe PLAGNIOL-VILLARD #include "overo.h" 41127f9ae5SJean-Christophe PLAGNIOL-VILLARD 42df382626SOlof Johansson #if defined(CONFIG_CMD_NET) 43df382626SOlof Johansson static void setup_net_chip(void); 44df382626SOlof Johansson #endif 45df382626SOlof Johansson 46127f9ae5SJean-Christophe PLAGNIOL-VILLARD /* 47127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Routine: board_init 48127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Description: Early hardware init. 49127f9ae5SJean-Christophe PLAGNIOL-VILLARD */ 50127f9ae5SJean-Christophe PLAGNIOL-VILLARD int board_init(void) 51127f9ae5SJean-Christophe PLAGNIOL-VILLARD { 52127f9ae5SJean-Christophe PLAGNIOL-VILLARD DECLARE_GLOBAL_DATA_PTR; 53127f9ae5SJean-Christophe PLAGNIOL-VILLARD 54127f9ae5SJean-Christophe PLAGNIOL-VILLARD gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ 55127f9ae5SJean-Christophe PLAGNIOL-VILLARD /* board id for Linux */ 56127f9ae5SJean-Christophe PLAGNIOL-VILLARD gd->bd->bi_arch_number = MACH_TYPE_OVERO; 57127f9ae5SJean-Christophe PLAGNIOL-VILLARD /* boot param addr */ 58127f9ae5SJean-Christophe PLAGNIOL-VILLARD gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); 59127f9ae5SJean-Christophe PLAGNIOL-VILLARD 60127f9ae5SJean-Christophe PLAGNIOL-VILLARD return 0; 61127f9ae5SJean-Christophe PLAGNIOL-VILLARD } 62127f9ae5SJean-Christophe PLAGNIOL-VILLARD 63127f9ae5SJean-Christophe PLAGNIOL-VILLARD /* 64127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Routine: misc_init_r 65127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Description: Configure board specific parts 66127f9ae5SJean-Christophe PLAGNIOL-VILLARD */ 67127f9ae5SJean-Christophe PLAGNIOL-VILLARD int misc_init_r(void) 68127f9ae5SJean-Christophe PLAGNIOL-VILLARD { 69127f9ae5SJean-Christophe PLAGNIOL-VILLARD twl4030_power_init(); 70*ead39d7aSGrazvydas Ignotas twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); 71127f9ae5SJean-Christophe PLAGNIOL-VILLARD 72df382626SOlof Johansson #if defined(CONFIG_CMD_NET) 73df382626SOlof Johansson setup_net_chip(); 74df382626SOlof Johansson #endif 75df382626SOlof Johansson 76127f9ae5SJean-Christophe PLAGNIOL-VILLARD dieid_num_r(); 77127f9ae5SJean-Christophe PLAGNIOL-VILLARD 78127f9ae5SJean-Christophe PLAGNIOL-VILLARD return 0; 79127f9ae5SJean-Christophe PLAGNIOL-VILLARD } 80127f9ae5SJean-Christophe PLAGNIOL-VILLARD 81127f9ae5SJean-Christophe PLAGNIOL-VILLARD /* 82127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Routine: set_muxconf_regs 83127f9ae5SJean-Christophe PLAGNIOL-VILLARD * Description: Setting up the configuration Mux registers specific to the 84127f9ae5SJean-Christophe PLAGNIOL-VILLARD * hardware. Many pins need to be moved from protect to primary 85127f9ae5SJean-Christophe PLAGNIOL-VILLARD * mode. 86127f9ae5SJean-Christophe PLAGNIOL-VILLARD */ 87127f9ae5SJean-Christophe PLAGNIOL-VILLARD void set_muxconf_regs(void) 88127f9ae5SJean-Christophe PLAGNIOL-VILLARD { 89127f9ae5SJean-Christophe PLAGNIOL-VILLARD MUX_OVERO(); 90127f9ae5SJean-Christophe PLAGNIOL-VILLARD } 91df382626SOlof Johansson 92df382626SOlof Johansson #if defined(CONFIG_CMD_NET) 93df382626SOlof Johansson /* 94df382626SOlof Johansson * Routine: setup_net_chip 95df382626SOlof Johansson * Description: Setting up the configuration GPMC registers specific to the 96df382626SOlof Johansson * Ethernet hardware. 97df382626SOlof Johansson */ 98df382626SOlof Johansson static void setup_net_chip(void) 99df382626SOlof Johansson { 100df382626SOlof Johansson struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE; 101df382626SOlof Johansson 102df382626SOlof Johansson /* Configure GPMC registers */ 103df382626SOlof Johansson writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[5].config1); 104df382626SOlof Johansson writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[5].config2); 105df382626SOlof Johansson writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[5].config3); 106df382626SOlof Johansson writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[5].config4); 107df382626SOlof Johansson writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[5].config5); 108df382626SOlof Johansson writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[5].config6); 109df382626SOlof Johansson writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[5].config7); 110df382626SOlof Johansson 111df382626SOlof Johansson /* Enable off mode for NWE in PADCONF_GPMC_NWE register */ 112df382626SOlof Johansson writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe); 113df382626SOlof Johansson /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */ 114df382626SOlof Johansson writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe); 115df382626SOlof Johansson /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */ 116df382626SOlof Johansson writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00, 117df382626SOlof Johansson &ctrl_base->gpmc_nadv_ale); 118df382626SOlof Johansson 119df382626SOlof Johansson /* Make GPIO 64 as output pin and send a magic pulse through it */ 120df382626SOlof Johansson if (!omap_request_gpio(64)) { 121df382626SOlof Johansson omap_set_gpio_direction(64, 0); 122df382626SOlof Johansson omap_set_gpio_dataout(64, 1); 123df382626SOlof Johansson udelay(1); 124df382626SOlof Johansson omap_set_gpio_dataout(64, 0); 125df382626SOlof Johansson udelay(1); 126df382626SOlof Johansson omap_set_gpio_dataout(64, 1); 127df382626SOlof Johansson } 128df382626SOlof Johansson } 129df382626SOlof Johansson #endif 130df382626SOlof Johansson 131df382626SOlof Johansson int board_eth_init(bd_t *bis) 132df382626SOlof Johansson { 133df382626SOlof Johansson int rc = 0; 134df382626SOlof Johansson #ifdef CONFIG_SMC911X 135df382626SOlof Johansson rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); 136df382626SOlof Johansson #endif 137df382626SOlof Johansson return rc; 138df382626SOlof Johansson } 139