From: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
To: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "Mark Rutland" <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
"Rob Herring" <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"Pawel Moll" <Pawel.Moll-5wv7dgnIgG8@public.gmane.org>,
"Ian Campbell"
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
"Kumar Gala" <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
"linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@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>,
"Stephen Warren"
<swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
"Marek Vasut" <marex-ynQEQJNshbs@public.gmane.org>,
"Rafał Miłecki" <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] Documentation: dt: mtd: replace "nor-jedec" binding with "jedec,spi-nor"
Date: Mon, 18 May 2015 20:51:46 +0200 [thread overview]
Message-ID: <CAMuHMdUCj2AXk_0mAgRfAStrveHPi=Rp2g-b177zO_ode8NaCw@mail.gmail.com> (raw)
In-Reply-To: <20150518183442.GR11598@ld-irv-0074>
Hi Brian,
On Mon, May 18, 2015 at 8:34 PM, Brian Norris
<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Mon, May 18, 2015 at 11:45:01AM +0100, Mark Rutland wrote:
>> On Fri, May 15, 2015 at 08:55:41PM +0100, Brian Norris wrote:
>> > It really helps if I test patches...
>> >
>> > On Thu, May 14, 2015 at 10:32:53AM -0700, Brian Norris wrote:
> [...]
>> > > @@ -305,7 +305,7 @@ static const struct spi_device_id m25p_ids[] = {
>> > > * Generic support for SPI NOR that can be identified by the JEDEC READ
>> > > * ID opcode (0x9F). Use this, if possible.
>> > > */
>> > > - {"nor-jedec"},
>> > > + {"jedec,spi-nor"},
>> >
>> > So I forgot (again; we hit this before) that the SPI/OF framework strips
>> > everything before the first comma before binding devices. See
>> > of_modalias_node(). So I'll have to squash in the patch below to get a
>> > usable binding.
>>
>> Is it not possible to use the of_match_table on spi_driver::driver? If
>> not, we really should make it so.
>
> Hmm, it does look like spi.c supports multiple matching mechanisms, so I
> guess m25p80.c could match some with of_match_table and some with
> modalias/spi_driver.id_table. See:
>
> static int spi_match_device(struct device *dev, struct device_driver *drv)
> {
> const struct spi_device *spi = to_spi_device(dev);
> const struct spi_driver *sdrv = to_spi_driver(drv);
>
> /* Attempt an OF style match */
> if (of_driver_match_device(dev, drv))
> return 1;
> // ^^^^ we aren't yet (but could be) using this
>
> /* Then try ACPI */
> if (acpi_driver_match_device(dev, drv))
> return 1;
>
> if (sdrv->id_table)
> return !!spi_match_id(sdrv->id_table, spi);
> // ^^^^ we're currently only using this
>
> return strcmp(spi->modalias, drv->name) == 0;
> }
>
> I'll see about patching this for 4.2. We have a working solution for
> 4.1 at least.
When using DT:
- spi_driver.id_table is used to match with vendor-stripped DT "compatible"
entries.
- spi_driver.driver.of_match_table is used to match with full DT "compatible"
entries.
Note that stripping of vendor names from DT "compatible" entries is done
for the _first_ "compatible" entry in the device node only!
Hence
compatible = "myvendor,m25p80";
will match against "m25p80" in m25p_ids[], while
compatible = "myvendor,shinynewdevice", "st,m25p80";
will _not_ match against "m25p80" in m25p_ids[], and fail to probe in
the absence of a driver entry for the first (real) "compatible" entry.
I2c behaves similarly.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" 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:[~2015-05-18 18:51 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1431624773-4165-1-git-send-email-computersforpeace@gmail.com>
[not found] ` <20150515195541.GL11598@ld-irv-0074>
[not found] ` <20150518104501.GD3551@leverpostej>
2015-05-18 18:34 ` [PATCH] Documentation: dt: mtd: replace "nor-jedec" binding with "jedec,spi-nor" Brian Norris
2015-05-18 18:51 ` Geert Uytterhoeven [this message]
2015-05-19 1:34 ` Brian Norris
2015-05-19 7:27 ` Rafał Miłecki
[not found] ` <CACna6rzpxoXEJbeRyxaR0wiPpWc_MmgvnqoW-dSw4fF-=EMM_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-20 21:35 ` Brian Norris
2015-05-21 7:12 ` Rafał Miłecki
2015-05-21 7:25 ` Brian Norris
2015-05-21 8:01 ` Rafał Miłecki
[not found] ` <CACna6rz6O2XRt0OBmf9stLvM1xh4v4aKTD=MR2EbCKFPV1SOpA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 8:15 ` Brian Norris
2015-05-21 8:25 ` Rafał Miłecki
[not found] ` <CACna6rweJuyqZ-sVe-DT7yaX4pPLXt8H++BdsZ7+EyzSzoeRoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 8:39 ` Geert Uytterhoeven
[not found] ` <CAMuHMdVr37hUxCJL+9WGX7BZtMpAaDyXrAb=i=xovUn6AyxfxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 8:50 ` Rafał Miłecki
[not found] ` <CACna6ryXarbqAoE2W7GMmXr-Dycgrq1bQc98bwex6T4rUg_AGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 8:58 ` Geert Uytterhoeven
2015-05-21 9:31 ` Rafał Miłecki
2015-05-21 9:39 ` Geert Uytterhoeven
[not found] ` <CAMuHMdVfoF-qJBNDtzqt4+caikGax-LHfacfsG1B356XH+UcSw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-21 9:47 ` Rafał Miłecki
2015-05-21 9:57 ` Rafał Miłecki
2015-07-21 16:57 ` Brian Norris
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='CAMuHMdUCj2AXk_0mAgRfAStrveHPi=Rp2g-b177zO_ode8NaCw@mail.gmail.com' \
--to=geert-td1emuhucqxl1znqvxdv9g@public.gmane.org \
--cc=Pawel.Moll-5wv7dgnIgG8@public.gmane.org \
--cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marex-ynQEQJNshbs@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=zajec5-Re5JQEeQqe8AvxtiuMwx3w@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).