dts: Use separate compatibles for Nordic SPI/SPIM/SPIS peripherals

This commit introduces separate "compatible" strings for DTS nodes
representing different types of Nordic SPI peripherals. Previously
"nordic,nrf-spi" was used for both SPI and SPIM. SPIS was already
handled separately.

Quite a few files need to be touched by this commit but the changes can
be divided into groups of related or very similar ones, distinguishable
by the initial part of the path to the modified file:

* dts/bindings/spi/
  new binding for "nordic,nrf-spim" is added and common fields for all
  3 types of Nordic SPI peripherals are extracted to a shared file

* dts/arm/nordic/
  "compatible" properties in spiX nodes are updated (when there is no
  choice as only one type of SPI peripheral is available) or replaced
  with a comment pointing out that the proper type of peripheral needs
  to be picked at some upper layer

* drivers/spi/
  spi_nrfx_spim driver is updated with the new form of macros generated
  from dts

* boards/
  all spiX nodes in dts files for boards equipped with an nRF chip are
  updated with the proper "compatible" property, according to the type
  of SPI peripheral that is currently selected for the board by the
  corresponding Kconfig choice option (SPI_x_NRF_SPI*)

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2019-09-25 07:43:48 +02:00 committed by Carles Cufí
commit f43bae38e8
29 changed files with 170 additions and 74 deletions

View file

@ -80,6 +80,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <26>;
mosi-pin = <23>;

View file

@ -105,6 +105,7 @@
};
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <20>;

View file

@ -91,6 +91,7 @@
};
&spi0 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <25>;
mosi-pin = <23>;
@ -99,6 +100,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <16>;
mosi-pin = <20>;

View file

@ -115,6 +115,7 @@
};
&spi0 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <41>;
mosi-pin = <40>;
@ -123,6 +124,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <19>;
mosi-pin = <20>;

View file

@ -91,6 +91,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <25>;
mosi-pin = <24>;

View file

@ -119,6 +119,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <6>;
mosi-pin = <5>;

View file

@ -108,6 +108,7 @@
};
&spi0 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <29>;
mosi-pin = <31>;

View file

@ -113,6 +113,7 @@
};
&spi0 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <0>;
mosi-pin = <1>;
@ -120,6 +121,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
/* cannot be used with i2c0 */
sck-pin = <19>;
mosi-pin = <20>;

View file

@ -100,6 +100,7 @@
};
&spi0 {
compatible = "nordic,nrf-spi";
/* Cannot be used together with i2c0. */
/* status = "okay"; */
sck-pin = <19>;
@ -108,6 +109,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <25>;
mosi-pin = <34>;
@ -115,6 +117,7 @@
};
&spi2 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <26>;
mosi-pin = <23>;

View file

@ -87,6 +87,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <31>;
mosi-pin = <29>;

View file

@ -158,6 +158,7 @@ arduino_i2c: &i2c0 {
};
&spi0 {
compatible = "nordic,nrf-spi";
/* Cannot be used together with i2c0. */
/* status = "okay"; */
sck-pin = <27>;
@ -166,6 +167,7 @@ arduino_i2c: &i2c0 {
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <31>;
mosi-pin = <30>;
@ -173,6 +175,7 @@ arduino_i2c: &i2c0 {
};
&spi2 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <19>;
mosi-pin = <20>;

View file

@ -112,6 +112,7 @@
* limited GPIOs available on dongle board.
*/
&spi0 {
compatible = "nordic,nrf-spi";
/* Cannot be used together with i2c0. */
/* status = "okay"; */
sck-pin = <27>;
@ -120,6 +121,7 @@
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <31>;
mosi-pin = <30>;

View file

@ -148,6 +148,7 @@ arduino_i2c: &i2c0 {
};
&spi0 {
compatible = "nordic,nrf-spi";
/* Cannot be used together with i2c0. */
/* status = "okay"; */
sck-pin = <27>;
@ -156,6 +157,7 @@ arduino_i2c: &i2c0 {
};
&spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <31>;
mosi-pin = <30>;
@ -163,6 +165,7 @@ arduino_i2c: &i2c0 {
};
arduino_spi: &spi2 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <25>;
mosi-pin = <23>;

View file

@ -116,6 +116,7 @@
};
&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <19>;
mosi-pin = <18>;

View file

@ -127,6 +127,7 @@
/* TWI1 used on Boron; also see mesh_feather_spi1_spi1.dtsi */
&spi2 { /* dedicated MX25L */
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <19>;
mosi-pin = <20>;

View file

@ -127,6 +127,7 @@
/* TWI1 used on Boron; also see mesh_feather_spi1_spi1.dtsi */
&spi2 { /* dedicated MX25L */
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <19>;
mosi-pin = <20>;

View file

@ -127,6 +127,7 @@
/* TWI1 used on Boron; also see mesh_feather_spi1_spi1.dtsi */
&spi2 { /* dedicated MX25L */
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <19>;
mosi-pin = <20>;

View file

@ -128,6 +128,7 @@ arduino_i2c: &i2c0 {
};
arduino_spi: &spi1 {
compatible = "nordic,nrf-spi";
status = "okay";
sck-pin = <47>;
miso-pin = <46>;

View file

@ -371,7 +371,7 @@ static int spim_nrfx_pm_control(struct device *dev, u32_t ctrl_command,
static int spi_##idx##_init(struct device *dev) \
{ \
IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIM##idx), \
DT_NORDIC_NRF_SPI_SPI_##idx##_IRQ_0_PRIORITY, \
DT_NORDIC_NRF_SPIM_SPI_##idx##_IRQ_0_PRIORITY, \
nrfx_isr, nrfx_spim_##idx##_irq_handler, 0); \
return init_spim(dev); \
} \
@ -384,9 +384,9 @@ static int spim_nrfx_pm_control(struct device *dev, u32_t ctrl_command,
.spim = NRFX_SPIM_INSTANCE(idx), \
.max_chunk_len = (1 << SPIM##idx##_EASYDMA_MAXCNT_SIZE) - 1, \
.config = { \
.sck_pin = DT_NORDIC_NRF_SPI_SPI_##idx##_SCK_PIN, \
.mosi_pin = DT_NORDIC_NRF_SPI_SPI_##idx##_MOSI_PIN, \
.miso_pin = DT_NORDIC_NRF_SPI_SPI_##idx##_MISO_PIN, \
.sck_pin = DT_NORDIC_NRF_SPIM_SPI_##idx##_SCK_PIN, \
.mosi_pin = DT_NORDIC_NRF_SPIM_SPI_##idx##_MOSI_PIN, \
.miso_pin = DT_NORDIC_NRF_SPIM_SPI_##idx##_MISO_PIN, \
.ss_pin = NRFX_SPIM_PIN_NOT_USED, \
.orc = CONFIG_SPI_##idx##_NRF_ORC, \
.frequency = NRF_SPIM_FREQ_4M, \
@ -396,7 +396,7 @@ static int spim_nrfx_pm_control(struct device *dev, u32_t ctrl_command,
} \
}; \
DEVICE_DEFINE(spi_##idx, \
DT_NORDIC_NRF_SPI_SPI_##idx##_LABEL, \
DT_NORDIC_NRF_SPIM_SPI_##idx##_LABEL, \
spi_##idx##_init, \
spim_nrfx_pm_control, \
&spi_##idx##_data, \

View file

@ -141,7 +141,12 @@
};
spi1: spi@40004000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be either SPI or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40004000 0x1000>;

View file

@ -134,7 +134,13 @@
};
spi0: spi@40004000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40004000 0x1000>;

View file

@ -141,7 +141,13 @@
};
spi0: spi@40004000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40004000 0x1000>;
@ -152,7 +158,13 @@
spi1: spi@40003000 {
/* cannot be used with i2c0 */
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40003000 0x1000>;

View file

@ -175,7 +175,13 @@
};
spi0: spi@40003000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40003000 0x1000>;
@ -185,7 +191,13 @@
};
spi1: spi@40004000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40004000 0x1000>;
@ -195,7 +207,13 @@
};
spi2: spi@40023000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40023000 0x1000>;

View file

@ -209,7 +209,13 @@
};
spi0: spi@40003000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40003000 0x1000>;
@ -219,7 +225,13 @@
};
spi1: spi@40004000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40004000 0x1000>;
@ -229,7 +241,13 @@
};
spi2: spi@40023000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be SPI, SPIM, or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spi" or
* "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40023000 0x1000>;
@ -239,7 +257,7 @@
};
spi3: spi@4002b000 {
compatible = "nordic,nrf-spi";
compatible = "nordic,nrf-spim";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x4002b000 0x1000>;

View file

@ -209,7 +209,11 @@ i2c3: i2c@b000 {
};
spi0: spi@8000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be either SPIM or SPIS, for the user to pick:
* compatible = "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x8000 0x1000>;
@ -219,7 +223,11 @@ spi0: spi@8000 {
};
spi1: spi@9000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be either SPIM or SPIS, for the user to pick:
* compatible = "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0x9000 0x1000>;
@ -229,7 +237,11 @@ spi1: spi@9000 {
};
spi2: spi@a000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be either SPIM or SPIS, for the user to pick:
* compatible = "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0xa000 0x1000>;
@ -239,7 +251,11 @@ spi2: spi@a000 {
};
spi3: spi@b000 {
compatible = "nordic,nrf-spi";
/*
* This spi node can be either SPIM or SPIS, for the user to pick:
* compatible = "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0xb000 0x1000>;

View file

@ -0,0 +1,28 @@
# Copyright (c) 2018 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# Common fields for Nordic nRF family SPI peripherals
include: spi-controller.yaml
properties:
reg:
required: true
interrupts:
required: true
sck-pin:
type: int
required: true
description: SCK pin
mosi-pin:
type: int
required: true
description: MOSI pin
miso-pin:
type: int
required: true
description: MISO pin

View file

@ -1,33 +1,10 @@
# Copyright (c) 2018 Nordic Semiconductor ASA
# Copyright (c) 2019 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
title: Nordic nRF Family SPI Master node
title: Nordic nRF family SPI
description: >
This is a representation of the Nordic nRF SPI node
description: Nordic nRF family SPI (SPI master)
compatible: "nordic,nrf-spi"
include: spi-controller.yaml
properties:
reg:
required: true
interrupts:
required: true
sck-pin:
type: int
required: true
description: SCK pin
mosi-pin:
type: int
required: true
description: MOSI pin
miso-pin:
type: int
required: true
description: MISO pin
include: nordic,nrf-spi-common.yaml

View file

@ -0,0 +1,10 @@
# Copyright (c) 2019 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
title: Nordic nRF family SPIM
description: Nordic nRF family SPIM (SPI master with EasyDMA)
compatible: "nordic,nrf-spim"
include: nordic,nrf-spi-common.yaml

View file

@ -1,37 +1,15 @@
# Copyright (c) 2019 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
title: Nordic nRF Family SPIS (SPI Slave)
title: Nordic nRF family SPIS
description: >
This is a representation of the Nordic nRF SPIS node
description: Nordic nRF family SPIS (SPI slave with EasyDMA)
compatible: "nordic,nrf-spis"
include: spi-controller.yaml
include: nordic,nrf-spi-common.yaml
properties:
reg:
required: true
interrupts:
required: true
sck-pin:
type: int
required: true
description: SCK pin
mosi-pin:
type: int
required: true
description: MOSI pin
miso-pin:
type: int
required: true
description: MISO pin
csn-pin:
type: int
required: true