lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aS77X7T50D8x6yZR@smile.fi.intel.com>
Date: Tue, 2 Dec 2025 16:44:47 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
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>,
	Marcelo Schmitt <marcelo.schmitt@...log.com>,
	Michael Hennerich <michael.hennerich@...log.com>,
	Nuno Sá <nuno.sa@...log.com>,
	Jonathan Cameron <jic23@...nel.org>,
	Andy Shevchenko <andy@...nel.org>,
	Sean Anderson <sean.anderson@...ux.dev>, linux-spi@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-iio@...r.kernel.org
Subject: Re: [PATCH v3 2/7] spi: Support controllers with multiple data lanes

On Mon, Dec 01, 2025 at 08:20:40PM -0600, David Lechner wrote:
> Add support for SPI controllers with multiple physical SPI data lanes.
> (A data lane in this context means lines connected to a serializer, so a
> controller with two data lanes would have two serializers in a single
> controller).

I'm a bit confused. Does it mean the three data lanes require three
serializers?

> This is common in the type of controller that can be used with parallel
> flash memories, but can be used for general purpose SPI as well.
> 
> To indicate support, a controller just needs to set ctlr->num_data_lanes
> to something greater than 1. Peripherals indicate which lane they are
> connected to via device tree (ACPI support can be added if needed).

...

> +	rc = of_property_read_variable_u32_array(nc, "data-lanes", lanes, 1,
> +						 ARRAY_SIZE(lanes));
> +	if (rc < 0 && rc != -EINVAL) {

It's a dup check for EINVAL, see below...

> +		dev_err(&ctlr->dev, "%pOF has invalid 'data-lanes' property (%d)\n",
> +			nc, rc);
> +		return rc;
> +	}
> +
> +	if (rc == -EINVAL) {
> +		/* Default when property is omitted. */
> +		spi->num_data_lanes = 1;


...just move it here as

	} else if (rc < 0) {
		...

(and yes, I know that this is not so usual pattern, but it makes the code less
 duplicative).

> +	} else {
> +		for (idx = 0; idx < rc; idx++) {
> +			if (lanes[idx] >= ctlr->num_data_lanes) {
> +				dev_err(&ctlr->dev,
> +					"%pOF has out of range 'data-lanes' property (%d/%d)\n",
> +					nc, lanes[idx], ctlr->num_data_lanes);
> +				return -EINVAL;
> +			}
> +			spi->data_lanes[idx] = lanes[idx];
> +		}
> +
> +		spi->num_data_lanes = rc;
> +	}

...

>   * @chip_select: Array of physical chipselect, spi->chipselect[i] gives
>   *	the corresponding physical CS for logical CS i.
>   * @num_chipselect: Number of physical chipselects used.
> + * @data_lanes: Array of physical data lanes. This is only used with specialized
> + * controllers that support multiple data lanes.
> + * @num_data_lanes: Number of physical data lanes used.

This split the group of cs related members. Can you move it out or explain how
does it relate?

>   * @cs_index_mask: Bit mask of the active chipselect(s) in the chipselect array
>   * @cs_gpiod: Array of GPIO descriptors of the corresponding chipselect lines
>   *	(optional, NULL when not using a GPIO line)

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ