diff mbox series

[PATCHv3,06/15] fsl: p1_p2_rdb: Move vsc7835 firmware uploading to board_early_init_r()

Message ID 20200612151735.49048-7-Zhiqiang.Hou@nxp.com
State Superseded
Headers show
Series powerpc: covert p1010, p1020 and p2020 RDB board to DM_ETH | expand

Commit Message

Zhiqiang Hou June 12, 2020, 3:17 p.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>

Move vsc7835 firmware uploading to board_early_init_r(), so that
the switch also can work in DM eTSEC driver.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
---
V3:
 - Rebase the patch, no change intended.

 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 35 +++++++++++----------
 1 file changed, 18 insertions(+), 17 deletions(-)

Comments

Vladimir Oltean June 12, 2020, 8:36 p.m. UTC | #1
On Fri, 12 Jun 2020 at 18:23, Zhiqiang Hou <Zhiqiang.Hou at nxp.com> wrote:
>
> From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
>
> Move vsc7835 firmware uploading to board_early_init_r(), so that
> the switch also can work in DM eTSEC driver.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> ---

For what it's worth, a DM_DSA uclass has been proposed exactly for
this kind of stuff, but has received exactly zero review thus far:
https://patchwork.ozlabs.org/project/uboot/cover/1588700588-8587-1-git-send-email-claudiu.manoil at nxp.com/
So, given the tools we have, this is the best we can do.

Reviewed-by: Vladimir Oltean <vladimir.oltean at nxp.com>

> V3:
>  - Rebase the patch, no change intended.
>
>  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 35 +++++++++++----------
>  1 file changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> index 1353debc0e..3dd6178708 100644
> --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> @@ -316,6 +316,10 @@ int board_early_init_r(void)
>  {
>         const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
>         int flash_esel = find_tlb_idx((void *)flashbase, 1);
> +#ifdef CONFIG_VSC7385_ENET
> +       unsigned int vscfw_addr;
> +       char *tmp;
> +#endif
>
>         /*
>          * Remap Boot flash region to caching-inhibited
> @@ -338,6 +342,20 @@ int board_early_init_r(void)
>         set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS, /* tlb, epn, rpn */
>                 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,/* perms, wimge */
>                 0, flash_esel, BOOKE_PAGESZ_64M, 1);/* ts, esel, tsize, iprot */
> +
> +#ifdef CONFIG_VSC7385_ENET
> +       /* If a VSC7385 microcode image is present, then upload it. */
> +       tmp = env_get("vscfw_addr");
> +       if (tmp) {
> +               vscfw_addr = simple_strtoul(tmp, NULL, 16);
> +               printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
> +               if (vsc7385_upload_firmware((void *)vscfw_addr,
> +                                           CONFIG_VSC7385_IMAGE_SIZE))
> +                       puts("Failure uploading VSC7385 microcode.\n");
> +       } else {
> +               puts("No address specified for VSC7385 microcode.\n");
> +       }
> +#endif
>         return 0;
>  }
>
> @@ -348,10 +366,6 @@ int board_eth_init(bd_t *bis)
>         ccsr_gur_t *gur __attribute__((unused)) =
>                 (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
>         int num = 0;
> -#ifdef CONFIG_VSC7385_ENET
> -       char *tmp;
> -       unsigned int vscfw_addr;
> -#endif
>
>  #ifdef CONFIG_TSEC1
>         SET_STD_TSEC_INFO(tsec_info[num], 1);
> @@ -375,19 +389,6 @@ int board_eth_init(bd_t *bis)
>                 return 0;
>         }
>
> -#ifdef CONFIG_VSC7385_ENET
> -       /* If a VSC7385 microcode image is present, then upload it. */
> -       tmp = env_get("vscfw_addr");
> -       if (tmp) {
> -               vscfw_addr = simple_strtoul(tmp, NULL, 16);
> -               printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
> -               if (vsc7385_upload_firmware((void *) vscfw_addr,
> -                                       CONFIG_VSC7385_IMAGE_SIZE))
> -                       puts("Failure uploading VSC7385 microcode.\n");
> -       } else
> -               puts("No address specified for VSC7385 microcode.\n");
> -#endif
> -
>         mdio_info.regs = TSEC_GET_MDIO_REGS_BASE(1);
>         mdio_info.name = DEFAULT_MII_NAME;
>
> --
> 2.25.1
>
Zhiqiang Hou June 15, 2020, 8:56 a.m. UTC | #2
Hi Vladimir,

Thanks a lot for your review!

Regards,
Zhiqiang

> -----Original Message-----
> From: Vladimir Oltean <olteanv at gmail.com>
> Sent: 2020?6?13? 4:37
> To: Z.q. Hou <zhiqiang.hou at nxp.com>
> Cc: u-boot <u-boot at lists.denx.de>; Priyanka Jain <priyanka.jain at nxp.com>;
> Bin Meng <bmeng.cn at gmail.com>
> Subject: Re: [PATCHv3 06/15] fsl: p1_p2_rdb: Move vsc7835 firmware
> uploading to board_early_init_r()
> 
> On Fri, 12 Jun 2020 at 18:23, Zhiqiang Hou <Zhiqiang.Hou at nxp.com> wrote:
> >
> > From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> >
> > Move vsc7835 firmware uploading to board_early_init_r(), so that the
> > switch also can work in DM eTSEC driver.
> >
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> > ---
> 
> For what it's worth, a DM_DSA uclass has been proposed exactly for this kind
> of stuff, but has received exactly zero review thus far:
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.ozlabs.org%2Fproject%2Fuboot%2Fcover%2F1588700588-8587-1-git-s
> end-email-claudiu.manoil%40nxp.com%2F&amp;data=02%7C01%7CZhiqian
> g.Hou%40nxp.com%7Cd10d8cbe295d402a213408d80f1059f9%7C686ea1d3
> bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637275910184645214&amp;sda
> ta=0gqLyzu96SUYn1t0Rrdjj6bEnT6r8CUSSelFnW%2BRpnE%3D&amp;reserve
> d=0
> So, given the tools we have, this is the best we can do.
> 
> Reviewed-by: Vladimir Oltean <vladimir.oltean at nxp.com>
> 
> > V3:
> >  - Rebase the patch, no change intended.
> >
> >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 35
> > +++++++++++----------
> >  1 file changed, 18 insertions(+), 17 deletions(-)
> >
> > diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > index 1353debc0e..3dd6178708 100644
> > --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
> > @@ -316,6 +316,10 @@ int board_early_init_r(void)  {
> >         const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
> >         int flash_esel = find_tlb_idx((void *)flashbase, 1);
> > +#ifdef CONFIG_VSC7385_ENET
> > +       unsigned int vscfw_addr;
> > +       char *tmp;
> > +#endif
> >
> >         /*
> >          * Remap Boot flash region to caching-inhibited @@ -338,6
> > +342,20 @@ int board_early_init_r(void)
> >         set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS, /* tlb,
> epn, rpn */
> >                 MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,/*
> perms, wimge */
> >                 0, flash_esel, BOOKE_PAGESZ_64M, 1);/* ts, esel,
> > tsize, iprot */
> > +
> > +#ifdef CONFIG_VSC7385_ENET
> > +       /* If a VSC7385 microcode image is present, then upload it. */
> > +       tmp = env_get("vscfw_addr");
> > +       if (tmp) {
> > +               vscfw_addr = simple_strtoul(tmp, NULL, 16);
> > +               printf("uploading VSC7385 microcode from %x\n",
> vscfw_addr);
> > +               if (vsc7385_upload_firmware((void *)vscfw_addr,
> > +
> CONFIG_VSC7385_IMAGE_SIZE))
> > +                       puts("Failure uploading VSC7385
> microcode.\n");
> > +       } else {
> > +               puts("No address specified for VSC7385
> microcode.\n");
> > +       }
> > +#endif
> >         return 0;
> >  }
> >
> > @@ -348,10 +366,6 @@ int board_eth_init(bd_t *bis)
> >         ccsr_gur_t *gur __attribute__((unused)) =
> >                 (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> >         int num = 0;
> > -#ifdef CONFIG_VSC7385_ENET
> > -       char *tmp;
> > -       unsigned int vscfw_addr;
> > -#endif
> >
> >  #ifdef CONFIG_TSEC1
> >         SET_STD_TSEC_INFO(tsec_info[num], 1); @@ -375,19 +389,6
> @@ int
> > board_eth_init(bd_t *bis)
> >                 return 0;
> >         }
> >
> > -#ifdef CONFIG_VSC7385_ENET
> > -       /* If a VSC7385 microcode image is present, then upload it. */
> > -       tmp = env_get("vscfw_addr");
> > -       if (tmp) {
> > -               vscfw_addr = simple_strtoul(tmp, NULL, 16);
> > -               printf("uploading VSC7385 microcode from %x\n",
> vscfw_addr);
> > -               if (vsc7385_upload_firmware((void *) vscfw_addr,
> > -
> CONFIG_VSC7385_IMAGE_SIZE))
> > -                       puts("Failure uploading VSC7385
> microcode.\n");
> > -       } else
> > -               puts("No address specified for VSC7385
> microcode.\n");
> > -#endif
> > -
> >         mdio_info.regs = TSEC_GET_MDIO_REGS_BASE(1);
> >         mdio_info.name = DEFAULT_MII_NAME;
> >
> > --
> > 2.25.1
> >
diff mbox series

Patch

diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 1353debc0e..3dd6178708 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -316,6 +316,10 @@  int board_early_init_r(void)
 {
 	const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
 	int flash_esel = find_tlb_idx((void *)flashbase, 1);
+#ifdef CONFIG_VSC7385_ENET
+	unsigned int vscfw_addr;
+	char *tmp;
+#endif
 
 	/*
 	 * Remap Boot flash region to caching-inhibited
@@ -338,6 +342,20 @@  int board_early_init_r(void)
 	set_tlb(1, flashbase, CONFIG_SYS_FLASH_BASE_PHYS, /* tlb, epn, rpn */
 		MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,/* perms, wimge */
 		0, flash_esel, BOOKE_PAGESZ_64M, 1);/* ts, esel, tsize, iprot */
+
+#ifdef CONFIG_VSC7385_ENET
+	/* If a VSC7385 microcode image is present, then upload it. */
+	tmp = env_get("vscfw_addr");
+	if (tmp) {
+		vscfw_addr = simple_strtoul(tmp, NULL, 16);
+		printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
+		if (vsc7385_upload_firmware((void *)vscfw_addr,
+					    CONFIG_VSC7385_IMAGE_SIZE))
+			puts("Failure uploading VSC7385 microcode.\n");
+	} else {
+		puts("No address specified for VSC7385 microcode.\n");
+	}
+#endif
 	return 0;
 }
 
@@ -348,10 +366,6 @@  int board_eth_init(bd_t *bis)
 	ccsr_gur_t *gur __attribute__((unused)) =
 		(void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 	int num = 0;
-#ifdef CONFIG_VSC7385_ENET
-	char *tmp;
-	unsigned int vscfw_addr;
-#endif
 
 #ifdef CONFIG_TSEC1
 	SET_STD_TSEC_INFO(tsec_info[num], 1);
@@ -375,19 +389,6 @@  int board_eth_init(bd_t *bis)
 		return 0;
 	}
 
-#ifdef CONFIG_VSC7385_ENET
-	/* If a VSC7385 microcode image is present, then upload it. */
-	tmp = env_get("vscfw_addr");
-	if (tmp) {
-		vscfw_addr = simple_strtoul(tmp, NULL, 16);
-		printf("uploading VSC7385 microcode from %x\n", vscfw_addr);
-		if (vsc7385_upload_firmware((void *) vscfw_addr,
-					CONFIG_VSC7385_IMAGE_SIZE))
-			puts("Failure uploading VSC7385 microcode.\n");
-	} else
-		puts("No address specified for VSC7385 microcode.\n");
-#endif
-
 	mdio_info.regs = TSEC_GET_MDIO_REGS_BASE(1);
 	mdio_info.name = DEFAULT_MII_NAME;