diff mbox series

[v2,1/3] board: ls2080aqds: transition to DM_ETH

Message ID 20200515065716.26965-2-ioana.ciornei@nxp.com
State Superseded
Headers show
Series boards: ls2080aqds: transition to CONFIG_DM_ETH | expand

Commit Message

Ioana Ciornei May 15, 2020, 6:57 a.m. UTC
In case CONFIG_DM_ETH is enabled, no hardcoding is necessary for DPAA2
Ethernet devices. Compile out any unnecessary setup when CONFIG_DM_ETH
is activated.  Also, force the PCI devices to be enumerated at probe
time.

Signed-off-by: Ioana Ciornei <ioana.ciornei at nxp.com>
---
 board/freescale/ls2080aqds/eth.c        | 13 +++++++++++--
 board/freescale/ls2080aqds/ls2080aqds.c |  4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)

Comments

Priyanka Jain May 18, 2020, 7:12 a.m. UTC | #1
>-----Original Message-----
>From: Ioana Ciornei <ioana.ciornei at nxp.com>
>Sent: Friday, May 15, 2020 12:27 PM
>To: Priyanka Jain <priyanka.jain at nxp.com>; u-boot at lists.denx.de
>Cc: Ioana Ciornei <ioana.ciornei at nxp.com>
>Subject: [PATCH v2 1/3] board: ls2080aqds: transition to DM_ETH
>
>In case CONFIG_DM_ETH is enabled, no hardcoding is necessary for DPAA2
>Ethernet devices. Compile out any unnecessary setup when CONFIG_DM_ETH
>is activated.  Also, force the PCI devices to be enumerated at probe time.
>
>Signed-off-by: Ioana Ciornei <ioana.ciornei at nxp.com>
>---
> board/freescale/ls2080aqds/eth.c        | 13 +++++++++++--
> board/freescale/ls2080aqds/ls2080aqds.c |  4 ++++
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
>diff --git a/board/freescale/ls2080aqds/eth.c
>b/board/freescale/ls2080aqds/eth.c
>index bbb70a859a1e..47f57d94b847 100644
>--- a/board/freescale/ls2080aqds/eth.c
>+++ b/board/freescale/ls2080aqds/eth.c
>@@ -24,6 +24,8 @@
>
> #define MC_BOOT_ENV_VAR "mcinitcmd"
>
>+#ifndef CONFIG_DM_ETH
>+
> #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
>  /* - In LS2080A there are only 16 SERDES lanes, spread across 2 SERDES
>banks.
>  *   Bank 1 -> Lanes A, B, C, D, E, F, G, H
>@@ -889,9 +891,11 @@ void ls2080a_handle_phy_interface_xsgmii(int i)
> 	}
> }
> #endif
>+#endif // !CONFIG_DM_ETH
>
> int board_eth_init(bd_t *bis)
> {
>+#ifndef CONFIG_DM_ETH
> 	int error;
> #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
> 	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
>@@ -970,8 +974,13 @@ int board_eth_init(bd_t *bis)
> 			sgmii_configure_repeater(2);
> 	}
> #endif
>-	error = pci_eth_init(bis);
>-	return error;
>+#endif // !CONFIG_DM_ETH
>+
>+#ifdef CONFIG_DM_ETH
>+	return 0;
>+#else
>+	return pci_eth_init(bis);
>+#endif
> }
>
> #if defined(CONFIG_RESET_PHY_R)
>diff --git a/board/freescale/ls2080aqds/ls2080aqds.c
>b/board/freescale/ls2080aqds/ls2080aqds.c
>index 4034bdee2842..1c91c5b7f052 100644
>--- a/board/freescale/ls2080aqds/ls2080aqds.c
>+++ b/board/freescale/ls2080aqds/ls2080aqds.c
>@@ -251,6 +251,10 @@ int board_init(void)
> 	ppa_init();
> #endif
>
>+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
>+	pci_init();
>+#endif
>+
> 	return 0;
> }
>
>--
>2.17.1
Please fix below build warning: 

-(ls2080aqds_nand ls2080aqds_sdcard)   int error;
-(ls2080aqds_nand ls2080aqds_sdcard)       ^~~~~
w-(ls2080aqds_nand ls2080aqds_sdcard) ../board/freescale/ls2080aqds/eth.c: In function ? board_eth_init? :
w-(ls2080aqds_nand ls2080aqds_sdcard) ../board/freescale/ls2080aqds/eth.c:899:6: warning: unused variable ? error?  [-Wunused-variable]

Regards
Priyanka
Ioana Ciornei May 18, 2020, 9:45 a.m. UTC | #2
> Subject: RE: [PATCH v2 1/3] board: ls2080aqds: transition to DM_ETH
> 
> >-----Original Message-----
> >From: Ioana Ciornei <ioana.ciornei at nxp.com>
> >Sent: Friday, May 15, 2020 12:27 PM
> >To: Priyanka Jain <priyanka.jain at nxp.com>; u-boot at lists.denx.de
> >Cc: Ioana Ciornei <ioana.ciornei at nxp.com>
> >Subject: [PATCH v2 1/3] board: ls2080aqds: transition to DM_ETH
> >
> >In case CONFIG_DM_ETH is enabled, no hardcoding is necessary for DPAA2
> >Ethernet devices. Compile out any unnecessary setup when CONFIG_DM_ETH
> >is activated.  Also, force the PCI devices to be enumerated at probe time.
> >
> >Signed-off-by: Ioana Ciornei <ioana.ciornei at nxp.com>
> >---
> > board/freescale/ls2080aqds/eth.c        | 13 +++++++++++--
> > board/freescale/ls2080aqds/ls2080aqds.c |  4 ++++
> > 2 files changed, 15 insertions(+), 2 deletions(-)
> >
> >diff --git a/board/freescale/ls2080aqds/eth.c
> >b/board/freescale/ls2080aqds/eth.c
> >index bbb70a859a1e..47f57d94b847 100644
> >--- a/board/freescale/ls2080aqds/eth.c
> >+++ b/board/freescale/ls2080aqds/eth.c
> >@@ -24,6 +24,8 @@
> >
> > #define MC_BOOT_ENV_VAR "mcinitcmd"
> >
> >+#ifndef CONFIG_DM_ETH
> >+
> > #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
> >  /* - In LS2080A there are only 16 SERDES lanes, spread across 2
> >SERDES banks.
> >  *   Bank 1 -> Lanes A, B, C, D, E, F, G, H
> >@@ -889,9 +891,11 @@ void ls2080a_handle_phy_interface_xsgmii(int i)
> > 	}
> > }
> > #endif
> >+#endif // !CONFIG_DM_ETH
> >
> > int board_eth_init(bd_t *bis)
> > {
> >+#ifndef CONFIG_DM_ETH
> > 	int error;
> > #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
> > 	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
> @@
> >-970,8 +974,13 @@ int board_eth_init(bd_t *bis)
> > 			sgmii_configure_repeater(2);
> > 	}
> > #endif
> >-	error = pci_eth_init(bis);
> >-	return error;
> >+#endif // !CONFIG_DM_ETH
> >+
> >+#ifdef CONFIG_DM_ETH
> >+	return 0;
> >+#else
> >+	return pci_eth_init(bis);
> >+#endif
> > }
> >
> > #if defined(CONFIG_RESET_PHY_R)
> >diff --git a/board/freescale/ls2080aqds/ls2080aqds.c
> >b/board/freescale/ls2080aqds/ls2080aqds.c
> >index 4034bdee2842..1c91c5b7f052 100644
> >--- a/board/freescale/ls2080aqds/ls2080aqds.c
> >+++ b/board/freescale/ls2080aqds/ls2080aqds.c
> >@@ -251,6 +251,10 @@ int board_init(void)
> > 	ppa_init();
> > #endif
> >
> >+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
> >+	pci_init();
> >+#endif
> >+
> > 	return 0;
> > }
> >
> >--
> >2.17.1
> Please fix below build warning:
> 
> -(ls2080aqds_nand ls2080aqds_sdcard)   int error;
> -(ls2080aqds_nand ls2080aqds_sdcard)       ^~~~~
> w-(ls2080aqds_nand ls2080aqds_sdcard) ../board/freescale/ls2080aqds/eth.c:
> In function ? board_eth_init? :
> w-(ls2080aqds_nand ls2080aqds_sdcard)
> ../board/freescale/ls2080aqds/eth.c:899:6: warning: unused variable ? error?  [-
> Wunused-variable]
> 
> Regards
> Priyanka

Sure, I'll fix it. Sorry for missing it myself.

Ioana
diff mbox series

Patch

diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c
index bbb70a859a1e..47f57d94b847 100644
--- a/board/freescale/ls2080aqds/eth.c
+++ b/board/freescale/ls2080aqds/eth.c
@@ -24,6 +24,8 @@ 
 
 #define MC_BOOT_ENV_VAR "mcinitcmd"
 
+#ifndef CONFIG_DM_ETH
+
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
  /* - In LS2080A there are only 16 SERDES lanes, spread across 2 SERDES banks.
  *   Bank 1 -> Lanes A, B, C, D, E, F, G, H
@@ -889,9 +891,11 @@  void ls2080a_handle_phy_interface_xsgmii(int i)
 	}
 }
 #endif
+#endif // !CONFIG_DM_ETH
 
 int board_eth_init(bd_t *bis)
 {
+#ifndef CONFIG_DM_ETH
 	int error;
 #if defined(CONFIG_FSL_MC_ENET) && !defined(CONFIG_SPL_BUILD)
 	struct ccsr_gur __iomem *gur = (void *)CONFIG_SYS_FSL_GUTS_ADDR;
@@ -970,8 +974,13 @@  int board_eth_init(bd_t *bis)
 			sgmii_configure_repeater(2);
 	}
 #endif
-	error = pci_eth_init(bis);
-	return error;
+#endif // !CONFIG_DM_ETH
+
+#ifdef CONFIG_DM_ETH
+	return 0;
+#else
+	return pci_eth_init(bis);
+#endif
 }
 
 #if defined(CONFIG_RESET_PHY_R)
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index 4034bdee2842..1c91c5b7f052 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -251,6 +251,10 @@  int board_init(void)
 	ppa_init();
 #endif
 
+#if !defined(CONFIG_SYS_EARLY_PCI_INIT) && defined(CONFIG_DM_ETH)
+	pci_init();
+#endif
+
 	return 0;
 }