2 * U-boot - main board file
4 * (C) Copyright 2010 3ality Digital Systems
6 * Copyright (c) 2005-2008 Analog Devices Inc.
8 * (C) Copyright 2000-2004
9 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
11 * SPDX-License-Identifier: GPL-2.0+
16 #include <asm/blackfin.h>
22 static void disable_external_watchdog(void)
24 #ifdef CONFIG_DNP5370_EXT_WD_DISABLE
25 /* disable external HW watchdog with PH13 = WD1 = 1 */
26 gpio_request(GPIO_PH13
, "ext_wd");
27 gpio_direction_output(GPIO_PH13
, 1);
33 printf("Board: SSV DilNet DNP5370\n");
37 #ifdef CONFIG_BFIN_MAC
38 static void board_init_enetaddr(uchar
*mac_addr
)
40 #ifdef CONFIG_SYS_NO_FLASH
41 # define USE_MAC_IN_FLASH 0
43 # define USE_MAC_IN_FLASH 1
45 bool valid_mac
= false;
47 if (USE_MAC_IN_FLASH
) {
48 /* we cram the MAC in the last flash sector */
49 uchar
*board_mac_addr
= (uchar
*)0x202F0000;
50 if (is_valid_ether_addr(board_mac_addr
)) {
51 memcpy(mac_addr
, board_mac_addr
, 6);
57 puts("Warning: Generating 'random' MAC address\n");
58 bfin_gen_rand_mac(mac_addr
);
61 eth_setenv_enetaddr("ethaddr", mac_addr
);
64 int board_eth_init(bd_t
*bis
)
66 return bfin_EMAC_initialize(bis
);
70 /* miscellaneous platform dependent initialisations */
73 disable_external_watchdog();
75 #ifdef CONFIG_BFIN_MAC
77 if (!eth_getenv_enetaddr("ethaddr", enetaddr
))
78 board_init_enetaddr(enetaddr
);
81 #ifndef CONFIG_SYS_NO_FLASH
82 /* we use the last sector for the MAC address / POST LDR */
83 extern flash_info_t flash_info
[];
84 flash_protect(FLAG_PROTECT_SET
, 0x202F0000, 0x202FFFFF, &flash_info
[0]);