dtc handling unreferenced nodes and an imx board dts
Subsystems (3)
cover dtc handling unreferenced nodes and an imx board dts
After showcasing my dtc change as RFC before, this series shows essentially where I want to go with the whole change - adding support for our ereaders without duplicating the generic pinconfig nodes :-) . And also provides with the dt change a user for the dtc flag addition.
That being said, the dtc change might need a bit more review and I also don't know if it should go through the scripts/dtc variant like this or some upstream and how the *_shipped files should be handled.
The patchset is done against linux-next from today, which includes both the pingroups moved to the individual board files and the bindings for the zforce touchscreen.
Heiko Stuebner (3):
dtc: add ability to make nodes conditional on them being referenced
ARM: dts: imx6sl: move pingroups back into soc dtsi
ARM: dts: imx6sl: add board file for BQ Cervantes
arch/arm/boot/dts/imx6sl-bq-cervantes.dts | 133 +++++++++++++++++++++ arch/arm/boot/dts/imx6sl-evk.dts | 181 ----------------------------- arch/arm/boot/dts/imx6sl.dtsi | 185 ++++++++++++++++++++++++++++++ scripts/dtc/checks.c | 2 + scripts/dtc/dtc-lexer.l | 7 ++ scripts/dtc/dtc-parser.y | 5 + scripts/dtc/dtc.h | 4 + scripts/dtc/flattree.c | 3 + scripts/dtc/livetree.c | 14 +++ 9 files changed, 353 insertions(+), 181 deletions(-) create mode 100644 arch/arm/boot/dts/imx6sl-bq-cervantes.dts
Signature · 1 line
1.8.5.3
PATCH 1/3 dtc: add ability to make nodes conditional on them being referenced
From: Heiko Stuebner <[email protected]>
On i.MX, which carries a lot of pin-groups of which most are unused on individual boards, they noticed that this plethora of nodes also results in the runtime-lookup-performance also degrading [0].
A i.MX-specific solution defining the pingroups in the board files but using macros to reference the pingroup-data was not well received
This patch is trying to solve this issue in a more general way, by adding the ability to mark nodes as needing to be referenced somewhere in the tree.
To mark a node a needing to be referenced it must be prefixed with /delete-unreferenced/. This makes dtc check the nodes reference-status when creating the flattened tree, dropping it if unreferenced.
For example, the i.MX6SL pingroup
/delete-unreferenced/ pinctrl_ecspi1_1: ecspi1grp-1 {
fsl,pins = <
MX6SL_PAD_ECSPI1_MISO__ECSPI1_MISO 0x100b1
MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI 0x100b1
MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK 0x100b1
>;
};would only be included in the dtb if it got referenced somewhere as pingroup via
node {
pinctrl-0 <&pinctrl_ecscpi1_1>;
};[0] http://thread.gmane.org/gmane.linux.ports.arm.kernel/275912/
--- scripts/dtc/checks.c | 2 ++ scripts/dtc/dtc-lexer.l | 7 +++++++ scripts/dtc/dtc-parser.y | 5 +++++ scripts/dtc/dtc.h | 4 ++++ scripts/dtc/flattree.c | 3 +++ scripts/dtc/livetree.c | 14 ++++++++++++++ 6 files changed, 35 insertions(+)
scripts/dtc/checks.c +2 -0
@@ -472,6 +472,8 @@ static void fixup_phandle_references(struct check *c, struct node *dt, phandle =get_node_phandle (dt, refnode); *((cell_t *)(prop->val.val + m->offset)) =cpu_to_fdt32 (phandle); + +reference_node (refnode); } } ERROR(phandle_references, NULL, NULL, fixup_phandle_references, NULL,
scripts/dtc/dtc-lexer.l +7 -0
@@ -138,6 +138,13 @@ static int pop_input_file(void); return DT_DEL_NODE; } +<*>"/delete-unreferenced/" { + DPRINT("Keyword: /delete-unreferenced/\n"); + DPRINT("<PROPNODENAME>\n"); + BEGIN(PROPNODENAME); + return DT_DEL_UNREFERENCED; + } + <*>{LABEL}: { DPRINT("Label: %s\n", yytext); yylval.labelref = xstrdup(yytext);
scripts/dtc/dtc-parser.y +5 -0
@@ -64,6 +64,7 @@ static unsigned char eval_char_literal(const char *s); %token DT_BITS %token DT_DEL_PROP %token DT_DEL_NODE +%token DT_DEL_UNREFERENCED %token <propnodename> DT_PROPNODENAME %token <literal> DT_LITERAL %token <literal> DT_CHAR_LITERAL
@@ -461,6 +462,10 @@ subnode: { $$ = name_node(build_node_delete(), $2); } + | DT_DEL_UNREFERENCED subnode + { + $$ = check_node_referenced($2); + } | DT_LABEL subnode { add_label(&$2->labels, $1);
scripts/dtc/dtc.h +4 -0
@@ -158,6 +158,8 @@ struct node {int addr_cells, size_cells;struct label *labels; + +int needs_reference, is_referenced; };#define for_each_label_withdel (l0, l) \
@@ -192,6 +194,8 @@ struct property *reverse_properties(struct property *first);struct node *build_node (struct property *proplist,struct node *children);struct node *build_node_delete (void );struct node *name_node (struct node *node,char *name); +struct node *check_node_referenced (struct node *node); +struct node *reference_node (struct node *node);struct node *chain_node (struct node *first,struct node *list);struct node *merge_nodes (struct node *old_node,struct node *new_node);
scripts/dtc/flattree.c +3 -0
@@ -266,6 +266,9 @@ static void flatten_tree(struct node *tree, struct emitter *emit,if (tree->deleted)return ; +if (tree->needs_reference && !tree->is_referenced) +return ; + emit->beginnode (etarget, tree->labels);if (vi->flags &FTF_FULLPATH )
scripts/dtc/livetree.c +14 -0
@@ -134,6 +134,20 @@ struct node *name_node(struct node *node, char *name)return node; } +struct node *check_node_referenced (struct node *node) +{ + node->needs_reference =1 ; + +return node; +} + +struct node *reference_node (struct node *node) +{ + node->is_referenced =1 ; + +return node; +} +struct node *merge_nodes (struct node *old_node,struct node *new_node) {struct property *new_prop, *old_prop;
Signature · 1 line
1.8.5.3
PATCH 2/3 ARM: dts: imx6sl: move pingroups back into soc dtsi
In reply to Heiko StübnerFrom: Heiko Stuebner <[email protected]>
Using the delete-unreferenced flag, the pingroups can be kept globally but won't be unecessarily included in dts files not using them.
--- arch/arm/boot/dts/imx6sl-evk.dts | 181 -------------------------------------- arch/arm/boot/dts/imx6sl.dtsi | 185 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 185 insertions(+), 181 deletions(-)
arch/arm/boot/dts/imx6sl-evk.dts +0 -181
@@ -267,192 +267,11 @@ >; }; - pinctrl_audmux3: audmux3grp { - fsl,pins = < - MX6SL_PAD_AUD_RXD__AUD3_RXD 0x4130b0 - MX6SL_PAD_AUD_TXC__AUD3_TXC 0x4130b0 - MX6SL_PAD_AUD_TXD__AUD3_TXD 0x4110b0 - MX6SL_PAD_AUD_TXFS__AUD3_TXFS 0x4130b0 - >; - }; - - pinctrl_ecspi1: ecspi1grp { - fsl,pins = < - MX6SL_PAD_ECSPI1_MISO__ECSPI1_MISO 0x100b1 - MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI 0x100b1 - MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK 0x100b1 - >; - }; - - pinctrl_fec: fecgrp { - fsl,pins = < - MX6SL_PAD_FEC_MDC__FEC_MDC 0x1b0b0 - MX6SL_PAD_FEC_MDIO__FEC_MDIO 0x1b0b0 - MX6SL_PAD_FEC_CRS_DV__FEC_RX_DV 0x1b0b0 - MX6SL_PAD_FEC_RXD0__FEC_RX_DATA0 0x1b0b0 - MX6SL_PAD_FEC_RXD1__FEC_RX_DATA1 0x1b0b0 - MX6SL_PAD_FEC_TX_EN__FEC_TX_EN 0x1b0b0 - MX6SL_PAD_FEC_TXD0__FEC_TX_DATA0 0x1b0b0 - MX6SL_PAD_FEC_TXD1__FEC_TX_DATA1 0x1b0b0 - MX6SL_PAD_FEC_REF_CLK__FEC_REF_OUT 0x4001b0a8 - >; - }; - - pinctrl_i2c1: i2c1grp { - fsl,pins = < - MX6SL_PAD_I2C1_SCL__I2C1_SCL 0x4001b8b1 - MX6SL_PAD_I2C1_SDA__I2C1_SDA 0x4001b8b1 - >; - }; - - - pinctrl_i2c2: i2c2grp { - fsl,pins = < - MX6SL_PAD_I2C2_SCL__I2C2_SCL 0x4001b8b1 - MX6SL_PAD_I2C2_SDA__I2C2_SDA 0x4001b8b1 - >; - }; - pinctrl_led: ledgrp { fsl,pins = < MX6SL_PAD_HSIC_STROBE__GPIO3_IO20 0x17059 >; }; - - pinctrl_kpp: kppgrp { - fsl,pins = < - MX6SL_PAD_KEY_ROW0__KEY_ROW0 0x1b010 - MX6SL_PAD_KEY_ROW1__KEY_ROW1 0x1b010 - MX6SL_PAD_KEY_ROW2__KEY_ROW2 0x1b0b0 - MX6SL_PAD_KEY_COL0__KEY_COL0 0x110b0 - MX6SL_PAD_KEY_COL1__KEY_COL1 0x110b0 - MX6SL_PAD_KEY_COL2__KEY_COL2 0x110b0 - >; - }; - - pinctrl_uart1: uart1grp { - fsl,pins = < - MX6SL_PAD_UART1_RXD__UART1_RX_DATA 0x1b0b1 - MX6SL_PAD_UART1_TXD__UART1_TX_DATA 0x1b0b1 - >; - }; - - pinctrl_usbotg1: usbotg1grp { - fsl,pins = < - MX6SL_PAD_EPDC_PWRCOM__USB_OTG1_ID 0x17059 - >; - }; - - pinctrl_usdhc1: usdhc1grp { - fsl,pins = < - MX6SL_PAD_SD1_CMD__SD1_CMD 0x17059 - MX6SL_PAD_SD1_CLK__SD1_CLK 0x10059 - MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x17059 - MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x17059 - MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x17059 - MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x17059 - MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x17059 - MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x17059 - MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x17059 - MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x17059 - >; - }; - - pinctrl_usdhc1_100mhz: usdhc1grp100mhz { - fsl,pins = < - MX6SL_PAD_SD1_CMD__SD1_CMD 0x170b9 - MX6SL_PAD_SD1_CLK__SD1_CLK 0x100b9 - MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x170b9 - MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x170b9 - MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x170b9 - MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x170b9 - MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x170b9 - MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x170b9 - MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x170b9 - MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x170b9 - >; - }; - - pinctrl_usdhc1_200mhz: usdhc1grp200mhz { - fsl,pins = < - MX6SL_PAD_SD1_CMD__SD1_CMD 0x170f9 - MX6SL_PAD_SD1_CLK__SD1_CLK 0x100f9 - MX6SL_PAD_SD1_DAT0__SD1_DATA0 0x170f9 - MX6SL_PAD_SD1_DAT1__SD1_DATA1 0x170f9 - MX6SL_PAD_SD1_DAT2__SD1_DATA2 0x170f9 - MX6SL_PAD_SD1_DAT3__SD1_DATA3 0x170f9 - MX6SL_PAD_SD1_DAT4__SD1_DATA4 0x170f9 - MX6SL_PAD_SD1_DAT5__SD1_DATA5 0x170f9 - MX6SL_PAD_SD1_DAT6__SD1_DATA6 0x170f9 - MX6SL_PAD_SD1_DAT7__SD1_DATA7 0x170f9 - >; - }; - - pinctrl_usdhc2: usdhc2grp { - fsl,pins = < - MX6SL_PAD_SD2_CMD__SD2_CMD 0x17059 - MX6SL_PAD_SD2_CLK__SD2_CLK 0x10059 - MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x17059 - MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x17059 - MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x17059 - MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x17059 - >; - }; - - pinctrl_usdhc2_100mhz: usdhc2grp100mhz { - fsl,pins = < - MX6SL_PAD_SD2_CMD__SD2_CMD 0x170b9 - MX6SL_PAD_SD2_CLK__SD2_CLK 0x100b9 - MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x170b9 - MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x170b9 - MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x170b9 - MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x170b9 - >; - }; - - pinctrl_usdhc2_200mhz: usdhc2grp200mhz { - fsl,pins = < - MX6SL_PAD_SD2_CMD__SD2_CMD 0x170f9 - MX6SL_PAD_SD2_CLK__SD2_CLK 0x100f9 - MX6SL_PAD_SD2_DAT0__SD2_DATA0 0x170f9 - MX6SL_PAD_SD2_DAT1__SD2_DATA1 0x170f9 - MX6SL_PAD_SD2_DAT2__SD2_DATA2 0x170f9 - MX6SL_PAD_SD2_DAT3__SD2_DATA3 0x170f9 - >; - }; - - pinctrl_usdhc3: usdhc3grp { - fsl,pins = < - MX6SL_PAD_SD3_CMD__SD3_CMD 0x17059 - MX6SL_PAD_SD3_CLK__SD3_CLK 0x10059 - MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x17059 - MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x17059 - MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x17059 - MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x17059 - >; - }; - - pinctrl_usdhc3_100mhz: usdhc3grp100mhz { - fsl,pins = < - MX6SL_PAD_SD3_CMD__SD3_CMD 0x170b9 - MX6SL_PAD_SD3_CLK__SD3_CLK 0x100b9 - MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170b9 - MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170b9 - MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170b9 - MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170b9 - >; - }; - - pinctrl_usdhc3_200mhz: usdhc3grp200mhz { - fsl,pins = < - MX6SL_PAD_SD3_CMD__SD3_CMD 0x170f9 - MX6SL_PAD_SD3_CLK__SD3_CLK 0x100f9 - MX6SL_PAD_SD3_DAT0__SD3_DATA0 0x170f9 - MX6SL_PAD_SD3_DAT1__SD3_DATA1 0x170f9 - MX6SL_PAD_SD3_DAT2__SD3_DATA2 0x170f9 - MX6SL_PAD_SD3_DAT3__SD3_DATA3 0x170f9 - >; - }; }; };
arch/arm/boot/dts/imx6sl.dtsi +185 -0
188 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH 3/3 ARM: dts: imx6sl: add board file for BQ Cervantes
In reply to Heiko StübnerFrom: Heiko Stuebner <[email protected]>
i.MX6SL based ebook-reader released in 2013.
--- arch/arm/boot/dts/imx6sl-bq-cervantes.dts | 133 ++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 arch/arm/boot/dts/imx6sl-bq-cervantes.dts
arch/arm/boot/dts/imx6sl-bq-cervantes.dts new file +133 -0
@@ -0,0 +1,133 @@ +/* + * Copyright (C) 2014 MundoReader S.L. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/dts-v1/; + +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include "imx6sl.dtsi" + +/ { + model = "BQ Cervantes"; + compatible = "fsl,imx6sl"; + + memory { + reg = <0x80000000 0x20000000>; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + reg_usdhc2_vmmc: regulator at 0 { + compatible = "regulator-fixed"; + reg = <0>; + regulator-name = "usdhc2_vmmc"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio3 29 0>; + enable-active-high; + }; + }; + + soc { + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + autorepeat; + + button at 0 { + gpios = <&gpio5 8 GPIO_ACTIVE_LOW>; + linux,code = <KEY_POWER>; + label = "GPIO Key Power"; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + + button at 1 { + gpios = <&gpio3 24 GPIO_ACTIVE_LOW>; + linux,code = <KEY_HOME>; + label = "GPIO Key Home"; + linux,input-type = <1>; + gpio-key,wakeup = <1>; + debounce-interval = <100>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + green { + gpios = <&gpio5 7 GPIO_ACTIVE_LOW>; + }; + }; + }; +}; + +&iomuxc { + imx6sl-bqcervantes { + pinctrl_zforce: zforcegrp { + fsl,pins = < + MX6SL_PAD_SD1_DAT3__GPIO5_IO06 0xc000 + MX6SL_PAD_SD1_DAT5__GPIO5_IO09 0x80000000 + >; + }; + }; +}; + +&i2c1 { + clock-frequency = <100000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + zforce at 50 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_zforce>; + + compatible = "neonode,zforce"; + reg = <0x50>; + interrupt-parent = <&gpio5>; + interrupts = <6 IRQ_TYPE_LEVEL_LOW>; + + gpios = <&gpio5 6 0 /* INT */ + &gpio5 9 0>; /* RST */ + + x-size = <758>; + y-size = <1024>; + }; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1>; + status = "okay"; +}; + +&usdhc2 { + vmmc-supply = <®_usdhc2_vmmc>; + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc2>; + pinctrl-1 = <&pinctrl_usdhc2_100mhz>; + pinctrl-2 = <&pinctrl_usdhc2_200mhz>; + cd-gpios = <&gpio5 2 0>; + status = "okay"; +}; + +&usdhc3 { + pinctrl-names = "default", "state_100mhz", "state_200mhz"; + pinctrl-0 = <&pinctrl_usdhc3>; + pinctrl-1 = <&pinctrl_usdhc3_100mhz>; + pinctrl-2 = <&pinctrl_usdhc3_200mhz>; + broken-cd; + status = "okay"; +};
Signature · 1 line
1.8.5.3