[U-Boot] [PATCH 8/8] microblaze: ll_temac: export xilinx_ll_temac_eth_init() for evaluation

Stephan Linz linz at li-pro.net
Sun Jan 29 16:54:39 CET 2012


Signed-off-by: Stephan Linz <linz at li-pro.net>
---
 .../xilinx/microblaze-generic/microblaze-generic.c |   57 ++++++++++++++++++++
 drivers/net/xilinx_ll_temac.c                      |    2 +-
 include/xilinx_ll_temac.h                          |    3 +
 3 files changed, 61 insertions(+), 1 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 517b2f1..d2f56b9 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -31,6 +31,10 @@
 #include <asm/microblaze_intc.h>
 #include <asm/asm.h>
 
+#ifdef CONFIG_XILINX_LL_TEMAC
+#include <xilinx_ll_temac.h>
+#endif
+
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 #ifdef CONFIG_SYS_GPIO_0
@@ -92,7 +96,60 @@ int board_eth_init(bd_t *bis)
 #endif
 
 #ifdef CONFIG_XILINX_LL_TEMAC
+#if 1
+	/* This should be the preferred way to initialize
+	 * all the interfaces. */
 	ret |= xilinx_ll_temac_standard_init(bis);
+#else
+	/************************************************************
+	 * NOTE: This part is for evaluation and will help achieve
+	 *       the right way to initialize all LL TEMAC ethernet
+	 *       interfaces. There can be more than this two i/f!
+	 ************************************************************/
+	struct ll_temac_info devinf;
+
+# ifdef XILINX_LLTEMAC_BASEADDR
+	memset(&devinf, 0, sizeof(devinf));
+	devinf.phyaddr = -1;
+	devinf.base_addr = XILINX_LLTEMAC_BASEADDR;
+#  ifdef XILINX_LLTEMAC_FIFO_BASEADDR
+	devinf.flags = LL_TEMAC_M_FIFO;
+	devinf.ctrl_addr = XILINX_LLTEMAC_FIFO_BASEADDR;
+	ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#  elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR
+#   if XILINX_LLTEMAC_SDMA_USE_DCR == 1
+	devinf.flags = LL_TEMAC_M_SDMA_DCR;
+	devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR;
+	ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   else
+	devinf.flags = LL_TEMAC_M_SDMA_PLB;
+	devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR;
+	ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   endif
+#  endif
+# endif
+
+# ifdef XILINX_LLTEMAC_BASEADDR1
+	memset(&devinf, 0, sizeof(devinf));
+	devinf.phyaddr = -1;
+	devinf.base_addr = XILINX_LLTEMAC_BASEADDR1;
+#  ifdef XILINX_LLTEMAC_FIFO_BASEADDR1
+	devinf.flags = LL_TEMAC_M_FIFO;
+	devinf.ctrl_addr = XILINX_LLTEMAC_FIFO_BASEADDR1;
+	ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#  elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1
+#   if XILINX_LLTEMAC_SDMA_USE_DCR == 1
+	devinf.flags = LL_TEMAC_M_SDMA_DCR;
+	devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1;
+	ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   else
+	devinf.flags = LL_TEMAC_M_SDMA_PLB;
+	devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1;
+	ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   endif
+#  endif
+# endif
+#endif /* if 0 */
 #endif
 
 	return ret;
diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c
index 28bc4cd..f6c5fc1 100644
--- a/drivers/net/xilinx_ll_temac.c
+++ b/drivers/net/xilinx_ll_temac.c
@@ -352,7 +352,7 @@ int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
  * Returns 1 if the ll_temac device and the mdio bus were initialized
  * otherwise returns 0
  */
-static int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info *devinf)
+int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info *devinf)
 {
 	struct ll_temac_mdio_info mdioinf;
 	int ret;
diff --git a/include/xilinx_ll_temac.h b/include/xilinx_ll_temac.h
index af4a09f..8fdce22 100644
--- a/include/xilinx_ll_temac.h
+++ b/include/xilinx_ll_temac.h
@@ -355,4 +355,7 @@ struct ll_temac_info {
 
 int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf);
 
+/* FIXME: xilinx_ll_temac_eth_init() must be again private ? */
+int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info *devinf);
+
 #endif /* _XILINX_LL_TEMAC_ */
-- 
1.7.0.4



More information about the U-Boot mailing list