[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240722-dlech-mainline-spi-engine-offload-2-v3-5-7420e45df69b@baylibre.com>
Date: Mon, 22 Jul 2024 16:57:12 -0500
From: David Lechner <dlechner@...libre.com>
To: Mark Brown <broonie@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Nuno Sá <nuno.sa@...log.com>
Cc: David Lechner <dlechner@...libre.com>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
David Jander <david@...tonic.nl>,
Martin Sperl <kernel@...tin.sperl.org>,
linux-spi@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: [PATCH RFC v3 5/9] spi: dt-bindings: axi-spi-engine: document spi-offloads
The AXI SPI Engine has support for hardware offloading capabilities.
There can be up to 32 offload instances per SPI controller, so the
bindings limit the value accordingly.
Signed-off-by: David Lechner <dlechner@...libre.com>
---
RFC: I have a few questions about this one...
1. The trigger-source properties are borrowed from the leds bindings.
Do we want to promote this to a generic binding that can be used by
any type of device?
2. Some folks are working on adding DMA to TX stream support to the
AXI SPI Engine hardware. I assume that the `dmas` property is like
others where the order/index in the phandle array matters. So this
would mean that for device that only uses 1 out of the 32 offloads
and only uses 1 TX DMA channel, we would have to have 32 <0>s for
each of the possible RX dmas in the array. Any way to do some kind
of mapping to avoid this?
3. In v2, we discussed about having some sort of data processing unit
between the AXI SPI Engine RX stream interface and the DMA channel
interface on the DMA controller. I haven't included this in the
bindings yet because we don't have a user yet. But it was suggested
that we could use the graph bindings for this. So here is what that
might look like:
Additional property for the AXI SPI Engine controller bindings:
out-ports:
$ref: /schemas/graph.yaml#/properties/ports
unevaluatedProperties: false
patternProperties:
"^port@1?[0-9a-f]$":
$ref: /schemas/graph.yaml#/properties/port
unevaluatedProperties: false
And this would be connected to a device node similar to this:
ip-block@...0 {
// Something similar to, but not exactly like
// http://analogdevicesinc.github.io/hdl/library/util_extract/index.html
compatible = "adi,crc-check";
// clock that runs this IP block
clocks = <&sysclk 15>;
// interrupt raised on bad CRC
interrupts = <&intc 99>;
interrupt-names = "crc";
// output stream with CRC byte removed piped to DMA
dmas = <&adc_dma 0>;
dma-names = "rx";
port {
adc_crc_check: endpoint {
remote-endpoint: <&offload0_rx>;
};
};
};
Does this sound reasonable?
v3 changes:
* Added #spi-offload-cells property.
* Added properties for triggers and RX data stream connected to DMA.
v2 changes:
This is basically a new patch. It partially replaces "dt-bindings: iio:
offload: add binding for PWM/DMA triggered buffer".
The controller no longer has an offloads object node and the
spi-offloads property is now a standard SPI peripheral property.
---
.../bindings/spi/adi,axi-spi-engine.yaml | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml b/Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml
index d48faa42d025..ec18eabb993a 100644
--- a/Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml
+++ b/Documentation/devicetree/bindings/spi/adi,axi-spi-engine.yaml
@@ -41,6 +41,42 @@ properties:
- const: s_axi_aclk
- const: spi_clk
+ '#spi-offload-cells':
+ description: The cell value is the offload instance number.
+ const: 1
+
+ trigger-sources:
+ description:
+ An array of trigger source phandles for offload instances. The index in
+ the array corresponds to the offload instance number.
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+
+ dmas:
+ description:
+ DMA channels connected to the output stream interface of an offload instance.
+ minItems: 1
+ maxItems: 32
+
+ dma-names:
+ minItems: 1
+ maxItems: 32
+ items:
+ pattern: "^offload(?:[12]?[0-9]|3[01])-rx$"
+
+patternProperties:
+ "^.*@[0-9a-f]+$":
+ type: object
+ $ref: spi-peripheral-props.yaml
+ additionalProperties: true
+ properties:
+ spi-offloads:
+ description:
+ An array of 1 or more offload instance numbers assigned to this
+ peripheral.
+ items:
+ minimum: 0
+ maximum: 31
+
required:
- compatible
- reg
@@ -59,6 +95,11 @@ examples:
clocks = <&clkc 15>, <&clkc 15>;
clock-names = "s_axi_aclk", "spi_clk";
+ #spi-offload-cells = <1>;
+ trigger-sources = <&trigger_clock>;
+ dmas = <&dma 0>;
+ dma-names = "offload0-rx";
+
#address-cells = <1>;
#size-cells = <0>;
--
2.43.0
Powered by blists - more mailing lists