[PATCH] of: add bus-number specification to spi_mpc8xxx
Ernst Schwab
eschwab at online.de
Wed Feb 17 22:11:05 EST 2010
On Tue, 16 Feb 2010 14:23:49 -0700
Grant Likely <grant.likely at secretlab.ca> wrote:
> On Tue, Feb 16, 2010 at 11:59 AM, Ernst Schwab <eschwab at online.de> wrote:
> > Grant Likely <grant.likely at secretlab.ca> 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:spi at 7000 { ...
eepmain:eeprom at 8 { ...
};
};
The aliases are visible at /proc/device-tree/aliases/:
eepmain : contains /immr at e0000000/spi at 7000/eeprom at 8
spi0 : contains /immr at e0000000/spi at 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. /immr at e0000000/spi at 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
More information about the devicetree-discuss
mailing list