Andreas Schallenberg | 2fc32de | 2010-11-17 13:51:33 -0500 | [diff] [blame] | 1 | /* |
Bin Meng | a187559 | 2016-02-05 19:30:11 -0800 | [diff] [blame] | 2 | * U-Boot - main board file |
Andreas Schallenberg | 2fc32de | 2010-11-17 13:51:33 -0500 | [diff] [blame] | 3 | * |
| 4 | * (C) Copyright 2010 3ality Digital Systems |
| 5 | * |
| 6 | * Copyright (c) 2005-2008 Analog Devices Inc. |
| 7 | * |
| 8 | * (C) Copyright 2000-2004 |
| 9 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 10 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 11 | * SPDX-License-Identifier: GPL-2.0+ |
Andreas Schallenberg | 2fc32de | 2010-11-17 13:51:33 -0500 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <common.h> |
| 15 | #include <config.h> |
| 16 | #include <asm/blackfin.h> |
Andreas Schallenberg | 2fc32de | 2010-11-17 13:51:33 -0500 | [diff] [blame] | 17 | #include <net.h> |
| 18 | #include <netdev.h> |
| 19 | #include <asm/gpio.h> |
| 20 | |
| 21 | static void disable_external_watchdog(void) |
| 22 | { |
| 23 | #ifdef CONFIG_DNP5370_EXT_WD_DISABLE |
| 24 | /* disable external HW watchdog with PH13 = WD1 = 1 */ |
| 25 | gpio_request(GPIO_PH13, "ext_wd"); |
| 26 | gpio_direction_output(GPIO_PH13, 1); |
| 27 | #endif |
| 28 | } |
| 29 | |
| 30 | int checkboard(void) |
| 31 | { |
| 32 | printf("Board: SSV DilNet DNP5370\n"); |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | #ifdef CONFIG_BFIN_MAC |
| 37 | static void board_init_enetaddr(uchar *mac_addr) |
| 38 | { |
Joe Hershberger | 76ec988 | 2015-05-04 14:55:15 -0500 | [diff] [blame] | 39 | #ifndef CONFIG_SYS_NO_FLASH |
| 40 | /* we cram the MAC in the last flash sector */ |
| 41 | uchar *board_mac_addr = (uchar *)0x202F0000; |
| 42 | if (is_valid_ethaddr(board_mac_addr)) { |
| 43 | memcpy(mac_addr, board_mac_addr, 6); |
| 44 | eth_setenv_enetaddr("ethaddr", mac_addr); |
| 45 | } |
Andreas Schallenberg | 2fc32de | 2010-11-17 13:51:33 -0500 | [diff] [blame] | 46 | #endif |
Andreas Schallenberg | 2fc32de | 2010-11-17 13:51:33 -0500 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | int board_eth_init(bd_t *bis) |
| 50 | { |
| 51 | return bfin_EMAC_initialize(bis); |
| 52 | } |
| 53 | #endif |
| 54 | |
| 55 | /* miscellaneous platform dependent initialisations */ |
| 56 | int misc_init_r(void) |
| 57 | { |
| 58 | disable_external_watchdog(); |
| 59 | |
| 60 | #ifdef CONFIG_BFIN_MAC |
| 61 | uchar enetaddr[6]; |
| 62 | if (!eth_getenv_enetaddr("ethaddr", enetaddr)) |
| 63 | board_init_enetaddr(enetaddr); |
| 64 | #endif |
| 65 | |
| 66 | #ifndef CONFIG_SYS_NO_FLASH |
| 67 | /* we use the last sector for the MAC address / POST LDR */ |
| 68 | extern flash_info_t flash_info[]; |
| 69 | flash_protect(FLAG_PROTECT_SET, 0x202F0000, 0x202FFFFF, &flash_info[0]); |
| 70 | #endif |
| 71 | |
| 72 | return 0; |
| 73 | } |