Re: [PATCH 05/13] MIPS: jz4740: DTS: Add node for the jz4740-pinctrl driver

From: Linus Walleij
Date: Wed Jan 18 2017 - 19:00:17 EST


On Wed, Jan 18, 2017 at 12:14 AM, Paul Cercueil <paul@xxxxxxxxxxxxxxx> wrote:

> For a description of the devicetree node, please read
> Documentation/devicetree/bindings/pinctrl/ingenic,pinctrl.txt
>
> Signed-off-by: Paul Cercueil <paul@xxxxxxxxxxxxxxx>

(...)

> + pinctrl: ingenic-pinctrl@10010000 {
> + compatible = "ingenic,jz4740-pinctrl";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + gpio-chips {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> + gpa: gpa {
> + reg = <0x10010000 0x100>;
> +
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + interrupt-controller;
> + #interrupt-cells = <2>;
> +
> + interrupt-parent = <&intc>;
> + interrupts = <28>;
> +
> + ingenic,pull-ups = <0xffffffff>;
> + };
> +
> + gpb: gpb {
> + reg = <0x10010100 0x100>;
> +
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + interrupt-controller;
> + #interrupt-cells = <2>;
> +
> + interrupt-parent = <&intc>;
> + interrupts = <27>;
> +
> + ingenic,pull-ups = <0xffffffff>;
> + };
> +
> + gpc: gpc {
> + reg = <0x10010200 0x100>;
> +
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + interrupt-controller;
> + #interrupt-cells = <2>;
> +
> + interrupt-parent = <&intc>;
> + interrupts = <26>;
> +
> + ingenic,pull-ups = <0xffffffff>;
> + };
> +
> + gpd: gpd {
> + reg = <0x10010300 0x100>;
> +
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + interrupt-controller;
> + #interrupt-cells = <2>;
> +
> + interrupt-parent = <&intc>;
> + interrupts = <25>;
> +
> + ingenic,pull-ups = <0xdfffffff>;
> + };
> + };

Just pull all these down two levels and make them one device
each instead of having them inside the pin controller node
like this.

Then make a pin controller node separately, it can reference the
pin controller by phandles if necessary, and use the standard
gpio-ranges property to cross make GPIO and pin control.

It seems you driver is similar to for example the
drivers/pinctrl/nomadik/* pin controller.

Look in arch/arm/boot/dts/ste-dbx500.dtsi for examples,
NB: I'm not fully using standard bindings in it, because they
were not invented at the time.

Yours,
Linus Walleij