Skip to content

Commit 2fbd7ff

Browse files
[nrf fromlist] soc: nordic: activate uicr generation and use correct dt reg check
- Activate the UICR file generation and PeriphConf for nRF92 application. - Add condition in reg dt check file to use the correct uicr node name for nRF92X. - Generation of preriphconf entries filters on device names to match the first 5 characters to nrf92 or the 6 first characters to nrf54h, this information is also used to determine the device SOC_SERIES to be either SOC_SERIES_NRF54HX or SOC_SERIES_NRF92X allowing possible extension of usage. Still in case of an unknown device of a certain family it will use existing configuration while generating periphconf entries. Upstream PR #:95549 Signed-off-by: Aymen LAOUINI <[email protected]>
1 parent 69ad052 commit 2fbd7ff

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

soc/nordic/common/uicr/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config NRF_PERIPHCONF_SECTION
55
bool "Populate global peripheral initialization section"
6-
default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD
6+
default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD || SOC_NRF9280_CPUAPP
77
depends on LINKER_DEVNULL_SUPPORT
88
imply LINKER_DEVNULL_MEMORY
99
help
@@ -12,7 +12,7 @@ config NRF_PERIPHCONF_SECTION
1212

1313
config NRF_PERIPHCONF_GENERATE_ENTRIES
1414
bool "Generate PERIPHCONF entries source file"
15-
default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD
15+
default y if SOC_NRF54H20_CPUAPP || SOC_NRF54H20_CPURAD || SOC_NRF9280_CPUAPP
1616
depends on NRF_PERIPHCONF_SECTION
1717
depends on NRF_PLATFORM_HALTIUM
1818
help

soc/nordic/common/uicr/Kconfig.sysbuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
config NRF_HALTIUM_GENERATE_UICR
55
bool "Generate UICR file"
6-
depends on SOC_SERIES_NRF54HX
6+
depends on SOC_SERIES_NRF54HX || SOC_SERIES_NRF92X
77
default y
88
help
99
Generate UICR HEX file.

soc/nordic/common/uicr/gen_periphconf_entries.py

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,51 @@ def get_additional_node_kwargs(node: Node) -> dict[str, Any]:
5555
return additional_kwargs
5656

5757

58+
class Family(enum.Enum):
59+
"""Families of SoCs supported by this script"""
60+
61+
SERIES_NRF54HX = "nrf54h"
62+
SERIES_NRF92X = "nrf92"
63+
SERIES_UNKNOWN = "unknown"
64+
65+
@classmethod
66+
def family(cls, soc):
67+
if soc.startswith("nrf54h") and len(soc) == 8:
68+
return cls.SERIES_NRF54HX
69+
elif soc.startswith("nrf92") and len(soc) == 7:
70+
return cls.SERIES_NRF92X
71+
else:
72+
return cls.SERIES_UNKNOWN
73+
74+
5875
class Soc(enum.Enum):
5976
"""Names of SoCs supported by this script"""
6077

6178
NRF54H20 = "nrf54h20"
6279
NRF9280 = "nrf9280"
80+
UNKNOWN = "unknown"
81+
82+
@classmethod
83+
def soc(cls, soc):
84+
if soc.startswith("nrf54h20") and len(soc) == 8:
85+
return cls.NRF54H20
86+
elif soc.startswith("nrf9280") and len(soc) == 7:
87+
return cls.NRF9280
88+
else:
89+
return cls.UNKNOWN
90+
91+
92+
def validate_soc_choice(soc):
93+
"""Helper for argparse to validate soc parameter type"""
94+
95+
if (soc.startswith("nrf54h") and soc[6:].isdigit() and len(soc) == 8) or (
96+
soc.startswith("nrf92") and soc[5:].isdigit() and len(soc) == 7
97+
):
98+
return soc
99+
else:
100+
raise argparse.ArgumentTypeError(
101+
f"Invalid soc '{soc}'. Must start with 'nrf54h' or 'nrf92' followed by 2 digits."
102+
)
63103

64104

65105
def parse_args() -> argparse.Namespace:
@@ -79,8 +119,8 @@ def parse_args() -> argparse.Namespace:
79119
)
80120
parser.add_argument(
81121
"--soc",
122+
type=validate_soc_choice,
82123
required=True,
83-
choices=[soc.value for soc in Soc],
84124
help=(
85125
"SoC to generate PERIPHCONF macros for. "
86126
"Used to look up soc specific hardware information"
@@ -105,7 +145,7 @@ def main() -> None:
105145
args = parse_args()
106146
dt = pickle.load(args.in_edt_pickle)
107147
processor = dt_processor_id(dt)
108-
lookup_tables = lookup_tables_get(Soc(args.soc))
148+
lookup_tables = lookup_tables_get(Soc.soc(args.soc), Family.family(args.soc))
109149
builder = PeriphconfBuilder(dt, lookup_tables)
110150

111151
# Application local peripherals
@@ -135,7 +175,7 @@ def main() -> None:
135175
args.out_periphconf_source.write(generated_source)
136176

137177

138-
def lookup_tables_get(soc: Soc) -> SocLookupTables:
178+
def lookup_tables_get(soc: Soc, family: Family) -> SocLookupTables:
139179
if soc == Soc.NRF54H20:
140180
ctrlsel_lookup = {
141181
# CAN120
@@ -427,7 +467,7 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables:
427467
NrfPsel(fun=NrfFun.IGNORE, port=2, pin=11): Ctrlsel.CAN,
428468
},
429469
}
430-
elif soc == Soc.NRF9280:
470+
elif soc == Soc.NRF9280 or (soc == Soc.UNKNOWN and family == Family.SERIES_NRF92X):
431471
ctrlsel_lookup = {
432472
# PWM120
433473
0x5F8E_4000: {

soc/nordic/validate_base_addresses.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ CHECK_DT_REG(uart134, NRF_UARTE134);
346346
CHECK_DT_REG(uart135, NRF_UARTE135);
347347
CHECK_DT_REG(uart136, NRF_UARTE136);
348348
CHECK_DT_REG(uart137, NRF_UARTE137);
349-
#if !defined(CONFIG_SOC_SERIES_NRF54HX)
349+
#if !defined(CONFIG_SOC_SERIES_NRF54HX) && !defined(CONFIG_SOC_SERIES_NRF92X)
350350
CHECK_DT_REG(uicr, NRF_UICR);
351351
#else
352352
CHECK_DT_REG(uicr, NRF_APPLICATION_UICR);

0 commit comments

Comments
 (0)