From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 C629B47DD5F for ; Tue, 14 Jul 2026 15:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041336; cv=none; b=T+aAyUdKr2AAsH9pLTO9CnR3HvVxQFdHcaHgyUw16nK7LwJalTBLEyWVZImGzEDHUMnpAT4mGp5hNF104kAh48H8BWi/JarwtNFdTIY9xemCNZO1KsO8KpTQHmnammubUSsDGvpX5Rret56UNL0IbGiJGwYZP+r54CFVmwSNKj8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041336; c=relaxed/simple; bh=CzPwwTGtwKKlUoMuy9C+LBMvDHA7sdhjrS9JB/w/ric=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=isEiNXjl6SnD5nqjJxJlG7QNoE2MXOYPbgJvltfdfIfd0w3B4u4ygz5cwhew2VQgmDUN028yyzRuy0uPZpdXkLsZgz0xkibeSrxZBHCRDY6uEEESXnalKkW0mcHsDh6fGeimCqLxUcyYxp/XPjj4JfwfAQQuPW+NJqqbaqX1h0A= 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 header.i=@baylibre.com header.b=Vry9ee41; arc=none smtp.client-ip=209.85.210.52 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.b="Vry9ee41" Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-7e6b5737bb2so3703622a34.1 for ; Tue, 14 Jul 2026 08:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1784041331; x=1784646131; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=UId+sMQ0S31GDuUH4mmvayQsO9inN0IgYMoufwbOOhg=; b=Vry9ee41K6Jhi5wQDQ19INlEdgVqAxHdh8LwtSlVeejNj1+0sWJDiR4Vk6oZjUoOq6 jM3Kkt7UJogHzuSDdHZ5X2gwneXx/9+LXAHmxQGIwxSTbxQTuNMev1PZ2jobCsIOpdA7 E/jdUI/Vl4sv12RWQg3O06y3w1Tgk2HJZwxTIQ/Ak506T6Eho8Qz5N5ebM7vC6iNaqQj +MLV2OdX+xdh2jg2TktS1A9ei2B90Q7dfmTEgfQTjvQgbFaL7TpartE3Qg7sNfB1ETkQ HdGagyw7uE11/eK5t2IbGWgvLGr9iHc049JSTEvhkHX4c9rh8iZITOEt1OscfeIZAGEK SZ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784041331; x=1784646131; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=UId+sMQ0S31GDuUH4mmvayQsO9inN0IgYMoufwbOOhg=; b=b11HFOErm+REyUbMKJUTK1/MjqfZnkRg9N/hPKK0cB/MvL4g4IU77gIMdcAu6HjyeG XCUdaRacopNAxV2QPwZHwR7QxuVAoMK5E/wGyZky0drjXUZZyrD6LN23sVSP94yJ9ebM jGxhDzmeai2suNrQmsxIEpEe0uHdUbXqGS8fvdmQ6Tv3Uoyyda6t4ejEclGztjfx3Vhp k+u2iu4biTJ7UQ3gENoBtYoKv1Gt9V+xmeiFADojH8j9VqCgc1gQxEMIe6vUGtcsUSDt pe/7yAL5kg3r11YviXtsG05HjUykQD9PAumjWojyGzZ8oY+Ptwors7p+MeQubAoxr7Zj o5ew== X-Forwarded-Encrypted: i=1; AFNElJ9H+faEsTJhd9aDHDDbNvi2tdNKcxF5YpWGtscUpHJD7TxjFMSaWmoPMsVs5or5hEfIjRck3JDpg601Cbg=@vger.kernel.org X-Gm-Message-State: AOJu0YyyufFuG4g66YzeeJXEaQdvHigKjA+SmT3LBjecFsbPib80dnPp NJU67vbKWoT3ZUcukifU8q2mxQLYMOmtXwaM3tQbGSYiu7Giak5jo5sAw3Bnw19YY88= X-Gm-Gg: AfdE7cn5zYcppCFKjwisB77K0DUZHGkVGqPe2/vSPeLnyLH4Qf3B4fnml4mobxYUr1D 931PkcsNmKutz4MvgcuzpRzVvXSRZJ8iZ7Glvok3LkcGp2Pw164aZLfrHQT5IPRrbcT0wm99zvA VfJDOuBE5AvKktMozLzJQL0PLUIapMC6F936lox5m4DfzlLbLrBX15PnjJMEBB/Ua7BxlKb5b/b 18Rp15HT1kTwm3a+ou9pA+HH8yrPAbcZ+IhVhZH7qSLANyILBqxu2Ag8cbeC2S4wnJiA+1aV/cV mbyvV/aEtQFNm1NAyKs6eGYgXPTYJXqipXGye94vPs3dzPPSEaVDeAqpZTb0VaWfHpJz4iRNQH5 cQQhhNlqqur0sKl0zzyvwnkmYJr95frkNgDqKie888b9NwMYALpxm+2VepzWzHWaRtrHBPrbYS8 Na6XkO3LF0z19H1sTil6eS4jKlzv+uMoVZZHj0+s9JDOOsn5kwMVJWiS1yhiqHt18= X-Received: by 2002:a05:6830:67db:b0:7e5:f957:a61f with SMTP id 46e09a7af769-7ec4ab3eb13mr1505503a34.18.1784041330446; Tue, 14 Jul 2026 08:02:10 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:280e:69fd:7612:d5a9? ([2600:8803:e7e4:500:280e:69fd:7612:d5a9]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7ebcb262da7sm15225137a34.17.2026.07.14.08.02.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jul 2026 08:02:09 -0700 (PDT) Message-ID: <6576af52-19d1-4b79-879e-bbd09df40a7a@baylibre.com> Date: Tue, 14 Jul 2026 10:02:08 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/6] spi: add multi-CS and per-transfer lane mask support To: =?UTF-8?Q?Nuno_S=C3=A1?= , Jonathan Santos Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, nuno.sa@analog.com, michael.hennerich@analog.com, broonie@kernel.org, jonath4nns@gmail.com, marcelo.schmitt1@gmail.com, andy@kernel.org References: Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 7/14/26 5:29 AM, Nuno Sá wrote: > On Tue, Jul 14, 2026 at 02:55:31AM -0300, Jonathan Santos wrote: >> This series introduces two SPI subsystem features: per-transfer chipselect >> masks and multi-CS device support. Together they address the multi-device >> setup described in [1] and the limitation noted in [2], where no SPI >> controller completely handles logical chip selects beyond the first one. >> >> The first part of the set addresses multi-CS support. Some SPI controllers >> can assert multiple chip selects simultaneously, but the existing code >> hardcoded CS index 0 in both spi_set_cs() and of_spi_parse_dt(), >> preventing this from working. >> >> The second part addresses dynamic lane selection for STRIPE mode. In >> SPI_MULTI_LANE_MODE_STRIPE, all available lanes are currently always >> active. Some peripherals need to select a different subset of rx/tx lanes >> per transfer. New fields are added to the spi_transfer struct to allow >> drivers to specify which lanes to use for each transfer. The documentation >> is also updated to describe this new behavior. >> >> [1]: https://lore.kernel.org/linux-iio/af0EGv172ZMl%2F6N5@JSANTO12-L01.ad.analog.com/T/#t >> [2]: https://lore.kernel.org/all/20250915183725.219473-1-jonas.gorski@gmail.com/ >> >> Jonathan Santos (6): >> spi: support simultaneous assertion of multiple CS >> spi: add per-transfer CS mask >> spi: spi-engine-ex: Add support for multi-CS devices >> spi: Documentation: multiple-data-lanes: describe rx and tx lane mask >> spi: add rx and tx lane mask to spi_transfer struct >> spi: axi-spi-engine: add support for dynamic multi-lane selection > > It would be nice to include an actual user for this in the series. Agree. For context, here is the scenario from [1] (with arrow directions fixed): +---------------+ | ADC 0 | | | | SYNC_IN|<--+---------------------------+ | DRDY0|---|------------------------+ | | | | | | +------------+ | SCLK0|<--|------+ | | | HOST | | SDI0|<--|------|--+ | | | | | CS0|<--|------|--|-----------+ | +---|ADC_SYNC | | DOUT0|---|------|--|--------+ | | | | | | | | | | | | | | +---------------+ | +--|--------|--|--|------|SCLK | | | +--------|--|--|------|MOSI | +---------------+ | | | | | | | | | ADC 1 | | | | | | | | | | | | | | | | +----->|DRDY0 | | SYNC_IN|<--+ | | | +---------|CS0 | | DRDY1|---|------|--|----+ +----------->|MISO0 | | | | | | | | | | SCLK1|<--|------+ | | | | | SDI1|<--|------|--+ +--------------->|DRDY1 | | CS1|<--|------|--|---------------------|CS1 | | DOUT1|---|------|--|-------------------->|MISO1 | | | | | | | | +---------------+ | | | | . | | | | | . | ... | | | | . | | | | | | +---------------+ | | | +------->|DRDYN | | ADC N | | | | | +------|CSN | | | | | | | | +--->|MISON | | SYNC_IN|<--+ | | | | | | | | DRDYN|----------|--|------------+ | | +------------+ | | | | | | | SCLKN|<---------+ | | | | SDIN|<------------+ | | | CSN|<---------------------------+ | | DOUTN|------------------------------+ | | +---------------+ And the proposed DT from the discussion in [1]. spi { #address-cells = <1>; #size-cells = <0>; adc@0 { compatible = "adi,adaq7768-1"; reg = <0>, <1>, <2>, <3>; spi-rx-bus-width = <1>, <1>, <1>, <1>; /* other properties */ }; }; As a refresher, the idea is that this is considered to be one big ADC with more channels (for simultaneous sampling) even though it is physically multiple chips. Currently, this series is treating CS selection and mutli-lane SPI line selection as completely independent. However, clearly certain spi-rx-bus lines are tightly coupled with certain CS lines. To reflect that (and easier to use in peripheral drivers), I think we could bake this correlation into the SPI core code. So struct spi_device.rx_lane_map would become a 2-D array where the first index is the logical CS (following the pattern of .chip_select) and the second index is the existing one for the data lane. The trivial implementation would be to assume that reg and spi-rx-bus-width have the same length and there is just a 1-to-1 correspondence (first data lane is associated with first CS, and so on). And we could add a new DT property for more complex mappings (multiple data lanes per CS or wires not connected in logical order). We probably don't need to do that right now though if there are no expected users at the moment. Then we would only need to add the CS selection to struct spi_transfer and the controller driver would just use the map to pick the correct data lanes based on other parameters as it does now. (So no need to add .rx_lane_mask to struct spi_transfer.) This way, the ADC (SPI peripheral driver) can set 1 CS in order to configure individual chips and then set all CS to read sample data. And all of the data lane selection is all handled transparently between the core SPI code and the SPI controller driver. (And obviously everything above applies to tx too, I just wrote rx everywhere to keep it shorter.) > > - Nuno Sá > >> >> Documentation/spi/multiple-data-lanes.rst | 30 ++++++ >> drivers/spi/spi-axi-spi-engine.c | 106 +++++++++++++++++----- >> drivers/spi/spi.c | 97 +++++++++++++++++--- >> include/linux/spi/spi.h | 12 +++ >> 4 files changed, 206 insertions(+), 39 deletions(-) >> >> >> base-commit: 093239070573637ad2b4cb56abc9c4c7ee109294 >> -- >> 2.34.1 >>