blob: 9b9daf4267c3884ec45c866bc2d98e92f3b595fc [file] [log] [blame]
Aubrey Li26bf7de2007-03-19 01:24:52 +08001/*
Bin Menga1875592016-02-05 19:30:11 -08002 * U-Boot - main board file
Aubrey Li26bf7de2007-03-19 01:24:52 +08003 *
Mike Frysinger751e54c2008-10-11 22:44:14 -04004 * Copyright (c) 2005-2008 Analog Devices Inc.
Aubrey Li26bf7de2007-03-19 01:24:52 +08005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Aubrey Li26bf7de2007-03-19 01:24:52 +080010 */
11
12#include <common.h>
13#include <config.h>
14#include <command.h>
15#include <asm/blackfin.h>
Jean-Christophe PLAGNIOL-VILLARDb8f41622007-12-10 22:32:14 +010016#include <net.h>
Mike Frysingerd4d77302008-02-04 19:26:55 -050017#include <asm/mach-common/bits/bootrom.h>
Ben Warren89973f82008-08-31 22:22:04 -070018#include <netdev.h>
Aubrey Li26bf7de2007-03-19 01:24:52 +080019
Wolfgang Denk1218abf2007-09-15 20:48:41 +020020DECLARE_GLOBAL_DATA_PTR;
21
Aubrey Li26bf7de2007-03-19 01:24:52 +080022int checkboard(void)
23{
Aubrey Li26bf7de2007-03-19 01:24:52 +080024 printf("Board: ADI BF537 stamp board\n");
25 printf(" Support: http://blackfin.uclinux.org/\n");
26 return 0;
27}
28
Mike Frysinger751e54c2008-10-11 22:44:14 -040029#ifdef CONFIG_BFIN_MAC
30static void board_init_enetaddr(uchar *mac_addr)
31{
Joe Hershberger76ec9882015-05-04 14:55:15 -050032#ifndef CONFIG_SYS_NO_FLASH
33 /* we cram the MAC in the last flash sector */
34 uchar *board_mac_addr = (uchar *)0x203F0000;
35 if (is_valid_ethaddr(board_mac_addr)) {
36 memcpy(mac_addr, board_mac_addr, 6);
37 eth_setenv_enetaddr("ethaddr", mac_addr);
38 }
Mike Frysinger751e54c2008-10-11 22:44:14 -040039#endif
Mike Frysinger751e54c2008-10-11 22:44:14 -040040}
41
42int board_eth_init(bd_t *bis)
43{
44 return bfin_EMAC_initialize(bis);
45}
46#endif
47
Aubrey Li26bf7de2007-03-19 01:24:52 +080048/* miscellaneous platform dependent initialisations */
49int misc_init_r(void)
50{
Mike Frysinger751e54c2008-10-11 22:44:14 -040051#ifdef CONFIG_BFIN_MAC
52 uchar enetaddr[6];
53 if (!eth_getenv_enetaddr("ethaddr", enetaddr))
54 board_init_enetaddr(enetaddr);
55#endif
Aubrey Li26bf7de2007-03-19 01:24:52 +080056
Mike Frysinger751e54c2008-10-11 22:44:14 -040057#ifndef CONFIG_SYS_NO_FLASH
58 /* we use the last sector for the MAC address / POST LDR */
59 extern flash_info_t flash_info[];
60 flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
Jon Loeligerfcec2eb2007-07-09 18:19:09 -050061#endif
Aubrey Li26bf7de2007-03-19 01:24:52 +080062
Mike Frysingerd248cfb2009-02-22 16:30:38 -050063#ifdef CONFIG_BFIN_IDE
64 cf_ide_init();
Aubrey Li26bf7de2007-03-19 01:24:52 +080065#endif
Mike Frysingerd248cfb2009-02-22 16:30:38 -050066
Aubrey Li26bf7de2007-03-19 01:24:52 +080067 return 0;
68}