[U-Boot] [PATCH v2 1/2] mvgbe: allow non-sequential PHY addresses
Albert ARIBAUD
albert.u.boot at aribaud.net
Fri Oct 19 23:38:08 CEST 2012
Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
---
drivers/net/mvgbe.c | 10 +++++++++-
drivers/net/mvgbe.h | 7 -------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 47bf27c..40b9bcf 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -653,6 +653,14 @@ int mvgbe_initialize(bd_t *bis)
struct eth_device *dev;
int devnum;
u8 used_ports[MAX_MVGBE_DEVS] = CONFIG_MVGBE_PORTS;
+#if defined(CONFIG_MVGBE_PHY_ADRS)
+#define MVGBE_PHY_ADRS CONFIG_MVGBE_PHY_ADRS
+#elif defined(CONFIG_PHY_BASE_ADR)
+#define MVGBE_PHY_ADRS {CONFIG_PHY_BASE_ADR, CONFIG_PHY_BASE_ADR+1}
+#else
+#define MVGBE_PHY_ADRS {8, 9}
+#endif
+ u8 used_phy_adrs[MAX_MVGBE_DEVS] = MVGBE_PHY_ADRS;
for (devnum = 0; devnum < MAX_MVGBE_DEVS; devnum++) {
/*skip if port is configured not to use */
@@ -733,7 +741,7 @@ error1:
miiphy_register(dev->name, smi_reg_read, smi_reg_write);
/* Set phy address of the port */
miiphy_write(dev->name, MV_PHY_ADR_REQUEST,
- MV_PHY_ADR_REQUEST, PHY_BASE_ADR + devnum);
+ MV_PHY_ADR_REQUEST, used_phy_adrs[devnum]);
#endif
}
return 0;
diff --git a/drivers/net/mvgbe.h b/drivers/net/mvgbe.h
index d8a5429..5434839 100644
--- a/drivers/net/mvgbe.h
+++ b/drivers/net/mvgbe.h
@@ -28,13 +28,6 @@
#ifndef __MVGBE_H__
#define __MVGBE_H__
-/* PHY_BASE_ADR is board specific and can be configured */
-#if defined (CONFIG_PHY_BASE_ADR)
-#define PHY_BASE_ADR CONFIG_PHY_BASE_ADR
-#else
-#define PHY_BASE_ADR 0x08 /* default phy base addr */
-#endif
-
/* Constants */
#define INT_CAUSE_UNMASK_ALL 0x0007ffff
#define INT_CAUSE_UNMASK_ALL_EXT 0x0011ffff
--
1.7.9.5
More information about the U-Boot
mailing list