summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMarian Balakowicz <m8@semihalf.com>2005-10-28 22:30:33 +0200
committerMarian Balakowicz <m8@semihalf.com>2005-10-28 22:30:33 +0200
commit63ff004c4fcad9f690bf44dbd15d568bb47aac2d (patch)
tree7b64074a85da8118b6c862f14de1171b36ade0f7 /net
parentfe93483a0ab9dcbf7794ffbf0b029ba138380e81 (diff)
Add support for multiple PHYs.
Diffstat (limited to 'net')
-rw-r--r--net/eth.c44
-rw-r--r--net/net.c4
2 files changed, 46 insertions, 2 deletions
diff --git a/net/eth.c b/net/eth.c
index cfab0e1e87f..b4ff5eff630 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -60,6 +60,26 @@ struct eth_device *eth_get_dev(void)
return eth_current;
}
+struct eth_device *eth_get_dev_by_name(char *devname)
+{
+ struct eth_device *dev, *target_dev;
+
+ if (!eth_devices)
+ return NULL;
+
+ dev = eth_devices;
+ target_dev = NULL;
+ do {
+ if (strcmp(devname, dev->name) == 0) {
+ target_dev = dev;
+ break;
+ }
+ dev = dev->next;
+ } while (dev != eth_devices);
+
+ return target_dev;
+}
+
int eth_get_dev_index (void)
{
struct eth_device *dev;
@@ -413,4 +433,28 @@ char *eth_get_name (void)
{
return (eth_current ? eth_current->name : "unknown");
}
+#elif (CONFIG_COMMANDS & CFG_CMD_NET) && !defined(CONFIG_NET_MULTI)
+
+extern int at91rm9200_miiphy_initialize(bd_t *bis);
+extern int emac4xx_miiphy_initialize(bd_t *bis);
+extern int mcf52x2_miiphy_initialize(bd_t *bis);
+extern int ns7520_miiphy_initialize(bd_t *bis);
+
+int eth_initialize(bd_t *bis)
+{
+#if defined(CONFIG_AT91RM9200)
+ at91rm9200_miiphy_initialize(bis);
+#endif
+#if defined(CONFIG_4xx) && !defined(CONFIG_IOP480) \
+ && !defined(CONFIG_AP1000) && !defined(CONFIG_405)
+ emac4xx_miiphy_initialize(bis);
+#endif
+#if defined(CONFIG_MCF52x2)
+ mcf52x2_miiphy_initialize(bis);
+#endif
+#if defined(CONFIG_NETARM)
+ ns7520_miiphy_initialize(bis);
+#endif
+ return 0;
+}
#endif
diff --git a/net/net.c b/net/net.c
index d1a15e2a096..2986924824b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -461,7 +461,7 @@ restart:
/*
* Echo the inverted link state to the fault LED.
*/
- if(miiphy_link(CFG_FAULT_MII_ADDR)) {
+ if(miiphy_link(eth_get_dev()->name, CFG_FAULT_MII_ADDR)) {
status_led_set (STATUS_LED_RED, STATUS_LED_OFF);
} else {
status_led_set (STATUS_LED_RED, STATUS_LED_ON);
@@ -512,7 +512,7 @@ restart:
/*
* Echo the inverted link state to the fault LED.
*/
- if(miiphy_link(CFG_FAULT_MII_ADDR)) {
+ if(miiphy_link(eth_get_dev()->name, CFG_FAULT_MII_ADDR)) {
status_led_set (STATUS_LED_RED, STATUS_LED_OFF);
} else {
status_led_set (STATUS_LED_RED, STATUS_LED_ON);