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

login
register
mail settings
Submitter Stephan Linz
Date Jan. 29, 2012, 3:54 p.m.
Message ID <bb9023f48486da009a4e68a645f8514a4c7b37e7.1327848193.git.linz@li-pro.net>
Download mbox | patch
Permalink /patch/138451/
State Rejected
Delegated to: Michal Simek
Headers show

Comments

Stephan Linz - Jan. 29, 2012, 3:54 p.m.
Signed-off-by: Stephan Linz <linz@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(-)
Michal Simek - Feb. 23, 2012, 11:56 a.m.
Stephan Linz wrote:
> Signed-off-by: Stephan Linz <linz@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);

if 1 is not the best for mainline because it means that below is dead code.

Michal
Stephan Linz - Feb. 23, 2012, 7:02 p.m.
Am Donnerstag, den 23.02.2012, 12:56 +0100 schrieb Michal Simek: 
> Stephan Linz wrote:
> > Signed-off-by: Stephan Linz <linz@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);
> 
> if 1 is not the best for mainline because it means that below is dead code.

:) right -- This snippet was only intended for illustration of the
differences


Stephan

Patch

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_ */