* [RFC PATCH 1/5] overlay: perl script to convert dts from old overlay style to new overlay style
[not found] ` <1482909617-31950-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-12-28 7:20 ` frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2016-12-28 7:20 ` [RFC PATCH 2/5] overlay: shell script to make overlay_convert easier to use frowand.list-Re5JQEeQqe8AvxtiuMwx3w
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: frowand.list-Re5JQEeQqe8AvxtiuMwx3w @ 2016-12-28 7:20 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
jdl-CYoMK+44s/E, pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w,
Pantelis Antoniou
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
Convert overlay dts file from hand-coded expanded form to new syntactic
sugar form.
Signed-off-by: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
---
overlay_convert | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 158 insertions(+)
create mode 100755 overlay_convert
diff --git a/overlay_convert b/overlay_convert
new file mode 100755
index 000000000000..fede0103fb4e
--- /dev/null
+++ b/overlay_convert
@@ -0,0 +1,158 @@
+#!/usr/bin/perl
+
+# Copyright 2016 Frank Rowand frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org
+# license: GPL V2
+# This file is subject to the terms and conditions of the GNU General Public
+# License v2.
+#
+# Convert overlay dts file from hand-coded expanded form to new syntactic
+# sugar form.
+
+# zzz TODO:
+# - May need to update the "/plugin/" declaration if dtc has changed.
+
+
+use strict 'refs';
+use strict subs;
+
+use Getopt::Long;
+
+$VUFX = "161227a";
+
+$script_name = $0;
+$script_name =~ s|^.*/||;
+
+
+sub usage()
+{
+ print STDERR
+"
+Usage: $script_name [options] DTS
+
+ Convert overlay dts file from hand-coded expanded form to new syntactic
+ sugar form.
+
+ Node names __symbols__, __fixups__, and __local_fixups__ are not allowed.
+ Their presence suggests that DTS has been compiled into a .dtbo and then
+ de-compiled. This is not the preferred form of source since phandle
+ references are not of the form: &label.
+
+Valid options:
+
+ -h Synonym for --help
+ --help Display this message
+ --version Display program version and exit
+
+
+ Return value:
+ 0 no error
+ 1 error processing command line
+ 2 unable to open or read DTS
+ 10 DTS contains a node name other than __overlay__, with leading '_'
+ 11 DTS contains a fragment node with no target property
+
+";
+}
+
+
+# -----------------------------------------------------------------------------
+# program entry point
+
+Getopt::Long::Configure("no_ignore_case", "bundling");
+
+if (!GetOptions(
+ "h" => \$help,
+ "help" => \$help,
+ "version" => \$version,
+ )) {
+
+ exit 1;
+}
+
+if ($version) {
+ print STDERR "\n$script_name $VUFX\n";
+ exit 0;
+}
+
+if ($help) {
+ &usage;
+ exit 0;
+}
+
+
+# ----- scan DTS
+
+$node_depth = 0;
+
+LINE:
+while ($line = <ARGV>) {
+
+ # ----- start of node
+
+ if ($line =~ /{/) {
+ $node_depth++;
+ $node_name = $line;
+ chomp $node_name;
+ $indent = $node_name;
+ $indent =~ s/\S.*//;
+ $node_name =~ s/^\s*//;
+ $node_name =~ s/\s*{.*//;
+
+ $in_fragment = 0;
+ if (($node_depth == 2) && ($node_name =~ /^fragment@\d*$/)) {
+ $in_fragment = 1;
+ $fragment_name = $node_name;
+ push @fragment_depth, $node_depth;
+ } elsif ($node_name =~ /^__overlay__$/) {
+ if (!$save_target) {
+ print STDERR "No 'target' property in node ${fragment_name}\n";
+ exit 11
+ }
+ print "$indent$save_target {\n";
+ undef $save_target;
+ } elsif ($node_name =~ /^_/) {
+ # might be __symbols__, __fixups__, or __local_fixups__
+ print STDERR "\nIllegal node name: $node_name\n\n";
+ exit 10;
+ } elsif ($node_depth > 1) {
+ print "$indent$node_name {\n";
+ }
+
+ next LINE;
+ }
+
+
+ # ----- end of node
+
+ if ($line =~ /}/) {
+
+ $indent = $line;
+ chomp $indent;
+ $indent =~ s/\S.*//;
+
+ $fragment_depth = pop @fragment_depth;
+ if (($node_depth > 2) && ($fragment_depth != $node_depth)) {
+ push @fragment_depth, $fragment_depth;
+ print "$line";
+ }
+
+ $node_depth--;
+
+ next LINE;
+ }
+
+
+ # ----- anything else
+
+ if ($in_fragment && ($line =~ /target = </)) {
+ $save_target = $line;
+ chomp $save_target;
+ $save_target =~ s/.*<\s*//;
+ $save_target =~ s/\s*>.*//;
+ } elsif (!$in_fragment) {
+ print "$line";
+ }
+
+ next LINE;
+
+}
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 2/5] overlay: shell script to make overlay_convert easier to use
[not found] ` <1482909617-31950-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-28 7:20 ` [RFC PATCH 1/5] overlay: perl script to convert dts from old overlay style to new overlay style frowand.list-Re5JQEeQqe8AvxtiuMwx3w
@ 2016-12-28 7:20 ` frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2016-12-28 7:20 ` [RFC PATCH 3/5] overlay: a.dts, example of an old style dts file to be converted frowand.list-Re5JQEeQqe8AvxtiuMwx3w
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: frowand.list-Re5JQEeQqe8AvxtiuMwx3w @ 2016-12-28 7:20 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
jdl-CYoMK+44s/E, pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w,
Pantelis Antoniou
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
A slightly paranoid wrapper around overlay_convert. Verifies that
converted dts file is equivalent to original dts file.
Signed-off-by: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
---
overlay_convert_old_to_new | 144 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 144 insertions(+)
create mode 100755 overlay_convert_old_to_new
diff --git a/overlay_convert_old_to_new b/overlay_convert_old_to_new
new file mode 100755
index 000000000000..bc26c57d4dc1
--- /dev/null
+++ b/overlay_convert_old_to_new
@@ -0,0 +1,144 @@
+#! /bin/bash
+
+#_______________________________________________________________________________
+
+
+function usage
+{
+echo "" >&2
+echo "usage:" >&2
+echo " `basename $0` -h | -help | --help" >&2
+echo " `basename $0` [options] OLD_DTS NEW_DTS" >&2
+echo "" >&2
+echo " Convert OLD_DTS from old overlay style to new overlay style" >&2
+echo " using syntactic sugar." >&2
+echo "" >&2
+echo " Options:" >&2
+echo " -h synonym for --help" >&2
+echo " --help print this message" >&2
+echo " -o synonym for --overwrite" >&2
+echo " --overwrite overwrite NEW_DTS if it already exists" >&2
+echo "" >&2
+echo " The early patches to dtc to support overlays required 'fragment'" >&2
+echo " and '__overlay__' nodes in the .dts source. Later patches to dtc" >&2
+echo " will not require these nodes (and may possibly disallow them)." >&2
+echo " The new overlay style is expected to be the preferrred form." >&2
+echo "" >&2
+echo " Will not overwrite NEW_DTS if it already exists." >&2
+echo "" >&2
+echo " Exit status is:" >&2
+echo " 0 success" >&2
+echo " 1 general error" >&2
+echo " 2 NEW_DTS already exists" >&2
+echo " 3 conversion problem" >&2
+echo " 4 'dtc -@ -O dts OLD_DTS' is different than 'dtc -@ -O dts NEW_DTS'" >&2
+echo "" >&2
+}
+
+
+unset new_dts
+unset old_dts
+unset overwrite
+
+while [[ ($# -gt 0) ]] ; do
+
+ case $1 in
+
+ -o | --overwrite )
+ shift
+ overwrite=1
+ ;;
+
+ -h | -help | --help )
+ shift
+ help=1
+ ;;
+
+ * )
+ if [[ "${old_dts}" != "" ]] ; then
+
+ if [[ "${new_dts}" != "" ]] ; then
+ echo "" >&2
+ echo "ERROR: too many arguments" >&2
+ echo "" >&2
+ exit 1
+ fi
+
+ new_dts=$1
+ shift
+ else
+ old_dts=$1
+ shift
+ fi
+ ;;
+
+ esac
+done
+
+
+if [[ (${help} == 1) ]] ; then
+ usage
+ exit 1
+fi
+
+
+#_______________________________________________________________________________
+
+if [[ -f ${new_dts} && overwrite -eq 0 ]] ; then
+
+ echo "" >&2
+ echo "ERROR: file '${new_dts}' already exists" >&2
+ echo "" >&2
+
+ exit 2
+fi
+
+
+#_______________________________________________________________________________
+
+
+if which overlay_convert >/dev/null ; then
+ OVERLAY_CONVERT=overlay_convert
+elif which ./overlay_convert >/dev/null ; then
+ OVERLAY_CONVERT=./overlay_convert
+else
+ echo "" >&2
+ echo "ERROR: overlay_convert not found or not executable" >&2
+ echo "" >&2
+
+ exit 1
+fi
+
+if ! ${OVERLAY_CONVERT} ${old_dts} > ${new_dts} ; then
+
+ echo "" >&2
+ echo "ERROR: unable to convert ${old_dts}" >&2
+ echo "" >&2
+
+ rm ${new_dts}
+
+ exit 3
+fi
+
+
+if ! which dtc >/dev/null ; then
+
+ echo "" >&2
+ echo "ERROR: dtc not found or not executable" >&2
+ echo " add the location of dtc to \$PATH" >&2
+ echo "" >&2
+
+ exit 1
+fi
+
+if ! diff -q \
+ <(dtc -@ -O dts ${old_dts} 2>/dev/null) \
+ <(dtc -@ -O dts ${new_dts} 2>/dev/null) ; then
+
+ echo "" >&2
+ echo "ERROR: ${new_dts} is not equivalent to ${old_dts}" >&2
+ echo "" >&2
+
+ exit 4
+fi
+
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 3/5] overlay: a.dts, example of an old style dts file to be converted
[not found] ` <1482909617-31950-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-28 7:20 ` [RFC PATCH 1/5] overlay: perl script to convert dts from old overlay style to new overlay style frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2016-12-28 7:20 ` [RFC PATCH 2/5] overlay: shell script to make overlay_convert easier to use frowand.list-Re5JQEeQqe8AvxtiuMwx3w
@ 2016-12-28 7:20 ` frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2016-12-28 7:20 ` [RFC PATCH 4/5] overlay: bad_a_1.dts, example of an old style dts file unable " frowand.list-Re5JQEeQqe8AvxtiuMwx3w
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: frowand.list-Re5JQEeQqe8AvxtiuMwx3w @ 2016-12-28 7:20 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
jdl-CYoMK+44s/E, pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w,
Pantelis Antoniou
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
Requires a dtc that supports the new syntactic sugar.
One such version is commit: 6f4db2fc2354 DTBO magic and dtbo format options
in url = https://github.com/pantoniou/dtc
$ export PATH="$PATH:/path/dtc/"
$ ./overlay_convert_old_to_new a.dts b.dts
Signed-off-by: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
---
a.dts | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 a.dts
diff --git a/a.dts b/a.dts
new file mode 100644
index 000000000000..ec21206a081f
--- /dev/null
+++ b/a.dts
@@ -0,0 +1,37 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&am3353x_pinmux>;
+
+ __overlay__ {
+
+ i2c1_pins: pinmux_i2c1_pins {
+ pinctrl-single,pins = <
+ 0x158 0x72
+ 0x15c 0x72
+ >;
+ };
+ };
+ };
+
+ fragment@1 {
+ target = <&i2c1>;
+
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+ clock-frequency = <400000>;
+ status = "okay";
+
+ at24@50 {
+ compatible = "at,24c256";
+ pagesize = <64>;
+ reg = <0x50>;
+ };
+ };
+ };
+};
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 4/5] overlay: bad_a_1.dts, example of an old style dts file unable to be converted
[not found] ` <1482909617-31950-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2016-12-28 7:20 ` [RFC PATCH 3/5] overlay: a.dts, example of an old style dts file to be converted frowand.list-Re5JQEeQqe8AvxtiuMwx3w
@ 2016-12-28 7:20 ` frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2016-12-28 7:20 ` [RFC PATCH 5/5] overlay: bad_a_2.dts, example of an old style dts file " frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2017-01-03 12:13 ` Pantelis Antoniou
5 siblings, 0 replies; 8+ messages in thread
From: frowand.list-Re5JQEeQqe8AvxtiuMwx3w @ 2016-12-28 7:20 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
jdl-CYoMK+44s/E, pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w,
Pantelis Antoniou
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
Requires a dtc that supports the new syntactic sugar.
One such version is commit: 6f4db2fc2354 DTBO magic and dtbo format options
in url = https://github.com/pantoniou/dtc
$ export PATH="$PATH:/path/dtc/"
$ ./overlay_convert_old_to_new bad_a_1.dts bad_b_1.dts
No 'target' property in node fragment@0
ERROR: unable to convert bad_a_1.dts
Signed-off-by: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
---
bad_a_1.dts | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 bad_a_1.dts
diff --git a/bad_a_1.dts b/bad_a_1.dts
new file mode 100644
index 000000000000..b4e26fc8d945
--- /dev/null
+++ b/bad_a_1.dts
@@ -0,0 +1,36 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+
+ __overlay__ {
+
+ i2c1_pins: pinmux_i2c1_pins {
+ pinctrl-single,pins = <
+ 0x158 0x72
+ 0x15c 0x72
+ >;
+ };
+ };
+ };
+
+ fragment@1 {
+ target = <&i2c1>;
+
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+ clock-frequency = <400000>;
+ status = "okay";
+
+ at24@50 {
+ compatible = "at,24c256";
+ pagesize = <64>;
+ reg = <0x50>;
+ };
+ };
+ };
+};
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC PATCH 5/5] overlay: bad_a_2.dts, example of an old style dts file to be converted
[not found] ` <1482909617-31950-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2016-12-28 7:20 ` [RFC PATCH 4/5] overlay: bad_a_1.dts, example of an old style dts file unable " frowand.list-Re5JQEeQqe8AvxtiuMwx3w
@ 2016-12-28 7:20 ` frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2017-01-03 12:13 ` Pantelis Antoniou
5 siblings, 0 replies; 8+ messages in thread
From: frowand.list-Re5JQEeQqe8AvxtiuMwx3w @ 2016-12-28 7:20 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
jdl-CYoMK+44s/E, pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w,
Pantelis Antoniou
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
Requires a dtc that supports the new syntactic sugar.
One such version is commit: 6f4db2fc2354 DTBO magic and dtbo format options
in url = https://github.com/pantoniou/dtc
$ export PATH="$PATH:/path/dtc/"
$ ./overlay_convert_old_to_new bad_a_2.dts bad_b_2.dts
No 'target' property in node fragment@1
ERROR: unable to convert bad_a_2.dts
Signed-off-by: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
---
bad_a_2.dts | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 bad_a_2.dts
diff --git a/bad_a_2.dts b/bad_a_2.dts
new file mode 100644
index 000000000000..68ac978f516c
--- /dev/null
+++ b/bad_a_2.dts
@@ -0,0 +1,36 @@
+/dts-v1/;
+/plugin/;
+
+/ {
+ fragment@0 {
+ target = <&am3353x_pinmux>;
+
+ __overlay__ {
+
+ i2c1_pins: pinmux_i2c1_pins {
+ pinctrl-single,pins = <
+ 0x158 0x72
+ 0x15c 0x72
+ >;
+ };
+ };
+ };
+
+ fragment@1 {
+
+ __overlay__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c1_pins>;
+ clock-frequency = <400000>;
+ status = "okay";
+
+ at24@50 {
+ compatible = "at,24c256";
+ pagesize = <64>;
+ reg = <0x50>;
+ };
+ };
+ };
+};
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RFC PATCH 0/5] overlay: tool to convert old overlay style dts to new style
[not found] ` <1482909617-31950-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-03 12:13 ` Pantelis Antoniou
2016-12-28 7:20 ` [RFC PATCH 2/5] overlay: shell script to make overlay_convert easier to use frowand.list-Re5JQEeQqe8AvxtiuMwx3w
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Pantelis Antoniou @ 2017-01-03 12:13 UTC (permalink / raw)
To: frowand.list-Re5JQEeQqe8AvxtiuMwx3w
Cc: David Gibson, jdl-CYoMK+44s/E,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
Hi Frank,
> On Dec 28, 2016, at 09:20 , frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>
> From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
>
> In response to "Subject: Re: [PATCH v11 5/7] overlay: Documentation for the
> overlay sugar syntax" I suggested a tool to convert the old style of dts
> overlay files to use the new syntactic sugar [1]:
>
>>>> I can imagine some reasons to support the fully written out version,
>>>> but can we document what those reasons are?
>>>
>>> I believe the main one is the dts files in this format out in the
>>> field. Mind you, I guess we're already requiring them to tweak how
>>> they declare the /plugin/ option.
>>
>> It might be easy to write a program that transforms the expanded
>> format to the simple format. I'll try to make some time to see
>> how difficult it is. The transformation is relatively easy to
>> do manually, but I don't know how many dts files would need to
>> be converted.
>
> My goal is to minimize legacy issues of dts files that expose the
> internal implementation of overlays, such as the fragment and
> __overlay__ nodes. Pantelis has submitted the dtc patches to add
> the necessary syntactic sugar, and these appear to be moving toward
> acceptance.
>
> I have created a perl script to create a new style dts overlay file
> from an old style dts overlay file. I have also created a shell
> script to provide some error checking and to validate that the
> new dts file compiles to the same result as the old dts file.
>
> I treat the issue as a simplistic text processing exercise instead
> of using a more complex approach with the hope that this is
> sufficient to process the bulk of the existing in the wild overlay
> dts files.
>
> I do not think it is worth cluttering the dtc git repo with these
> tools, but have no objection to them being hosted there if David
> prefers. I can host them on github, elinux.org, or anywhere else
> that makes sense for a (hopefully) short lived tool.
>
> Patches 3, 4, and 5 are sample old style dts overlay files and
> are not intended to be committed.
>
> Following are several examples of use. One example that converts
> properly and two that show how convsersion a malformed old style
> dts is reported.
>
> ----- example 1
>
> $ export PATH="$PATH:/home/frowand/nobackup/src/github_pantelis/dtc/"
> $ ./overlay_convert_old_to_new a.dts b.dts
>
> $ cat a.dts
> /dts-v1/;
> /plugin/;
>
> / {
> fragment@0 {
> target = <&am3353x_pinmux>;
>
> __overlay__ {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
> };
>
> fragment@1 {
> target = <&i2c1>;
>
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> };
> };
> $ cat b.dts
> /dts-v1/;
> /plugin/;
>
> &am3353x_pinmux {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
>
> &i2c1 {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> $ diff -u a.dts b.dts
> --- a.dts 2016-12-27 15:51:36.433101164 -0800
> +++ b.dts 2016-12-27 22:01:28.541530464 -0800
> @@ -1,11 +1,7 @@
> /dts-v1/;
> /plugin/;
>
> -/ {
> - fragment@0 {
> - target = <&am3353x_pinmux>;
> -
> - __overlay__ {
> + &am3353x_pinmux {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> @@ -14,12 +10,8 @@
> >;
> };
> };
> - };
> -
> - fragment@1 {
> - target = <&i2c1>;
>
> - __overlay__ {
> + &i2c1 {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> @@ -33,5 +25,3 @@
> reg = <0x50>;
> };
> };
> - };
> -};
>
>
> ----- example 2
>
> $ export PATH="$PATH:/home/frowand/nobackup/src/github_pantelis/dtc/"
> $ ./overlay_convert_old_to_new bad_a_1.dts bad_b_1.dts
> No 'target' property in node fragment@0
>
> ERROR: unable to convert bad_a_1.dts
>
> $ cat bad_a_1.dts
> /dts-v1/;
> /plugin/;
>
> / {
> fragment@0 {
>
> __overlay__ {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
> };
>
> fragment@1 {
> target = <&i2c1>;
>
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> };
> };
>
>
> ----- example 3
>
> $ export PATH="$PATH:/home/frowand/nobackup/src/github_pantelis/dtc/"
> $ ./overlay_convert_old_to_new bad_a_2.dts bad_b_2.dts
> No 'target' property in node fragment@1
>
> ERROR: unable to convert bad_a_2.dts
>
> $ cat bad_a_2.dts
> /dts-v1/;
> /plugin/;
>
> / {
> fragment@0 {
> target = <&am3353x_pinmux>;
>
> __overlay__ {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
> };
>
> fragment@1 {
>
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> };
> };
>
>
>
> [1] http://www.spinics.net/lists/devicetree/msg152891.html
>
Very interesting and helpful.
Thanks for the good work. I would support converting all overlays in the wild
to the new format to get going on the connector problem.
> Frank Rowand (5):
> perl script to convert dts from old overlay style to new overlay style
> shell script to make overlay_convert easier to use
> a.dts: example of an old style dts file to be converted
> bad_a_1.dts: example of an old style dts file unable to be converted
> bad_a_2.dts: example of an old style dts file to be converted
>
Regards
— Pantelis
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC PATCH 0/5] overlay: tool to convert old overlay style dts to new style
@ 2017-01-03 12:13 ` Pantelis Antoniou
0 siblings, 0 replies; 8+ messages in thread
From: Pantelis Antoniou @ 2017-01-03 12:13 UTC (permalink / raw)
To: frowand.list-Re5JQEeQqe8AvxtiuMwx3w
Cc: David Gibson, jdl-CYoMK+44s/E,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
glikely-s3s/WqlpOiPyB63q8FvJNQ, jlu-bIcnvbaLZ9MEGnE8C9+IrQ,
s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ, phil-FnsA7b+Nu9XbIbC87yuRow,
sjg-F7+t8E8rja9g9hUCZPvPmw,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
stephen.boyd-QSEj5FYQhm4dnm+yROfE0A
Hi Frank,
> On Dec 28, 2016, at 09:20 , frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>
> From: Frank Rowand <frank.rowand-mEdOJwZ7QcZBDgjK7y7TUQ@public.gmane.org>
>
> In response to "Subject: Re: [PATCH v11 5/7] overlay: Documentation for the
> overlay sugar syntax" I suggested a tool to convert the old style of dts
> overlay files to use the new syntactic sugar [1]:
>
>>>> I can imagine some reasons to support the fully written out version,
>>>> but can we document what those reasons are?
>>>
>>> I believe the main one is the dts files in this format out in the
>>> field. Mind you, I guess we're already requiring them to tweak how
>>> they declare the /plugin/ option.
>>
>> It might be easy to write a program that transforms the expanded
>> format to the simple format. I'll try to make some time to see
>> how difficult it is. The transformation is relatively easy to
>> do manually, but I don't know how many dts files would need to
>> be converted.
>
> My goal is to minimize legacy issues of dts files that expose the
> internal implementation of overlays, such as the fragment and
> __overlay__ nodes. Pantelis has submitted the dtc patches to add
> the necessary syntactic sugar, and these appear to be moving toward
> acceptance.
>
> I have created a perl script to create a new style dts overlay file
> from an old style dts overlay file. I have also created a shell
> script to provide some error checking and to validate that the
> new dts file compiles to the same result as the old dts file.
>
> I treat the issue as a simplistic text processing exercise instead
> of using a more complex approach with the hope that this is
> sufficient to process the bulk of the existing in the wild overlay
> dts files.
>
> I do not think it is worth cluttering the dtc git repo with these
> tools, but have no objection to them being hosted there if David
> prefers. I can host them on github, elinux.org, or anywhere else
> that makes sense for a (hopefully) short lived tool.
>
> Patches 3, 4, and 5 are sample old style dts overlay files and
> are not intended to be committed.
>
> Following are several examples of use. One example that converts
> properly and two that show how convsersion a malformed old style
> dts is reported.
>
> ----- example 1
>
> $ export PATH="$PATH:/home/frowand/nobackup/src/github_pantelis/dtc/"
> $ ./overlay_convert_old_to_new a.dts b.dts
>
> $ cat a.dts
> /dts-v1/;
> /plugin/;
>
> / {
> fragment@0 {
> target = <&am3353x_pinmux>;
>
> __overlay__ {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
> };
>
> fragment@1 {
> target = <&i2c1>;
>
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> };
> };
> $ cat b.dts
> /dts-v1/;
> /plugin/;
>
> &am3353x_pinmux {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
>
> &i2c1 {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> $ diff -u a.dts b.dts
> --- a.dts 2016-12-27 15:51:36.433101164 -0800
> +++ b.dts 2016-12-27 22:01:28.541530464 -0800
> @@ -1,11 +1,7 @@
> /dts-v1/;
> /plugin/;
>
> -/ {
> - fragment@0 {
> - target = <&am3353x_pinmux>;
> -
> - __overlay__ {
> + &am3353x_pinmux {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> @@ -14,12 +10,8 @@
> >;
> };
> };
> - };
> -
> - fragment@1 {
> - target = <&i2c1>;
>
> - __overlay__ {
> + &i2c1 {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> @@ -33,5 +25,3 @@
> reg = <0x50>;
> };
> };
> - };
> -};
>
>
> ----- example 2
>
> $ export PATH="$PATH:/home/frowand/nobackup/src/github_pantelis/dtc/"
> $ ./overlay_convert_old_to_new bad_a_1.dts bad_b_1.dts
> No 'target' property in node fragment@0
>
> ERROR: unable to convert bad_a_1.dts
>
> $ cat bad_a_1.dts
> /dts-v1/;
> /plugin/;
>
> / {
> fragment@0 {
>
> __overlay__ {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
> };
>
> fragment@1 {
> target = <&i2c1>;
>
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> };
> };
>
>
> ----- example 3
>
> $ export PATH="$PATH:/home/frowand/nobackup/src/github_pantelis/dtc/"
> $ ./overlay_convert_old_to_new bad_a_2.dts bad_b_2.dts
> No 'target' property in node fragment@1
>
> ERROR: unable to convert bad_a_2.dts
>
> $ cat bad_a_2.dts
> /dts-v1/;
> /plugin/;
>
> / {
> fragment@0 {
> target = <&am3353x_pinmux>;
>
> __overlay__ {
>
> i2c1_pins: pinmux_i2c1_pins {
> pinctrl-single,pins = <
> 0x158 0x72
> 0x15c 0x72
> >;
> };
> };
> };
>
> fragment@1 {
>
> __overlay__ {
> #address-cells = <1>;
> #size-cells = <0>;
> pinctrl-names = "default";
> pinctrl-0 = <&i2c1_pins>;
> clock-frequency = <400000>;
> status = "okay";
>
> at24@50 {
> compatible = "at,24c256";
> pagesize = <64>;
> reg = <0x50>;
> };
> };
> };
> };
>
>
>
> [1] http://www.spinics.net/lists/devicetree/msg152891.html
>
Very interesting and helpful.
Thanks for the good work. I would support converting all overlays in the wild
to the new format to get going on the connector problem.
> Frank Rowand (5):
> perl script to convert dts from old overlay style to new overlay style
> shell script to make overlay_convert easier to use
> a.dts: example of an old style dts file to be converted
> bad_a_1.dts: example of an old style dts file unable to be converted
> bad_a_2.dts: example of an old style dts file to be converted
>
Regards
— Pantelis
^ permalink raw reply [flat|nested] 8+ messages in thread