diff mbox series

xilinx: Add option to select SC id instead of DUT id for SC support

Message ID 90bb7cc5463568a690b979f18c8d42556986b46d.1669204122.git.michal.simek@amd.com
State Changes Requested
Delegated to: Michal Simek
Headers show
Series xilinx: Add option to select SC id instead of DUT id for SC support | expand

Commit Message

Michal Simek Nov. 23, 2022, 11:48 a.m. UTC
Reading MAC address from on board EEPROM requires different type for System
Controller (SC).

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 board/xilinx/Kconfig          | 9 +++++++++
 board/xilinx/common/fru.h     | 1 +
 board/xilinx/common/fru_ops.c | 6 +++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

Comments

Michal Simek Nov. 28, 2022, 11:30 a.m. UTC | #1
st 23. 11. 2022 v 12:49 odesílatel Michal Simek <michal.simek@amd.com> napsal:
>
> Reading MAC address from on board EEPROM requires different type for System
> Controller (SC).
>
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
>
>  board/xilinx/Kconfig          | 9 +++++++++
>  board/xilinx/common/fru.h     | 1 +
>  board/xilinx/common/fru_ops.c | 6 +++++-
>  3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig
> index 4ea78418780c..4f0776e8bd95 100644
> --- a/board/xilinx/Kconfig
> +++ b/board/xilinx/Kconfig
> @@ -65,3 +65,12 @@ config CMD_FRU
>           information present in the device. The FRU Information is used
>           to primarily to provide "inventory" information about the boards
>           that the FRU Information Device is located on.
> +
> +config FRU_SC
> +       bool "FRU system controller decoding"
> +       help
> +         Xilinx System Controller (SC) FRU format is describing boards from two
> +         angles. One from DUT and then from SC. DUT is default option for
> +         the main CPU. SC behaves more or less as slave and have different ID.
> +         If you build U-Boot for SC you should enable this option to get proper
> +         MAC address.
> diff --git a/board/xilinx/common/fru.h b/board/xilinx/common/fru.h
> index 59f6b722cf12..586c41b66ef7 100644
> --- a/board/xilinx/common/fru.h
> +++ b/board/xilinx/common/fru.h
> @@ -90,6 +90,7 @@ struct fru_table {
>  #define FRU_MULTIREC_MAC_OFFSET                4
>  #define FRU_LAST_REC                   BIT(7)
>  #define FRU_DUT_MACID                  0x31
> +#define FRU_SC_MACID                   0x11
>
>  /* This should be minimum of fields */
>  #define FRU_BOARD_AREA_TOTAL_FIELDS    5
> diff --git a/board/xilinx/common/fru_ops.c b/board/xilinx/common/fru_ops.c
> index 49846ae3d660..c4f009affc5e 100644
> --- a/board/xilinx/common/fru_ops.c
> +++ b/board/xilinx/common/fru_ops.c
> @@ -239,8 +239,12 @@ static int fru_parse_multirec(unsigned long addr)
>
>                 if (mrc.rec_type == FRU_MULTIREC_TYPE_OEM) {
>                         struct fru_multirec_mac *mac = (void *)addr + hdr_len;
> +                       u32 type = FRU_DUT_MACID;
>
> -                       if (mac->ver == FRU_DUT_MACID) {
> +                       if (CONFIG_IS_ENABLED(FRU_SC))
> +                               type = FRU_SC_MACID;
> +
> +                       if (mac->ver == type) {
>                                 mac_len = mrc.len - FRU_MULTIREC_MAC_OFFSET;
>                                 memcpy(&fru_data.mac.macid, mac->macid, mac_len);
>                         }
> --
> 2.36.1
>

Applied.
M
diff mbox series

Patch

diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig
index 4ea78418780c..4f0776e8bd95 100644
--- a/board/xilinx/Kconfig
+++ b/board/xilinx/Kconfig
@@ -65,3 +65,12 @@  config CMD_FRU
 	  information present in the device. The FRU Information is used
 	  to primarily to provide "inventory" information about the boards
 	  that the FRU Information Device is located on.
+
+config FRU_SC
+	bool "FRU system controller decoding"
+	help
+	  Xilinx System Controller (SC) FRU format is describing boards from two
+	  angles. One from DUT and then from SC. DUT is default option for
+	  the main CPU. SC behaves more or less as slave and have different ID.
+	  If you build U-Boot for SC you should enable this option to get proper
+	  MAC address.
diff --git a/board/xilinx/common/fru.h b/board/xilinx/common/fru.h
index 59f6b722cf12..586c41b66ef7 100644
--- a/board/xilinx/common/fru.h
+++ b/board/xilinx/common/fru.h
@@ -90,6 +90,7 @@  struct fru_table {
 #define FRU_MULTIREC_MAC_OFFSET		4
 #define FRU_LAST_REC			BIT(7)
 #define FRU_DUT_MACID			0x31
+#define FRU_SC_MACID			0x11
 
 /* This should be minimum of fields */
 #define FRU_BOARD_AREA_TOTAL_FIELDS	5
diff --git a/board/xilinx/common/fru_ops.c b/board/xilinx/common/fru_ops.c
index 49846ae3d660..c4f009affc5e 100644
--- a/board/xilinx/common/fru_ops.c
+++ b/board/xilinx/common/fru_ops.c
@@ -239,8 +239,12 @@  static int fru_parse_multirec(unsigned long addr)
 
 		if (mrc.rec_type == FRU_MULTIREC_TYPE_OEM) {
 			struct fru_multirec_mac *mac = (void *)addr + hdr_len;
+			u32 type = FRU_DUT_MACID;
 
-			if (mac->ver == FRU_DUT_MACID) {
+			if (CONFIG_IS_ENABLED(FRU_SC))
+				type = FRU_SC_MACID;
+
+			if (mac->ver == type) {
 				mac_len = mrc.len - FRU_MULTIREC_MAC_OFFSET;
 				memcpy(&fru_data.mac.macid, mac->macid, mac_len);
 			}