2 * U-boot - main board file
4 * Copyright (c) 2005-2008 Analog Devices Inc.
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * SPDX-License-Identifier: GPL-2.0+
15 #include <asm/blackfin.h>
17 #include <asm/mach-common/bits/bootrom.h>
20 DECLARE_GLOBAL_DATA_PTR;
24 printf("Board: ADI BF537 stamp board\n");
25 printf(" Support: http://blackfin.uclinux.org/\n");
29 #ifdef CONFIG_BFIN_MAC
30 static void board_init_enetaddr(uchar *mac_addr)
32 #ifdef CONFIG_SYS_NO_FLASH
33 # define USE_MAC_IN_FLASH 0
35 # define USE_MAC_IN_FLASH 1
37 bool valid_mac = false;
39 if (USE_MAC_IN_FLASH) {
40 /* we cram the MAC in the last flash sector */
41 uchar *board_mac_addr = (uchar *)0x203F0000;
42 if (is_valid_ethaddr(board_mac_addr)) {
43 memcpy(mac_addr, board_mac_addr, 6);
49 puts("Warning: Generating 'random' MAC address\n");
50 net_random_ethaddr(mac_addr);
53 eth_setenv_enetaddr("ethaddr", mac_addr);
56 int board_eth_init(bd_t *bis)
58 return bfin_EMAC_initialize(bis);
62 /* miscellaneous platform dependent initialisations */
65 #ifdef CONFIG_BFIN_MAC
67 if (!eth_getenv_enetaddr("ethaddr", enetaddr))
68 board_init_enetaddr(enetaddr);
71 #ifndef CONFIG_SYS_NO_FLASH
72 /* we use the last sector for the MAC address / POST LDR */
73 extern flash_info_t flash_info[];
74 flash_protect(FLAG_PROTECT_SET, 0x203F0000, 0x203FFFFF, &flash_info[0]);
77 #ifdef CONFIG_BFIN_IDE