Re: [PATCH v10 3/4] dtc: Plugin and fixup support

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

 




On Tue, Nov 29, 2016 at 12:11:15PM +0000, Phil Elwell wrote:
> Pantelis,
> 
> On 29/11/2016 10:55, Pantelis Antoniou wrote:
> > Manually adding symbols by targeting __symbols__ is just bad. There is absolutely
> > no guarantee that the symbol/fixup node(s) will still be there in following iterations
> > of the patches.
> Remember that this is now part of the Linux kernel - it isn't something
> you can just change at will.
> > I am thinking of parsing them, recording the information in kernel structures and then
> > deleting them altogether.
> >
> >> How does your patch handle duplicate symbols?
> >>
> > It doesn’t. Having duplicate global symbols is bad. 
> >
> > It appears you want scoping rules instead. Care to paste a concrete example?
> 
> Concrete non-trivial examples are hard to come by. There are some simple
> cases where we've attached labels to __overlay__ nodes so that the
> contents can be patched by our overlay parameter mechanism - they could
> just be given unique names instead of just "frag0", "frag1" etc. I'm
> more concerned about parameterised macro-expanded overlays.
> 
> Consider an overlay that defines a CAN controller on an SPI bus. We
> currently have two such overlays in the RPi tree, one for SPI 0.0 and
> one for SPI 0.1. Here's an extract from one of them:
> 
>     /* the interrupt pin of the can-controller */
>     fragment@2 {
>         target = <&gpio>;
>         __overlay__ {
>             can0_pins: can0_pins {
>                 brcm,pins = <25>;
>                 brcm,function = <0>; /* input */
>             };
>         };
>     };
> ...
>     fragment@4 {
>         target = <&spi0>;
>         __overlay__ {
>             /* needed to avoid dtc warning */
>             #address-cells = <1>;
>             #size-cells = <0>;
>             can0: mcp2515@0 {
>                 reg = <0>;
>                 compatible = "microchip,mcp2515";
>                 pinctrl-names = "default";
>                 pinctrl-0 = <&can0_pins>;
>                 spi-max-frequency = <10000000>;
>                 interrupt-parent = <&gpio>;
>                 interrupts = <25 0x2>;
>                 clocks = <&can0_osc>;
>             };
>         };
>     };
> 
> One day I'd like to merge these into a single parameterised version that
> could target any CS line on any SPI controller. This requires that any
> created node names are unique with the scope of the parent ("mcp2515@0",
> "can0_pins"), and that the name of the target label (spi0) is patched to
> select the correct SPI bus. Our existing, limited overlay parameter
> mechanism uses labels to identify properties to patch:

Yeah, I think this is basically out of scope for the simple overlay
format.  It's really not designed to do this - it works directly with
the global namespace everywhere.

The connector proposals are designed to address this sort of case.

This sort of limitation is, incidentally, why I objected to the dtb
overlay stuff when it was originally proposed (I would have preferred
something closer to the connector proposals which are now floating
again).  That in turn is why it's taken so long to get on its way into
mainline dtc.  But despite the limitations, people wanted it badly
enough that it's become widely used, so now we have to cope with it.

-- 
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 Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux