WIP: device tree MVP

This commit is contained in:
Daniel Agar
2022-01-06 17:20:17 -05:00
parent 07d75d85cf
commit 1f39b42525
1395 changed files with 68755 additions and 0 deletions
@@ -0,0 +1,57 @@
# Copyright (c) 2020-2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
This is a representation of generic radio Front-End Module (FEM)
that has a two-pin control interface (CTX, CRX).
The CTX control pin is used to enable the Power Amplifier (PA) in
the transmit path. This is therefore sometimes referred to as
the "PA pin" in other contexts.
The CRX control pin is used to enable the Low Noise Amplifier
(LNA) in the receive path, and is sometimes referred to as
the "LNA pin" in other contexts.
Each of these pins is optional, and may be omitted if not present.
(Though if you do specify a pin, you must also specify its
corresponding settle-time-us property.)
compatible: "generic-fem-two-ctrl-pins"
include: base.yaml
properties:
ctx-gpios:
type: phandle-array
required: false
description: |
SoC GPIO connected to the CTX input pin on the FEM device.
crx-gpios:
type: phandle-array
required: false
description: |
SoC GPIO connected to the CRX input pin on the FEM device.
ctx-settle-time-us:
type: int
description: |
Desired minimum settling time, in microseconds, from
assertion of the CTX pin to beginning of transmission.
crx-settle-time-us:
type: int
description: |
Desired minimum settling time, in microseconds, from
assertion of the CRX pin to beginning of reception.
tx-gain-db:
type: int
description: |
TX gain of the PA of the FEM device, in dB.
rx-gain-db:
type: int
description: |
RX gain of the LNA of the FEM device, in dB.
@@ -0,0 +1,217 @@
# Copyright (c) 2020 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
Nordic nRF family RADIO peripheral.
This controls the 2.4 GHz radio transceiver on nRF5x
SoCs, which is available for use with Bluetooth, 802.15.4,
and proprietary wireless protocols (not all of these
protocols are available on all SoCs; consult the product
specifications for details).
This binding is not relevant to the nRF91x baseband radio.
Front-End Module (FEM) support
------------------------------
External front-end modules are range extenders used for boosting
the link robustness and link budget of wireless SoCs. If your
system includes an external FEM, set it up in the devicetree using
this binding's 'fem' property, like this example:
&radio {
fem = <&nrf_radio_fem>;
};
nrf_radio_fem: my-fem {
compatible = "...";
....
};
Currently supported "compatible" properties for the FEM node are:
- generic-fem-two-ctrl-pins
- nordic,nrf21540-fem
Refer to the bindings for these compatibles for more information
about how to configure the FEM.
Direction Finding Extension
---------------------------
Some radios support the Bluetooth Direction Finding Extension (DFE).
The 'dfe-supported' property will be set when it is available.
In this case, the 'dfegpio[n]-gpios' properties configure GPIO pins
to use to drive antenna switching.
Each dfegpio[n]-gpios property which is set is used to initialize the
corresponding PSEL.DFEGPIO[n] register.
None of the dfegpio[n]-gpios properties are marked 'required',
since which PSEL.DFEGPIO[n] registers will be used to drive
antenna switches depends on the use case. Nevertheless, at least two
antennas must be available to use DFE.
That in turn means that at least one dfegpio[n]-gpios
property must be provided if DFE is used, to give the radio the
possibility to switch between two antennas. To use 12 antennas,
4 GPIOs must be provided (since 4 GPIO pins support switching up to
16 antennas).
GPIOs are used in order, following the indices of the dfegpio[n]-gpios
properties. The order is important because it affects the mapping of
antenna switch patterns to GPIOs.
Antenna switching patterns
--------------------------
An antenna switching pattern is a binary number where each bit is
applied to a particular antenna GPIO pin. For example, the pattern
0x3 means that antenna GPIOs at indexes 0 and 1 will be set, while
the following are left unset.
The number of GPIOs specified with dfegpio[n]-gpios properties
affects the allowed pattern values. For example, when using four
GPIOs, the pattern count cannot be greater than 16, and the
maximum allowed value is 15.
Antenna switch patterns are stored in DFE internal memory by
writes to the SWITCHPATTERN register. DFE handling code applies
antenna switch patterns during Constant Tone Extension (CTE)
receive (Angle of Arrival mode) or transmission (Angle of
Departure mode) procedure.
DFE States
----------
There are four states of DFE operation:
* Idle: in this state, PDU transmission happens.
DFE uses SWITCHPATTERN[0] to select the antenna in this state.
(The 'dfe-pdu-antenna' property value described below is stored
in SWITCHPATTERN[0] by the radio controller code.)
* Guard: in this state, DFE prepares for reception or transmission
of CTE. For this state, DFE selects the antenna by applying
SWITCHPATTERN[1].
* Reference: in this state, DFE starts to receive or transmit CTE.
In AoA mode, DFE collects reference IQ samples. The selected
antenna is the same as in the guard state.
* Switch-sample: in this state, actual antenna switching happens.
DFE selects antennas by applying SWITCHPATTERN[2..N]. If the
number of switch-sample periods is greater than the number of
stored switching patterns, DFE loops back to SWITCHPATTERN[2].
compatible: "nordic,nrf-radio"
include: [base.yaml]
properties:
reg:
required: true
interrupts:
required: true
fem:
type: phandle
description: |
Phandle linking the RADIO node to its external front-end module.
coex:
type: phandle
description: |
Phandle linking the RADIO node to the external radio coexistence arbitrator.
dfe-supported:
type: boolean
description: |
If set, the radio hardware supports the Direction Finding Extension.
This property should be treated as read-only and should not be overridden;
the correct value is provided for your target's SoC already.
dfe-antenna-num:
type: int
required: false
description: |
Number of available antennas for the Direction Finding Extension.
This should only be set if dfe-supported is true. If you set this
property, the value must be at least two.
dfe-pdu-antenna:
type: int
required: false
description: |
Antenna switch pattern to be used for transmission of PDU before start
of transmission of Constant Tone Extension.
This should only be set if dfe-supported is true.
This pattern is stored in SWITCHPATTERN[0] before actual antenna
switching patterns. This pattern will also be used to drive GPIOs
when the radio releases control of GPIOs used to switch antennas.
dfegpio0-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 0. This should only be set if dfe-supported
is true.
For example, to use P0.2 on an nRF5x SoC:
dfegpio1-gpios = <&gpio0 2 0>;
To use P1.4:
dfegpio1-gpios = <&gpio1 4 0>;
Note the last 'flags' cell in the property is not used,
and should be set to 0 as shown.
dfegpio1-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 1. See description for dfegpio0-gpios.
dfegpio2-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 2. See description for dfegpio0-gpios.
dfegpio3-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 3. See description for dfegpio0-gpios.
dfegpio4-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 4. See description for dfegpio0-gpios.
dfegpio5-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 5. See description for dfegpio0-gpios.
dfegpio6-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 6. See description for dfegpio0-gpios.
dfegpio7-gpios:
type: phandle-array
required: false
description: |
Pin select for DFE pin 7. See description for dfegpio0-gpios.
@@ -0,0 +1,10 @@
# Copyright (c) 2020 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
This is a SPI device interface to the nRF21540 Radio Front-End module
compatible: "nordic,nrf21540-fem-spi"
include: spi-device.yaml
@@ -0,0 +1,137 @@
# Copyright (c) 2020, 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: |
This is a representation of the nRF21540 Radio Front-End module.
See the "nordic,nrf21540-fem-spi" binding to configure the SPI
interface. The SPI interface should be configured as a child node
of the SPI bus you have connected to the FEM. Then you "connect"
the FEM and SPI configurations using the spi-if property.
Here is an example nRF21540 configuration with a SPI interface
selected, using the SPIM0 peripheral found on several nRF5 SoCs:
&spi0 {
compatible = "nordic,nrf-spim";
status = "okay";
cs-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
/* ... MISO/MOSI/SCK pin configuration goes here ... */
my_spi_if: nrf21540-spi@0 {
compatible = "nordic,nrf21540-fem-spi";
reg = <0>;
spi-max-frequency = <8000000>;
};
};
nrf_radio_fem: nrf21540 {
compatible = "nordic,nrf21540-fem";
tx-en-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
rx-en-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
spi-if = <&my_spi_if>;
pdn-gpios = <...>;
ant-sel-gpios = <...>;
mode-gpios = <...>;
/* ... other nRF21540 properties go here ... */
};
&radio {
fem = <&nrf_radio_fem>;
};
In the above example, the nRF21540 is configured for use with:
- TX_EN on P0.2 (from 'tx-en-gpios')
- RX_EN on P0.5 (from 'rx-en-gpios')
- SPI communication via SPIM0 (the bus, or parent node, of
the 'my_spi_if' node
- CSN on P1.3 (from index 0 in the bus node's 'cs-gpios' property)
You must perform any additional required SPI pin configuration
(nRF21540 MISO, MOSI, and SCK pins) within the SPI bus node
('spi0' in the above example). See your SPI node's binding for
details on these pin mux properties. You can use any SPI node
available in your SoC's devicetree.
Configure any other nRF21540 pins as needed using 'pdn-gpios',
'ant-sel-gpios', and 'mode-gpios' properties. If unsure about the
format, use 'tx-en-gpios' as an example.
Finally, the nRF5 SoC's radio peripheral is set up for use with
the nRF21540 via the 'fem' property in the 'radio' node.
compatible: "nordic,nrf21540-fem"
include: base.yaml
properties:
tx-en-gpios:
type: phandle-array
required: false
description: |
GPIO of the SOC controlling TX_EN pin of the nRF21540
rx-en-gpios:
type: phandle-array
required: false
description: |
GPIO of the SOC controlling RX_EN pin of the nRF21540
pdn-gpios:
type: phandle-array
required: false
description: |
GPIO of the SOC controlling PDN pin of the nRF21540
ant-sel-gpios:
type: phandle-array
required: false
description: |
GPIO of the SOC controlling ANT-SEL pin of the nRF21540
mode-gpios:
type: phandle-array
required: false
description: |
GPIO of the SOC controlling MODE pin of the nRF21540
spi-if:
type: phandle
required: false
description: |
Reference to the nordic,nrf21540-fem-spi SPI bus interface.
This must be present to support SPI control of the FEM.
tx-en-settle-time-us:
type: int
default: 11
description: |
Settling time in microseconds from state PG to TX.
Default value is based on Table 6 of the nRF21540 Product
Specification (v1.0), and can be overridden for tuned
configurations.
rx-en-settle-time-us:
type: int
default: 11
description: |
Settling time in microseconds from state PG to RX.
Default value is based on Table 6 of the nRF21540 Product
Specification (v1.0), and can be overridden for tuned
configurations.
pdn-settle-time-us:
type: int
default: 18
description: |
Settling time in microseconds from state PD to PG.
Default value is based on Table 6 of the nRF21540 Product
Specification (v1.0), and can be overridden for tuned
configurations.
trx-hold-time-us:
type: int
default: 3
description: |
Power-off time in microseconds when changing from RX or TX to PG.
Default value is based on Table 6 of the nRF21540 Product
Specification (v1.0), and can be overridden for tuned
configurations.