Skip to content
Snippets Groups Projects
board.c 25.2 KiB
Newer Older
Wolfgang Denk's avatar
Wolfgang Denk committed
/*
 * (C) Copyright 2000-2011
Wolfgang Denk's avatar
Wolfgang Denk committed
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#include <common.h>
#include <watchdog.h>
#include <command.h>
#include <malloc.h>
Wolfgang Denk's avatar
Wolfgang Denk committed
#ifdef CONFIG_8xx
#include <mpc8xx.h>
#endif
#ifdef CONFIG_5xx
#include <mpc5xx.h>
#endif
#ifdef CONFIG_MPC5xxx
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <ide.h>
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <scsi.h>
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <kgdb.h>
#endif
#ifdef CONFIG_STATUS_LED
#include <status_led.h>
#endif
#include <net.h>
Andy Fleming's avatar
Andy Fleming committed
#ifdef CONFIG_GENERIC_MMC
#include <mmc.h>
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <serial.h>
#ifdef CONFIG_SYS_ALLOC_DPRAM
#if !defined(CONFIG_CPM2)
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <commproc.h>
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <version.h>
#if defined(CONFIG_BAB7xx)
#include <w83c553f.h>
#endif
#include <dtt.h>
#if defined(CONFIG_POST)
#include <post.h>
#endif
#if defined(CONFIG_LOGBUFFER)
#include <logbuff.h>
#endif
#if defined(CONFIG_SYS_INIT_RAM_LOCK) && defined(CONFIG_E500)
#include <asm/cache.h>
#endif
#ifdef CONFIG_PS2KBD
#include <keyboard.h>
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed

#ifdef CONFIG_ADDR_MAP
#include <asm/mmu.h>
#endif

#ifdef CONFIG_MP
#include <asm/mp.h>
#endif

#ifdef CONFIG_BITBANGMII
#include <miiphy.h>
#endif

#ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
extern int update_flash_size(int flash_size);
extern void sc3_read_eeprom(void);
#endif

Wolfgang Denk's avatar
Wolfgang Denk committed
#endif
#if defined(CONFIG_HARD_I2C) || \
    defined(CONFIG_SOFT_I2C)
#include <i2c.h>
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed

static char *failed = "*** failed ***\n";

#if defined(CONFIG_OXC) || defined(CONFIG_RMU)
Wolfgang Denk's avatar
Wolfgang Denk committed
extern flash_info_t flash_info[];
Wolfgang Denk's avatar
Wolfgang Denk committed
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed

#if defined(CONFIG_START_IDE)
extern int board_start_ide(void);
#endif
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <environment.h>
Wolfgang Denk's avatar
Wolfgang Denk committed

#if !defined(CONFIG_SYS_MEM_TOP_HIDE)
#define CONFIG_SYS_MEM_TOP_HIDE	0
Po-Yu Chuang's avatar
Po-Yu Chuang committed
extern ulong __bss_end__;
Wolfgang Denk's avatar
Wolfgang Denk committed
#include <bedbug/type.h>
#endif

Wolfgang Denk's avatar
Wolfgang Denk committed
 */

/*
 * All attempts to come up with a "common" initialization sequence
 * that works for all boards and architectures failed: some of the
 * requirements are just _too_ different. To get rid of the resulting
 * mess of board dependend #ifdef'ed code we now make the whole
 * initialization sequence configurable to the user.
 *
 * The requirements for any new initalization function is simple: it
 * receives a pointer to the "global data" structure as it's only
 * argument, and returns an integer return code, where 0 means
 * "continue" and != 0 means "fatal error, hang the system".
 */
typedef int (init_fnc_t)(void);
Wolfgang Denk's avatar
Wolfgang Denk committed

Wolfgang Denk's avatar
Wolfgang Denk committed
 * Some of this code should be moved into the core functions,
 * but let's get it working (again) first...
 */

static int init_baudrate(void)
Wolfgang Denk's avatar
Wolfgang Denk committed
{
	gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
	return 0;
Wolfgang Denk's avatar
Wolfgang Denk committed
}

/***********************************************************************/

static void __board_add_ram_info(int use_default)
{
	/* please define platform specific board_add_ram_info() */
}

void board_add_ram_info(int)
	__attribute__ ((weak, alias("__board_add_ram_info")));
static int __board_flash_wp_on(void)
{
	/*
	 * Most flashes can't be detected when write protection is enabled,
	 * so provide a way to let U-Boot gracefully ignore write protected
	 * devices.
	 */
	return 0;
}

int board_flash_wp_on(void)
	__attribute__ ((weak, alias("__board_flash_wp_on")));
static void __cpu_secondary_init_r(void)
	__attribute__ ((weak, alias("__cpu_secondary_init_r")));
static int init_func_ram(void)
Wolfgang Denk's avatar
Wolfgang Denk committed
{
#ifdef	CONFIG_BOARD_TYPES
	int board_type = gd->board_type;
#else
	int board_type = 0;	/* use dummy arg */
#endif
Loading
Loading full blame...