Patchwork [U-Boot,09/14] net: gem: Pass phy address to init

login
register
mail settings
Submitter Michal Simek
Date April 22, 2013, 2:52 p.m.
Message ID <e883c2206b0b29bda21cfc016767278118269584.1366641836.git.michal.simek@xilinx.com>
Download mbox | patch
Permalink /patch/238555/
State Changes Requested
Delegated to: Tom Rini
Headers show

Comments

Michal Simek - April 22, 2013, 2:52 p.m.
From: David Andrey <david.andrey@netmodule.com>

Pass the PHY address to the driver init to
allow parallel use of both interfaces

Signed-off-by: David Andrey <david.andrey@netmodule.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
 board/xilinx/zynq/board.c | 6 ++++--
 drivers/net/zynq_gem.c    | 8 ++------
 include/configs/zynq.h    | 1 +
 include/netdev.h          | 2 +-
 4 files changed, 8 insertions(+), 9 deletions(-)

--
1.8.2.1

Patch

diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 8da476c..f92d5a8 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -42,10 +42,12 @@  int board_eth_init(bd_t *bis)

 #if defined(CONFIG_ZYNQ_GEM)
 # if defined(CONFIG_ZYNQ_GEM0)
-	ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0);
+	ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR0,
+						CONFIG_ZYNQ_GEM_PHY_ADDR0);
 # endif
 # if defined(CONFIG_ZYNQ_GEM1)
-	ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1);
+	ret |= zynq_gem_initialize(bis, CONFIG_ZYNQ_GEM_BASEADDR1,
+						CONFIG_ZYNQ_GEM_PHY_ADDR1);
 # endif
 #endif
 	return ret;
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 2d717e9..316816d 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -427,7 +427,7 @@  static int zynq_gem_miiphy_write(const char *devname, uchar addr,
 	return phywrite(dev, addr, reg, val);
 }

-int zynq_gem_initialize(bd_t *bis, int base_addr)
+int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr)
 {
 	struct eth_device *dev;
 	struct zynq_gem_priv *priv;
@@ -443,11 +443,7 @@  int zynq_gem_initialize(bd_t *bis, int base_addr)
 	}
 	priv = dev->priv;

-#ifdef CONFIG_PHY_ADDR
-	priv->phyaddr = CONFIG_PHY_ADDR;
-#else
-	priv->phyaddr = -1;
-#endif
+	priv->phyaddr = phy_addr;

 	sprintf(dev->name, "Gem.%x", base_addr);

diff --git a/include/configs/zynq.h b/include/configs/zynq.h
index ebe1b1b..3b23354 100644
--- a/include/configs/zynq.h
+++ b/include/configs/zynq.h
@@ -54,6 +54,7 @@ 
 #define CONFIG_NET_MULTI
 #define CONFIG_ZYNQ_GEM
 #define CONFIG_ZYNQ_GEM0
+#define CONFIG_ZYNQ_GEM_PHY_ADDR0	7

 #if defined(CONFIG_ZYNQ_DCC)
 # define CONFIG_ARM_DCC
diff --git a/include/netdev.h b/include/netdev.h
index fd3e243..81117b1 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -104,7 +104,7 @@  int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
 							int txpp, int rxpp);
 int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags,
 						unsigned long ctrl_addr);
-int zynq_gem_initialize(bd_t *bis, int base_addr);
+int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr);
 /*
  * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface
  * exported by a public hader file, we need a global definition at this point.