From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Ernst Schwab <eschwab-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH] of: add bus-number specification to spi_mpc8xxx
Date: Tue, 16 Feb 2010 14:23:49 -0700 [thread overview]
Message-ID: <fa686aa41002161323v72dbcdb4rd28ece040c878972@mail.gmail.com> (raw)
In-Reply-To: <20100216195943.e40e104e.eschwab-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>
On Tue, Feb 16, 2010 at 11:59 AM, Ernst Schwab <eschwab-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org> wrote:
> Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>
>> Add a property to the /chosen node to assign short labels to devices.
>
> I'm not familiar with this and will check - does anyone know of an
> existing example for this?
Oops, sorry. I meant the 'aliases' node. 'chosen' is for something else.
Properties in the aliases node are simply name = "/path/to/node";
pairs. Do "grep -A 6 arch/powerpc/boot/dts/" to see lots of examples.
dtc expands the <name> = &label; construct into the full path to the
node.
>> Unless you're trying to line up disparate data structure, the actually
>> number assigned to a bus really doesn't matter. It is better to let
>> Linux dynamically assign than to manually maintain the assigned bus
>> numbers for each machine. Assuming dynamic assignment also protects
>> against breaking userspace applications when, for whatever reason, the
>> bus numbers get shuffled on a platform.
>
> Hm. What if we have two identical devices, lets say EEPROMs at25,
> connected to two SPI controllers. These are set up as
> /sys/bus/spi/devices/spi32766.0/eeprom and
> /sys/bus/spi/devices/spi32765.0/eeprom.
> How can userspace code determine which one it should
> use if it needs to use the one connected to the first spi controller?
> Can this be solved with the /chosen mechanism?
Use the alias to find the spi bus you care about in /sys/devices/.
Then whichever eeprom has that bus as its parent is the device you
want. You can read the expanded device tree in /proc/device-tree.
Unfortunately I don't have sample code that shows how to do this; I
haven't had to do so personally yet.
g.
next prev parent reply other threads:[~2010-02-16 21:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100216150850.d966cd79.eschwab@online.de>
[not found] ` <fa686aa41002160628g62bd6564h50e712e8fb9c384d@mail.gmail.com>
[not found] ` <20100216160832.730cb00b.eschwab@online.de>
[not found] ` <20100216160832.730cb00b.eschwab-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>
2010-02-16 15:18 ` [PATCH] of: add bus-number specification to spi_mpc8xxx Grant Likely
[not found] ` <fa686aa41002160718u36fe6f7ey7be83ab69317ec76-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-16 18:59 ` Ernst Schwab
[not found] ` <20100216195943.e40e104e.eschwab-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org>
2010-02-16 21:23 ` Grant Likely [this message]
[not found] ` <fa686aa41002161323v72dbcdb4rd28ece040c878972-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-02-17 11:11 ` Ernst Schwab
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=fa686aa41002161323v72dbcdb4rd28ece040c878972@mail.gmail.com \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=eschwab-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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).