Skip to content

Commit

Permalink
soc: nxp_s32: consolidate part number options
Browse files Browse the repository at this point in the history
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_<part>` 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 <[email protected]>
  • Loading branch information
manuargue authored and mmahadevan108 committed Nov 15, 2023
1 parent 8ca4f5b commit 1a05cfc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion boards/arm/mr_canhubk3/Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions drivers/ethernet/eth_nxp_s32_gmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down
4 changes: 0 additions & 4 deletions soc/arm/nxp_s32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion soc/arm/nxp_s32/common/power_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
6 changes: 3 additions & 3 deletions soc/arm/nxp_s32/s32k3/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions soc/arm/nxp_s32/s32ze/Kconfig.soc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NXP S32Z/E MCUs family

# Copyright 2022 NXP
# Copyright 2022-2023 NXP
# SPDX-License-Identifier: Apache-2.0

choice
Expand All @@ -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
Expand Down

0 comments on commit 1a05cfc

Please sign in to comment.