From 1a05cfc03a87f65e6450f06925e00b44554c168d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Arg=C3=BCelles?= Date: Tue, 14 Nov 2023 20:45:38 +0700 Subject: [PATCH] soc: nxp_s32: consolidate part number options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the NXP S32 SoCs have three redundant Kconfig hidden options to define the part number. To streamline this, we will retain `CONFIG_SOC_PART_NUMBER` to store the part number as a string and `CONFIG_SOC_PART_NUMBER_` that can be selected by the boards. Furthermore, for drivers requiring conditional code compilation based on the target SoC, they should utilize the series or SoC config option as applicable, instead of the part number config. Signed-off-by: Manuel Argüelles --- boards/arm/mr_canhubk3/Kconfig.board | 2 +- drivers/ethernet/eth_nxp_s32_gmac.c | 4 ++-- soc/arm/nxp_s32/Kconfig | 4 ---- soc/arm/nxp_s32/common/power_soc.c | 2 +- soc/arm/nxp_s32/s32k3/Kconfig.soc | 6 +++--- soc/arm/nxp_s32/s32ze/Kconfig.soc | 4 ++-- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/boards/arm/mr_canhubk3/Kconfig.board b/boards/arm/mr_canhubk3/Kconfig.board index 9c3f4e917b269f..af9a09391cd738 100644 --- a/boards/arm/mr_canhubk3/Kconfig.board +++ b/boards/arm/mr_canhubk3/Kconfig.board @@ -4,4 +4,4 @@ config BOARD_MR_CANHUBK3 bool "mr_canhubk3" depends on SOC_SERIES_S32K3XX - select SOC_PART_NUMBER_S32K344 + select SOC_PART_NUMBER_PS32K344EHVPBS diff --git a/drivers/ethernet/eth_nxp_s32_gmac.c b/drivers/ethernet/eth_nxp_s32_gmac.c index 428a57c6065e13..71e3e94c176253 100644 --- a/drivers/ethernet/eth_nxp_s32_gmac.c +++ b/drivers/ethernet/eth_nxp_s32_gmac.c @@ -78,7 +78,7 @@ static inline struct net_if *get_iface(struct eth_nxp_s32_data *ctx, uint16_t vl #endif } -#if defined(CONFIG_SOC_PART_NUMBER_S32K3) +#if defined(CONFIG_SOC_SERIES_S32K3XX) static int select_phy_interface(Gmac_Ip_MiiModeType mode) { uint32_t regval; @@ -105,7 +105,7 @@ static int select_phy_interface(Gmac_Ip_MiiModeType mode) } #else #error "SoC not supported" -#endif /* CONFIG_SOC_PART_NUMBER_S32K3 */ +#endif /* CONFIG_SOC_SERIES_S32K3XX */ static int eth_nxp_s32_init(const struct device *dev) { diff --git a/soc/arm/nxp_s32/Kconfig b/soc/arm/nxp_s32/Kconfig index e991957c03ec86..d014315e4d70b1 100644 --- a/soc/arm/nxp_s32/Kconfig +++ b/soc/arm/nxp_s32/Kconfig @@ -35,8 +35,4 @@ config NXP_S32_DEST_RESET_THRESHOLD source "soc/arm/nxp_s32/*/Kconfig.soc" -config SOC_PART_NUMBER - default SOC_PART_NUMBER_S32ZE_R52 if SOC_SERIES_S32ZE_R52 - default SOC_PART_NUMBER_S32K3 if SOC_SERIES_S32K3XX - endif # SOC_FAMILY_NXP_S32 diff --git a/soc/arm/nxp_s32/common/power_soc.c b/soc/arm/nxp_s32/common/power_soc.c index eef489ee8df74b..3e277155cb82ea 100644 --- a/soc/arm/nxp_s32/common/power_soc.c +++ b/soc/arm/nxp_s32/common/power_soc.c @@ -71,7 +71,7 @@ static int nxp_s32_power_init(void) }; const Power_Ip_PMC_ConfigType pmc_cfg = { -#ifdef CONFIG_SOC_PART_NUMBER_S32K3 +#ifdef CONFIG_SOC_SERIES_S32K3XX /* PMC Configuration Register (CONFIG) */ .ConfigRegister = PMC_CONFIG_LMEN(IS_ENABLED(CONFIG_NXP_S32_PMC_LMEN)) | PMC_CONFIG_LMBCTLEN(IS_ENABLED(CONFIG_NXP_S32_PMC_LMBCTLEN)), diff --git a/soc/arm/nxp_s32/s32k3/Kconfig.soc b/soc/arm/nxp_s32/s32k3/Kconfig.soc index 298477f71c2b75..6b8f4e3a883970 100644 --- a/soc/arm/nxp_s32/s32k3/Kconfig.soc +++ b/soc/arm/nxp_s32/s32k3/Kconfig.soc @@ -14,12 +14,12 @@ endchoice if SOC_SERIES_S32K3XX -config SOC_PART_NUMBER_S32K344 +config SOC_PART_NUMBER_PS32K344EHVPBS bool -config SOC_PART_NUMBER_S32K3 +config SOC_PART_NUMBER string - default "S32K344" if SOC_PART_NUMBER_S32K344 + default "PS32K344EHVPBS" if SOC_PART_NUMBER_PS32K344EHVPBS help This string holds the full part number of the SoC. It is a hidden option that you should not set directly. The part number selection choice defines diff --git a/soc/arm/nxp_s32/s32ze/Kconfig.soc b/soc/arm/nxp_s32/s32ze/Kconfig.soc index 757b4096634983..790751362d3e63 100644 --- a/soc/arm/nxp_s32/s32ze/Kconfig.soc +++ b/soc/arm/nxp_s32/s32ze/Kconfig.soc @@ -1,6 +1,6 @@ # NXP S32Z/E MCUs family -# Copyright 2022 NXP +# Copyright 2022-2023 NXP # SPDX-License-Identifier: Apache-2.0 choice @@ -18,7 +18,7 @@ if SOC_SERIES_S32ZE_R52 config SOC_PART_NUMBER_S32Z27 bool -config SOC_PART_NUMBER_S32ZE_R52 +config SOC_PART_NUMBER string default "S32Z27" if SOC_PART_NUMBER_S32Z27 help