Re: [PATCH v3] fdtget: Support decoding phandles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, May 22, 2018 at 10:32:48AM -0500, Rob Herring wrote:
> On Sun, May 20, 2018 at 2:32 PM, Simon Glass <sjg@xxxxxxxxxxxx> wrote:
> > Currently nodes with phandles just print out as plain integer values, e.g.
> >
> >    $ fdtget firefly-rk3288/u-boot.dtb /gpio-keys/button@0 gpios
> >    112 5 1
> >
> > A common use of phandles is:
> >
> >    <phandle> <n cells of stuff> <phandle> <m cells of stuff>
> >
> > It is useful to be able to decode these phandles and print them out in a
> > properly formatted way, e.g.
> >
> >    $ fdtget firefly-rk3288/u-boot.dtb -P -c gpio /gpio-keys/button@0 gpios
> >    /pinctrl/gpio0@ff750000 5 1
> >
> > Add a -P option to decode these sorts of phandles. For those which require
> > arguments, add a -c option to specify the name of the '#xxx-cells' property
> > in the target node. This allows the tool to look up the number of cells
> > that follow each phandle.
> 
> The number of bindings using #*-cells is not that big. Why not add a
> lookup. We do that already in the dtc checks. You can almost do it
> without a lookup table by just dropping the 's' of the property name.
> But then you have special cases like 'mboxes'.
> 
> In any case, just a thought for a follow-up.

Yeah, I find the proposed interface really clunky.  What I'd suggest
instead is a whole batch of options for specific property formats.
e.g.:
	--reg
	--ranges
	--interrupts
	--gpios

Now internally those would mostly be tiny wrappers around code closely
resembling what you have in this patch.  But I think that would be
easier to understand and use in practice, even if it's not quite as
general in theory.

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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux