Skip to content

Commit 9a3f3f6

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 be5d777 commit 9a3f3f6

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
@@ -54,11 +54,51 @@ def get_additional_node_kwargs(node: Node) -> dict[str, Any]:
5454
return additional_kwargs
5555

5656

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

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

63103

64104
def parse_args() -> argparse.Namespace:
@@ -78,8 +118,8 @@ def parse_args() -> argparse.Namespace:
78118
)
79119
parser.add_argument(
80120
"--soc",
121+
type=validate_soc_choice,
81122
required=True,
82-
choices=[soc.value for soc in Soc],
83123
help=(
84124
"SoC to generate PERIPHCONF macros for. "
85125
"Used to look up soc specific hardware information"
@@ -104,7 +144,7 @@ def main() -> None:
104144
args = parse_args()
105145
dt = pickle.load(args.in_edt_pickle)
106146
processor = dt_processor_id(dt)
107-
lookup_tables = lookup_tables_get(Soc(args.soc))
147+
lookup_tables = lookup_tables_get(Soc.soc(args.soc), Family.family(args.soc))
108148
builder = PeriphconfBuilder(dt, lookup_tables)
109149

110150
# Application local peripherals
@@ -138,7 +178,7 @@ def main() -> None:
138178
args.out_periphconf_source.write(generated_source)
139179

140180

141-
def lookup_tables_get(soc: Soc) -> SocLookupTables:
181+
def lookup_tables_get(soc: Soc, family: Family) -> SocLookupTables:
142182
if soc == Soc.NRF54H20:
143183
ctrlsel_lookup = {
144184
# CAN120
@@ -438,7 +478,7 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables:
438478
NrfPsel(fun=NrfFun.TPIU_DATA3, port=7, pin=7): Ctrlsel.TND,
439479
},
440480
}
441-
elif soc == Soc.NRF9280:
481+
elif soc == Soc.NRF9280 or (soc == Soc.UNKNOWN and family == Family.SERIES_NRF92X):
442482
ctrlsel_lookup = {
443483
# PWM120
444484
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)