From: Adrian Fiergolski <Adrian.Fiergolski-vJEk5272eHo@public.gmane.org>
To: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Miguel Ojeda Sandonis
<miguel.ojeda.sandonis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] spi: Add spi-bits-per-word binding.
Date: Mon, 13 Mar 2017 21:26:04 +0100 [thread overview]
Message-ID: <5f86da77-c3f9-24e4-6c9a-3e2554bb49d3@cern.ch> (raw)
In-Reply-To: <CAMuHMdVLUrFnTY+swpxd0yUZ3iMR0_Wi1Dn05NQpYc_4=rA19Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi Geert,
On 13.03.2017 at 20:57, Geert Uytterhoeven wrote:
> On Mon, Mar 13, 2017 at 7:12 PM, Adrian Fiergolski
> <Adrian.Fiergolski-vJEk5272eHo@public.gmane.org> wrote:
>> On 13.03.2017 at 18:55, Mark Brown wrote:
>>>> In my case, xilinx_spi_probe function (of spi-xilinx controller) sets
>>>> bits_per_word_mask of spi_master struct only to 16 bits support. Later,
>>>> xilinx_spi_probe calls of_register_spi_devices, which calls
>>>> of_register_spi_devices. The last one allocates an empty spi_device
>>>> struct and configures different options of the spi_device according to a
>>>> device tree. bits_per_word are not covered here (why?), thus it is left
>>>> 0 (value after allocation), which, by convention, means 8 bits support.
>>>> At the end, the same function (of_register_spi_device) calls
>>>> spi_add_device which finally calls spi_setup. The last call, according
>>>> to convention, changes bits_per_word to 8 and calls
>>>> __spi_validate_bits_per_word which fails, as master doesn't support 8
>>>> bit transmission. This fails registration sequence of a device driver.
>>>> As you see, the device driver doesn't have possibility to modify
>>>> bits_per_word during the registration process, thus it can't provide
>>>> support for such limited controllers.
>>> I can't see any way in which it follows from the above that it's a good
>>> idea to try to override bits per word settings in the device tree, that
>>> just wastes user time and is an abstraction failure. We need better
>>> handling of defaults done purely in the kernel.
>> If enforcing by device tree specific for a given device driver SPI_CPHA,
>> SPIC_CPOL, SPI_CS_HIGH, max_speed_hz, etc. if fine form the abstraction
>> point of view, why it doesn't apply to bits_per_word ?
> Because unlike polarity, phase, and speed, bits_per_word is a property
> of the communication protocol.
>
> E.g. you can talk to the same EEPROM using different polarities, phase, or
> speed, but bits_per_word is fixed.
In this case, currently, what is the proper way to handle SPI
controllers (spi-xilinx) without 8-bit transmission support ?
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-03-13 20:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170217101151.hyzmz5a4lgdy7p5m>
2017-02-20 15:35 ` [PATCH] spi: Add spi-bits-per-word binding Adrian Fiergolski
2017-02-21 19:08 ` Mark Brown
[not found] ` <20170221190830.xyubgimyc2w5p5v6-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-03-13 17:25 ` Adrian Fiergolski
[not found] ` <983e943b-30f2-7d80-294a-df29bca11738-vJEk5272eHo@public.gmane.org>
2017-03-13 17:55 ` Mark Brown
[not found] ` <20170313175504.mpwjxqbhc4yxk434-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2017-03-13 18:12 ` Adrian Fiergolski
[not found] ` <12c66ecf-8472-c108-d2b4-1d6c3a8e6e74-vJEk5272eHo@public.gmane.org>
2017-03-13 19:57 ` Geert Uytterhoeven
[not found] ` <CAMuHMdVLUrFnTY+swpxd0yUZ3iMR0_Wi1Dn05NQpYc_4=rA19Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-13 20:26 ` Adrian Fiergolski [this message]
2017-03-17 21:21 ` Mark Brown
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=5f86da77-c3f9-24e4-6c9a-3e2554bb49d3@cern.ch \
--to=adrian.fiergolski-vjek5272eho@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=miguel.ojeda.sandonis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).