Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp837206lqo; Fri, 10 May 2024 17:50:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUjQr2DqXpLrTpJ98smWHCINcWFtW74PujEon5X7EoRkKz7mQEmff2/0M3HPsvq/I6c0fQS5ml9HvrHwlqWxr8pv8jz6CL28iWVNZlDpQ== X-Google-Smtp-Source: AGHT+IEyhdxa1Hr5Ax+yLbD0fklLW9UCiahN5VJb4/OUpUgjRTj08nhuyMrtcWwkC3f2TkjDxU6c X-Received: by 2002:a05:622a:4895:b0:43a:cc59:e82b with SMTP id d75a77b69052e-43dfdae0f20mr43394791cf.16.1715388618521; Fri, 10 May 2024 17:50:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715388618; cv=pass; d=google.com; s=arc-20160816; b=e6q19nY6H+GWSyH0l7YGn67szIn7PsJe84erI5fuHN8s/bHuNM27yaBJMCPZEMRFOd g+lUT93X1tvb1FMiPdqjpjCRR+cD047CVaI8jgTcWoyr8vjr9OO7CowniFmPKf/VypI2 H9HUYcyDQ18qR3j3FiOi4n7u0r9c2aKZqLp9jEwSCtUm8S6HjOsNT5RYaE5eGsYI5GN4 IEeP2mcjDXVgyaXNBqUFAzcnpwLPNwslqlZl7SIJ+03S82E7Suk5O7EfjMHLAo4iPxJf I0audDFIkuTikq/N1qLDdnKMCVJqRjhbJSkl+SUiFwOPxLVVwJGqna+hShbXgSqKeyGj E35A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=BVdf4zx6zwtx6KZ3x+nZAgrV5XQ5p7PNnM/KaEXNehA=; fh=GlaZOsc5J6Ex4Um5zNfsIrwREc9Jahq1BSSZD8u47sY=; b=Xt0usjRRTwQX/bKIScRnTnPq/sEdXEmqzMDU4Dh0N9lTh+TWrEzBHlNtcTfJOJ5Zxh HXCCUjuUmqWONQtgYaGERmTyM3Z9Pr46ZZaMfo/p8CSyb5Z8ZXKjlumJwZStWn20o4VB xgbEyed2C9csB7zzncRLcsPYut9nIeohqVsWLIJ3MCmI5ysfkb7O3NMUrw0cKaoLK26a XUl0v34GykpRdcb7Qz0Sp1mwjy/grWxMPH4r6JTML0xRqb62gHZk3QICAxYt0fG0kC0Y oj68LfI7nNgj/L1Xcau7sed9uAM6zmoJTfMDzutoSHb8W04qY6CUV4RIzlXGR78o0j3F zuuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=PgqPKZSh; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-176323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176323-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df54c31besi31638761cf.227.2024.05.10.17.50.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 17:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=PgqPKZSh; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-176323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176323-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1D9731C213D9 for ; Sat, 11 May 2024 00:50:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8FBBC12B93; Sat, 11 May 2024 00:50:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="PgqPKZSh" Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFFB06AB8 for ; Sat, 11 May 2024 00:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715388600; cv=none; b=oD40bgnCMpA4CSpjfgAwnBCXR/QywtluWWF0Q/NFjou7MvOMtzOAcwPkNvzkHZyXhQEK/aG99Ul7AcTupVDlTGWkklso4MTbuCmIdR2DucPYM1MHUI9yPwWVJpeMsEH/uWbstIYlmz1arBB9Ty2Qhiy5NC+js4L2mJ6ooU3NT6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715388600; c=relaxed/simple; bh=hSduPC43AAmHpwPQqz1x75rIfbxY36WPQViOrqNdCXY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=NrXIZdooknwSf+SUBfAXNRi21oCozMqI8aq7ND7O4kCVLUzbR4bC1fro+6mLgQLPVctMumSAVUWNdi7q/JAqk96yF2EdkS9xTEtYITQ9c+up+fZusVsDY/h7beKqQyEdsi7KiIEfMAeJtboAiYLNJvmeTRNzGvmw4IOes5vSOxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=PgqPKZSh; arc=none smtp.client-ip=209.85.161.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-5b296194ac1so237190eaf.2 for ; Fri, 10 May 2024 17:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1715388596; x=1715993396; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BVdf4zx6zwtx6KZ3x+nZAgrV5XQ5p7PNnM/KaEXNehA=; b=PgqPKZShryV7YCuYvNJh72RMI6MwCpaUFXlF0H6EBPG3j73XNXWULsrr0xmZXYHFTr 4/axtF5nodeiRjHGScTyellRTMpk65rpC8JLNz7GwiPfHOX5Tz1F9HRsbiMcCqIfr1RR MxU0NbeDdbq0eLMvlSNGDfCxfazJoAjWTxMxQVme1u+Fq6sG+zhGMRAH37kuZvIgtrU/ pPe1Hofz7MMbAMZguT+hGfQb8srOQ2YsCYj6X1f5xbJRryBqgZvZqqiYumGNh/QA/Qso FsKd9h+ijMeBqLwaP8m+P/rf57Xa5MSciwIuj0PVbAk+LcUHWKQ22EV0EkuueDc/onrF MH0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715388596; x=1715993396; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BVdf4zx6zwtx6KZ3x+nZAgrV5XQ5p7PNnM/KaEXNehA=; b=EJtVRyDu8ayIlrHk0GcT3mQ3LNkZnQ2EXFSIsaGVetJgnRdqwboYswaGog+dDtMoOp YUyvkWeB0rcun6twI+CHwCzEyISejTyzqZTG+iATwo44m4f93u+3hIBFmC9N4ndkGSN+ 4HFJq8NT+9VO6J3Avh0oeQaJBPwwB2GlRleBjCcG3bHOWNq5hOvHgmX+VvDuYap8zasz Tn05v7HMgvhvr3KwBXO6PLZg6Aa1RzVUcZMikU5lLTg6IZDF2gL9FtiXl9dKvZyEuw1V wuRYolY+4jqemleXF0NiD3ohDQB68cIsh3dFDBR15w3akOOK7HeiLRDI1YmhfWeSHqFg QRUg== X-Forwarded-Encrypted: i=1; AJvYcCVpo2HPsKUba/DjsmvsxQGxjEX+OTRNpFyhTkERcktjNtm2JFSofIs4Zb71zgaNWuoTgXlcPMa4gtHT+RTPD7TQVJe6lSYiOkUR7XSD X-Gm-Message-State: AOJu0YybVlTDNhwRVlW2g4KWkSvzPVJPTGfVZ/FesdcxWZOXAiughZel EE8PGlLCvsGMrRAIuQjFhI+h+jph8nPinhMitGCvapy32ofGjGFqg9SCRsPYL4k= X-Received: by 2002:a4a:aa43:0:b0:5ae:fe80:7dd3 with SMTP id 006d021491bc7-5b2819d53d9mr3917970eaf.7.1715388596092; Fri, 10 May 2024 17:49:56 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5b29015a3dbsm321132eaf.46.2024.05.10.17.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 17:49:55 -0700 (PDT) From: David Lechner To: Mark Brown , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?utf-8?q?Nuno_S=C3=A1?= Cc: David Lechner , Michael Hennerich , Lars-Peter Clausen , David Jander , Martin Sperl , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH RFC v2 0/8] spi: axi-spi-engine: add offload support Date: Fri, 10 May 2024 19:44:23 -0500 Message-ID: <20240510-dlech-mainline-spi-engine-offload-2-v2-0-8707a870c435@baylibre.com> X-Mailer: git-send-email 2.43.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: 8bit Continuing the discussion started a few months ago [1]... It was suggested that we were trying to do too much in one series. So we split out part of the series into a separate series that adds generic support for pre-preparing SPI messages [2]. That work has been merged. [1]: https://lore.kernel.org/linux-spi/20240109-axi-spi-engine-series-3-v1-0-e42c6a986580@baylibre.com/ [2]: https://lore.kernel.org/linux-spi/20240219-mainline-spi-precook-message-v2-0-4a762c6701b9@baylibre.com/ I was hoping to also break down the remaining work into smaller parts by first only considering more generic offload support that could be used with the regular SPI message queue and leaving out the hardware trigger bits. But the hardware I have at hand is not capable of doing that so this is the best I can do for now. (Happy to take suggestions if someone knows some other hardware that could be used for this.) There have been significant changes since the last version so I'll discuss what changed in each patch instead of having a very lengthy cover letter. A working branch complete with extra hacks can be found at [3]. [3]: https://github.com/dlech/linux/tree/axi-spi-engine-offload-v2 --- As a recap, here is the background and end goal of this series: The AXI SPI Engine is a SPI controller that has the ability to record a series of SPI transactions and then play them back using a hardware trigger. This allows operations to be performed, repeating many times, without any CPU intervention. This is needed for achieving high data rates (millions of samples per second) from ADCs and DACs that are connected via a SPI bus. The offload hardware interface consists of a trigger input and a data output for the RX data. These are connected to other hardware external to the SPI controller. To record one or more transactions, commands and TX data are written to memories in the controller (RX buffer is not used since RX data gets piped to an external sink). This sequence of transactions can then be played back when the trigger input is asserted. This series includes core SPI support along with the first SPI controller (AXI SPI Engine) and SPI peripheral (AD7944 ADC) that use them. This enables capturing analog data at 2 million samples per second. The hardware setup looks like this: +-------------------------------+ +------------------+ | | | | | SOC/FPGA | | AD7944 ADC | | +---------------------+ | | | | | AXI SPI Engine | | | | | | SPI Bus ============ SPI Bus | | | | | | | | | +---------------+ | | | | | | | Offload 0 | | | +------------------+ | | | RX DATA OUT > > > > | | | | TRIGGER IN < < < v | | | +---------------+ | ^ v | | +---------------------+ ^ v | | | AXI PWM | ^ v | | | CH0 > ^ v | | +---------------------+ v | | | AXI DMA | v | | | CH0 < < < | | +---------------------+ | | | +-------------------------------+ To: Mark Brown To: Jonathan Cameron To: Rob Herring To: Krzysztof Kozlowski To: Conor Dooley To: Nuno Sá Cc: Michael Hennerich Cc: Lars-Peter Clausen Cc: David Jander Cc: Martin Sperl Cc: Cc: Cc: Cc: --- David Lechner (8): spi: dt-bindings: spi-peripheral-props: add spi-offloads property spi: add basic support for SPI offloading spi: add support for hardware triggered offload spi: add offload xfer flags spi: dt-bindings: axi-spi-engine: document spi-offloads spi: axi-spi-engine: add offload support dt-bindings: iio: adc: adi,ad7944: add SPI offload properties iio: adc: ad7944: add support for SPI offload .../devicetree/bindings/iio/adc/adi,ad7944.yaml | 58 +++++ .../bindings/spi/adi,axi-spi-engine.yaml | 14 ++ .../bindings/spi/spi-peripheral-props.yaml | 10 + drivers/iio/adc/ad7944.c | 147 +++++++++--- drivers/spi/spi-axi-spi-engine.c | 267 ++++++++++++++++++++- drivers/spi/spi.c | 202 +++++++++++++++- include/linux/spi/spi.h | 84 +++++++ 7 files changed, 741 insertions(+), 41 deletions(-) --- base-commit: 14fde009028126f91c2bd72c404e425cf4f8aec3 change-id: 20240510-dlech-mainline-spi-engine-offload-2-afce3790b5ab Best regards, -- David Lechner