Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -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> |
| 15 | #include <asm/net.h> |
Mike Frysinger | 2ff0a30 | 2010-07-24 03:54:19 -0400 | [diff] [blame] | 16 | #include "../cm-bf537e/gpio_cfi_flash.h" |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 17 | |
| 18 | DECLARE_GLOBAL_DATA_PTR; |
| 19 | |
| 20 | int checkboard(void) |
| 21 | { |
| 22 | printf("Board: Bluetechnix CM-BF537U board\n"); |
| 23 | printf(" Support: http://www.bluetechnix.at/\n"); |
| 24 | return 0; |
| 25 | } |
| 26 | |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 27 | static void board_init_enetaddr(char *var) |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 28 | { |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 29 | #ifdef CONFIG_NET_MULTI |
| 30 | uchar enetaddr[6]; |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 31 | |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 32 | if (eth_getenv_enetaddr(var, enetaddr)) |
| 33 | return; |
| 34 | |
| 35 | printf("Warning: %s: generating 'random' MAC address\n", var); |
| 36 | bfin_gen_rand_mac(enetaddr); |
| 37 | eth_setenv_enetaddr(var, enetaddr); |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 38 | #endif |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 39 | } |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 40 | |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 41 | #ifndef CONFIG_BFIN_MAC |
| 42 | # define bfin_EMAC_initialize(x) 1 |
| 43 | #endif |
| 44 | #ifndef CONFIG_SMC911X |
| 45 | # define smc911x_initialize(n, x) 1 |
| 46 | #endif |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 47 | int board_eth_init(bd_t *bis) |
| 48 | { |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 49 | /* return ok if at least 1 eth device works */ |
| 50 | return bfin_EMAC_initialize(bis) & |
| 51 | smc911x_initialize(0, CONFIG_SMC911X_BASE); |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 52 | } |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 53 | |
| 54 | int misc_init_r(void) |
| 55 | { |
Harald Krapfenbauer | 8ff448d | 2011-05-17 15:25:54 -0400 | [diff] [blame] | 56 | board_init_enetaddr("ethaddr"); |
| 57 | board_init_enetaddr("eth1addr"); |
Harald Krapfenbauer | f437660 | 2009-08-20 19:20:41 -0400 | [diff] [blame] | 58 | |
| 59 | gpio_cfi_flash_init(); |
| 60 | |
| 61 | return 0; |
| 62 | } |