[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241214142802.27bd774d@jic23-huawei>
Date: Sat, 14 Dec 2024 14:28:02 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: David Lechner <dlechner@...libre.com>
Cc: Mark Brown <broonie@...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>, Uwe
Kleine-König <ukleinek@...nel.org>, 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,
linux-pwm@...r.kernel.org
Subject: Re: [PATCH v6 05/17] spi: add offload TX/RX streaming APIs
On Wed, 11 Dec 2024 14:54:42 -0600
David Lechner <dlechner@...libre.com> wrote:
> Most configuration of SPI offloads is handled opaquely using the offload
> pointer that is passed to the various offload functions. However, there
> are some offload features that need to be controlled on a per transfer
> basis.
>
> This patch adds a flag field to struct spi_transfer to allow specifying
> such features. The first feature to be added is the ability to stream
> data to/from a hardware sink/source rather than using a tx or rx buffer.
> Additional flags can be added in the future as needed.
>
> A flags field is also added to the offload struct for providers to
> indicate which flags are supported. This allows for generic checking of
> offload capabilities during __spi_validate() so that each offload
> provider doesn't have to implement their own validation.
>
> As a first users of this streaming capability, getter functions are
> added to get a DMA channel that is directly connected to the offload.
> Peripheral drivers will use this to get a DMA channel and configure it
> to suit their needs.
>
> Signed-off-by: David Lechner <dlechner@...libre.com>
Really really minor comment inline.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index ff1add2ecb91f18cf82e6f1e9595584c11adf9d8..4a871db9ee636aba64c866ebdd8bb1dbf82e0f42 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -31,6 +31,7 @@
> #include <linux/ptp_clock_kernel.h>
> #include <linux/sched/rt.h>
> #include <linux/slab.h>
> +#include <linux/spi/offload/types.h>
> #include <linux/spi/spi.h>
> #include <linux/spi/spi-mem.h>
> #include <uapi/linux/sched/types.h>
> @@ -4163,6 +4164,15 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
>
> if (_spi_xfer_word_delay_update(xfer, spi))
> return -EINVAL;
> +
> + /* make sure controller supports required offload features */
Comment syntax seems inconsistent with local code.
/* Make sure controller supports required offload features. */
> + if (xfer->offload_flags) {
> + if (!message->offload)
> + return -EINVAL;
> +
> + if (xfer->offload_flags & ~message->offload->xfer_flags)
> + return -EINVAL;
> + }
> }
>
> message->status = -EINPROGRESS;
Powered by blists - more mailing lists