boards: nrf9160dk: Add support for newer revisions (0.14.0+) of the DK

Use the multiple board revisions feature to provide support for the new
hardware possibilities available in nRF9160 DK starting from v0.14.0.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2021-01-26 11:10:27 +01:00 committed by Ioannis Glaropoulos
commit 75135e87d9
20 changed files with 305 additions and 23 deletions

View file

@ -9,6 +9,7 @@
#include <drivers/gpio.h>
#include <devicetree.h>
#include <logging/log.h>
#include <hal/nrf_gpio.h>
LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_NRF9160DK_LOG_LEVEL);
@ -22,7 +23,16 @@ LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_NRF9160DK_LOG_LEVEL);
DT_GPIO_FLAGS_BY_IDX(DT_NODELABEL(name), prop, idx)
#define GET_DEV(name, prop, idx) DEVICE_DT_GET(GET_CTLR(name, prop, idx))
#define USE_RESET_GPIO DT_NODE_HAS_STATUS(DT_NODELABEL(reset_input), okay)
/* If the GPIO pin selected to be the reset line is actually the pin that
* exposes the nRESET function (P0.18 in nRF52840), there is no need to
* provide any additional GPIO configuration for it.
*/
#define RESET_INPUT_IS_PINRESET (IS_ENABLED(CONFIG_GPIO_AS_PINRESET) && \
GET_PORT(reset_input, gpios, 0) == 0 && \
GET_PIN(reset_input, gpios, 0) == 18)
#define USE_RESET_GPIO \
(DT_NODE_HAS_STATUS(DT_NODELABEL(reset_input), okay) && \
!RESET_INPUT_IS_PINRESET)
struct switch_cfg {
const struct device *gpio;
@ -77,6 +87,9 @@ static const struct switch_cfg routing_switches[] = {
ROUTING_SWITCH(nrf_interface_pins_0_2_routing)
ROUTING_SWITCH(nrf_interface_pins_3_5_routing)
ROUTING_SWITCH(nrf_interface_pins_6_8_routing)
ROUTING_SWITCH(nrf_interface_pin_9_routing)
ROUTING_SWITCH(io_expander_pins_routing)
ROUTING_SWITCH(external_flash_pins_routing)
};
#if USE_RESET_GPIO
@ -197,3 +210,32 @@ static int init(const struct device *dev)
}
SYS_INIT(init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#define EXT_MEM_CTRL DT_NODELABEL(external_flash_pins_routing)
#if DT_NODE_EXISTS(EXT_MEM_CTRL)
static int early_init(const struct device *dev)
{
/* As soon as possible after the system starts up, enable the analog
* switch that routes signals to the external flash. Otherwise, the
* HOLD line in the flash chip may not be properly pulled up internally
* and consequently the chip will not respond to any command.
* Later on, during the normal initialization performed above, this
* analog switch will get configured according to what is selected
* in devicetree.
*/
uint32_t psel = NRF_DT_GPIOS_TO_PSEL(EXT_MEM_CTRL, control_gpios);
gpio_dt_flags_t flags = DT_GPIO_FLAGS(EXT_MEM_CTRL, control_gpios);
if (flags & GPIO_ACTIVE_LOW) {
nrf_gpio_pin_clear(psel);
} else {
nrf_gpio_pin_set(psel);
}
nrf_gpio_cfg_output(psel);
return 0;
}
SYS_INIT(early_init, PRE_KERNEL_1, 0);
#endif

View file

@ -130,8 +130,9 @@ such as LEDs and buttons, UART interfaces (VCOMx) of the interface MCU, and
specific nRF52840 SoC pins.
.. note::
nRF9160 signals routed to other components on the DK are not simultaneously
available on the DK connectors.
In nRF9160 DK revisions earlier than v0.14.0, nRF9160 signals routed to
other components on the DK are not simultaneously available on the DK
connectors.
When compiling a project for nrf9160dk_nrf52840, the board controller firmware
will be compiled and run automatically after the Kernel has been initialized.
@ -208,6 +209,20 @@ on the nRF9160 DK:
| ``nrf_interface_pins_6_8_routing`` | nRF_IF6-8_CTRL (nRF91_COEX) |
+------------------------------------+------------------------------+
When building for the DK revision 0.14.0 or later, you can use the following
additional nodes (see :ref:`application_board_version` for information how to
build for specific revisions of the board):
+------------------------------------+------------------------------+
| Devicetree node label | Analog switch name |
+====================================+==============================+
| ``nrf_interface_pin_9_routing`` | nRF_IF9_CTRL |
+------------------------------------+------------------------------+
| ``io_expander_pins_routing`` | IO_EXP_EN |
+------------------------------------+------------------------------+
| ``external_flash_pins_routing`` | EXT_MEM_CTRL |
+------------------------------------+------------------------------+
For example, if you want to enable the optional routing for the nRF9160 pins
P0.17, P0.18, and P0.19 so that they are routed to nRF52840 pins P0.17, P0.20,
and P0.15, respectively, add the following in the devicetree overlay in your

View file

@ -10,16 +10,17 @@ description: |
This interface can be used for inter-SoC communication on the DK.
The connections are as follows:
| nRF9160 | | nRF52840 |
| P0.17 | -- nRF interface line 0 -- | P0.17 |
| P0.18 | -- nRF interface line 1 -- | P0.20 |
| P0.19 | -- nRF interface line 2 -- | P0.15 |
| P0.21 | -- nRF interface line 3 -- | P0.22 |
| P0.22 | -- nRF interface line 4 -- | P1.04 |
| P0.23 | -- nRF interface line 5 -- | P1.02 |
| COEX0 | -- nRF interface line 6 -- | P1.13 |
| COEX1 | -- nRF interface line 7 -- | P1.11 |
| COEX2 | -- nRF interface line 8 -- | P1.15 |
| nRF9160 | | nRF52840 |
| P0.17 | -- nRF interface line 0 -- | P0.17 |
| P0.18 | -- nRF interface line 1 -- | P0.20 |
| P0.19 | -- nRF interface line 2 -- | P0.15 |
| P0.21 | -- nRF interface line 3 -- | P0.22 |
| P0.22 | -- nRF interface line 4 -- | P1.04 |
| P0.23 | -- nRF interface line 5 -- | P1.02 |
| COEX0 | -- nRF interface line 6 -- | P1.13 |
| COEX1 | -- nRF interface line 7 -- | P1.11 |
| COEX2 | -- nRF interface line 8 -- | P1.15 |
| P0.24 | -- nRF interface line 9 -- | P0.18 (nRESET) | (in v0.14.0 or later)
Before particular lines of this interface can be used, the corresponding
analog switches that control the routing of involved nRF9160 pins must be
@ -29,6 +30,12 @@ description: |
- `nrf_interface_pins_0_2_routing` to enable lines 0-2
- `nrf_interface_pins_3_5_routing` to enable lines 3-5
- `nrf_interface_pins_6_8_routing` to enable lines 6-8
- `nrf_interface_pin_9_routing` to enable line 9 (this line is only
available in nRF9160 DK v0.14.0 or later)
NOTE: In nRF9160 DK revisions earlier than v0.14.0, when the above signals
from nRF9160 are routed to nRF52840, they are not available on the DK
connectors.
compatible: "nordic,nrf9160dk-nrf52840-interface"

View file

@ -0,0 +1,16 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* NOTE: this feature is only available in nRF9160 DK v0.14.0 or later. */
&nrf_interface_pin_9_routing {
status = "okay";
};
&reset_input {
status = "okay";
gpios = <&interface_to_nrf9160 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is required by the multiple board revisions mechanism.

View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
board-control {
nrf_interface_pin_9_routing: switch-nrf-if9-ctrl {
compatible = "nordic,nrf9160dk-optional-routing";
control-gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
status = "disabled";
};
io_expander_pins_routing: switch-io-exp-en {
compatible = "nordic,nrf9160dk-optional-routing";
control-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
status = "disabled";
};
external_flash_pins_routing: switch-ext-mem-ctrl {
compatible = "nordic,nrf9160dk-optional-routing";
control-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>;
status = "disabled";
};
};
};
&interface_to_nrf9160 {
gpio-map = <0 0 &gpio0 17 0>,
<1 0 &gpio0 20 0>,
<2 0 &gpio0 15 0>,
<3 0 &gpio0 22 0>,
<4 0 &gpio1 4 0>,
<5 0 &gpio1 2 0>,
<6 0 &gpio1 13 0>,
<7 0 &gpio1 11 0>,
<8 0 &gpio1 15 0>,
/* New signal added in this revision (0.14.0). */
<9 0 &gpio0 18 0>; /* nReset */
};
&vcom2_pins_routing {
/* No need to drive P0.12 together with P1.12 in this board revision. */
control-gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
};
&reset_input {
/* By default use the dedicated connection to the nRESET (P0.18) pin. */
gpios = <&interface_to_nrf9160 9 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is required by the multiple board revisions mechanism.

View file

@ -0,0 +1,7 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
board_check_revision(
FORMAT MAJOR.MINOR.PATCH
DEFAULT_REVISION 0.7.0
)

View file

@ -83,6 +83,31 @@ hardware features:
| WDT | on-chip | watchdog |
+-----------+------------+----------------------+
.. _nrf9160dk_additional_hardware:
Additional hardware in v0.14.0+
-------------------------------
Starting from v0.14.0, additional hardware is available on the DK:
* External flash memory (MX25R6435F, 64 Mb)
* I/O expander (PCAL6408A) that can be used to interface LEDs, slide switches,
and buttons
To use this additional hardware, specify the revision of the board that
should be used when building your application (for more information, see
:ref:`application_board_version`). For example, to build for nRF9160 DK v1.0.0:
.. zephyr-app-commands::
:tool: all
:cd-into:
:board: nrf9160dk_nrf9160@1.0.0
:goals: build
:compact:
Remember to also enable routing for this additional hardware in the firmware for
:ref:`nrf9160dk_nrf52840` (see :ref:`nrf9160dk_board_controller_firmware`).
Other hardware features are not supported by the Zephyr kernel.
See `nRF9160 DK website`_ and `Nordic Semiconductor Infocenter`_
for a complete list of nRF9160 DK board hardware features.

View file

@ -10,16 +10,17 @@ description: |
This interface can be used for inter-SoC communication on the DK.
The connections are as follows:
| nRF9160 | | nRF52840 |
| P0.17 | -- nRF interface line 0 -- | P0.17 |
| P0.18 | -- nRF interface line 1 -- | P0.20 |
| P0.19 | -- nRF interface line 2 -- | P0.15 |
| P0.21 | -- nRF interface line 3 -- | P0.22 |
| P0.22 | -- nRF interface line 4 -- | P1.04 |
| P0.23 | -- nRF interface line 5 -- | P1.02 |
| COEX0 | -- nRF interface line 6 -- | P1.13 |
| COEX1 | -- nRF interface line 7 -- | P1.11 |
| COEX2 | -- nRF interface line 8 -- | P1.15 |
| nRF9160 | | nRF52840 |
| P0.17 | -- nRF interface line 0 -- | P0.17 |
| P0.18 | -- nRF interface line 1 -- | P0.20 |
| P0.19 | -- nRF interface line 2 -- | P0.15 |
| P0.21 | -- nRF interface line 3 -- | P0.22 |
| P0.22 | -- nRF interface line 4 -- | P1.04 |
| P0.23 | -- nRF interface line 5 -- | P1.02 |
| COEX0 | -- nRF interface line 6 -- | P1.13 |
| COEX1 | -- nRF interface line 7 -- | P1.11 |
| COEX2 | -- nRF interface line 8 -- | P1.15 |
| P0.24 | -- nRF interface line 9 -- | P0.18 (nRESET) | (in v0.14.0 or later)
Before particular lines of this interface can be used, the corresponding
analog switches that control the routing of involved nRF9160 pins must be
@ -29,6 +30,12 @@ description: |
- `nrf_interface_pins_0_2_routing` to enable lines 0-2
- `nrf_interface_pins_3_5_routing` to enable lines 3-5
- `nrf_interface_pins_6_8_routing` to enable lines 6-8
- `nrf_interface_pin_9_routing` to enable line 9 (this line is only
available in nRF9160 DK v0.14.0 or later)
NOTE: In nRF9160 DK revisions earlier than v0.14.0, when the above signals
from nRF9160 are routed to nRF52840, they are not available on the DK
connectors.
compatible: "nordic,nrf9160dk-nrf52840-interface"

View file

@ -0,0 +1,12 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* NOTE: this feature is only available in nRF9160 DK v0.14.0 or later. */
&nrf52840_reset {
status = "okay";
gpios = <&interface_to_nrf52840 9 GPIO_ACTIVE_LOW>;
};

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is required by the multiple board revisions mechanism.

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "nrf9160dk_nrf9160_common_0_14_0.dtsi"

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is required by the multiple board revisions mechanism.

View file

@ -0,0 +1,47 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
&interface_to_nrf52840 {
gpio-map = <0 0 &gpio0 17 0>,
<1 0 &gpio0 18 0>,
<2 0 &gpio0 19 0>,
<3 0 &gpio0 21 0>,
<4 0 &gpio0 22 0>,
<5 0 &gpio0 23 0>,
/* 6: COEX0 */
/* 7: COEX1 */
/* 8: COEX2 */
<9 0 &gpio0 24 0>;
};
&nrf52840_reset {
gpios = <&interface_to_nrf52840 9 GPIO_ACTIVE_LOW>;
};
&spi3 {
status = "okay";
sck-pin = <13>;
mosi-pin = <11>;
miso-pin = <12>;
cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
mx25r64: mx25r6435f@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <8000000>;
label = "MX25R64";
jedec-id = [c2 28 17];
sfdp-bfp = [
e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
];
size = <67108864>;
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <35000>;
};
};

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is required by the multiple board revisions mechanism.

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "nrf9160dk_nrf9160_common_0_14_0.dtsi"

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is required by the multiple board revisions mechanism.

View file

@ -0,0 +1,7 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
board_check_revision(
FORMAT MAJOR.MINOR.PATCH
DEFAULT_REVISION 0.7.0
)

View file

@ -0,0 +1,8 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Use the reset line that is available starting from v0.14.0 of the DK. */
#include <nrf9160dk_nrf52840_reset_on_if9.dtsi>