[PATCH 03/11] board: freescale: t208xrdb: fdt fixups under DM_ETH

2021-04-10 Thread Camelia Groza
Disable the FMan mEMAC 5 and 6 nodes from the fdt since they are not
available under the supported RCW. Also disable the associated
"fsl,dpa-ethernet" nodes that reference them.

This is a simplified version of the fdt_fixup_fman_ethernet call for
use under DM_ETH.

Signed-off-by: Camelia Groza 
---
 board/freescale/t208xrdb/eth_t208xrdb.c | 35 +
 board/freescale/t208xrdb/t208xrdb.c |  3 +++
 board/freescale/t208xrdb/t208xrdb.h |  2 ++
 3 files changed, 40 insertions(+)

diff --git a/board/freescale/t208xrdb/eth_t208xrdb.c 
b/board/freescale/t208xrdb/eth_t208xrdb.c
index e77f3f7146f7..b0ff4b1f375a 100644
--- a/board/freescale/t208xrdb/eth_t208xrdb.c
+++ b/board/freescale/t208xrdb/eth_t208xrdb.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  *
  * Shengzhou Liu 
  */
@@ -104,6 +105,40 @@ int board_eth_init(struct bd_info *bis)
return pci_eth_init(bis);
 }
 
+/* Disable the MAC5 and MAC6 "fsl,fman-memac" nodes and the two
+ * "fsl,dpa-ethernet" nodes that reference them.
+ */
+void fdt_fixup_board_fman_ethernet(void *fdt)
+{
+   int mac_off, eth_off, i;
+   char mac_path[2][42] = {
+   "/soc@ffe00/fman@40/ethernet@e8000",
+   "/soc@ffe00/fman@40/ethernet@ea000",
+   };
+   u32 eth_ph;
+
+   for (i = 0; i < 2; i++) {
+   /* Disable the MAC node */
+   mac_off = fdt_path_offset(fdt, mac_path[i]);
+   if (mac_off < 0)
+   continue;
+   fdt_status_disabled(fdt, mac_off);
+
+   /* Disable the fsl,dpa-ethernet node that points to the MAC.
+* The fsl,fman-mac property refers to the MAC's phandle.
+*/
+   eth_ph = fdt_get_phandle(fdt, mac_off);
+   if (eth_ph <= 0)
+   continue;
+
+   eth_off = fdt_node_offset_by_prop_value(fdt, -1, "fsl,fman-mac",
+   ð_ph,
+   sizeof(eth_ph));
+   if (eth_off >= 0)
+   fdt_status_disabled(fdt, eth_off);
+   }
+}
+
 void fdt_fixup_board_enet(void *fdt)
 {
return;
diff --git a/board/freescale/t208xrdb/t208xrdb.c 
b/board/freescale/t208xrdb/t208xrdb.c
index a18459841c62..7ccb205c6473 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2009-2013 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  */
 
 #include 
@@ -137,6 +138,8 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #ifdef CONFIG_SYS_DPAA_FMAN
 #ifndef CONFIG_DM_ETH
fdt_fixup_fman_ethernet(blob);
+#else
+   fdt_fixup_board_fman_ethernet(blob);
 #endif
fdt_fixup_board_enet(blob);
 #endif
diff --git a/board/freescale/t208xrdb/t208xrdb.h 
b/board/freescale/t208xrdb/t208xrdb.h
index 22a496fb8cf2..cd0a9f44da79 100644
--- a/board/freescale/t208xrdb/t208xrdb.h
+++ b/board/freescale/t208xrdb/t208xrdb.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  */
 
 #ifndef __CORENET_DS_H__
@@ -8,5 +9,6 @@
 
 void fdt_fixup_board_enet(void *blob);
 void pci_of_setup(void *blob, struct bd_info *bd);
+void fdt_fixup_board_fman_ethernet(void *blob);
 
 #endif
-- 
2.17.1



[PATCH 03/11] board: freescale: t208xrdb: fdt fixups under DM_ETH

2021-04-09 Thread Camelia Groza
From: Camelia Groza 

Disable the FMan mEMAC 5 and 6 nodes from the fdt since they are not
available under the supported RCW. Also disable the associated
"fsl,dpa-ethernet" nodes that reference them.

This is a simplified version of the fdt_fixup_fman_ethernet call for
use under DM_ETH.

Signed-off-by: Camelia Groza 
---
 board/freescale/t208xrdb/eth_t208xrdb.c | 35 +
 board/freescale/t208xrdb/t208xrdb.c |  3 +++
 board/freescale/t208xrdb/t208xrdb.h |  2 ++
 3 files changed, 40 insertions(+)

diff --git a/board/freescale/t208xrdb/eth_t208xrdb.c 
b/board/freescale/t208xrdb/eth_t208xrdb.c
index e77f3f7146f7..b0ff4b1f375a 100644
--- a/board/freescale/t208xrdb/eth_t208xrdb.c
+++ b/board/freescale/t208xrdb/eth_t208xrdb.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  *
  * Shengzhou Liu 
  */
@@ -104,6 +105,40 @@ int board_eth_init(struct bd_info *bis)
return pci_eth_init(bis);
 }
 
+/* Disable the MAC5 and MAC6 "fsl,fman-memac" nodes and the two
+ * "fsl,dpa-ethernet" nodes that reference them.
+ */
+void fdt_fixup_board_fman_ethernet(void *fdt)
+{
+   int mac_off, eth_off, i;
+   char mac_path[2][42] = {
+   "/soc@ffe00/fman@40/ethernet@e8000",
+   "/soc@ffe00/fman@40/ethernet@ea000",
+   };
+   u32 eth_ph;
+
+   for (i = 0; i < 2; i++) {
+   /* Disable the MAC node */
+   mac_off = fdt_path_offset(fdt, mac_path[i]);
+   if (mac_off < 0)
+   continue;
+   fdt_status_disabled(fdt, mac_off);
+
+   /* Disable the fsl,dpa-ethernet node that points to the MAC.
+* The fsl,fman-mac property refers to the MAC's phandle.
+*/
+   eth_ph = fdt_get_phandle(fdt, mac_off);
+   if (eth_ph <= 0)
+   continue;
+
+   eth_off = fdt_node_offset_by_prop_value(fdt, -1, "fsl,fman-mac",
+   ð_ph,
+   sizeof(eth_ph));
+   if (eth_off >= 0)
+   fdt_status_disabled(fdt, eth_off);
+   }
+}
+
 void fdt_fixup_board_enet(void *fdt)
 {
return;
diff --git a/board/freescale/t208xrdb/t208xrdb.c 
b/board/freescale/t208xrdb/t208xrdb.c
index a18459841c62..7ccb205c6473 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2009-2013 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  */
 
 #include 
@@ -137,6 +138,8 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #ifdef CONFIG_SYS_DPAA_FMAN
 #ifndef CONFIG_DM_ETH
fdt_fixup_fman_ethernet(blob);
+#else
+   fdt_fixup_board_fman_ethernet(blob);
 #endif
fdt_fixup_board_enet(blob);
 #endif
diff --git a/board/freescale/t208xrdb/t208xrdb.h 
b/board/freescale/t208xrdb/t208xrdb.h
index 22a496fb8cf2..cd0a9f44da79 100644
--- a/board/freescale/t208xrdb/t208xrdb.h
+++ b/board/freescale/t208xrdb/t208xrdb.h
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  */
 
 #ifndef __CORENET_DS_H__
@@ -8,5 +9,6 @@
 
 void fdt_fixup_board_enet(void *blob);
 void pci_of_setup(void *blob, struct bd_info *bd);
+void fdt_fixup_board_fman_ethernet(void *blob);
 
 #endif
-- 
2.17.1