blob: ae7552081f6d23a2600489ffe663f33ca40dd91a [file] [log] [blame]
Mike Frysinger03783552008-10-12 21:30:48 -04001/*
Bin Meng75574052016-02-05 19:30:11 -08002 * U-Boot - main board file
Mike Frysinger03783552008-10-12 21:30:48 -04003 *
4 * Copyright (c) 2005-2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <common.h>
10#include <config.h>
11#include <command.h>
12#include <net.h>
13#include <netdev.h>
14#include <asm/blackfin.h>
Mike Frysinger03783552008-10-12 21:30:48 -040015#include <asm/mach-common/bits/otp.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
19int checkboard(void)
20{
21 printf("Board: ADI BF526 EZ-Board board\n");
22 printf(" Support: http://blackfin.uclinux.org/\n");
23 return 0;
24}
25
Mike Frysinger03783552008-10-12 21:30:48 -040026#ifdef CONFIG_BFIN_MAC
27static void board_init_enetaddr(uchar *mac_addr)
28{
Masahiro Yamada8cea9b52017-02-11 22:43:54 +090029#ifdef CONFIG_MTD_NOR_FLASH
Joe Hershberger522aba32015-05-04 14:55:15 -050030 /* we cram the MAC in the last flash sector */
31 uchar *board_mac_addr = (uchar *)0x203F0096;
32 if (is_valid_ethaddr(board_mac_addr)) {
33 memcpy(mac_addr, board_mac_addr, 6);
34 eth_setenv_enetaddr("ethaddr", mac_addr);
Mike Frysinger03783552008-10-12 21:30:48 -040035 }
Joe Hershberger522aba32015-05-04 14:55:15 -050036#endif
Mike Frysinger03783552008-10-12 21:30:48 -040037}
38
39int board_eth_init(bd_t *bis)
40{
41 return bfin_EMAC_initialize(bis);
42}
43#endif
44
45int misc_init_r(void)
46{
47#ifdef CONFIG_BFIN_MAC
48 uchar enetaddr[6];
49 if (!eth_getenv_enetaddr("ethaddr", enetaddr))
50 board_init_enetaddr(enetaddr);
51#endif
52
Masahiro Yamada8cea9b52017-02-11 22:43:54 +090053#ifdef CONFIG_MTD_NOR_FLASH
Mike Frysingerece0bfb2011-03-17 17:32:51 -040054 /* we use the last sector for the MAC address / POST LDR */
55 extern flash_info_t flash_info[];
56 flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
57#endif
58
Mike Frysinger03783552008-10-12 21:30:48 -040059 return 0;
60}