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: <f068eab7d873b9cdfae41b5413ebdbb8@risingedge.co.za>
Date: Mon, 18 Mar 2024 13:06:54 +0200
From: Justin Swartz <justin.swartz@...ingedge.co.za>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
Cc: Mark Brown <broonie@...nel.org>, Matthias Brugger
 <matthias.bgg@...il.com>, linux-spi@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH v2] spi: mt7621: allow GPIO chip select lines

On 2024-03-18 12:16, AngeloGioacchino Del Regno wrote:
> Il 16/03/24 02:03, Justin Swartz ha scritto:
>> Extract a magic number, from mt7621_spi_probe(), used to
>> declare the number of chip select lines (which co-incides
>> with the native chip select count of 2) to a macro.
>> 
>> Use the newly defined MT7621_NATIVE_CS_COUNT macro to
>> instead populate both the spi_controller's max_native_cs
>> and num_chipselect members.
>> 
>> Declare that the spi_controller should use_gpio_descriptors
>> if present in the device properties (such as those declared
>> in the cs-gpio property of a "ralink,mt7621-spi" compatible
>> device-tree node) so that the SPI core will recalculcate
>> num_chipselect to account for the GPIO descriptors that
>> it should have populated in the cs_gpiod array member.
>> 
>> Remove the assignment of mt7621_spi_transfer_one_message()
>> to the spi_controller's transfer_one_message hook.
>> 
>> Refactor the mt7621_spi_transfer_one_message() logic into
>> mt7621_spi_prepare_message() and mt7621_spi_transfer_one()
>> and assign both to the spi_controller's prepare_message
>> and transfer_one hooks respectively.
>> 
>> Migrate the call mt7621_spi_transfer_one_message() made to
>> mt7621_spi_flush() just before chip select deactivation,
>> to the end of mt7621_spi_write_half_duplex() to ensure
>> that any pending data is shifted out of MOSI before the SPI
>> core deactivates the chip select line.
>> 
>> As chip select activation is now taken care of by the SPI
>> core, due to the use of the transfer_one hook instead of
>> transfer_one_message, the calls to mt7621_spi_set_cs()
>> from mt7621_spi_transfer_one_message() have fallen away.
>> 
>> And although the SPI core will handle activation for GPIO
>> chip select lines behind the scenes, it requires a callback
>> to allow the driver to perform controller-specific
>> operations to control its native chip select lines.
>> 
>> Rename mt7621_spi_set_cs() to mt7621_spi_set_native_cs()
>> and make sure that it takes into account the activation
>> polarity of the chip select line it's acting upon, as the
>> passed enable parameter represents the desired line level
>> and not the desired activation state, and then assign
>> mt7621_set_cs() to the spi_controller's set_cs hook.
>> 
>> Signed-off-by: Justin Swartz <justin.swartz@...ingedge.co.za>
> 
> Reviewed-by: AngeloGioacchino Del Regno
> <angelogioacchino.delregno@...labora.com>

Thank you very much for the review.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ