From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: generating a phandle w/libfdt? Date: Mon, 27 Oct 2008 10:40:52 +1100 Message-ID: <20081026234052.GB22339@yookeroo.seuss> References: <4BE3ADDA-362B-43AE-8D05-11260B94CD13@kernel.crashing.org> <9696D7A991D0824DBA8DFAC74A9C5FA3047947A3@az33exm25.fsl.freescale.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <9696D7A991D0824DBA8DFAC74A9C5FA3047947A3-ofAVchDyotYzzZk0BCvKg5jmvxFtTJ+o0e7PPNI6Mm0@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-mnsaURCQ41sdnm+yROfE0A@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-mnsaURCQ41sdnm+yROfE0A@public.gmane.org To: Yoder Stuart Cc: devicetree-discuss List-Id: devicetree@vger.kernel.org On Fri, Oct 24, 2008 at 09:29:21AM -0700, Yoder Stuart wrote: > > > > -----Original Message----- > > From: > > devicetree-discuss-bounces+stuart.yoder=freescale.com@ozlabs.o > > rg > > [mailto:devicetree-discuss-bounces+stuart.yoder=freescale.com@ > ozlabs.org] On Behalf Of Kumar Gala > > Sent: Friday, October 24, 2008 9:19 AM > > To: devicetree-discuss > > Subject: Re: generating a phandle w/libfdt? > > > > > > On Oct 24, 2008, at 8:11 AM, Kumar Gala wrote: > > > > > In some work I'm doing I noticed we don't have any APIs to > > generate > > > a phandle via libfdt. > > > > > > was wondering if anyone had ideas on this. > > > > > > In first thought it seems we have to scan through the whole blob > > > looking for the largest phandle id and than +1 it to generate the > > > next "valid" id. Any other ideas on how to do this more > > efficiently? > > > > The other question is there a way today to create a phandle even if > > there isn't a reference to it elsewhere in a .dts? > > We had this issue and the 'hack' was to create a phandle property > in the node itself, so it was self-referenced. That caused DTC > to allocate a phandle. We then could reference the node from > dynamically generated nodes. That's nasty. I should add a way to make dtc generate a phandle for a node, even if it's not referenced from elsewhere. Just need to think of a decent syntax. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson