Skip to content

Commit fe04ab1

Browse files
committed
[nrf noup] dts: nordic: Add support for BICR generation
This will be replaced by a different solution upstream (NCSDK-27673). Migrate the existing BICR bindings from NCS 2.4.99-cs3 to NCS 2.7.0. They are updated to remove obsoleted values. Enable generating bicr.hex for Application core by default. LFXO CLOAD value is a resualt of DK's characterization. The BICR LFOSC.LFXOCONFIG.MODE field supports disabling the usage of an external crystal oscillator to disable LFXO as LF clock source. Signed-off-by: Grzegorz Swiderski <[email protected]> Signed-off-by: Karol Lisak <[email protected]> Signed-off-by: Karsten Koenig <[email protected]>
1 parent e5ae15f commit fe04ab1

File tree

9 files changed

+224
-1
lines changed

9 files changed

+224
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2024 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/ {
8+
bicr: bicr@fff87b0 {
9+
compatible = "nordic,nrf-bicr";
10+
reg = <0xfff87b0 0x48>;
11+
12+
power-vddao5v0 = "external";
13+
power-vddao1v8 = "internal";
14+
power-vdd1v0 = "internal";
15+
power-vddrf1v0 = "shorted";
16+
power-vddao0v8 = "internal";
17+
power-vddvs0v8 = "internal";
18+
19+
inductor-present;
20+
21+
ioport-power-rails = <&gpio1 2>, <&gpio2 2>, <&gpio6 2>, <&gpio7 2>, <&gpio9 4>;
22+
ioport-drivectrls = <&gpio6 50>, <&gpio7 50>;
23+
24+
lfosc-mode = "crystal";
25+
lfosc-loadcap = <15>;
26+
27+
lfrc-autocalibration = <20 40 3>;
28+
29+
hfxo-mode = "crystal";
30+
hfxo-loadcap = <56>;
31+
};
32+
};
33+
34+
&gpio1 {
35+
#ioport-power-rail-cells = <1>;
36+
};
37+
38+
&gpio2 {
39+
#ioport-power-rail-cells = <1>;
40+
};
41+
42+
&gpio6 {
43+
#ioport-power-rail-cells = <1>;
44+
#ioport-drivectrl-cells = <1>;
45+
};
46+
47+
&gpio7 {
48+
#ioport-power-rail-cells = <1>;
49+
#ioport-drivectrl-cells = <1>;
50+
};
51+
52+
&gpio9 {
53+
#ioport-power-rail-cells = <1>;
54+
};

boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <nordic/nrf54h20_cpuapp.dtsi>
1010
#include "nrf54h20dk_nrf54h20-common.dtsi"
11+
#include "nrf54h20dk_bicr.dtsi"
1112

1213
/delete-node/ &cpurad_cpusys_ipc;
1314
/delete-node/ &cpusec_cpurad_ipc;

dts/bindings/gpio/nordic,nrf-gpio.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: NRF5 GPIO node
55

66
compatible: "nordic,nrf-gpio"
77

8-
include: [gpio-controller.yaml, base.yaml]
8+
include: [gpio-controller.yaml, base.yaml, "nordic,nrf-port-configs.yaml"]
99

1010
properties:
1111
reg:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
3+
4+
description: |
5+
Nordic Port Configs
6+
7+
Hardware configurations that apply to IO ports.
8+
9+
properties:
10+
ioport-power-rails:
11+
type: phandle-array
12+
description: |
13+
Power supply configurations for GPIO ports. The configuration is board-
14+
specific and stored in BICR.
15+
The property is encoded as <&phandle rail>, where:
16+
17+
- phandle is the phandle of the associated GPIO port
18+
- rail is the 8-bit power rail configuration to apply to the port
19+
20+
ioport-drivectrls:
21+
type: phandle-array
22+
description: |
23+
Drive control settings for GPIO ports. The configuration is board-specific
24+
and stored in BICR.
25+
The property is encoded as <&phandle resistance>, where:
26+
27+
- phandle is the phandle of the associated GPIO port
28+
- resistance is the resistance in ohms to adjust in the port's drive
29+
control, and can be one of the following: [33, 40, 50, 66, 100].
30+
31+
ioport-power-rail-cells:
32+
- rail
33+
34+
ioport-drivectrl-cells:
35+
- resistance
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Copyright (c) 2024 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
3+
4+
description: |
5+
Nordic Board Information Configuration Registers (BICR)
6+
7+
compatible: "nordic,nrf-bicr"
8+
9+
include: [base.yaml, "nordic,nrf-port-configs.yaml"]
10+
11+
properties:
12+
power-vddao5v0:
13+
type: string
14+
description: VDD_AO_5V0 power rail configuration.
15+
enum:
16+
- "external"
17+
- "shorted"
18+
19+
power-vddao1v8:
20+
type: string
21+
description: VDD_AO_1V8 power rail configuration.
22+
enum:
23+
- "internal"
24+
- "external"
25+
26+
power-vdd1v0:
27+
type: string
28+
description: VDD_1V0 power rail configuration.
29+
enum:
30+
- "internal"
31+
- "external"
32+
33+
power-vddrf1v0:
34+
type: string
35+
description: VDD_RF_1V0 power rail configuration.
36+
enum:
37+
- "external"
38+
- "shorted"
39+
40+
power-vddao0v8:
41+
type: string
42+
description: VDD_AO_0V8 power rail configuration.
43+
enum:
44+
- "internal"
45+
- "external"
46+
47+
power-vddvs0v8:
48+
type: string
49+
description: VDD_VS_0V8 power rail configuration.
50+
enum:
51+
- "internal"
52+
- "external"
53+
54+
inductor-present:
55+
type: boolean
56+
description: DC/DC inductor present.
57+
58+
lfosc-accuracy:
59+
type: int
60+
description: LFXO crystal or external signal accuracy in ppm.
61+
enum:
62+
- 500
63+
- 250
64+
- 150
65+
- 100
66+
- 75
67+
- 50
68+
- 30
69+
- 20
70+
71+
lfosc-mode:
72+
type: string
73+
description: |
74+
LFXO operational mode.
75+
enum:
76+
- "crystal"
77+
- "external-sine"
78+
- "external-square"
79+
- "disabled"
80+
81+
lfosc-loadcap:
82+
type: int
83+
description: |
84+
Built-in load capacitors selection in 1pF steps, up to 25pF max. If 0,
85+
only external capacitors will be used.
86+
87+
lfosc-startup:
88+
type: int
89+
description: LFXO startup time in milliseconds.
90+
91+
lfrc-autocalibration:
92+
type: array
93+
description: |
94+
A list of values pertaining to LFRC autocalibration settings. The prop
95+
is encoded as <temp-interval temp-delta interval-max-count>, where:
96+
- temp-interval is the temperature measurement interval in 0.25s steps
97+
- temp-delta is the temperature delta that should trigger a calibration
98+
in 0.25 degree steps
99+
- interval-max-count are the max number of temp-interval periods in
100+
between calibrations, independent of temperature changes.
101+
102+
hfxo-mode:
103+
type: string
104+
description: |
105+
HFXO operational mode.
106+
enum:
107+
- "crystal"
108+
- "external-square"
109+
110+
hfxo-loadcap:
111+
type: int
112+
description: |
113+
Built-in load capacitors selection in 0.25 pF steps, up to 25.75 pF max.
114+
If 0, only external capacitors will be used.
115+
116+
hfxo-startup:
117+
type: int
118+
description: HFXO startup time in milliseconds.

modules/hal_nordic/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ add_subdirectory_ifdef(CONFIG_HAS_NRFS nrfs)
1111
if(CONFIG_NRF_REGTOOL_GENERATE_UICR)
1212
list(APPEND nrf_regtool_components GENERATE:UICR)
1313
endif()
14+
if(CONFIG_NRF_REGTOOL_GENERATE_BICR)
15+
list(APPEND nrf_regtool_components GENERATE:BICR)
16+
endif()
1417
if(DEFINED nrf_regtool_components)
1518
find_package(nrf-regtool 5.6.0 REQUIRED
1619
COMPONENTS ${nrf_regtool_components}

modules/hal_nordic/Kconfig.nrf_regtool

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ config NRF_REGTOOL_GENERATE_UICR
1111
CPU domains that require UICR allocation aren't bootable without it
1212
being programmed alongside the firmware.
1313

14+
config NRF_REGTOOL_GENERATE_BICR
15+
bool "Generate BICR"
16+
help
17+
Generate a BICR hex based on devicetree contents using nrf-regtool.
18+
If not already present, the BICR must be included alongside
19+
any firmware programmed to the board for the first time.
20+
1421
config NRF_REGTOOL_VERBOSITY
1522
int "Verbosity level of console output"
1623
range 0 3

modules/hal_nordic/nrf-regtool/nrf-regtoolConfig.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ foreach(component IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
5858
)
5959
set_property(TARGET runners_yaml_props_target PROPERTY hex_file ${merged_hex_file})
6060

61+
elseif(component STREQUAL "GENERATE:BICR")
62+
nrf_regtool_generate_peripheral(BICR ${PROJECT_BINARY_DIR}/bicr.hex)
6163
else()
6264
message(FATAL_ERROR "Unrecognized package component: \"${component}\"")
6365
endif()

soc/nordic/nrf54h/Kconfig.defconfig.nrf54h20_cpuapp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ config NUM_IRQS
1111
config NRF_REGTOOL_GENERATE_UICR
1212
default y
1313

14+
config NRF_REGTOOL_GENERATE_BICR
15+
default y
16+
1417
endif # SOC_NRF54H20_CPUAPP || SOC_NRF54H20_ENGB_CPUAPP

0 commit comments

Comments
 (0)