On Thu, Mar 5, 2009 at 12:41 AM, Michael Guntsche <m...@it-loops.com> wrote: > On Wed, 4 Mar 2009 08:57:59 -0700, Grant Likely <grant.lik...@secretlab.ca> > wrote: >> You might be able to use of_attach_node() & prom_add_property() to >> modify the tree, but I've never done it myself. Give it a try and >> tell me if it works. :-) >> > > Hello Grant, > > I made some progress in this area, but I have now hit a problem I do not > know how to solve. > Taking code from the iseries/vio.c files I am able to add properties with > add_string_property and add_raw_property. > The problem I have is adding properties like > > reg = <0x2520 0x20> > > I know how to add a property > > reg = <0x2520> > > but I do not know what data structure to pass to add_raw_property to add > two numbers there.
Device tree properties are just "bags of bytes". 'cells' in device tree nomenclature are big endian u32 values. So, for specifying a property with one cell (ie: reg = <0x2520>;), the data length is 4 bytes and the data is an array of 4 bytes: 0x00 0x00 0x25 0x20. To add a property with two cells (ie: reg = <0x2520 0x20>;), the data length is 8 bytes and the data is and array of 8 bytes: 0x00 0x00 0x25 0x20 0x00 0x00 0x00 0x20. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev