All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alvaro Gamez Machado <alvaro.gamez@hazent.com>
To: Mark Brown <broonie@kernel.org>
Cc: Michal Simek <michal.simek@xilinx.com>,
	Shubhrajyoti Datta <shubhraj@xilinx.com>,
	linux-spi@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH] spi: set bits_per_word based on controller's bits_per_word_mask
Date: Mon, 28 Oct 2019 10:43:46 +0100	[thread overview]
Message-ID: <20191028094345.GA20816@salem.gmr.ssr.upm.es> (raw)
In-Reply-To: <20191025115655.GA4568@sirena.org.uk>

On Fri, Oct 25, 2019 at 12:56:55PM +0100, Mark Brown wrote:
> On Fri, Oct 25, 2019 at 08:39:48AM +0200, Alvaro Gamez Machado wrote:
> 
> > to claim the specific SPI slave. It may be spidev as in my use case, or it
> > may really be any other driver. But its probe() function is never going to
> > be called because the error is not raised inside the driver, but immediately
> > after forcibly setting the default value to 8 in spi.c
> 
> Then you need to extend the validation the core is doing here to
> skip this parameter when registering the device and only enforce
> it after a driver is bound, we don't have a driver at the time we
> initially register the device so we can't enforce this.

Ok, so I can remove the call to __spi_validate_bits_per_word() from
spi_setup(), and instead place it on spi_drv_probe after calling
spi_drv_probe() and detach the device if it returns with an error. The
behaviour would be basically the same as it is now, but the slave driver
will have an opportunity to choose a different transfer width if it wants to
and can match the capabilities of the master.

> 
> > I can't modify spidev because spidev doesn't even know this is happening.
> 
> You are, at some point, going to need to set your spidev to 32
> bits per word (spidev does already support this).

If I do the former, spidev will then need to load the initial bits per word
value from DT before returning from probe(), otherwise it will end up detached
when the check above is performed.

Should I go for this?

Thanks

-- 
Alvaro G. M.

      reply	other threads:[~2019-10-28  9:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 11:07 [PATCH] Allowing Xilinx's AXI Quad widths different than 8 bits on userspace Alvaro Gamez Machado
2019-10-24 11:07 ` [PATCH] spi: xilinx: add description of new property xlnx,num-transfer-bits Alvaro Gamez Machado
2019-10-24 11:57   ` Mark Brown
2019-10-24 11:57   ` Applied "spi: xilinx: add description of new property xlnx,num-transfer-bits" to the spi tree Mark Brown
2019-10-24 11:07 ` [PATCH] spi: xilinx: Add DT support for selecting transfer word width Alvaro Gamez Machado
2019-10-24 11:57   ` Applied "spi: xilinx: Add DT support for selecting transfer word width" to the spi tree Mark Brown
2019-10-24 11:07 ` [PATCH] spi: set bits_per_word based on controller's bits_per_word_mask Alvaro Gamez Machado
2019-10-24 11:13   ` Mark Brown
2019-10-24 12:54     ` Alvaro Gamez Machado
2019-10-24 13:11       ` Mark Brown
2019-10-24 13:18         ` Alvaro Gamez Machado
2019-10-24 13:41           ` Mark Brown
2019-10-24 14:07             ` Alvaro Gamez Machado
2019-10-24 17:40               ` Mark Brown
2019-10-25  6:39                 ` Alvaro Gamez Machado
2019-10-25 11:56                   ` Mark Brown
2019-10-28  9:43                     ` Alvaro Gamez Machado [this message]

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=20191028094345.GA20816@salem.gmr.ssr.upm.es \
    --to=alvaro.gamez@hazent.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=shubhraj@xilinx.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.