On Tue, 16 Feb 2010 14:23:49 -0700
Grant Likely <[email protected]> wrote:

> On Tue, Feb 16, 2010 at 11:59 AM, Ernst Schwab <[email protected]> wrote:
> > Grant Likely <[email protected]> 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.

Ok, as I did the grep with "chosen" there wasn't anything, "aliases" 
looks much better. I was aware of this node, but had no idea how
to use it. Actually, I still do not exactly know how to use it ;-).

> 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.

I created 
        aliases { ...
                spi0 = &spi;
                eepmain   = &eepmain;
        };

        spi:s...@7000 { ...
                eepmain:eep...@8 { ...
                };
        };

The aliases are visible at /proc/device-tree/aliases/:
eepmain   : contains /i...@e0000000/s...@7000/eep...@8
spi0      : contains /i...@e0000000/s...@7000

The EEPROM can be accessed under 
        /sys/bus/spi/devices/spi32766.8/eeprom

The alias names do not appear in /sys as far as I can see.
The paths (e.g. /i...@e0000000/s...@7000) seems not to be useable
to address something in the /sys directory directly.

Does this mean that software which wants to access 'eepmain' 
has to reformat the alias value to construct a path in the sysfs
to access the EEPROM contents?

Regards
Ernst


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to