mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 10/12] spi: add support for spi_controller::set_cs_timing
Date: Mon, 25 Nov 2024 11:20:22 +0100	[thread overview]
Message-ID: <Z0RPZt-dtgpRvAZA@pengutronix.de> (raw)
In-Reply-To: <20241125100855.axxxbcgleefxaouo@pengutronix.de>

On Mon, Nov 25, 2024 at 11:08:55AM +0100, Marco Felsch wrote:
> On 24-11-25, Sascha Hauer wrote:
> > On Fri, Nov 15, 2024 at 08:57:45PM +0100, Marco Felsch wrote:
> > > Import the spi_controller set_cs_timing() hook to make it easier to port
> > > code from the Linux.
> > > 
> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > ---
> > >  include/spi/spi.h | 13 +++++++++++++
> > >  1 file changed, 13 insertions(+)
> > > 
> > > diff --git a/include/spi/spi.h b/include/spi/spi.h
> > > index 8354b7d8baa6..092eacd4a8e1 100644
> > > --- a/include/spi/spi.h
> > > +++ b/include/spi/spi.h
> > > @@ -179,6 +179,9 @@ static inline void spi_set_ctldata(struct spi_device *spi, void *state)
> > >   *	must fail if an unrecognized or unsupported mode is requested.
> > >   *	It's always safe to call this unless transfers are pending on
> > >   *	the device whose settings are being modified.
> > > + * @set_cs_timing: optional hook for SPI devices to request SPI master
> > > + * controller for configuring specific CS setup time, hold time and inactive
> > > + * delay interms of clock counts
> > >   * @transfer: adds a message to the controller's transfer queue.
> > >   * @cleanup: frees controller-specific state
> > >   * @cs_gpiods: Array of GPIO descriptors to use as chip select lines; one per CS
> > > @@ -246,6 +249,16 @@ struct spi_controller {
> > >  	/* setup mode and clock, etc (spi driver may call many times) */
> > >  	int			(*setup)(struct spi_device *spi);
> > >  
> > > +	/*
> > > +	 * set_cs_timing() method is for SPI controllers that supports
> > > +	 * configuring CS timing.
> > > +	 *
> > > +	 * This hook allows SPI client drivers to request SPI controllers
> > > +	 * to configure specific CS timing through spi_set_cs_timing() after
> > > +	 * spi_setup().
> > > +	 */
> > > +	int (*set_cs_timing)(struct spi_device *spi);
> > 
> > You add this hook here, but it's not called from the core code changes
> > in the next commit and it's not implemented in the new driver you
> > introduce with this series. Is there something missing in this series?
> 
> It's checked by spi_set_cs(). I wanted to be as close as possible to the
> Linux version but can drop this hook and adapt the check. Another option
> is to add the Linux spi_set_cs_timing() to the barebox
> spi_register_controller().

I think when the hook exists there should be a chance that it is
actually called. Having it without using it just creates dead code in
the drivers.

So either implement it and use it, or remove it, whatever you prefer.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2024-11-25 10:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 19:57 [PATCH 01/12] spi: cosmetic style fixes Marco Felsch
2024-11-15 19:57 ` [PATCH 02/12] spi: fix spi_message init during __spi_validate Marco Felsch
2024-11-15 19:57 ` [PATCH 03/12] spi: add spi_{set,get}_ctldata accessors Marco Felsch
2024-11-15 19:57 ` [PATCH 04/12] gpiolib: add support for gpiod_get_index and gpiod_get_index_optional Marco Felsch
2024-11-15 19:57 ` [PATCH 05/12] gpiolib: add support for gpiod_set_consumer_name Marco Felsch
2024-11-15 19:57 ` [PATCH 06/12] spi: add support to handle cs-gpios Marco Felsch
2024-11-25  9:19   ` Sascha Hauer
2024-11-25 10:00     ` Marco Felsch
2024-11-15 19:57 ` [PATCH 07/12] spi: add support to setup spi-cs-{setup,hold,inactive}-delay-ns Marco Felsch
2024-11-15 19:57 ` [PATCH 08/12] spi: allow reporting the effectivly used speed_hz for a transfer Marco Felsch
2024-11-15 19:57 ` [PATCH 09/12] spi: import spi_controller::flags Marco Felsch
2024-11-15 19:57 ` [PATCH 10/12] spi: add support for spi_controller::set_cs_timing Marco Felsch
2024-11-25  9:24   ` Sascha Hauer
2024-11-25 10:08     ` Marco Felsch
2024-11-25 10:20       ` Sascha Hauer [this message]
2024-11-15 19:57 ` [PATCH 11/12] spi: Provide common spi_message processing loop Marco Felsch
2024-11-15 19:57 ` [PATCH 12/12] spi: add support for BCM2835 SPI controller Marco Felsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0RPZt-dtgpRvAZA@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.felsch@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox