Skip to content

Commit 026dbe0

Browse files
hal_nordic: ironside: Add 9251 peripherals
- Add Fast peripherals controlled through Ctrlsel configuration. - Add Trace port support Ctrlsel support for nRF9251 and nRF9280. Signed-off-by: Aymen LAOUINI <aymen.laouini@nordicsemi.no>
1 parent 7c30f86 commit 026dbe0

1 file changed

Lines changed: 44 additions & 20 deletions

File tree

modules/hal_nordic/ironside/se/scripts/gen_periphconf_entries.py

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,12 @@ 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-
7558
class Soc(enum.Enum):
7659
"""Names of SoCs supported by this script"""
7760

7861
NRF54H20 = "nrf54h20"
7962
NRF9280 = "nrf9280"
63+
NRF9251 = "nrf9251"
8064
UNKNOWN = "unknown"
8165

8266
@classmethod
@@ -85,6 +69,8 @@ def soc(cls, soc):
8569
return cls.NRF54H20
8670
elif soc.startswith("nrf9280") and len(soc) == 7:
8771
return cls.NRF9280
72+
elif soc.startswith("nrf9251") and len(soc) == 7:
73+
return cls.NRF9251
8874
else:
8975
return cls.UNKNOWN
9076

@@ -151,7 +137,7 @@ def main() -> None:
151137
args = parse_args()
152138
dt = pickle.load(args.in_edt_pickle)
153139
processor = dt_processor_id(dt)
154-
lookup_tables = lookup_tables_get(Soc.soc(args.soc), Family.family(args.soc))
140+
lookup_tables = lookup_tables_get(Soc.soc(args.soc))
155141
builder = PeriphconfBuilder(dt, lookup_tables, lock_value=args.lock)
156142

157143
# Application local peripherals
@@ -185,7 +171,7 @@ def main() -> None:
185171
args.out_periphconf_source.write(generated_source)
186172

187173

188-
def lookup_tables_get(soc: Soc, family: Family) -> SocLookupTables:
174+
def lookup_tables_get(soc: Soc) -> SocLookupTables:
189175
if soc == Soc.NRF54H20:
190176
ctrlsel_lookup = {
191177
# CAN120
@@ -485,7 +471,37 @@ def lookup_tables_get(soc: Soc, family: Family) -> SocLookupTables:
485471
NrfPsel(fun=NrfFun.TPIU_DATA3, port=7, pin=7): Ctrlsel.TND,
486472
},
487473
}
488-
elif family == Family.SERIES_NRF92X:
474+
elif soc == Soc.NRF9251:
475+
ctrlsel_lookup = {
476+
# (High Speed peripherals using Ctrlsel=3)
477+
# SPIM120/SPIS120/UART120
478+
0x5F8E_6000: {
479+
# SPIS120 P5 Mappings
480+
NrfPsel(fun=NrfFun.SPIS_SCK, port=5, pin=1): Ctrlsel.SERIAL0,
481+
NrfPsel(fun=NrfFun.SPIS_MOSI, port=5, pin=4): Ctrlsel.SERIAL0,
482+
NrfPsel(fun=NrfFun.SPIS_MISO, port=5, pin=2): Ctrlsel.SERIAL0,
483+
NrfPsel(fun=NrfFun.SPIS_CSN, port=5, pin=5): Ctrlsel.SERIAL0,
484+
# UART120 P5 Mappings
485+
NrfPsel(fun=NrfFun.UART_CTS, port=5, pin=4): Ctrlsel.SERIAL0,
486+
NrfPsel(fun=NrfFun.UART_RTS, port=5, pin=5): Ctrlsel.SERIAL0,
487+
NrfPsel(fun=NrfFun.UART_RX, port=5, pin=3): Ctrlsel.SERIAL0,
488+
NrfPsel(fun=NrfFun.UART_TX, port=5, pin=2): Ctrlsel.SERIAL0,
489+
# SPIM120 P5 Mappings
490+
NrfPsel(fun=NrfFun.SPIM_SCK, port=5, pin=1): Ctrlsel.SERIAL0,
491+
NrfPsel(fun=NrfFun.SPIM_MOSI, port=5, pin=2): Ctrlsel.SERIAL0,
492+
NrfPsel(fun=NrfFun.SPIM_MISO, port=5, pin=4): Ctrlsel.SERIAL0,
493+
NrfPsel(fun=NrfFun.SPIM_CSN, port=5, pin=5): Ctrlsel.SERIAL0,
494+
},
495+
# Coresight (TPIU) – TDD
496+
0xBF04_0000: {
497+
NrfPsel(fun=NrfFun.TPIU_CLOCK, port=5, pin=1): Ctrlsel.TND,
498+
NrfPsel(fun=NrfFun.TPIU_DATA0, port=5, pin=2): Ctrlsel.TND,
499+
NrfPsel(fun=NrfFun.TPIU_DATA1, port=5, pin=3): Ctrlsel.TND,
500+
NrfPsel(fun=NrfFun.TPIU_DATA2, port=5, pin=4): Ctrlsel.TND,
501+
NrfPsel(fun=NrfFun.TPIU_DATA3, port=5, pin=5): Ctrlsel.TND,
502+
},
503+
}
504+
elif soc == Soc.NRF9280:
489505
ctrlsel_lookup = {
490506
# PWM120
491507
0x5F8E_4000: {
@@ -568,6 +584,14 @@ def lookup_tables_get(soc: Soc, family: Family) -> SocLookupTables:
568584
NrfPsel(fun=NrfFun.UART_RX, port=9, pin=4): Ctrlsel.SERIAL0,
569585
NrfPsel(fun=NrfFun.UART_TX, port=9, pin=3): Ctrlsel.SERIAL0,
570586
},
587+
# Coresight (TPIU) – TDD
588+
0xBF04_0000: {
589+
NrfPsel(fun=NrfFun.TPIU_CLOCK, port=8, pin=4): Ctrlsel.TND,
590+
NrfPsel(fun=NrfFun.TPIU_DATA0, port=8, pin=0): Ctrlsel.TND,
591+
NrfPsel(fun=NrfFun.TPIU_DATA1, port=8, pin=1): Ctrlsel.TND,
592+
NrfPsel(fun=NrfFun.TPIU_DATA2, port=8, pin=2): Ctrlsel.TND,
593+
NrfPsel(fun=NrfFun.TPIU_DATA3, port=8, pin=3): Ctrlsel.TND,
594+
},
571595
}
572596
else:
573597
raise NotImplementedError(f"No CTRLSEL table exists for soc {soc}")

0 commit comments

Comments
 (0)