Commit d9785c14bf489908b8e39b1e20f0c14cb8fcda76
1 parent
0a69b26ed6
Exists in
master
and in
54 other branches
Fix miiphy global data initialization (problem on 4xx boards when no
ethaddr is assigned). Initialization moved from miiphy_register() to eth_initialize(). Based on initial patch for 4xx platform by Matthias Fuchs.
Showing 4 changed files with 27 additions and 7 deletions Side-by-side Diff
CHANGELOG
... | ... | @@ -2,6 +2,12 @@ |
2 | 2 | Changes for U-Boot 1.1.4: |
3 | 3 | ====================================================================== |
4 | 4 | |
5 | +* Fix miiphy global data initialization (problem on 4xx boards when no | |
6 | + ethaddr is assigned). Initialization moved from miiphy_register() to | |
7 | + eth_initialize(). | |
8 | + | |
9 | + Based on initial patch for 4xx platform by Matthias Fuchs. | |
10 | + | |
5 | 11 | * Remove unnnecessary #include <linux/types.h> from include/asm-*/u-boot.h |
6 | 12 | |
7 | 13 | * Allow use of include/image.h and include/asm-*/u-boot.h in proprietary code. |
common/miiphyutil.c
... | ... | @@ -60,6 +60,16 @@ |
60 | 60 | |
61 | 61 | /***************************************************************************** |
62 | 62 | * |
63 | + * Initialize global data. Need to be called before any other miiphy routine. | |
64 | + */ | |
65 | +void miiphy_init() | |
66 | +{ | |
67 | + INIT_LIST_HEAD(&mii_devs); | |
68 | + current_mii = NULL; | |
69 | +} | |
70 | + | |
71 | +/***************************************************************************** | |
72 | + * | |
63 | 73 | * Register read and write MII access routines for the device <name>. |
64 | 74 | */ |
65 | 75 | void miiphy_register(char *name, |
66 | 76 | |
... | ... | @@ -71,14 +81,7 @@ |
71 | 81 | struct list_head *entry; |
72 | 82 | struct mii_dev *new_dev; |
73 | 83 | struct mii_dev *miidev; |
74 | - static int head_initialized = 0; | |
75 | 84 | unsigned int name_len; |
76 | - | |
77 | - if (head_initialized == 0) { | |
78 | - INIT_LIST_HEAD(&mii_devs); | |
79 | - current_mii = NULL; | |
80 | - head_initialized = 1; | |
81 | - } | |
82 | 85 | |
83 | 86 | /* check if we have unique name */ |
84 | 87 | list_for_each(entry, &mii_devs) { |
include/miiphy.h
net/eth.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #include <common.h> |
25 | 25 | #include <command.h> |
26 | 26 | #include <net.h> |
27 | +#include <miiphy.h> | |
27 | 28 | |
28 | 29 | #if (CONFIG_COMMANDS & CFG_CMD_NET) && defined(CONFIG_NET_MULTI) |
29 | 30 | |
... | ... | @@ -136,6 +137,10 @@ |
136 | 137 | eth_devices = NULL; |
137 | 138 | eth_current = NULL; |
138 | 139 | |
140 | +#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) | |
141 | + miiphy_init(); | |
142 | +#endif | |
143 | + | |
139 | 144 | #ifdef CONFIG_DB64360 |
140 | 145 | mv6436x_eth_initialize(bis); |
141 | 146 | #endif |
... | ... | @@ -442,6 +447,10 @@ |
442 | 447 | |
443 | 448 | int eth_initialize(bd_t *bis) |
444 | 449 | { |
450 | +#if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) | |
451 | + miiphy_init(); | |
452 | +#endif | |
453 | + | |
445 | 454 | #if defined(CONFIG_AT91RM9200) |
446 | 455 | at91rm9200_miiphy_initialize(bis); |
447 | 456 | #endif |