[U-Boot] [PATCH 08/26] net: emaclite: Move RX/TX ping pong initialization to board

Michal Simek monstr at monstr.eu
Tue Sep 13 09:10:03 CEST 2011


Init RX/TX ping pong directly from board not in the driver.

Signed-off-by: Michal Simek <monstr at monstr.eu>
---
 .../xilinx/microblaze-generic/microblaze-generic.c |   18 ++++++++++++------
 drivers/net/xilinx_emaclite.c                      |   11 ++++-------
 include/netdev.h                                   |    3 ++-
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 183e4dc..9b2952f 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -71,12 +71,18 @@ int fsl_init2 (void) {
 
 int board_eth_init(bd_t *bis)
 {
-	/*
-	 * This board either has PCI NICs or uses the CPU's TSECs
-	 * pci_eth_init() will return 0 if no NICs found, so in that case
-	 * returning -1 will force cpu_eth_init() to be called.
-	 */
+	int ret = 0;
 #ifdef CONFIG_XILINX_EMACLITE
-	return xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR);
+	u32 txpp = 0;
+	u32 rxpp = 0;
+# ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
+	txpp = 1;
+# endif
+# ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG
+	rxpp = 1;
+# endif
+	ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,
+			txpp, rxpp);
 #endif
+	return ret;
 }
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index c4366c2..eca6ef9 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -347,7 +347,8 @@ static int emaclite_recv(struct eth_device *dev)
 
 }
 
-int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr)
+int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
+							int txpp, int rxpp)
 {
 	struct eth_device *dev;
 	struct xemaclite *emaclite;
@@ -364,12 +365,8 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr)
 
 	dev->priv = emaclite;
 
-#ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
-	emaclite->txpp = 1;
-#endif
-#ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG
-	emaclite->rxpp = 1;
-#endif
+	emaclite->txpp = txpp;
+	emaclite->rxpp = rxpp;
 
 	sprintf(dev->name, "Xelite.%lx", base_addr);
 
diff --git a/include/netdev.h b/include/netdev.h
index 5d78148..8b71011 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -94,7 +94,8 @@ int smc911x_initialize(u8 dev_num, int base_addr);
 int tsi108_eth_initialize(bd_t *bis);
 int uec_standard_init(bd_t *bis);
 int uli526x_initialize(bd_t *bis);
-int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr);
+int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
+							int txpp, int rxpp);
 
 /* Boards with PCI network controllers can call this from their board_eth_init()
  * function to initialize whatever's on board.
-- 
1.5.5.6



More information about the U-Boot mailing list