Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 1 | /* |
| 2 | * U-boot - main board file |
| 3 | * |
| 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 Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 15 | #include "gpio_cfi_flash.h" |
| 16 | |
| 17 | DECLARE_GLOBAL_DATA_PTR; |
| 18 | |
| 19 | int checkboard(void) |
| 20 | { |
| 21 | printf("Board: Bluetechnix CM-BF537E board\n"); |
| 22 | printf(" Support: http://www.bluetechnix.at/\n"); |
| 23 | return 0; |
| 24 | } |
| 25 | |
Harald Krapfenbauer | fff18be | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 26 | static void board_init_enetaddr(char *var) |
Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 27 | { |
Harald Krapfenbauer | fff18be | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 28 | uchar enetaddr[6]; |
| 29 | |
| 30 | if (eth_getenv_enetaddr(var, enetaddr)) |
| 31 | return; |
| 32 | |
| 33 | printf("Warning: %s: generating 'random' MAC address\n", var); |
Masahiro Yamada | c42f56d | 2014-04-18 19:09:49 +0900 | [diff] [blame] | 34 | eth_random_addr(enetaddr); |
Harald Krapfenbauer | fff18be | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 35 | eth_setenv_enetaddr(var, enetaddr); |
Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 36 | } |
| 37 | |
Harald Krapfenbauer | fff18be | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 38 | #ifndef CONFIG_BFIN_MAC |
| 39 | # define bfin_EMAC_initialize(x) 1 |
| 40 | #endif |
| 41 | #ifndef CONFIG_SMC911X |
| 42 | # define smc911x_initialize(n, x) 1 |
| 43 | #endif |
Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 44 | int board_eth_init(bd_t *bis) |
| 45 | { |
Harald Krapfenbauer | fff18be | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 46 | /* return ok if at least 1 eth device works */ |
| 47 | return bfin_EMAC_initialize(bis) & |
| 48 | smc911x_initialize(0, CONFIG_SMC911X_BASE); |
Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 49 | } |
Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 50 | |
| 51 | int misc_init_r(void) |
| 52 | { |
Harald Krapfenbauer | fff18be | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 53 | board_init_enetaddr("ethaddr"); |
| 54 | board_init_enetaddr("eth1addr"); |
Mike Frysinger | 8a9bab0 | 2008-10-12 21:41:06 -0400 | [diff] [blame] | 55 | |
| 56 | gpio_cfi_flash_init(); |
| 57 | |
| 58 | return 0; |
| 59 | } |