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: <a183973d-e648-c7e6-d65b-1479f7e32bb5@lechnology.com>
Date:   Wed, 18 Jul 2018 11:47:30 -0500
From:   David Lechner <david@...hnology.com>
To:     Mark Brown <broonie@...nel.org>
Cc:     linux-spi@...r.kernel.org, linux-iio@...r.kernel.org,
        Jonathan Cameron <jic23@...nel.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] spi: add new SPI_CS_WORD flag



On 7/18/18 10:04 AM, Mark Brown wrote:
> On Mon, Jul 16, 2018 at 10:20:50PM -0500, David Lechner wrote:
>> This adds a new SPI mode flag, SPI_CS_WORD, that is used to indicate
>> that a SPI device requires the chip select to be toggled after each
>> word that is transferred.
> 
> This feels like it should have a soft implementation if it is going to
> be truly usable, the vast majority of SPI controllers don't do this and

This occurred to me as well. Another possibility, though, would be to 
leave it up to the client device drivers to support both cases, e.g.:

	if (master has SPI_CS_WORD support)
		setup message as single transfer
	else
		setup message as multiple one-word transfers

This seems like that would be more efficient than having a generic 
implementation for masters that says:

	if (master does not have SPI_CS_WORD support)
		allocate enough transfers for each word of each
			each transfer of the message
		allocate and setup a new message for these transfers
		loop through the original transfers of the original
			message and copy them to the new transfers
		send the new message
		free allocated message and transfers

> I can only think of a few that have the hardware feature.  I'd also
> expect to see some validation added to the core spi_setup() since at
> present a client driver could set the mode option but then have it
> ignored by the controller which would presumably break things, we
> currently only have checks for specific modes and nothing that'd catch
> an unknown flag like this.

There is already a generic mode flags check in spi_setup() that will 
catch this and return an error if the device has the SPI_CS_WORD flag 
set and the controller does not. (I know this works because I ran into 
it during development.)

> 
> Ideally we'd also have some ability to use this as an optimization where
> possible with longer sequences (I can see a regmap cache sync being able
> to take advantage of this for example) but that might be more trouble
> than it's worth.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ