1/* 2 * U-boot - main board file 3 * 4 * Copyright (c) 2005-2008 Analog Devices Inc. 5 * 6 * (C) Copyright 2000-2004 7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 8 * 9 * See file CREDITS for list of people who contributed to this 10 * project. 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License as 14 * published by the Free Software Foundation; either version 2 of 15 * the License, or (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 25 * MA 02110-1301 USA 26 */ 27 28#include <common.h> 29#include <config.h> 30#include <command.h> 31#include <asm/blackfin.h> 32#include <asm/net.h> 33#include <net.h> 34#include <asm/mach-common/bits/bootrom.h> 35#include <netdev.h> 36 37DECLARE_GLOBAL_DATA_PTR; 38 39int checkboard(void) 40{ 41 printf("Board: ADI BF537 stamp board\n"); 42 printf(" Support: http://blackfin.uclinux.org/\n"); 43 return 0; 44} 45 46phys_size_t initdram(int board_type) 47{ 48 gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; 49 gd->bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE; 50 return gd->bd->bi_memsize; 51} 52 53void board_reset(void) 54{ 55 /* workaround for weak pull ups on ssel */ 56 if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER) { 57 bfin_write_PORTF_FER(bfin_read_PORTF_FER() & ~PF10); 58 bfin_write_PORTFIO_SET(PF10); 59 udelay(1); 60 } 61} 62 63#ifdef CONFIG_BFIN_MAC 64static void board_init_enetaddr(uchar *mac_addr) 65{ 66#ifdef CONFIG_SYS_NO_FLASH 67# define USE_MAC_IN_FLASH 0 68#else 69# define USE_MAC_IN_FLASH 1 70#endif 71 bool valid_mac = false; 72 73 if (USE_MAC_IN_FLASH) { 74 /* we cram the MAC in the last flash sector */ 75 uchar *board_mac_addr = (uchar *)0x203F0000; 76 if (is_valid_ether_addr(board_mac_addr)) { 77 memcpy(mac_addr, board_mac_addr, 6); 78 valid_mac = true; 79 } 80 } 81 82 if (!valid_mac) { 83 puts("Warning: Generating 'random' MAC address\n"); 84 bfin_gen_rand_mac(mac_addr); 85 } 86 87 eth_setenv_enetaddr("ethaddr", mac_addr); 88} 89 90int board_eth_init(bd_t *bis) 91{ 92 return bfin_EMAC_initialize(bis); 93} 94#endif 95 96/* miscellaneous platform dependent initialisations */ 97int misc_init_r(void) 98{ 99#ifdef CONFIG_BFIN_MAC 100 uchar enetaddr[6]; 101 if (!eth_getenv_enetaddr("ethaddr", enetaddr)) 102 board_init_enetaddr(enetaddr); 103#endif 104 105#ifndef CONFIG_SYS_NO_FLASH 106 /* we use the last sector for the MAC address / POST LDR */ 107 extern flash_info_t flash_info[]; 108 flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]); 109#endif 110 111#ifdef CONFIG_BFIN_IDE 112 cf_ide_init(); 113#endif 114 115 return 0; 116} 117