Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spi engine and ad7944 backport #2446

Merged
merged 22 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9147340
spi: core: add spi_split_transfers_maxwords
hnez Mar 10, 2023
8fbf5c5
spi: consolidate setting message->spi
dlech Jan 23, 2024
d018972
spi: fix finalize message on error return
dlech Jan 25, 2024
46f286d
spi: avoid double validation in __spi_sync()
dlech Jan 25, 2024
6eb7910
spi: move split xfers for CS_WORD emulation
dlech Jan 26, 2024
cd609f4
spi: drop gpf arg from __spi_split_transfer_maxsize()
dlech Feb 6, 2024
deed771
spi: add spi_optimize_message() APIs
dlech Feb 19, 2024
8b20785
spi: move splitting transfers to spi_optimize_message()
dlech Feb 19, 2024
4b83202
dt-bindings: spi: axi-spi-engine: convert to yaml
dlech Nov 17, 2023
b7674b6
dt-bindings: spi: add copy of adi,adi-spi-engine.yaml
dlech Mar 7, 2024
d20ea38
spi: Add copy of upstream spi-axi-spi-engine.c
dlech Mar 7, 2024
2d0a194
spi: axi-spi-engine-ex: port offload functions
dlech Mar 7, 2024
c885a9a
Revert "iio: adc: ad_pulsar: initial support for turbo gpio"
dlech Mar 12, 2024
5dd7849
Revert "iio: adc: ad_pulsar: add ad7944, ad7985, ad7986"
dlech Mar 12, 2024
5ffc0ac
Revert "dt-bindings: iio: adc: adi,pulsar: add ad7944, ad7985, ad7986"
dlech Mar 12, 2024
a913106
dt-bindings: iio: adc: add ad7944 ADCs
dlech Mar 4, 2024
55eac62
iio: adc: ad7944: add driver for AD7944/AD7985/AD7986
dlech Mar 4, 2024
fcea399
iio: adc: ad7944: Add support for "3-wire mode"
dlech Feb 29, 2024
d10dc7b
iio: adc: ad7944: use spi_optimize_message()
dlech Mar 5, 2024
e5a6a89
iio: Kconfig.adi: imply AD7944
dlech Mar 12, 2024
4ee3c3d
arm: dts: update ad4744 dts for new driver
dlech Mar 7, 2024
d73dba4
iio: adc: ad7944: add spi offload support
dlech Mar 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions Documentation/devicetree/bindings/iio/adc/adi,ad7944.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/adi,ad7944.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices PulSAR LFCSP Analog to Digital Converters

maintainers:
- Michael Hennerich <[email protected]>
- Nuno Sá <[email protected]>

description: |
A family of pin-compatible single channel differential analog to digital
converters with SPI support in a LFCSP package.

* https://www.analog.com/en/products/ad7944.html
* https://www.analog.com/en/products/ad7985.html
* https://www.analog.com/en/products/ad7986.html

$ref: /schemas/spi/spi-peripheral-props.yaml#

properties:
compatible:
enum:
- adi,ad7944
- adi,ad7985
- adi,ad7986

reg:
maxItems: 1

spi-max-frequency:
maximum: 111111111

spi-cpol: true
spi-cpha: true

adi,spi-mode:
$ref: /schemas/types.yaml#/definitions/string
enum: [ single, chain ]
description: |
This property indicates the SPI wiring configuration.

When this property is omitted, it is assumed that the device is using what
the datasheet calls "4-wire mode". This is the conventional SPI mode used
when there are multiple devices on the same bus. In this mode, the CNV
line is used to initiate the conversion and the SDI line is connected to
CS on the SPI controller.

When this property is present, it indicates that the device is using one
of the following alternative wiring configurations:

* single: The datasheet calls this "3-wire mode". (NOTE: The datasheet's
definition of 3-wire mode is NOT at all related to the standard
spi-3wire property!) This mode is often used when the ADC is the only
device on the bus. In this mode, SDI is tied to VIO, and the CNV line
can be connected to the CS line of the SPI controller or to a GPIO, in
which case the CS line of the controller is unused.
* chain: The datasheet calls this "chain mode". This mode is used to save
on wiring when multiple ADCs are used. In this mode, the SDI line of
one chip is tied to the SDO of the next chip in the chain and the SDI of
the last chip in the chain is tied to GND. Only the first chip in the
chain is connected to the SPI bus. The CNV line of all chips are tied
together. The CS line of the SPI controller can be used as the CNV line
only if it is active high.

'#daisy-chained-devices': true

avdd-supply:
description: A 2.5V supply that powers the analog circuitry.

dvdd-supply:
description: A 2.5V supply that powers the digital circuitry.

vio-supply:
description:
A 1.8V to 2.7V supply for the digital inputs and outputs.

bvdd-supply:
description:
A voltage supply for the buffered power. When using an external reference
without an internal buffer (PDREF high, REFIN low), this should be
connected to the same supply as ref-supply. Otherwise, when using an
internal reference or an external reference with an internal buffer, this
is connected to a 5V supply.

ref-supply:
description:
Voltage regulator for the external reference voltage (REF). This property
is omitted when using an internal reference.

refin-supply:
description:
Voltage regulator for the reference buffer input (REFIN). When using an
external buffer with internal reference, this should be connected to a
1.2V external reference voltage supply. Otherwise, this property is
omitted.

cnv-gpios:
description:
The Convert Input (CNV). This input has multiple functions. It initiates
the conversions and selects the SPI mode of the device (chain or CS). In
'single' mode, this property is omitted if the CNV pin is connected to the
CS line of the SPI controller.
maxItems: 1

turbo-gpios:
description:
GPIO connected to the TURBO line. If omitted, it is assumed that the TURBO
line is hard-wired and the state is determined by the adi,always-turbo
property.
maxItems: 1

adi,always-turbo:
type: boolean
description:
When present, this property indicates that the TURBO line is hard-wired
and the state is always high. If neither this property nor turbo-gpios is
present, the TURBO line is assumed to be hard-wired and the state is
always low.

interrupts:
description:
The SDO pin can also function as a busy indicator. This node should be
connected to an interrupt that is triggered when the SDO line goes low
while the SDI line is high and the CNV line is low ('single' mode) or the
SDI line is low and the CNV line is high ('multi' mode); or when the SDO
line goes high while the SDI and CNV lines are high (chain mode),
maxItems: 1

required:
- compatible
- reg
- avdd-supply
- dvdd-supply
- vio-supply
- bvdd-supply

allOf:
# ref-supply and refin-supply are mutually exclusive (neither is also valid)
- if:
required:
- ref-supply
then:
properties:
refin-supply: false
- if:
required:
- refin-supply
then:
properties:
ref-supply: false
# in '4-wire' mode, cnv-gpios is required, for other modes it is optional
- if:
not:
required:
- adi,spi-mode
then:
required:
- cnv-gpios
# chain mode has lower SCLK max rate and doesn't work when TURBO is enabled
- if:
required:
- adi,spi-mode
properties:
adi,spi-mode:
const: chain
then:
properties:
spi-max-frequency:
maximum: 90909090
adi,always-turbo: false
required:
- '#daisy-chained-devices'
else:
properties:
'#daisy-chained-devices': false
# turbo-gpios and adi,always-turbo are mutually exclusive
- if:
required:
- turbo-gpios
then:
properties:
adi,always-turbo: false
- if:
required:
- adi,always-turbo
then:
properties:
turbo-gpios: false

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/gpio/gpio.h>
spi {
#address-cells = <1>;
#size-cells = <0>;
adc@0 {
compatible = "adi,ad7944";
reg = <0>;
spi-cpha;
spi-max-frequency = <111111111>;
avdd-supply = <&supply_2_5V>;
dvdd-supply = <&supply_2_5V>;
vio-supply = <&supply_1_8V>;
bvdd-supply = <&supply_5V>;
cnv-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
turbo-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
};
};
24 changes: 0 additions & 24 deletions Documentation/devicetree/bindings/iio/adc/adi,pulsar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@ description: |
Analog Devices PulSAR family Analog to Digital Converters with SPI support
https://www.analog.com/en/products/ad7988-5.html
https://www.analog.com/en/products/ad7988-1.html
https://www.analog.com/en/products/ad7986.html
https://www.analog.com/en/products/ad7985.html
https://www.analog.com/en/products/ad7984.html
https://www.analog.com/en/products/ad7983.html
https://www.analog.com/en/products/ad7982.html
https://www.analog.com/en/products/ad7980.html
https://www.analog.com/en/products/ad7949.html
https://www.analog.com/en/products/ad7944.html
https://www.analog.com/en/products/ad7946.html
https://www.analog.com/en/products/ad7942.html
https://www.analog.com/en/products/ad7699.html
Expand Down Expand Up @@ -48,15 +45,12 @@ properties:
enum:
- adi,pulsar,ad7988-5
- adi,pulsar,ad7988-1
- adi,pulsar,ad7986
- adi,pulsar,ad7985
- adi,pulsar,ad7984
- adi,pulsar,ad7983
- adi,pulsar,ad7982
- adi,pulsar,ad7980
- adi,pulsar,ad7949
- adi,pulsar,ad7946
- adi,pulsar,ad7944
- adi,pulsar,ad7942
- adi,pulsar,ad7699
- adi,pulsar,ad7693
Expand Down Expand Up @@ -110,12 +104,6 @@ properties:
vref-supply:
description: Voltage regulator for the reference voltage.

turbo-gpios:
maxItems: 1
description:
GPIO used to enable the turbo mode. This mode is used to increase the
sampling rate of the ADC at the expense of power consumption.

patternProperties:
"^channel@([0-8])$":
type: object
Expand Down Expand Up @@ -177,18 +165,6 @@ allOf:
required:
- adi,single-channel

- if:
properties:
compatible:
contains:
enum:
- adi,pulsar,ad7986
- adi,pulsar,ad7985
- adi,pulsar,ad7944
then:
required:
- turbo-gpios

required:
- compatible
- reg
Expand Down
31 changes: 0 additions & 31 deletions Documentation/devicetree/bindings/spi/adi,axi-spi-engine.txt

This file was deleted.

66 changes: 66 additions & 0 deletions Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/spi/adi,axi-spi-engine.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Analog Devices AXI SPI Engine Controller

description: |
The AXI SPI Engine controller is part of the SPI Engine framework[1] and
allows memory mapped access to the SPI Engine control bus. This allows it
to be used as a general purpose software driven SPI controller as well as
some optional advanced acceleration and offloading capabilities.

[1] https://wiki.analog.com/resources/fpga/peripherals/spi_engine

maintainers:
- Michael Hennerich <[email protected]>
- Nuno Sá <[email protected]>

allOf:
- $ref: /schemas/spi/spi-controller.yaml#

properties:
compatible:
const: adi,axi-spi-engine-1.00.a

reg:
maxItems: 1

interrupts:
maxItems: 1

clocks:
items:
- description: The AXI interconnect clock.
- description: The SPI controller clock.

clock-names:
items:
- const: s_axi_aclk
- const: spi_clk

required:
- compatible
- reg
- interrupts
- clocks
- clock-names

unevaluatedProperties: false

examples:
- |
spi@44a00000 {
compatible = "adi,axi-spi-engine-1.00.a";
reg = <0x44a00000 0x1000>;
interrupts = <0 56 4>;
clocks = <&clkc 15>, <&clkc 15>;
clock-names = "s_axi_aclk", "spi_clk";

#address-cells = <1>;
#size-cells = <0>;

/* SPI devices */
};
Loading
Loading