Skip to content

Commit 85363f9

Browse files
karstenkoenigkartben
authored andcommitted
drivers: pinctrl_nrf: Add coresight tpiu pins
Pinctrl needs to set the needed drive and direction of the pins. Also this later allows automatically setting the clock bit for the traceclk pin. Signed-off-by: Karsten Koenig <[email protected]>
1 parent 925451e commit 85363f9

File tree

5 files changed

+49
-1
lines changed

5 files changed

+49
-1
lines changed

boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20-pinctrl.dtsi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,15 @@
138138
low-power-enable;
139139
};
140140
};
141+
142+
/omit-if-no-ref/ tpiu_default: tpiu_default {
143+
group1 {
144+
psels = <NRF_PSEL(TPIU_CLOCK, 7, 3)>,
145+
<NRF_PSEL(TPIU_DATA0, 7, 4)>,
146+
<NRF_PSEL(TPIU_DATA1, 7, 5)>,
147+
<NRF_PSEL(TPIU_DATA2, 7, 6)>,
148+
<NRF_PSEL(TPIU_DATA3, 7, 7)>;
149+
nordic,drive-mode = <NRF_DRIVE_H0H1>;
150+
};
151+
};
141152
};

drivers/pinctrl/pinctrl_nrf.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,17 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
557557
input = NRF_GPIO_PIN_INPUT_CONNECT;
558558
break;
559559
#endif /* defined(NRF_PSEL_TWIS) */
560+
#if DT_HAS_COMPAT_STATUS_OKAY(nordic_coresight_nrf)
561+
/* Pin routing is controlled by secure domain, via UICR */
562+
case NRF_FUN_TPIU_CLOCK:
563+
case NRF_FUN_TPIU_DATA0:
564+
case NRF_FUN_TPIU_DATA1:
565+
case NRF_FUN_TPIU_DATA2:
566+
case NRF_FUN_TPIU_DATA3:
567+
dir = NRF_GPIO_PIN_DIR_OUTPUT;
568+
input = NRF_GPIO_PIN_INPUT_DISCONNECT;
569+
break;
570+
#endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_coresight_nrf) */
560571
default:
561572
return -ENOTSUP;
562573
}

include/zephyr/dt-bindings/pinctrl/nrf-pinctrl.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,17 @@
187187
/** TDM MCK */
188188
#define NRF_FUN_TDM_MCK 77U
189189
/** SPI master CSN */
190-
#define NRF_FUN_SPIM_CSN 78U
190+
#define NRF_FUN_SPIM_CSN 78U
191+
/** TPIU CLOCK */
192+
#define NRF_FUN_TPIU_CLOCK 79U
193+
/** TPIU DATA0 */
194+
#define NRF_FUN_TPIU_DATA0 80U
195+
/** TPIU DATA1 */
196+
#define NRF_FUN_TPIU_DATA1 81U
197+
/** TPIU DATA2 */
198+
#define NRF_FUN_TPIU_DATA2 82U
199+
/** TPIU DATA3 */
200+
#define NRF_FUN_TPIU_DATA3 83U
191201

192202
/** @} */
193203

soc/nordic/common/uicr/gen_periphconf_entries.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ def lookup_tables_get(soc: Soc) -> SocLookupTables:
425425
NrfPsel(fun=NrfFun.IGNORE, port=2, pin=10): Ctrlsel.CAN,
426426
NrfPsel(fun=NrfFun.IGNORE, port=2, pin=11): Ctrlsel.CAN,
427427
},
428+
# Coresight (TPIU)
429+
0xBF04_0000: {
430+
NrfPsel(fun=NrfFun.TPIU_CLOCK, port=7, pin=3): Ctrlsel.TND,
431+
NrfPsel(fun=NrfFun.TPIU_DATA0, port=7, pin=4): Ctrlsel.TND,
432+
NrfPsel(fun=NrfFun.TPIU_DATA1, port=7, pin=5): Ctrlsel.TND,
433+
NrfPsel(fun=NrfFun.TPIU_DATA2, port=7, pin=6): Ctrlsel.TND,
434+
NrfPsel(fun=NrfFun.TPIU_DATA3, port=7, pin=7): Ctrlsel.TND,
435+
},
428436
}
429437
elif soc == Soc.NRF9280:
430438
ctrlsel_lookup = {

soc/nordic/common/uicr/periphconf/builder.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
"nordic,nrf-temp",
4242
"nordic,nrf-vevif-task-tx",
4343
"nordic,nrf-vevif-task-rx",
44+
# No retention in TDD so permissions can't be set outside of the TDD service
45+
"nordic,coresight-nrf",
46+
"nordic,nrf-tbm",
4447
}
4548

4649
# Compatibles of global peripherals that should be assigned to the current core but do not have DMA
@@ -1018,6 +1021,11 @@ class NrfFun(int, enum.Enum):
10181021
TDM_SDOUT = 76
10191022
TDM_MCK = 77
10201023
SPIM_CSN = 78
1024+
TPIU_CLOCK = 79
1025+
TPIU_DATA0 = 80
1026+
TPIU_DATA1 = 81
1027+
TPIU_DATA2 = 82
1028+
TPIU_DATA3 = 83
10211029

10221030
# Value used to ignore the function field and only check (port, pin)
10231031
IGNORE = -1

0 commit comments

Comments
 (0)