All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Get rid of big array from imx pinctrl driver
@ 2013-02-20  7:08 Shawn Guo
  2013-02-20  7:08 ` [PATCH 1/3] ARM: dts: imx: use pre-processor for device trees Shawn Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-20  7:08 UTC (permalink / raw)
  To: linux-arm-kernel

First of all, thanks to Stephen for getting CPP pre-processor support
on DTC.

The series is an action of discussion [1].  It utilizes the DTC
pre-processing feature to move those huge mount of data about pin
from pinctrl driver into device tree.

[1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/181670/focus=19468

Shawn Guo (3):
  ARM: dts: imx: use pre-processor for device trees
  ARM: dts: imx: replace magic number with pin function name
  pinctrl: imx: move hard-coding data into device tree

 .../bindings/pinctrl/fsl,imx-pinctrl.txt           |    6 +-
 .../bindings/pinctrl/fsl,imx35-pinctrl.txt         |  954 +-----------
 .../bindings/pinctrl/fsl,imx51-pinctrl.txt         |  758 +--------
 .../bindings/pinctrl/fsl,imx53-pinctrl.txt         | 1173 +-------------
 .../bindings/pinctrl/fsl,imx6q-pinctrl.txt         | 1593 -------------------
 .../{imx25-karo-tx25.dts => imx25-karo-tx25.dtsp}  |    2 +-
 .../arm/boot/dts/{imx25-pdk.dts => imx25-pdk.dtsp} |    2 +-
 arch/arm/boot/dts/{imx25.dtsi => imx25.dtsip}      |    2 +-
 .../boot/dts/{imx27-apf27.dts => imx27-apf27.dtsp} |    2 +-
 .../arm/boot/dts/{imx27-pdk.dts => imx27-pdk.dtsp} |    2 +-
 ...hytec-phycore.dts => imx27-phytec-phycore.dtsp} |    2 +-
 arch/arm/boot/dts/{imx27.dtsi => imx27.dtsip}      |    2 +-
 .../arm/boot/dts/{imx31-bug.dts => imx31-bug.dtsp} |    2 +-
 arch/arm/boot/dts/{imx31.dtsi => imx31.dtsip}      |    2 +-
 arch/arm/boot/dts/imx35-pinfunc.h                  |  970 ++++++++++++
 .../boot/dts/{imx51-apf51.dts => imx51-apf51.dtsp} |    2 +-
 .../dts/{imx51-babbage.dts => imx51-babbage.dtsp}  |   16 +-
 arch/arm/boot/dts/imx51-pinfunc.h                  |  773 ++++++++++
 arch/arm/boot/dts/{imx51.dtsi => imx51.dtsip}      |  247 +--
 .../arm/boot/dts/{imx53-ard.dts => imx53-ard.dtsp} |   70 +-
 .../arm/boot/dts/{imx53-evk.dts => imx53-evk.dtsp} |   18 +-
 arch/arm/boot/dts/imx53-mba53.dts                  |  129 --
 arch/arm/boot/dts/imx53-mba53.dtsp                 |  135 ++
 arch/arm/boot/dts/imx53-pinfunc.h                  | 1189 +++++++++++++++
 .../arm/boot/dts/{imx53-qsb.dts => imx53-qsb.dtsp} |   22 +-
 .../arm/boot/dts/{imx53-smd.dts => imx53-smd.dtsp} |   16 +-
 .../dts/{imx53-tqma53.dtsi => imx53-tqma53.dtsip}  |   32 +-
 arch/arm/boot/dts/{imx53.dtsi => imx53.dtsip}      |  207 +--
 arch/arm/boot/dts/{imx6dl.dtsi => imx6dl.dtsip}    |    0
 .../boot/dts/{imx6q-arm2.dts => imx6q-arm2.dtsp}   |    8 +-
 arch/arm/boot/dts/imx6q-pinfunc.h                  | 1611 ++++++++++++++++++++
 .../{imx6q-sabreauto.dts => imx6q-sabreauto.dtsp}  |    6 +-
 .../{imx6q-sabrelite.dts => imx6q-sabrelite.dtsp}  |   18 +-
 .../dts/{imx6q-sabresd.dts => imx6q-sabresd.dtsp}  |   14 +-
 arch/arm/boot/dts/imx6q.dtsi                       |  302 ----
 arch/arm/boot/dts/imx6q.dtsip                      |  303 ++++
 arch/arm/boot/dts/{imx6qdl.dtsi => imx6qdl.dtsip}  |    2 +-
 drivers/pinctrl/pinctrl-imx.c                      |  118 +-
 drivers/pinctrl/pinctrl-imx.h                      |   13 +-
 drivers/pinctrl/pinctrl-imx35.c                    |  958 ------------
 drivers/pinctrl/pinctrl-imx51.c                    |  762 ---------
 drivers/pinctrl/pinctrl-imx53.c                    | 1177 --------------
 drivers/pinctrl/pinctrl-imx6q.c                    | 1599 -------------------
 43 files changed, 5380 insertions(+), 9839 deletions(-)
 rename arch/arm/boot/dts/{imx25-karo-tx25.dts => imx25-karo-tx25.dtsp} (96%)
 rename arch/arm/boot/dts/{imx25-pdk.dts => imx25-pdk.dtsp} (96%)
 rename arch/arm/boot/dts/{imx25.dtsi => imx25.dtsip} (99%)
 rename arch/arm/boot/dts/{imx27-apf27.dts => imx27-apf27.dtsp} (98%)
 rename arch/arm/boot/dts/{imx27-pdk.dts => imx27-pdk.dtsp} (96%)
 rename arch/arm/boot/dts/{imx27-phytec-phycore.dts => imx27-phytec-phycore.dtsp} (98%)
 rename arch/arm/boot/dts/{imx27.dtsi => imx27.dtsip} (99%)
 rename arch/arm/boot/dts/{imx31-bug.dts => imx31-bug.dtsp} (96%)
 rename arch/arm/boot/dts/{imx31.dtsi => imx31.dtsip} (98%)
 create mode 100644 arch/arm/boot/dts/imx35-pinfunc.h
 rename arch/arm/boot/dts/{imx51-apf51.dts => imx51-apf51.dtsp} (97%)
 rename arch/arm/boot/dts/{imx51-babbage.dts => imx51-babbage.dtsp} (94%)
 create mode 100644 arch/arm/boot/dts/imx51-pinfunc.h
 rename arch/arm/boot/dts/{imx51.dtsi => imx51.dtsip} (61%)
 rename arch/arm/boot/dts/{imx53-ard.dts => imx53-ard.dtsp} (55%)
 rename arch/arm/boot/dts/{imx53-evk.dts => imx53-evk.dtsp} (82%)
 delete mode 100644 arch/arm/boot/dts/imx53-mba53.dts
 create mode 100644 arch/arm/boot/dts/imx53-mba53.dtsp
 create mode 100644 arch/arm/boot/dts/imx53-pinfunc.h
 rename arch/arm/boot/dts/{imx53-qsb.dts => imx53-qsb.dtsp} (89%)
 rename arch/arm/boot/dts/{imx53-smd.dts => imx53-smd.dtsp} (88%)
 rename arch/arm/boot/dts/{imx53-tqma53.dtsi => imx53-tqma53.dtsip} (75%)
 rename arch/arm/boot/dts/{imx53.dtsi => imx53.dtsip} (69%)
 rename arch/arm/boot/dts/{imx6dl.dtsi => imx6dl.dtsip} (100%)
 rename arch/arm/boot/dts/{imx6q-arm2.dts => imx6q-arm2.dtsp} (90%)
 create mode 100644 arch/arm/boot/dts/imx6q-pinfunc.h
 rename arch/arm/boot/dts/{imx6q-sabreauto.dts => imx6q-sabreauto.dtsp} (88%)
 rename arch/arm/boot/dts/{imx6q-sabrelite.dts => imx6q-sabrelite.dtsp} (87%)
 rename arch/arm/boot/dts/{imx6q-sabresd.dts => imx6q-sabresd.dtsp} (84%)
 delete mode 100644 arch/arm/boot/dts/imx6q.dtsi
 create mode 100644 arch/arm/boot/dts/imx6q.dtsip
 rename arch/arm/boot/dts/{imx6qdl.dtsi => imx6qdl.dtsip} (99%)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 1/3] ARM: dts: imx: use pre-processor for device trees
  2013-02-20  7:08 [PATCH 0/3] Get rid of big array from imx pinctrl driver Shawn Guo
@ 2013-02-20  7:08 ` Shawn Guo
  2013-02-20  9:26   ` Dong Aisheng
  2013-02-20  9:25 ` [PATCH 0/3] Get rid of big array from imx pinctrl driver Dong Aisheng
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 55+ messages in thread
From: Shawn Guo @ 2013-02-20  7:08 UTC (permalink / raw)
  To: linux-arm-kernel

Enable C pre-processing on imx device trees. This allows future use
of defining names for various constants, to increase the readability
of the device tree sources.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 .../{imx25-karo-tx25.dts => imx25-karo-tx25.dtsp}  |    2 +-
 .../arm/boot/dts/{imx25-pdk.dts => imx25-pdk.dtsp} |    2 +-
 arch/arm/boot/dts/{imx25.dtsi => imx25.dtsip}      |    2 +-
 .../boot/dts/{imx27-apf27.dts => imx27-apf27.dtsp} |    2 +-
 .../arm/boot/dts/{imx27-pdk.dts => imx27-pdk.dtsp} |    2 +-
 ...hytec-phycore.dts => imx27-phytec-phycore.dtsp} |    2 +-
 arch/arm/boot/dts/{imx27.dtsi => imx27.dtsip}      |    2 +-
 .../arm/boot/dts/{imx31-bug.dts => imx31-bug.dtsp} |    2 +-
 arch/arm/boot/dts/{imx31.dtsi => imx31.dtsip}      |    2 +-
 .../boot/dts/{imx51-apf51.dts => imx51-apf51.dtsp} |    2 +-
 .../dts/{imx51-babbage.dts => imx51-babbage.dtsp}  |    2 +-
 arch/arm/boot/dts/{imx51.dtsi => imx51.dtsip}      |    2 +-
 .../arm/boot/dts/{imx53-ard.dts => imx53-ard.dtsp} |    2 +-
 .../arm/boot/dts/{imx53-evk.dts => imx53-evk.dtsp} |    2 +-
 .../boot/dts/{imx53-mba53.dts => imx53-mba53.dtsp} |    2 +-
 .../arm/boot/dts/{imx53-qsb.dts => imx53-qsb.dtsp} |    2 +-
 .../arm/boot/dts/{imx53-smd.dts => imx53-smd.dtsp} |    2 +-
 .../dts/{imx53-tqma53.dtsi => imx53-tqma53.dtsip}  |    2 +-
 arch/arm/boot/dts/{imx53.dtsi => imx53.dtsip}      |    2 +-
 arch/arm/boot/dts/{imx6dl.dtsi => imx6dl.dtsip}    |    0
 .../boot/dts/{imx6q-arm2.dts => imx6q-arm2.dtsp}   |    2 +-
 .../{imx6q-sabreauto.dts => imx6q-sabreauto.dtsp}  |    2 +-
 .../{imx6q-sabrelite.dts => imx6q-sabrelite.dtsp}  |    2 +-
 .../dts/{imx6q-sabresd.dts => imx6q-sabresd.dtsp}  |    2 +-
 arch/arm/boot/dts/{imx6q.dtsi => imx6q.dtsip}      |    2 +-
 arch/arm/boot/dts/{imx6qdl.dtsi => imx6qdl.dtsip}  |    2 +-
 26 files changed, 25 insertions(+), 25 deletions(-)
 rename arch/arm/boot/dts/{imx25-karo-tx25.dts => imx25-karo-tx25.dtsp} (96%)
 rename arch/arm/boot/dts/{imx25-pdk.dts => imx25-pdk.dtsp} (96%)
 rename arch/arm/boot/dts/{imx25.dtsi => imx25.dtsip} (99%)
 rename arch/arm/boot/dts/{imx27-apf27.dts => imx27-apf27.dtsp} (98%)
 rename arch/arm/boot/dts/{imx27-pdk.dts => imx27-pdk.dtsp} (96%)
 rename arch/arm/boot/dts/{imx27-phytec-phycore.dts => imx27-phytec-phycore.dtsp} (98%)
 rename arch/arm/boot/dts/{imx27.dtsi => imx27.dtsip} (99%)
 rename arch/arm/boot/dts/{imx31-bug.dts => imx31-bug.dtsp} (96%)
 rename arch/arm/boot/dts/{imx31.dtsi => imx31.dtsip} (98%)
 rename arch/arm/boot/dts/{imx51-apf51.dts => imx51-apf51.dtsp} (97%)
 rename arch/arm/boot/dts/{imx51-babbage.dts => imx51-babbage.dtsp} (99%)
 rename arch/arm/boot/dts/{imx51.dtsi => imx51.dtsip} (99%)
 rename arch/arm/boot/dts/{imx53-ard.dts => imx53-ard.dtsp} (99%)
 rename arch/arm/boot/dts/{imx53-evk.dts => imx53-evk.dtsp} (99%)
 rename arch/arm/boot/dts/{imx53-mba53.dts => imx53-mba53.dtsp} (98%)
 rename arch/arm/boot/dts/{imx53-qsb.dts => imx53-qsb.dtsp} (99%)
 rename arch/arm/boot/dts/{imx53-smd.dts => imx53-smd.dtsp} (99%)
 rename arch/arm/boot/dts/{imx53-tqma53.dtsi => imx53-tqma53.dtsip} (99%)
 rename arch/arm/boot/dts/{imx53.dtsi => imx53.dtsip} (99%)
 rename arch/arm/boot/dts/{imx6dl.dtsi => imx6dl.dtsip} (100%)
 rename arch/arm/boot/dts/{imx6q-arm2.dts => imx6q-arm2.dtsp} (98%)
 rename arch/arm/boot/dts/{imx6q-sabreauto.dts => imx6q-sabreauto.dtsp} (98%)
 rename arch/arm/boot/dts/{imx6q-sabrelite.dts => imx6q-sabrelite.dtsp} (99%)
 rename arch/arm/boot/dts/{imx6q-sabresd.dts => imx6q-sabresd.dtsp} (98%)
 rename arch/arm/boot/dts/{imx6q.dtsi => imx6q.dtsip} (99%)
 rename arch/arm/boot/dts/{imx6qdl.dtsi => imx6qdl.dtsip} (99%)

diff --git a/arch/arm/boot/dts/imx25-karo-tx25.dts b/arch/arm/boot/dts/imx25-karo-tx25.dtsp
similarity index 96%
rename from arch/arm/boot/dts/imx25-karo-tx25.dts
rename to arch/arm/boot/dts/imx25-karo-tx25.dtsp
index 1a9d049..3dbe775 100644
--- a/arch/arm/boot/dts/imx25-karo-tx25.dts
+++ b/arch/arm/boot/dts/imx25-karo-tx25.dtsp
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "imx25.dtsi"
+#include "imx25.dtsip"
 
 / {
 	model = "Ka-Ro TX25";
diff --git a/arch/arm/boot/dts/imx25-pdk.dts b/arch/arm/boot/dts/imx25-pdk.dtsp
similarity index 96%
rename from arch/arm/boot/dts/imx25-pdk.dts
rename to arch/arm/boot/dts/imx25-pdk.dtsp
index a02a860..8064b76 100644
--- a/arch/arm/boot/dts/imx25-pdk.dts
+++ b/arch/arm/boot/dts/imx25-pdk.dtsp
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "imx25.dtsi"
+#include "imx25.dtsip"
 
 / {
 	model = "Freescale i.MX25 Product Development Kit";
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx25.dtsi
rename to arch/arm/boot/dts/imx25.dtsip
index 94f3305..d2550e0 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsip
@@ -9,7 +9,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	aliases {
diff --git a/arch/arm/boot/dts/imx27-apf27.dts b/arch/arm/boot/dts/imx27-apf27.dtsp
similarity index 98%
rename from arch/arm/boot/dts/imx27-apf27.dts
rename to arch/arm/boot/dts/imx27-apf27.dtsp
index b464c80..59f276f 100644
--- a/arch/arm/boot/dts/imx27-apf27.dts
+++ b/arch/arm/boot/dts/imx27-apf27.dtsp
@@ -13,7 +13,7 @@
  */
 
 /dts-v1/;
-/include/ "imx27.dtsi"
+#include "imx27.dtsip"
 
 / {
 	model = "Armadeus Systems APF27 module";
diff --git a/arch/arm/boot/dts/imx27-pdk.dts b/arch/arm/boot/dts/imx27-pdk.dtsp
similarity index 96%
rename from arch/arm/boot/dts/imx27-pdk.dts
rename to arch/arm/boot/dts/imx27-pdk.dtsp
index 41cd110..fe5f609 100644
--- a/arch/arm/boot/dts/imx27-pdk.dts
+++ b/arch/arm/boot/dts/imx27-pdk.dtsp
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "imx27.dtsi"
+#include "imx27.dtsip"
 
 / {
 	model = "Freescale i.MX27 Product Development Kit";
diff --git a/arch/arm/boot/dts/imx27-phytec-phycore.dts b/arch/arm/boot/dts/imx27-phytec-phycore.dtsp
similarity index 98%
rename from arch/arm/boot/dts/imx27-phytec-phycore.dts
rename to arch/arm/boot/dts/imx27-phytec-phycore.dtsp
index 53b0ec0..924097a 100644
--- a/arch/arm/boot/dts/imx27-phytec-phycore.dts
+++ b/arch/arm/boot/dts/imx27-phytec-phycore.dtsp
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "imx27.dtsi"
+#include "imx27.dtsip"
 
 / {
 	model = "Phytec pcm038";
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx27.dtsi
rename to arch/arm/boot/dts/imx27.dtsip
index 5a82cb5..324130f 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsip
@@ -9,7 +9,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	aliases {
diff --git a/arch/arm/boot/dts/imx31-bug.dts b/arch/arm/boot/dts/imx31-bug.dtsp
similarity index 96%
rename from arch/arm/boot/dts/imx31-bug.dts
rename to arch/arm/boot/dts/imx31-bug.dtsp
index 9ac6f6b..8e26e91 100644
--- a/arch/arm/boot/dts/imx31-bug.dts
+++ b/arch/arm/boot/dts/imx31-bug.dtsp
@@ -10,7 +10,7 @@
  */
 
 /dts-v1/;
-/include/ "imx31.dtsi"
+#include "imx31.dtsip"
 
 / {
 	model = "Buglabs i.MX31 Bug 1.x";
diff --git a/arch/arm/boot/dts/imx31.dtsi b/arch/arm/boot/dts/imx31.dtsip
similarity index 98%
rename from arch/arm/boot/dts/imx31.dtsi
rename to arch/arm/boot/dts/imx31.dtsip
index 454c2d1..aa488ac 100644
--- a/arch/arm/boot/dts/imx31.dtsi
+++ b/arch/arm/boot/dts/imx31.dtsip
@@ -9,7 +9,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	aliases {
diff --git a/arch/arm/boot/dts/imx51-apf51.dts b/arch/arm/boot/dts/imx51-apf51.dtsp
similarity index 97%
rename from arch/arm/boot/dts/imx51-apf51.dts
rename to arch/arm/boot/dts/imx51-apf51.dtsp
index 92d3a66..4ef88fc 100644
--- a/arch/arm/boot/dts/imx51-apf51.dts
+++ b/arch/arm/boot/dts/imx51-apf51.dtsp
@@ -15,7 +15,7 @@
  */
 
 /dts-v1/;
-/include/ "imx51.dtsi"
+#include "imx51.dtsip"
 
 / {
 	model = "Armadeus Systems APF51 module";
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dtsp
similarity index 99%
rename from arch/arm/boot/dts/imx51-babbage.dts
rename to arch/arm/boot/dts/imx51-babbage.dtsp
index aab6e43..965a8c8 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx51.dtsi"
+#include "imx51.dtsip"
 
 / {
 	model = "Freescale i.MX51 Babbage Board";
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx51.dtsi
rename to arch/arm/boot/dts/imx51.dtsip
index fcf035b..606a167 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsip
@@ -10,7 +10,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	aliases {
diff --git a/arch/arm/boot/dts/imx53-ard.dts b/arch/arm/boot/dts/imx53-ard.dtsp
similarity index 99%
rename from arch/arm/boot/dts/imx53-ard.dts
rename to arch/arm/boot/dts/imx53-ard.dtsp
index e049fd0..78425a4 100644
--- a/arch/arm/boot/dts/imx53-ard.dts
+++ b/arch/arm/boot/dts/imx53-ard.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx53.dtsi"
+#include "imx53.dtsip"
 
 / {
 	model = "Freescale i.MX53 Automotive Reference Design Board";
diff --git a/arch/arm/boot/dts/imx53-evk.dts b/arch/arm/boot/dts/imx53-evk.dtsp
similarity index 99%
rename from arch/arm/boot/dts/imx53-evk.dts
rename to arch/arm/boot/dts/imx53-evk.dtsp
index 85a89b5..20fa799 100644
--- a/arch/arm/boot/dts/imx53-evk.dts
+++ b/arch/arm/boot/dts/imx53-evk.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx53.dtsi"
+#include "imx53.dtsip"
 
 / {
 	model = "Freescale i.MX53 Evaluation Kit";
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dtsp
similarity index 98%
rename from arch/arm/boot/dts/imx53-mba53.dts
rename to arch/arm/boot/dts/imx53-mba53.dtsp
index 468c0a1..e7bde54 100644
--- a/arch/arm/boot/dts/imx53-mba53.dts
+++ b/arch/arm/boot/dts/imx53-mba53.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx53-tqma53.dtsi"
+#include "imx53-tqma53.dtsip"
 
 / {
 	model = "TQ MBa53 starter kit";
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dtsp
similarity index 99%
rename from arch/arm/boot/dts/imx53-qsb.dts
rename to arch/arm/boot/dts/imx53-qsb.dtsp
index 05cc562..37fc83c 100644
--- a/arch/arm/boot/dts/imx53-qsb.dts
+++ b/arch/arm/boot/dts/imx53-qsb.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx53.dtsi"
+#include "imx53.dtsip"
 
 / {
 	model = "Freescale i.MX53 Quick Start Board";
diff --git a/arch/arm/boot/dts/imx53-smd.dts b/arch/arm/boot/dts/imx53-smd.dtsp
similarity index 99%
rename from arch/arm/boot/dts/imx53-smd.dts
rename to arch/arm/boot/dts/imx53-smd.dtsp
index 995554c..c429f44 100644
--- a/arch/arm/boot/dts/imx53-smd.dts
+++ b/arch/arm/boot/dts/imx53-smd.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx53.dtsi"
+#include "imx53.dtsip"
 
 / {
 	model = "Freescale i.MX53 Smart Mobile Reference Design Board";
diff --git a/arch/arm/boot/dts/imx53-tqma53.dtsi b/arch/arm/boot/dts/imx53-tqma53.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx53-tqma53.dtsi
rename to arch/arm/boot/dts/imx53-tqma53.dtsip
index 8278ec5..af24cb4 100644
--- a/arch/arm/boot/dts/imx53-tqma53.dtsi
+++ b/arch/arm/boot/dts/imx53-tqma53.dtsip
@@ -10,7 +10,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "imx53.dtsi"
+#include "imx53.dtsip"
 
 / {
 	model = "TQ TQMa53";
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx53.dtsi
rename to arch/arm/boot/dts/imx53.dtsip
index d05aa21..baea3b5 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsip
@@ -10,7 +10,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	aliases {
diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsip
similarity index 100%
rename from arch/arm/boot/dts/imx6dl.dtsi
rename to arch/arm/boot/dts/imx6dl.dtsip
diff --git a/arch/arm/boot/dts/imx6q-arm2.dts b/arch/arm/boot/dts/imx6q-arm2.dtsp
similarity index 98%
rename from arch/arm/boot/dts/imx6q-arm2.dts
rename to arch/arm/boot/dts/imx6q-arm2.dtsp
index 53eb241..3028f96 100644
--- a/arch/arm/boot/dts/imx6q-arm2.dts
+++ b/arch/arm/boot/dts/imx6q-arm2.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx6q.dtsi"
+#include "imx6q.dtsip"
 
 / {
 	model = "Freescale i.MX6 Quad Armadillo2 Board";
diff --git a/arch/arm/boot/dts/imx6q-sabreauto.dts b/arch/arm/boot/dts/imx6q-sabreauto.dtsp
similarity index 98%
rename from arch/arm/boot/dts/imx6q-sabreauto.dts
rename to arch/arm/boot/dts/imx6q-sabreauto.dtsp
index 656d489..4063b90 100644
--- a/arch/arm/boot/dts/imx6q-sabreauto.dts
+++ b/arch/arm/boot/dts/imx6q-sabreauto.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx6q.dtsi"
+#include "imx6q.dtsip"
 
 / {
 	model = "Freescale i.MX6 Quad SABRE Automotive Board";
diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dtsp
similarity index 99%
rename from arch/arm/boot/dts/imx6q-sabrelite.dts
rename to arch/arm/boot/dts/imx6q-sabrelite.dtsp
index 2ce355c..c6a7737 100644
--- a/arch/arm/boot/dts/imx6q-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6q-sabrelite.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx6q.dtsi"
+#include "imx6q.dtsip"
 
 / {
 	model = "Freescale i.MX6 Quad SABRE Lite Board";
diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dtsp
similarity index 98%
rename from arch/arm/boot/dts/imx6q-sabresd.dts
rename to arch/arm/boot/dts/imx6q-sabresd.dtsp
index bafaccd..306d101 100644
--- a/arch/arm/boot/dts/imx6q-sabresd.dts
+++ b/arch/arm/boot/dts/imx6q-sabresd.dtsp
@@ -11,7 +11,7 @@
  */
 
 /dts-v1/;
-/include/ "imx6q.dtsi"
+#include "imx6q.dtsip"
 
 / {
 	model = "Freescale i.MX6Q SABRE Smart Device Board";
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx6q.dtsi
rename to arch/arm/boot/dts/imx6q.dtsip
index 0125250..5ca905c 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsip
@@ -8,7 +8,7 @@
  *
  */
 
-/include/ "imx6qdl.dtsi"
+#include "imx6qdl.dtsip"
 
 / {
 	cpus {
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsip
similarity index 99%
rename from arch/arm/boot/dts/imx6qdl.dtsi
rename to arch/arm/boot/dts/imx6qdl.dtsip
index 8f34a3cd..52b156f 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsip
@@ -10,7 +10,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	aliases {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH 0/3] Get rid of big array from imx pinctrl driver
  2013-02-20  7:08 [PATCH 0/3] Get rid of big array from imx pinctrl driver Shawn Guo
  2013-02-20  7:08 ` [PATCH 1/3] ARM: dts: imx: use pre-processor for device trees Shawn Guo
@ 2013-02-20  9:25 ` Dong Aisheng
       [not found] ` <1361344089-16804-3-git-send-email-shawn.guo@linaro.org>
       [not found] ` <1361344089-16804-4-git-send-email-shawn.guo@linaro.org>
  3 siblings, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-20  9:25 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Shawn,

Really glad to see this clean up patch series.
Thanks for your work.

On 20 February 2013 15:08, Shawn Guo <shawn.guo@linaro.org> wrote:
> First of all, thanks to Stephen for getting CPP pre-processor support
> on DTC.

I want to express my thanks to Stephen too.

>
> The series is an action of discussion [1].  It utilizes the DTC
> pre-processing feature to move those huge mount of data about pin
> from pinctrl driver into device tree.
>

It's good we start this work now.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 1/3] ARM: dts: imx: use pre-processor for device trees
  2013-02-20  7:08 ` [PATCH 1/3] ARM: dts: imx: use pre-processor for device trees Shawn Guo
@ 2013-02-20  9:26   ` Dong Aisheng
  0 siblings, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-20  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 20 February 2013 15:08, Shawn Guo <shawn.guo@linaro.org> wrote:
> Enable C pre-processing on imx device trees. This allows future use
> of defining names for various constants, to increase the readability
> of the device tree sources.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Acked-by: Dong Aisheng <dong.aisheng@linaro.org>

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
       [not found] ` <1361344089-16804-3-git-send-email-shawn.guo@linaro.org>
@ 2013-02-20  9:30   ` Dong Aisheng
       [not found]   ` <1361344089-16804-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  1 sibling, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-20  9:30 UTC (permalink / raw)
  To: linux-arm-kernel

On 20 February 2013 15:08, Shawn Guo <shawn.guo@linaro.org> wrote:
> This turns the imx pin function number defined by binding document
> into #define constants in header which can be used in dts and handled
> by pre-processor to improve the readability of device tree sources.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
.........
>                                 usdhc4 {
>                                         pinctrl_usdhc4_1: usdhc4grp-1 {
>                                                 fsl,pins = <
> -                                                       1386 0x17059    /* MX6Q_PAD_SD4_CMD__USDHC4_CMD */
> -                                                       1392 0x10059    /* MX6Q_PAD_SD4_CLK__USDHC4_CLK */
> -                                                       1462 0x17059    /* MX6Q_PAD_SD4_DAT0__USDHC4_DAT0 */
> -                                                       1470 0x17059    /* MX6Q_PAD_SD4_DAT1__USDHC4_DAT1 */
> -                                                       1478 0x17059    /* MX6Q_PAD_SD4_DAT2__USDHC4_DAT2 */
> -                                                       1486 0x17059    /* MX6Q_PAD_SD4_DAT3__USDHC4_DAT3 */
> -                                                       1493 0x17059    /* MX6Q_PAD_SD4_DAT4__USDHC4_DAT4 */
> -                                                       1501 0x17059    /* MX6Q_PAD_SD4_DAT5__USDHC4_DAT5 */
> -                                                       1509 0x17059    /* MX6Q_PAD_SD4_DAT6__USDHC4_DAT6 */
> -                                                       1517 0x17059    /* MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 */
> +                                                       MX6Q_PAD_SD4_CMD__USDHC4_CMD   0x17059
> +                                                       MX6Q_PAD_SD4_CLK__USDHC4_CLK   0x10059
> +                                                       MX6Q_PAD_SD4_DAT0__USDHC4_DAT0 0x17059
> +                                                       MX6Q_PAD_SD4_DAT1__USDHC4_DAT1 0x17059
> +                                                       MX6Q_PAD_SD4_DAT2__USDHC4_DAT2 0x17059
> +                                                       MX6Q_PAD_SD4_DAT3__USDHC4_DAT3 0x17059
> +                                                       MX6Q_PAD_SD4_DAT4__USDHC4_DAT4 0x17059
> +                                                       MX6Q_PAD_SD4_DAT5__USDHC4_DAT5 0x17059
> +                                                       MX6Q_PAD_SD4_DAT6__USDHC4_DAT6 0x17059
> +                                                       MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 0x17059

IMO we could also replace the config value with a macro.
You could either do it in this patch or another separate patch.
So,
Acked-by: Dong Aisheng <dong.aisheng@linaro.org>

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
       [not found] ` <1361344089-16804-4-git-send-email-shawn.guo@linaro.org>
@ 2013-02-20  9:44   ` Dong Aisheng
  2013-02-21  6:04     ` Shawn Guo
       [not found]   ` <1361344089-16804-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  1 sibling, 1 reply; 55+ messages in thread
From: Dong Aisheng @ 2013-02-20  9:44 UTC (permalink / raw)
  To: linux-arm-kernel

On 20 February 2013 15:08, Shawn Guo <shawn.guo@linaro.org> wrote:
> Currently, all imx pinctrl drivers maintain a big array of struct
> imx_pin_reg which hard-codes data like register offset and mux mode
> setting for each pin function.  Every time a new imx SoC support is
> added, we need to add such a big mount of data.  With moving to single
> kernel build, it's only matter of time to be blamed on memory consuming.
>
> With DTC pre-processor support in place, the patch moves all these data
> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
> changing the PIN_FUNC_ID parsing code a little bit.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> ---
>  .../bindings/pinctrl/fsl,imx-pinctrl.txt           |    6 +-
>  arch/arm/boot/dts/imx35-pinfunc.h                  | 1908 ++++++------
>  arch/arm/boot/dts/imx51-pinfunc.h                  | 1514 +++++-----
>  arch/arm/boot/dts/imx53-pinfunc.h                  | 2346 +++++++-------
>  arch/arm/boot/dts/imx6q-pinfunc.h                  | 3190 ++++++++++----------
>  drivers/pinctrl/pinctrl-imx.c                      |  118 +-
>  drivers/pinctrl/pinctrl-imx.h                      |   13 +-
>  drivers/pinctrl/pinctrl-imx35.c                    |  958 ------
>  drivers/pinctrl/pinctrl-imx51.c                    |  762 -----
>  drivers/pinctrl/pinctrl-imx53.c                    | 1177 --------
>  drivers/pinctrl/pinctrl-imx6q.c                    | 1599 ----------
>  11 files changed, 4534 insertions(+), 9057 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
> index ab19e6b..614cab1 100644
> --- a/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
> @@ -24,9 +24,9 @@ Required properties for iomux controller:
>  Required properties for pin configuration node:
>  - fsl,pins: two integers array, represents a group of pins mux and config
>    setting. The format is fsl,pins = <PIN_FUNC_ID CONFIG>, PIN_FUNC_ID is
> -  pin working on a specific function, CONFIG is the pad setting value like
> -  pull-up on this pin. Please refer to fsl,<soc>-pinctrl.txt for the valid
> -  pins and functions of each SoC.
> +  pin working on a specific function, which consists of a tuple of <pinid
> +  mux_reg conf_reg input_reg mux_val input_val>.  CONFIG is the pad setting
> +  value like pull-up on this pin.

Since we actually do not have a PIN_FUNC_ID anymore, i would suggest
totoally remove this concept in both doc and code.

> +/*
> + * The pin function ID is a tuple of
> + * <pinid mux_reg conf_reg input_reg mux_val input_val>
> + */
> +#define MX6Q_PAD_SD2_DAT1__USDHC2_DAT1                 0x000 0x04c 0x360 0x000 0x0 0x0

The original table generated does not have pinid, so you manually added it here?
Since the pin id is really created by us, maybe we could try to remove it
and dynamically generate the pin id.
Then user does not need to care about id anymore.

> +/*
> + * Each pin represented in fsl,pins consists of 6 u32 PIN_FUNC_ID and

We could remove PIN_FUNC_ID.

> + * 1 u32 CONFIG, so 28 types in total for each pin.
> + */
> +#define FSL_PIN_SIZE 28
>
>  static int imx_pinctrl_parse_groups(struct device_node *np,
>                                     struct imx_pin_group *grp,
>                                     struct imx_pinctrl_soc_info *info,
>                                     u32 index)
>  {
> -       unsigned int pin_func_id;
> -       int ret, size;
> +       int size;
>         const __be32 *list;
> -       int i, j;
> +       int i;
>         u32 config;
>
>         dev_dbg(info->dev, "group(%d): %s\n", index, np->name);
> @@ -447,32 +401,36 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
>          */
>         list = of_get_property(np, "fsl,pins", &size);
>         /* we do not check return since it's safe node passed down */
> -       size /= sizeof(*list);

Is this wrongly deleted?

> -       if (!size || size % 2) {
> -               dev_err(info->dev, "wrong pins number or pins and configs should be pairs\n");
> +       if (!size || size % FSL_PIN_SIZE) {
> +               dev_err(info->dev, "Invalid fsl,pins property\n");
>                 return -EINVAL;
>         }
>
> -       grp->npins = size / 2;
> +       grp->npins = size / FSL_PIN_SIZE;
>         grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
>                                 GFP_KERNEL);
>         grp->mux_mode = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
>                                 GFP_KERNEL);
> +       grp->input_val = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
> +                               GFP_KERNEL);
>         grp->configs = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned long),
>                                 GFP_KERNEL);
> -       for (i = 0, j = 0; i < size; i += 2, j++) {
> -               pin_func_id = be32_to_cpu(*list++);
> -               ret = imx_pinctrl_get_pin_id_and_mux(info, pin_func_id,
> -                                       &grp->pins[j], &grp->mux_mode[j]);
> -               if (ret) {
> -                       dev_err(info->dev, "get invalid pin function id\n");
> -                       return -EINVAL;
> -               }
> +       for (i = 0; i < grp->npins; i++) {
> +               unsigned int pin_id = be32_to_cpu(*list++);
> +               struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id];
> +
> +               grp->pins[i] = pin_id;
> +               pin_reg->mux_reg = be32_to_cpu(*list++);
> +               pin_reg->conf_reg = be32_to_cpu(*list++);
> +               pin_reg->input_reg = be32_to_cpu(*list++);
> +               grp->mux_mode[i] = be32_to_cpu(*list++);
> +               grp->input_val[i] = be32_to_cpu(*list++);
> +
>                 /* SION bit is in mux register */
>                 config = be32_to_cpu(*list++);
>                 if (config & IMX_PAD_SION)
> -                       grp->mux_mode[j] |= IOMUXC_CONFIG_SION;
> -               grp->configs[j] = config & ~IMX_PAD_SION;
> +                       grp->mux_mode[i] |= IOMUXC_CONFIG_SION;
> +               grp->configs[i] = config & ~IMX_PAD_SION;
>         }
>
>  #ifdef DEBUG
> @@ -568,8 +526,7 @@ int imx_pinctrl_probe(struct platform_device *pdev,
>         struct resource *res;
>         int ret;
>
> -       if (!info || !info->pins || !info->npins
> -                 || !info->pin_regs || !info->npin_regs) {
> +       if (!info || !info->pins || !info->npins) {
>                 dev_err(&pdev->dev, "wrong pinctrl info\n");
>                 return -EINVAL;
>         }
> @@ -580,6 +537,11 @@ int imx_pinctrl_probe(struct platform_device *pdev,
>         if (!ipctl)
>                 return -ENOMEM;
>
> +       info->pin_regs = devm_kzalloc(&pdev->dev, sizeof(*info->pin_regs) *
> +                                     info->npins, GFP_KERNEL);

Since we only record the used pins from device tree, it seems not make too much
sense to create pin_regs for everypin no matter wheter it's used or not.
I would suggest to put the pin_regs info into group,
then we do not need info->pin_regs anymore.
What do you think?

Regards
Dong Aisheng
> +       if (!info->pin_regs)
> +               return -ENOMEM;
> +
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         if (!res)
>                 return -ENOENT;
> diff --git a/drivers/pinctrl/pinctrl-imx.h b/drivers/pinctrl/pinctrl-imx.h
> index 9b65e78..4749b0a 100644
> --- a/drivers/pinctrl/pinctrl-imx.h
> +++ b/drivers/pinctrl/pinctrl-imx.h
> @@ -26,6 +26,8 @@ struct platform_device;
>   *     elements in .pins so we can iterate over that array
>   * @mux_mode: the mux mode for each pin in this group. The size of this
>   *     array is the same as pins.
> + * @input_val: the select input value for each pin in this group. The size of
> + *     this array is the same as pins.
>   * @configs: the config for each pin in this group. The size of this
>   *     array is the same as pins.
>   */
> @@ -34,6 +36,7 @@ struct imx_pin_group {
>         unsigned int *pins;
>         unsigned npins;
>         unsigned int *mux_mode;
> +       unsigned int *input_val;
>         unsigned long *configs;
>  };
>
> @@ -51,30 +54,22 @@ struct imx_pmx_func {
>
>  /**
>   * struct imx_pin_reg - describe a pin reg map
> - * The last 3 members are used for select input setting
> - * @pid: pin id
>   * @mux_reg: mux register offset
>   * @conf_reg: config register offset
> - * @mux_mode: mux mode
>   * @input_reg: select input register offset for this mux if any
>   *  0 if no select input setting needed.
> - * @input_val: the value set to select input register
>   */
>  struct imx_pin_reg {
> -       u16 pid;
>         u16 mux_reg;
>         u16 conf_reg;
> -       u8 mux_mode;
>         u16 input_reg;
> -       u8 input_val;
>  };
>
>  struct imx_pinctrl_soc_info {
>         struct device *dev;
>         const struct pinctrl_pin_desc *pins;
>         unsigned int npins;
> -       const struct imx_pin_reg *pin_regs;
> -       unsigned int npin_regs;
> +       struct imx_pin_reg *pin_regs;
>         struct imx_pin_group *groups;
>         unsigned int ngroups;
>         struct imx_pmx_func *functions;

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
       [not found] ` <1361344089-16804-3-git-send-email-shawn.guo@linaro.org>
@ 2013-02-20 18:46       ` Stephen Warren
       [not found]   ` <1361344089-16804-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  1 sibling, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-20 18:46 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Rob Herring, Uwe Kleine-König, Dong Aisheng,
	devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 02/20/2013 12:08 AM, Shawn Guo wrote:
> This turns the imx pin function number defined by binding document
> into #define constants in header which can be used in dts and handled
> by pre-processor to improve the readability of device tree sources.

> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt

> -See below for available PIN_FUNC_ID for imx35:
> -0 MX35_PAD_CAPTURE__GPT_CAPIN1
...
> -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
> +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.

So that path is specific to the Linux kernel. The DT binding
documentation isn't supposed to be specific to the Linux kernel. I
wonder if we shouldn't put all the header files into
Documentation/devicetree/bindings rather than arch/*/boot/dts. That way,
you could encode relative path names into the DT binding docs. The
headers are logically part of the documentation anyway.

This all plays into whatever plans exist for removing the DT binding
docs and/or .dts files from the kernel, and how things will end up
getting laid out then though. That's something we should discuss with at
least Grant and Rob. I note that the DT maintainers weren't Cc'd on this
series though. I added them for this reply.

Perhaps I should just send a patch to the dtc and kernel include paths
which implements that, and see what people say.

> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt

>  See below for available PIN_FUNC_ID for imx6q:
> -MX6Q_PAD_SD2_DAT1__USDHC2_DAT1			0

You forgot to add a reference to the header filename to this file.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-20 18:46       ` Stephen Warren
  0 siblings, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-20 18:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/20/2013 12:08 AM, Shawn Guo wrote:
> This turns the imx pin function number defined by binding document
> into #define constants in header which can be used in dts and handled
> by pre-processor to improve the readability of device tree sources.

> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt

> -See below for available PIN_FUNC_ID for imx35:
> -0 MX35_PAD_CAPTURE__GPT_CAPIN1
...
> -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
> +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.

So that path is specific to the Linux kernel. The DT binding
documentation isn't supposed to be specific to the Linux kernel. I
wonder if we shouldn't put all the header files into
Documentation/devicetree/bindings rather than arch/*/boot/dts. That way,
you could encode relative path names into the DT binding docs. The
headers are logically part of the documentation anyway.

This all plays into whatever plans exist for removing the DT binding
docs and/or .dts files from the kernel, and how things will end up
getting laid out then though. That's something we should discuss with at
least Grant and Rob. I note that the DT maintainers weren't Cc'd on this
series though. I added them for this reply.

Perhaps I should just send a patch to the dtc and kernel include paths
which implements that, and see what people say.

> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt

>  See below for available PIN_FUNC_ID for imx6q:
> -MX6Q_PAD_SD2_DAT1__USDHC2_DAT1			0

You forgot to add a reference to the header filename to this file.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
       [not found] ` <1361344089-16804-4-git-send-email-shawn.guo@linaro.org>
@ 2013-02-20 19:04       ` Stephen Warren
       [not found]   ` <1361344089-16804-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  1 sibling, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-20 19:04 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Rob Herring, Uwe Kleine-König, Dong Aisheng,
	devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 02/20/2013 12:08 AM, Shawn Guo wrote:
> Currently, all imx pinctrl drivers maintain a big array of struct
> imx_pin_reg which hard-codes data like register offset and mux mode
> setting for each pin function.  Every time a new imx SoC support is
> added, we need to add such a big mount of data.  With moving to single
> kernel build, it's only matter of time to be blamed on memory consuming.
> 
> With DTC pre-processor support in place, the patch moves all these data
> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
> changing the PIN_FUNC_ID parsing code a little bit.

There are a couple of potential issues with this patch, which I'm in two
minds about:

1)

This is an incompatible change to the DT binding definition. A DT
written to the old specification won't work with a newer kernel and
vice-versa. This isn't supposed to happen with device tree.

Right now I believe we're still being flexible about DT binding changes,
but I've seen hints that this kind of thing will start getting lots of
push-back in the near future...

That all said, I'd also love to change the Tegra pinctrl binding now
that we have CPP, since I could replace all the strings in the current
binding with integers and presumably save some space in the .dtb. Hence,
I'd love to maintain the flexibility to keep changing the .dts and
kernel code in lock-step.

2)

This patch removes a bunch of tables from the kernel. I like having the
tables in the kernel, since in theory it could allow a future debugfs or
sysfs interface to pinctrl that allows manipulation of the pinctrl HW
state at a semantic level. This is only possible if the DT binding
includes details such as "set this pin to this function", and the driver
includes the tables to convert that into details such as register
address and value. I don't think such an "API" could be implemented for
IMX after this patch. Still, given the IMX binding already merged "pin"
and "function" into a single integer in the binding, I'm not sure if IMX
could support that kind of "API" before anyway?

This is part of the reason I pushed hard for the pinctrl APIs to operate
at the semantic pin/group/function level, and that Tegra's pinctrl
drivers explicitly have tables listing all the pins/groups/functions,
rather than just putting a bunch of register values into the DT.

I'm not sure how much of an issue this is, though. LinusW and/or the DT
maintainers should probably chime in here.

I didn't actually read the driver implementation changes in this patch.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
@ 2013-02-20 19:04       ` Stephen Warren
  0 siblings, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-20 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/20/2013 12:08 AM, Shawn Guo wrote:
> Currently, all imx pinctrl drivers maintain a big array of struct
> imx_pin_reg which hard-codes data like register offset and mux mode
> setting for each pin function.  Every time a new imx SoC support is
> added, we need to add such a big mount of data.  With moving to single
> kernel build, it's only matter of time to be blamed on memory consuming.
> 
> With DTC pre-processor support in place, the patch moves all these data
> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
> changing the PIN_FUNC_ID parsing code a little bit.

There are a couple of potential issues with this patch, which I'm in two
minds about:

1)

This is an incompatible change to the DT binding definition. A DT
written to the old specification won't work with a newer kernel and
vice-versa. This isn't supposed to happen with device tree.

Right now I believe we're still being flexible about DT binding changes,
but I've seen hints that this kind of thing will start getting lots of
push-back in the near future...

That all said, I'd also love to change the Tegra pinctrl binding now
that we have CPP, since I could replace all the strings in the current
binding with integers and presumably save some space in the .dtb. Hence,
I'd love to maintain the flexibility to keep changing the .dts and
kernel code in lock-step.

2)

This patch removes a bunch of tables from the kernel. I like having the
tables in the kernel, since in theory it could allow a future debugfs or
sysfs interface to pinctrl that allows manipulation of the pinctrl HW
state at a semantic level. This is only possible if the DT binding
includes details such as "set this pin to this function", and the driver
includes the tables to convert that into details such as register
address and value. I don't think such an "API" could be implemented for
IMX after this patch. Still, given the IMX binding already merged "pin"
and "function" into a single integer in the binding, I'm not sure if IMX
could support that kind of "API" before anyway?

This is part of the reason I pushed hard for the pinctrl APIs to operate
at the semantic pin/group/function level, and that Tegra's pinctrl
drivers explicitly have tables listing all the pins/groups/functions,
rather than just putting a bunch of register values into the DT.

I'm not sure how much of an issue this is, though. LinusW and/or the DT
maintainers should probably chime in here.

I didn't actually read the driver implementation changes in this patch.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-20 18:46       ` Stephen Warren
@ 2013-02-21  0:03           ` Matt Sealey
  -1 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-21  0:03 UTC (permalink / raw)
  To: Stephen Warren
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Wed, Feb 20, 2013 at 12:46 PM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>> This turns the imx pin function number defined by binding document
>> into #define constants in header which can be used in dts and handled
>> by pre-processor to improve the readability of device tree sources.
>
>> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt
>
>> -See below for available PIN_FUNC_ID for imx35:
>> -0 MX35_PAD_CAPTURE__GPT_CAPIN1
> ...
>> -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
>> +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.
>
> So that path is specific to the Linux kernel. The DT binding
> documentation isn't supposed to be specific to the Linux kernel.

I have to violently NACK this patchset for this very reason.

Shawn, we've discussed this before!

Please try not to use the device tree to "help" Linux drivers somehow
look up internal Linux data. This means the device tree is not
portable to other operating systems without copying out data from a
GPL source to a non-GPL source if this is required, meaning device
trees ONLY apply to Linux, and as Stephen pointed out, this is bad.
You cannot have ANY entries in the device tree that cannot be
described outside of the device tree or explained away directly in the
binding (i.e. you can get around this by making a PDF of the binding
and pasting that include data in there, but that is obtuse). Having a
binding that maps an arbitrary string (and these strings ARE arbitrary
since "pin" 951 maps to nowhere but a big array).

Please also do not use the device tree to "help" people "read" the
device tree. A device tree is not meant to be human-readable, it's
meant to be machine-parseable. It has the same fundamental concept as
XML - if you read an XML file and are pulling information out of it
with your eyes and brain you are Doing It Wrong. You're supposed to
use an XML parser. However, that does not stop people with the
appropriate talents writing XML files in a text editor using their
knowledge of syntax. We are all programmers here - and board
designers. Nobody else is going to be writing device tree data,
certainly not a secretary or someone who doesn't understand what 3
pairs of hexadecimal values does.

XML has comments, and so do device trees. Preprocessing the device
tree is to convert pin names into values not something anyone who
designs boards will be doing. Most board designers don't even use
Freescale's IOMUX gui tool. Neither will programmers think "pasting in
a huge arbitrary string" is any easier than "pasting in 6 values from
an appropriate reference". Programmers will also add comments, as
already existed, if they need to cross-reference which pin this is
without decoding a number in their heads. These comments get stripped
when it's compiled. Comments are not enemies.

By simply pasting in the 3 pairs into your target device tree, all the
values would be directly referenced in the documentation of the
appropriate processor. They would be internally consistent - i.e. no
data structures (even macros) referenced that end up living outside
the device tree itself.

Here is an idea; write some documentation (in the pin binding if you
like) that essentially looks like the C header, only without the
#define part. Put that directly in the binding as *examples*.
Programmers and board designers doing initial bring-up can use these
as a quick reference that SUPPLEMENTS the information in the CPU
manual.

As examples for developers of device trees it will come in much
handier than having preprocessing go on. In the event that - in very
many circumstances - the default pin configuration in the list from
the binding document is not relevant to your board (if pullups or
pulldowns or logic inverters are present on the PCB rather than
derived in pad settings) then you will end up copying some of them as
reference and pasting it in and modifying the values anyway, so

        MX51_PIN_X__SD3_DAT4 nnnn

In my device tree doesn't work. I will have to intersperse
preprocessor items with real values for the chip making it terrible to
debug device trees, and defeating the preprocessing step. What your
patch will do, implicitly, is encourage people to *ADD* pad settings
as a reference to the binding, which is the mess we got into with the
old macro solution in the first place (when a pin config doesn't
match, you have to add pins to the include and give it a new name..) -
so this ends up in my target board tree as

        MX51_PIN_X__SD3_DAT1 nnnn
        MX51_PIN_X__SD3_DAT2 nnnn
        MX51_PIN_X__SD3_DAT3 nnnn
        aaa bbb ccc xxx yyy zzz /* MX51_PIN_X_SD3_DAT4 with some mod I did */
        MX51_PIN_X__SD3_WP nnnn
        ddd eee fff uuu vvv www /* MX51_PIN_X__SD3_CD logic is on PCB */
        /* und so weiter */

How does preprocessing the tree here help? What you end up with after
preprocessing is 3 pairs of values in any event. Why not just paste
them into the tree directly and use comments?

Also, since the #define NAME_OF_PIN__FUNCTION is arbitrary (only the
part of the name before the double underscore exists in docs, and
sometimes this changes between chip revisions) it helps nobody.

Also, since the pad config value is STILL using the silly SION bit
information, that would have to go away too (please, please, do not
put a magic SION bit in the PAD configuration value. It doesn't go
into this register and means the driver has to mask out the value and
do special work...)

Preprocessing device trees is useful to keep redundant or repeatative
data out of a single device tree (for instance, if a chip has 24 timer
modules all absolutely identical except the address and an interrupt
number, but there are 10 other information items that are identical,
this is a target for preprocessing and expanding a macro). It
shouldn't be used to allow storing "data" (i.e. arbitrary lists or
tables) in any other place than the device tree (besides the processor
documentation shipped by the vendor) as a clever way to "clean up"
trees to make them more "readable".

I am not sure I am getting this point across, but.. damn it.. nack nack nack :D

--
Matt Sealey <matt-sEEEE4iEDtaXzmuOJsdVMQ@public.gmane.org>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21  0:03           ` Matt Sealey
  0 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-21  0:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 20, 2013 at 12:46 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>> This turns the imx pin function number defined by binding document
>> into #define constants in header which can be used in dts and handled
>> by pre-processor to improve the readability of device tree sources.
>
>> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt
>
>> -See below for available PIN_FUNC_ID for imx35:
>> -0 MX35_PAD_CAPTURE__GPT_CAPIN1
> ...
>> -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
>> +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.
>
> So that path is specific to the Linux kernel. The DT binding
> documentation isn't supposed to be specific to the Linux kernel.

I have to violently NACK this patchset for this very reason.

Shawn, we've discussed this before!

Please try not to use the device tree to "help" Linux drivers somehow
look up internal Linux data. This means the device tree is not
portable to other operating systems without copying out data from a
GPL source to a non-GPL source if this is required, meaning device
trees ONLY apply to Linux, and as Stephen pointed out, this is bad.
You cannot have ANY entries in the device tree that cannot be
described outside of the device tree or explained away directly in the
binding (i.e. you can get around this by making a PDF of the binding
and pasting that include data in there, but that is obtuse). Having a
binding that maps an arbitrary string (and these strings ARE arbitrary
since "pin" 951 maps to nowhere but a big array).

Please also do not use the device tree to "help" people "read" the
device tree. A device tree is not meant to be human-readable, it's
meant to be machine-parseable. It has the same fundamental concept as
XML - if you read an XML file and are pulling information out of it
with your eyes and brain you are Doing It Wrong. You're supposed to
use an XML parser. However, that does not stop people with the
appropriate talents writing XML files in a text editor using their
knowledge of syntax. We are all programmers here - and board
designers. Nobody else is going to be writing device tree data,
certainly not a secretary or someone who doesn't understand what 3
pairs of hexadecimal values does.

XML has comments, and so do device trees. Preprocessing the device
tree is to convert pin names into values not something anyone who
designs boards will be doing. Most board designers don't even use
Freescale's IOMUX gui tool. Neither will programmers think "pasting in
a huge arbitrary string" is any easier than "pasting in 6 values from
an appropriate reference". Programmers will also add comments, as
already existed, if they need to cross-reference which pin this is
without decoding a number in their heads. These comments get stripped
when it's compiled. Comments are not enemies.

By simply pasting in the 3 pairs into your target device tree, all the
values would be directly referenced in the documentation of the
appropriate processor. They would be internally consistent - i.e. no
data structures (even macros) referenced that end up living outside
the device tree itself.

Here is an idea; write some documentation (in the pin binding if you
like) that essentially looks like the C header, only without the
#define part. Put that directly in the binding as *examples*.
Programmers and board designers doing initial bring-up can use these
as a quick reference that SUPPLEMENTS the information in the CPU
manual.

As examples for developers of device trees it will come in much
handier than having preprocessing go on. In the event that - in very
many circumstances - the default pin configuration in the list from
the binding document is not relevant to your board (if pullups or
pulldowns or logic inverters are present on the PCB rather than
derived in pad settings) then you will end up copying some of them as
reference and pasting it in and modifying the values anyway, so

        MX51_PIN_X__SD3_DAT4 nnnn

In my device tree doesn't work. I will have to intersperse
preprocessor items with real values for the chip making it terrible to
debug device trees, and defeating the preprocessing step. What your
patch will do, implicitly, is encourage people to *ADD* pad settings
as a reference to the binding, which is the mess we got into with the
old macro solution in the first place (when a pin config doesn't
match, you have to add pins to the include and give it a new name..) -
so this ends up in my target board tree as

        MX51_PIN_X__SD3_DAT1 nnnn
        MX51_PIN_X__SD3_DAT2 nnnn
        MX51_PIN_X__SD3_DAT3 nnnn
        aaa bbb ccc xxx yyy zzz /* MX51_PIN_X_SD3_DAT4 with some mod I did */
        MX51_PIN_X__SD3_WP nnnn
        ddd eee fff uuu vvv www /* MX51_PIN_X__SD3_CD logic is on PCB */
        /* und so weiter */

How does preprocessing the tree here help? What you end up with after
preprocessing is 3 pairs of values in any event. Why not just paste
them into the tree directly and use comments?

Also, since the #define NAME_OF_PIN__FUNCTION is arbitrary (only the
part of the name before the double underscore exists in docs, and
sometimes this changes between chip revisions) it helps nobody.

Also, since the pad config value is STILL using the silly SION bit
information, that would have to go away too (please, please, do not
put a magic SION bit in the PAD configuration value. It doesn't go
into this register and means the driver has to mask out the value and
do special work...)

Preprocessing device trees is useful to keep redundant or repeatative
data out of a single device tree (for instance, if a chip has 24 timer
modules all absolutely identical except the address and an interrupt
number, but there are 10 other information items that are identical,
this is a target for preprocessing and expanding a macro). It
shouldn't be used to allow storing "data" (i.e. arbitrary lists or
tables) in any other place than the device tree (besides the processor
documentation shipped by the vendor) as a clever way to "clean up"
trees to make them more "readable".

I am not sure I am getting this point across, but.. damn it.. nack nack nack :D

--
Matt Sealey <matt@genesi-usa.com>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21  0:03           ` Matt Sealey
@ 2013-02-21  0:34               ` Stephen Warren
  -1 siblings, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-21  0:34 UTC (permalink / raw)
  To: Matt Sealey
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On 02/20/2013 05:03 PM, Matt Sealey wrote:
> On Wed, Feb 20, 2013 at 12:46 PM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
>> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>>> This turns the imx pin function number defined by binding document
>>> into #define constants in header which can be used in dts and handled
>>> by pre-processor to improve the readability of device tree sources.
>>
>>> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt
>>
>>> -See below for available PIN_FUNC_ID for imx35:
>>> -0 MX35_PAD_CAPTURE__GPT_CAPIN1
>> ...
>>> -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
>>> +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.
>>
>> So that path is specific to the Linux kernel. The DT binding
>> documentation isn't supposed to be specific to the Linux kernel.
> 
> I have to violently NACK this patchset for this very reason.
> 
> Shawn, we've discussed this before!
> 
> Please try not to use the device tree to "help" Linux drivers somehow
> look up internal Linux data. This means the device tree is not
> portable to other operating systems without copying out data from a
> GPL source to a non-GPL source if this is required, meaning device
> trees ONLY apply to Linux, and as Stephen pointed out, this is bad.

I believe my comment was directed somewhere a little different than
yours are.

My comment was simply that the *pathname* of the header file
imx35-pinfunc.h was Linux-specific. I would advocate replacing it with
e.g. <dt-bindings/pinctrl/imx35-pinfunc.h>. My belief is that the header
file is *part* of the binding, and so there will be a tree (currently
Documentation/devicetree/bindings in the kernel's copy) that contains
the *.txt bindings, and another tree (which I'm proposing storing in
include/dt-bindings as the kernel's copy) which contains the header
files, and which is known as the source of include files reference under
<dt-bindings/>.

Re: the license question: What is the license of the DT bindings
documentation? I don't recall having seen any license header in any of
the files, so I'd have to assume they're all GPLv2 since that's the
license of the kernel. Hence, Shawn having licensed his new headers
under the same license explicitly seems entirely consistent.

> You cannot have ANY entries in the device tree that cannot be
> described outside of the device tree or explained away directly in the
> binding

Sure. But note that I explicitly consider the header files as part of
the binding; it's just that for tabular/constant data, it's more
convenient to represent it in a header file than a more free-form table
in the DT binding document itself.

> (i.e. you can get around this by making a PDF of the binding
> and pasting that include data in there, but that is obtuse). Having a
> binding that maps an arbitrary string (and these strings ARE arbitrary
> since "pin" 951 maps to nowhere but a big array).
> 
> Please also do not use the device tree to "help" people "read" the
> device tree. A device tree is not meant to be human-readable, it's
> meant to be machine-parseable.

Just because something is machine parseable doesn't mean it shouldn't
also be human readable. Your argument could be applied to any piece of C
code too; it's meant for consumption by the compiler, so it doesn't
matter if people can read or maintain it?

> It has the same fundamental concept as
> XML - if you read an XML file and are pulling information out of it
> with your eyes and brain you are Doing It Wrong. You're supposed to
> use an XML parser. However, that does not stop people with the
> appropriate talents writing XML files in a text editor using their
> knowledge of syntax. We are all programmers here - and board
> designers. Nobody else is going to be writing device tree data,
> certainly not a secretary or someone who doesn't understand what 3
> pairs of hexadecimal values does.

Understanding is one thing. Nobody is going to argue against that. The
issue is remembering which bits are which, accidental typos that aren't
obvious, etc.

> XML has comments, and so do device trees. Preprocessing the device
> tree is to convert pin names into values not something anyone who
> designs boards will be doing.

You state that as fact, but I disagree.

> Most board designers don't even use
> Freescale's IOMUX gui tool. Neither will programmers think "pasting in
> a huge arbitrary string" is any easier than "pasting in 6 values from
> an appropriate reference".

That's simply not true. I and Shawn are both programmers, and we would
find using a CPP macro name to set up GPIO IDs, IRQ/GPIO flags, etc.
much easier than referring to a DT binding document, manually or'ing
some bits together, and writing the result into the .dts file. It's
simply error-prone to do this manually, and unreadable after it's done.

> Programmers will also add comments, as
> already existed, if they need to cross-reference which pin this is
> without decoding a number in their heads. These comments get stripped
> when it's compiled. Comments are not enemies.

Comments aren't compiled. So, it's easy to make a typo and get a comment
right but the integer value they comment on wrong. By using
defines/macros, the values *are* comments, just in a human-readable form.

> By simply pasting in the 3 pairs into your target device tree, all the
> values would be directly referenced in the documentation of the
> appropriate processor. They would be internally consistent - i.e. no
> data structures (even macros) referenced that end up living outside
> the device tree itself.
> 
> Here is an idea; write some documentation (in the pin binding if you
> like) that essentially looks like the C header, only without the
> #define part. Put that directly in the binding as *examples*.
> Programmers and board designers doing initial bring-up can use these
> as a quick reference that SUPPLEMENTS the information in the CPU
> manual.
> 
> As examples for developers of device trees it will come in much
> handier than having preprocessing go on. In the event that - in very
> many circumstances - the default pin configuration in the list from
> the binding document is not relevant to your board (if pullups or
> pulldowns or logic inverters are present on the PCB rather than
> derived in pad settings) then you will end up copying some of them as
> reference and pasting it in and modifying the values anyway, so
> 
>         MX51_PIN_X__SD3_DAT4 nnnn
> 
> In my device tree doesn't work. I will have to intersperse
> preprocessor items with real values for the chip making it terrible to
> debug device trees, and defeating the preprocessing step. What your
> patch will do, implicitly, is encourage people to *ADD* pad settings
> as a reference to the binding, which is the mess we got into with the
> old macro solution in the first place (when a pin config doesn't
> match, you have to add pins to the include and give it a new name..) -
> so this ends up in my target board tree as
> 
>         MX51_PIN_X__SD3_DAT1 nnnn
>         MX51_PIN_X__SD3_DAT2 nnnn
>         MX51_PIN_X__SD3_DAT3 nnnn
>         aaa bbb ccc xxx yyy zzz /* MX51_PIN_X_SD3_DAT4 with some mod I did */
>         MX51_PIN_X__SD3_WP nnnn
>         ddd eee fff uuu vvv www /* MX51_PIN_X__SD3_CD logic is on PCB */
>         /* und so weiter */
> 
> How does preprocessing the tree here help? What you end up with after
> preprocessing is 3 pairs of values in any event. Why not just paste
> them into the tree directly and use comments?

Sorry, I'm having a hard time understanding that. The header should
already contain all defined fields/values, so there wouldn't be a need
to add more to it. If something ended up missing through oversight, it'd
be entirely appropriate to add it. I can't see why you'd end up with a
mix of defines and literals.

> Also, since the #define NAME_OF_PIN__FUNCTION is arbitrary (only the
> part of the name before the double underscore exists in docs, and
> sometimes this changes between chip revisions) it helps nobody.

The value is arbitrary.

The concept of selecting a specific pinmux function on a particular pin
is certainly something that exists in HW. It's the very purpose of a
pinmux IP block, and there are explicitly register fields for it.

The fact that the IMX binding has a single integer that represents both
the pin ID and the function muxed onto it, rather than separately
representing the pin ID and the function as separate cells/fields does
admittedly seem rather odd to me. However, that fact already exists now,
before this patch, and so isn't anything to do with this patch.

> Preprocessing device trees is useful to keep redundant or repeatative
> data out of a single device tree (for instance, if a chip has 24 timer
> modules all absolutely identical except the address and an interrupt
> number, but there are 10 other information items that are identical,
> this is a target for preprocessing and expanding a macro). It
> shouldn't be used to allow storing "data" (i.e. arbitrary lists or
> tables) in any other place than the device tree (besides the processor
> documentation shipped by the vendor) as a clever way to "clean up"
> trees to make them more "readable".
> 
> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D

Well, I certainly understand you don't want to use defines instead of
literals, but the simple fact is that many people writing device trees
/do/ very explicitly want that.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21  0:34               ` Stephen Warren
  0 siblings, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-21  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/20/2013 05:03 PM, Matt Sealey wrote:
> On Wed, Feb 20, 2013 at 12:46 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>>> This turns the imx pin function number defined by binding document
>>> into #define constants in header which can be used in dts and handled
>>> by pre-processor to improve the readability of device tree sources.
>>
>>> diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt
>>
>>> -See below for available PIN_FUNC_ID for imx35:
>>> -0 MX35_PAD_CAPTURE__GPT_CAPIN1
>> ...
>>> -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
>>> +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.
>>
>> So that path is specific to the Linux kernel. The DT binding
>> documentation isn't supposed to be specific to the Linux kernel.
> 
> I have to violently NACK this patchset for this very reason.
> 
> Shawn, we've discussed this before!
> 
> Please try not to use the device tree to "help" Linux drivers somehow
> look up internal Linux data. This means the device tree is not
> portable to other operating systems without copying out data from a
> GPL source to a non-GPL source if this is required, meaning device
> trees ONLY apply to Linux, and as Stephen pointed out, this is bad.

I believe my comment was directed somewhere a little different than
yours are.

My comment was simply that the *pathname* of the header file
imx35-pinfunc.h was Linux-specific. I would advocate replacing it with
e.g. <dt-bindings/pinctrl/imx35-pinfunc.h>. My belief is that the header
file is *part* of the binding, and so there will be a tree (currently
Documentation/devicetree/bindings in the kernel's copy) that contains
the *.txt bindings, and another tree (which I'm proposing storing in
include/dt-bindings as the kernel's copy) which contains the header
files, and which is known as the source of include files reference under
<dt-bindings/>.

Re: the license question: What is the license of the DT bindings
documentation? I don't recall having seen any license header in any of
the files, so I'd have to assume they're all GPLv2 since that's the
license of the kernel. Hence, Shawn having licensed his new headers
under the same license explicitly seems entirely consistent.

> You cannot have ANY entries in the device tree that cannot be
> described outside of the device tree or explained away directly in the
> binding

Sure. But note that I explicitly consider the header files as part of
the binding; it's just that for tabular/constant data, it's more
convenient to represent it in a header file than a more free-form table
in the DT binding document itself.

> (i.e. you can get around this by making a PDF of the binding
> and pasting that include data in there, but that is obtuse). Having a
> binding that maps an arbitrary string (and these strings ARE arbitrary
> since "pin" 951 maps to nowhere but a big array).
> 
> Please also do not use the device tree to "help" people "read" the
> device tree. A device tree is not meant to be human-readable, it's
> meant to be machine-parseable.

Just because something is machine parseable doesn't mean it shouldn't
also be human readable. Your argument could be applied to any piece of C
code too; it's meant for consumption by the compiler, so it doesn't
matter if people can read or maintain it?

> It has the same fundamental concept as
> XML - if you read an XML file and are pulling information out of it
> with your eyes and brain you are Doing It Wrong. You're supposed to
> use an XML parser. However, that does not stop people with the
> appropriate talents writing XML files in a text editor using their
> knowledge of syntax. We are all programmers here - and board
> designers. Nobody else is going to be writing device tree data,
> certainly not a secretary or someone who doesn't understand what 3
> pairs of hexadecimal values does.

Understanding is one thing. Nobody is going to argue against that. The
issue is remembering which bits are which, accidental typos that aren't
obvious, etc.

> XML has comments, and so do device trees. Preprocessing the device
> tree is to convert pin names into values not something anyone who
> designs boards will be doing.

You state that as fact, but I disagree.

> Most board designers don't even use
> Freescale's IOMUX gui tool. Neither will programmers think "pasting in
> a huge arbitrary string" is any easier than "pasting in 6 values from
> an appropriate reference".

That's simply not true. I and Shawn are both programmers, and we would
find using a CPP macro name to set up GPIO IDs, IRQ/GPIO flags, etc.
much easier than referring to a DT binding document, manually or'ing
some bits together, and writing the result into the .dts file. It's
simply error-prone to do this manually, and unreadable after it's done.

> Programmers will also add comments, as
> already existed, if they need to cross-reference which pin this is
> without decoding a number in their heads. These comments get stripped
> when it's compiled. Comments are not enemies.

Comments aren't compiled. So, it's easy to make a typo and get a comment
right but the integer value they comment on wrong. By using
defines/macros, the values *are* comments, just in a human-readable form.

> By simply pasting in the 3 pairs into your target device tree, all the
> values would be directly referenced in the documentation of the
> appropriate processor. They would be internally consistent - i.e. no
> data structures (even macros) referenced that end up living outside
> the device tree itself.
> 
> Here is an idea; write some documentation (in the pin binding if you
> like) that essentially looks like the C header, only without the
> #define part. Put that directly in the binding as *examples*.
> Programmers and board designers doing initial bring-up can use these
> as a quick reference that SUPPLEMENTS the information in the CPU
> manual.
> 
> As examples for developers of device trees it will come in much
> handier than having preprocessing go on. In the event that - in very
> many circumstances - the default pin configuration in the list from
> the binding document is not relevant to your board (if pullups or
> pulldowns or logic inverters are present on the PCB rather than
> derived in pad settings) then you will end up copying some of them as
> reference and pasting it in and modifying the values anyway, so
> 
>         MX51_PIN_X__SD3_DAT4 nnnn
> 
> In my device tree doesn't work. I will have to intersperse
> preprocessor items with real values for the chip making it terrible to
> debug device trees, and defeating the preprocessing step. What your
> patch will do, implicitly, is encourage people to *ADD* pad settings
> as a reference to the binding, which is the mess we got into with the
> old macro solution in the first place (when a pin config doesn't
> match, you have to add pins to the include and give it a new name..) -
> so this ends up in my target board tree as
> 
>         MX51_PIN_X__SD3_DAT1 nnnn
>         MX51_PIN_X__SD3_DAT2 nnnn
>         MX51_PIN_X__SD3_DAT3 nnnn
>         aaa bbb ccc xxx yyy zzz /* MX51_PIN_X_SD3_DAT4 with some mod I did */
>         MX51_PIN_X__SD3_WP nnnn
>         ddd eee fff uuu vvv www /* MX51_PIN_X__SD3_CD logic is on PCB */
>         /* und so weiter */
> 
> How does preprocessing the tree here help? What you end up with after
> preprocessing is 3 pairs of values in any event. Why not just paste
> them into the tree directly and use comments?

Sorry, I'm having a hard time understanding that. The header should
already contain all defined fields/values, so there wouldn't be a need
to add more to it. If something ended up missing through oversight, it'd
be entirely appropriate to add it. I can't see why you'd end up with a
mix of defines and literals.

> Also, since the #define NAME_OF_PIN__FUNCTION is arbitrary (only the
> part of the name before the double underscore exists in docs, and
> sometimes this changes between chip revisions) it helps nobody.

The value is arbitrary.

The concept of selecting a specific pinmux function on a particular pin
is certainly something that exists in HW. It's the very purpose of a
pinmux IP block, and there are explicitly register fields for it.

The fact that the IMX binding has a single integer that represents both
the pin ID and the function muxed onto it, rather than separately
representing the pin ID and the function as separate cells/fields does
admittedly seem rather odd to me. However, that fact already exists now,
before this patch, and so isn't anything to do with this patch.

> Preprocessing device trees is useful to keep redundant or repeatative
> data out of a single device tree (for instance, if a chip has 24 timer
> modules all absolutely identical except the address and an interrupt
> number, but there are 10 other information items that are identical,
> this is a target for preprocessing and expanding a macro). It
> shouldn't be used to allow storing "data" (i.e. arbitrary lists or
> tables) in any other place than the device tree (besides the processor
> documentation shipped by the vendor) as a clever way to "clean up"
> trees to make them more "readable".
> 
> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D

Well, I certainly understand you don't want to use defines instead of
literals, but the simple fact is that many people writing device trees
/do/ very explicitly want that.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-20 18:46       ` Stephen Warren
@ 2013-02-21  4:59           ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  4:59 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Rob Herring, Uwe Kleine-König, Dong Aisheng,
	devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Feb 20, 2013 at 11:46:41AM -0700, Stephen Warren wrote:
> On 02/20/2013 12:08 AM, Shawn Guo wrote:
> > This turns the imx pin function number defined by binding document
> > into #define constants in header which can be used in dts and handled
> > by pre-processor to improve the readability of device tree sources.
> 
> > diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt
> 
> > -See below for available PIN_FUNC_ID for imx35:
> > -0 MX35_PAD_CAPTURE__GPT_CAPIN1
> ...
> > -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
> > +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.
> 
> So that path is specific to the Linux kernel.

The only reason for that is device tree sources are currently sitting
in the Linux kernel tree.  I can reword it as below.

Refer to imx35-pinfunc.h in the device tree source folder for all
available imx35 PIN_FUNC_ID.

> The DT binding
> documentation isn't supposed to be specific to the Linux kernel. I
> wonder if we shouldn't put all the header files into
> Documentation/devicetree/bindings rather than arch/*/boot/dts. That way,
> you could encode relative path names into the DT binding docs. The
> headers are logically part of the documentation anyway.
> 
> This all plays into whatever plans exist for removing the DT binding
> docs and/or .dts files from the kernel, and how things will end up
> getting laid out then though. That's something we should discuss with at
> least Grant and Rob. I note that the DT maintainers weren't Cc'd on this
> series though. I added them for this reply.
> 
> Perhaps I should just send a patch to the dtc and kernel include paths
> which implements that, and see what people say.
> 
> > diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt
> 
> >  See below for available PIN_FUNC_ID for imx6q:
> > -MX6Q_PAD_SD2_DAT1__USDHC2_DAT1			0
> 
> You forgot to add a reference to the header filename to this file.

Thanks, just added it.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21  4:59           ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  4:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 20, 2013 at 11:46:41AM -0700, Stephen Warren wrote:
> On 02/20/2013 12:08 AM, Shawn Guo wrote:
> > This turns the imx pin function number defined by binding document
> > into #define constants in header which can be used in dts and handled
> > by pre-processor to improve the readability of device tree sources.
> 
> > diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx35-pinctrl.txt
> 
> > -See below for available PIN_FUNC_ID for imx35:
> > -0 MX35_PAD_CAPTURE__GPT_CAPIN1
> ...
> > -951 MX35_PAD_TEST_MODE__TCU_TEST_MODE
> > +Refer to arch/arm/boot/dts/imx35-pinfunc.h for all available imx35 PIN_FUNC_ID.
> 
> So that path is specific to the Linux kernel.

The only reason for that is device tree sources are currently sitting
in the Linux kernel tree.  I can reword it as below.

Refer to imx35-pinfunc.h in the device tree source folder for all
available imx35 PIN_FUNC_ID.

> The DT binding
> documentation isn't supposed to be specific to the Linux kernel. I
> wonder if we shouldn't put all the header files into
> Documentation/devicetree/bindings rather than arch/*/boot/dts. That way,
> you could encode relative path names into the DT binding docs. The
> headers are logically part of the documentation anyway.
> 
> This all plays into whatever plans exist for removing the DT binding
> docs and/or .dts files from the kernel, and how things will end up
> getting laid out then though. That's something we should discuss with at
> least Grant and Rob. I note that the DT maintainers weren't Cc'd on this
> series though. I added them for this reply.
> 
> Perhaps I should just send a patch to the dtc and kernel include paths
> which implements that, and see what people say.
> 
> > diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx6q-pinctrl.txt
> 
> >  See below for available PIN_FUNC_ID for imx6q:
> > -MX6Q_PAD_SD2_DAT1__USDHC2_DAT1			0
> 
> You forgot to add a reference to the header filename to this file.

Thanks, just added it.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21  0:03           ` Matt Sealey
@ 2013-02-21  5:02               ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  5:02 UTC (permalink / raw)
  To: Matt Sealey
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> 
Do you see any downgrade side that the series introduces over the
existing implementation?

Sorry, I do not really understand your nack.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21  5:02               ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  5:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> 
Do you see any downgrade side that the series introduces over the
existing implementation?

Sorry, I do not really understand your nack.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
  2013-02-20 19:04       ` Stephen Warren
@ 2013-02-21  5:30           ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  5:30 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Rob Herring, Uwe Kleine-König, Dong Aisheng,
	devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Feb 20, 2013 at 12:04:58PM -0700, Stephen Warren wrote:
> There are a couple of potential issues with this patch, which I'm in two
> minds about:
> 
> 1)
> 
> This is an incompatible change to the DT binding definition. A DT
> written to the old specification won't work with a newer kernel and
> vice-versa. This isn't supposed to happen with device tree.
> 
> Right now I believe we're still being flexible about DT binding changes,
> but I've seen hints that this kind of thing will start getting lots of
> push-back in the near future...
> 
Last time I heard of the time frame about doing this is when we get
device tree source maintained in a separate repository from the kernel
tree.  I'm not sure how far we're still away from that.  But most of
sub-architectures (including IMX) have not been converted over to
device tree.  And as far as I know, none of IMX based product runs
device tree kernel yet.  So I think at least for IMX we are still
in a phase of being flexible about DT binding changes.

> That all said, I'd also love to change the Tegra pinctrl binding now
> that we have CPP, since I could replace all the strings in the current
> binding with integers and presumably save some space in the .dtb. Hence,
> I'd love to maintain the flexibility to keep changing the .dts and
> kernel code in lock-step.
> 
> 2)
> 
> This patch removes a bunch of tables from the kernel. I like having the
> tables in the kernel, since in theory it could allow a future debugfs or
> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
> state at a semantic level. This is only possible if the DT binding
> includes details such as "set this pin to this function", and the driver
> includes the tables to convert that into details such as register
> address and value. I don't think such an "API" could be implemented for
> IMX after this patch. Still, given the IMX binding already merged "pin"
> and "function" into a single integer in the binding, I'm not sure if IMX
> could support that kind of "API" before anyway?
> 
Right, we do not support that even before the patch.  As the platform
maintainer and user, I do not think this kind of support is so useful
for IMX.

> This is part of the reason I pushed hard for the pinctrl APIs to operate
> at the semantic pin/group/function level, and that Tegra's pinctrl
> drivers explicitly have tables listing all the pins/groups/functions,
> rather than just putting a bunch of register values into the DT.
> 
> I'm not sure how much of an issue this is, though. LinusW and/or the DT
> maintainers should probably chime in here.
> 
IIRC, LinusW said it can be a decision of platform.

Shawn

> I didn't actually read the driver implementation changes in this patch.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
@ 2013-02-21  5:30           ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  5:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 20, 2013 at 12:04:58PM -0700, Stephen Warren wrote:
> There are a couple of potential issues with this patch, which I'm in two
> minds about:
> 
> 1)
> 
> This is an incompatible change to the DT binding definition. A DT
> written to the old specification won't work with a newer kernel and
> vice-versa. This isn't supposed to happen with device tree.
> 
> Right now I believe we're still being flexible about DT binding changes,
> but I've seen hints that this kind of thing will start getting lots of
> push-back in the near future...
> 
Last time I heard of the time frame about doing this is when we get
device tree source maintained in a separate repository from the kernel
tree.  I'm not sure how far we're still away from that.  But most of
sub-architectures (including IMX) have not been converted over to
device tree.  And as far as I know, none of IMX based product runs
device tree kernel yet.  So I think at least for IMX we are still
in a phase of being flexible about DT binding changes.

> That all said, I'd also love to change the Tegra pinctrl binding now
> that we have CPP, since I could replace all the strings in the current
> binding with integers and presumably save some space in the .dtb. Hence,
> I'd love to maintain the flexibility to keep changing the .dts and
> kernel code in lock-step.
> 
> 2)
> 
> This patch removes a bunch of tables from the kernel. I like having the
> tables in the kernel, since in theory it could allow a future debugfs or
> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
> state at a semantic level. This is only possible if the DT binding
> includes details such as "set this pin to this function", and the driver
> includes the tables to convert that into details such as register
> address and value. I don't think such an "API" could be implemented for
> IMX after this patch. Still, given the IMX binding already merged "pin"
> and "function" into a single integer in the binding, I'm not sure if IMX
> could support that kind of "API" before anyway?
> 
Right, we do not support that even before the patch.  As the platform
maintainer and user, I do not think this kind of support is so useful
for IMX.

> This is part of the reason I pushed hard for the pinctrl APIs to operate
> at the semantic pin/group/function level, and that Tegra's pinctrl
> drivers explicitly have tables listing all the pins/groups/functions,
> rather than just putting a bunch of register values into the DT.
> 
> I'm not sure how much of an issue this is, though. LinusW and/or the DT
> maintainers should probably chime in here.
> 
IIRC, LinusW said it can be a decision of platform.

Shawn

> I didn't actually read the driver implementation changes in this patch.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
  2013-02-20  9:44   ` [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree Dong Aisheng
@ 2013-02-21  6:04     ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-21  6:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 20, 2013 at 05:44:09PM +0800, Dong Aisheng wrote:
> > @@ -24,9 +24,9 @@ Required properties for iomux controller:
> >  Required properties for pin configuration node:
> >  - fsl,pins: two integers array, represents a group of pins mux and config
> >    setting. The format is fsl,pins = <PIN_FUNC_ID CONFIG>, PIN_FUNC_ID is
> > -  pin working on a specific function, CONFIG is the pad setting value like
> > -  pull-up on this pin. Please refer to fsl,<soc>-pinctrl.txt for the valid
> > -  pins and functions of each SoC.
> > +  pin working on a specific function, which consists of a tuple of <pinid
> > +  mux_reg conf_reg input_reg mux_val input_val>.  CONFIG is the pad setting
> > +  value like pull-up on this pin.
> 
> Since we actually do not have a PIN_FUNC_ID anymore, i would suggest
> totoally remove this concept in both doc and code.
> 
Nothing really changed about PIN_FUNC_ID except it's a tuple of
numbers now.  So the concept is still there.

> > +/*
> > + * The pin function ID is a tuple of
> > + * <pinid mux_reg conf_reg input_reg mux_val input_val>
> > + */
> > +#define MX6Q_PAD_SD2_DAT1__USDHC2_DAT1                 0x000 0x04c 0x360 0x000 0x0 0x0
> 
> The original table generated does not have pinid, so you manually added it here?

The only goal about the patch is to move the data in that big array of
struct imx_pin_reg out of kernel.  Doesn't the struct have the pinid
encoded there before?

> Since the pin id is really created by us, maybe we could try to remove it
> and dynamically generate the pin id.

I actually thought about that, but decided to encode the pin id into
PIN_FUNC_ID for the reasons below.

 * I did not figure out a easy way to dynamically generate the pin id
 * Even we have a way to dynamically generate it, it might not match
   the existing pin id used in driver, which means we need to renumber
   the enum imxXX_pads.
 * Since pin id is a type of hard-coding value that pinctrl driver
   figures out from hardware manual and reports to pinctrl subsystem
   statically, I do not see why we have to dynamically generate it
   when it's not easy to do.

> Then user does not need to care about id anymore.
> 
> > +/*
> > + * Each pin represented in fsl,pins consists of 6 u32 PIN_FUNC_ID and
> 
> We could remove PIN_FUNC_ID.
> 
> > + * 1 u32 CONFIG, so 28 types in total for each pin.
> > + */
> > +#define FSL_PIN_SIZE 28
> >
> >  static int imx_pinctrl_parse_groups(struct device_node *np,
> >                                     struct imx_pin_group *grp,
> >                                     struct imx_pinctrl_soc_info *info,
> >                                     u32 index)
> >  {
> > -       unsigned int pin_func_id;
> > -       int ret, size;
> > +       int size;
> >         const __be32 *list;
> > -       int i, j;
> > +       int i;
> >         u32 config;
> >
> >         dev_dbg(info->dev, "group(%d): %s\n", index, np->name);
> > @@ -447,32 +401,36 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
> >          */
> >         list = of_get_property(np, "fsl,pins", &size);
> >         /* we do not check return since it's safe node passed down */
> > -       size /= sizeof(*list);
> 
> Is this wrongly deleted?
> 
No, it's not.

> > -       if (!size || size % 2) {
> > -               dev_err(info->dev, "wrong pins number or pins and configs should be pairs\n");
> > +       if (!size || size % FSL_PIN_SIZE) {
> > +               dev_err(info->dev, "Invalid fsl,pins property\n");
> >                 return -EINVAL;
> >         }
> >
> > -       grp->npins = size / 2;
> > +       grp->npins = size / FSL_PIN_SIZE;
> >         grp->pins = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
> >                                 GFP_KERNEL);
> >         grp->mux_mode = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
> >                                 GFP_KERNEL);
> > +       grp->input_val = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned int),
> > +                               GFP_KERNEL);
> >         grp->configs = devm_kzalloc(info->dev, grp->npins * sizeof(unsigned long),
> >                                 GFP_KERNEL);
> > -       for (i = 0, j = 0; i < size; i += 2, j++) {
> > -               pin_func_id = be32_to_cpu(*list++);
> > -               ret = imx_pinctrl_get_pin_id_and_mux(info, pin_func_id,
> > -                                       &grp->pins[j], &grp->mux_mode[j]);
> > -               if (ret) {
> > -                       dev_err(info->dev, "get invalid pin function id\n");
> > -                       return -EINVAL;
> > -               }
> > +       for (i = 0; i < grp->npins; i++) {
> > +               unsigned int pin_id = be32_to_cpu(*list++);
> > +               struct imx_pin_reg *pin_reg = &info->pin_regs[pin_id];
> > +
> > +               grp->pins[i] = pin_id;
> > +               pin_reg->mux_reg = be32_to_cpu(*list++);
> > +               pin_reg->conf_reg = be32_to_cpu(*list++);
> > +               pin_reg->input_reg = be32_to_cpu(*list++);
> > +               grp->mux_mode[i] = be32_to_cpu(*list++);
> > +               grp->input_val[i] = be32_to_cpu(*list++);
> > +
> >                 /* SION bit is in mux register */
> >                 config = be32_to_cpu(*list++);
> >                 if (config & IMX_PAD_SION)
> > -                       grp->mux_mode[j] |= IOMUXC_CONFIG_SION;
> > -               grp->configs[j] = config & ~IMX_PAD_SION;
> > +                       grp->mux_mode[i] |= IOMUXC_CONFIG_SION;
> > +               grp->configs[i] = config & ~IMX_PAD_SION;
> >         }
> >
> >  #ifdef DEBUG
> > @@ -568,8 +526,7 @@ int imx_pinctrl_probe(struct platform_device *pdev,
> >         struct resource *res;
> >         int ret;
> >
> > -       if (!info || !info->pins || !info->npins
> > -                 || !info->pin_regs || !info->npin_regs) {
> > +       if (!info || !info->pins || !info->npins) {
> >                 dev_err(&pdev->dev, "wrong pinctrl info\n");
> >                 return -EINVAL;
> >         }
> > @@ -580,6 +537,11 @@ int imx_pinctrl_probe(struct platform_device *pdev,
> >         if (!ipctl)
> >                 return -ENOMEM;
> >
> > +       info->pin_regs = devm_kzalloc(&pdev->dev, sizeof(*info->pin_regs) *
> > +                                     info->npins, GFP_KERNEL);
> 
> Since we only record the used pins from device tree, it seems not make too much
> sense to create pin_regs for everypin no matter wheter it's used or not.
> I would suggest to put the pin_regs info into group,
> then we do not need info->pin_regs anymore.
> What do you think?
> 
I thought about doing that.  What I do not like about that is the
register offset data for one pin will have multiple copies in different
groups, if the pin happens to be in several groups.

Shawn 

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
  2013-02-21  5:30           ` Shawn Guo
@ 2013-02-21  7:55               ` Sascha Hauer
  -1 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-21  7:55 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, Feb 21, 2013 at 01:30:22PM +0800, Shawn Guo wrote:
> On Wed, Feb 20, 2013 at 12:04:58PM -0700, Stephen Warren wrote:
> > There are a couple of potential issues with this patch, which I'm in two
> > minds about:
> > 
> > 1)
> > 
> > This is an incompatible change to the DT binding definition. A DT
> > written to the old specification won't work with a newer kernel and
> > vice-versa. This isn't supposed to happen with device tree.
> > 
> > Right now I believe we're still being flexible about DT binding changes,
> > but I've seen hints that this kind of thing will start getting lots of
> > push-back in the near future...
> > 
> Last time I heard of the time frame about doing this is when we get
> device tree source maintained in a separate repository from the kernel
> tree.  I'm not sure how far we're still away from that.  But most of
> sub-architectures (including IMX) have not been converted over to
> device tree.  And as far as I know, none of IMX based product runs
> device tree kernel yet.

The nature of open source makes it hard to know which devices ship out
there, so please don't assume there are none just because you know of
none.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
@ 2013-02-21  7:55               ` Sascha Hauer
  0 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-21  7:55 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 21, 2013 at 01:30:22PM +0800, Shawn Guo wrote:
> On Wed, Feb 20, 2013 at 12:04:58PM -0700, Stephen Warren wrote:
> > There are a couple of potential issues with this patch, which I'm in two
> > minds about:
> > 
> > 1)
> > 
> > This is an incompatible change to the DT binding definition. A DT
> > written to the old specification won't work with a newer kernel and
> > vice-versa. This isn't supposed to happen with device tree.
> > 
> > Right now I believe we're still being flexible about DT binding changes,
> > but I've seen hints that this kind of thing will start getting lots of
> > push-back in the near future...
> > 
> Last time I heard of the time frame about doing this is when we get
> device tree source maintained in a separate repository from the kernel
> tree.  I'm not sure how far we're still away from that.  But most of
> sub-architectures (including IMX) have not been converted over to
> device tree.  And as far as I know, none of IMX based product runs
> device tree kernel yet.

The nature of open source makes it hard to know which devices ship out
there, so please don't assume there are none just because you know of
none.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
  2013-02-20 19:04       ` Stephen Warren
@ 2013-02-21  9:36           ` Dong Aisheng
  -1 siblings, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-21  9:36 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Rob Herring, Uwe Kleine-König, devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 21 February 2013 03:04, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>> Currently, all imx pinctrl drivers maintain a big array of struct
>> imx_pin_reg which hard-codes data like register offset and mux mode
>> setting for each pin function.  Every time a new imx SoC support is
>> added, we need to add such a big mount of data.  With moving to single
>> kernel build, it's only matter of time to be blamed on memory consuming.
>>
>> With DTC pre-processor support in place, the patch moves all these data
>> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
>> changing the PIN_FUNC_ID parsing code a little bit.
>
> There are a couple of potential issues with this patch, which I'm in two
> minds about:
>
> 1)
>
> This is an incompatible change to the DT binding definition. A DT
> written to the old specification won't work with a newer kernel and
> vice-versa. This isn't supposed to happen with device tree.
>
> Right now I believe we're still being flexible about DT binding changes,
> but I've seen hints that this kind of thing will start getting lots of
> push-back in the near future...
>
I wonder it may be hard to avoid it, especially for some complicated devices or
non-standard devices during development process.
No sure if any better way to control it.

> That all said, I'd also love to change the Tegra pinctrl binding now
> that we have CPP, since I could replace all the strings in the current
> binding with integers and presumably save some space in the .dtb. Hence,
> I'd love to maintain the flexibility to keep changing the .dts and
> kernel code in lock-step.
>
> 2)
>
> This patch removes a bunch of tables from the kernel. I like having the
> tables in the kernel, since in theory it could allow a future debugfs or
> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
> state at a semantic level.

Right, that's one of the considerations why i kept the register table in driver
in the first binding design.

> This is only possible if the DT binding
> includes details such as "set this pin to this function", and the driver
> includes the tables to convert that into details such as register
> address and value. I don't think such an "API" could be implemented for
> IMX after this patch.

Theoretically It can, because device tree contains the pin registers
informations
in this way. But the problem is that it can only manipulate the used pins which
are parsed from devices tree. While for those unused pins, since the driver does
not have the pin register information, it can not manipulate it.
But what i'm wondering now is do we really need to manipulate the unused pins
from sysfs or debugfs?
I still can not think out a real using case now.
Anyone else can think one?

> Still, given the IMX binding already merged "pin"
> and "function" into a single integer in the binding, I'm not sure if IMX
> could support that kind of "API" before anyway?
>
At least PIN config could support.
For PIN mux, it may also be implementable since we have all the needed
information
for a pin in driver whether it's used or not.

Regards
Dong Aisheng

> This is part of the reason I pushed hard for the pinctrl APIs to operate
> at the semantic pin/group/function level, and that Tegra's pinctrl
> drivers explicitly have tables listing all the pins/groups/functions,
> rather than just putting a bunch of register values into the DT.
>
> I'm not sure how much of an issue this is, though. LinusW and/or the DT
> maintainers should probably chime in here.
>
> I didn't actually read the driver implementation changes in this patch.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
@ 2013-02-21  9:36           ` Dong Aisheng
  0 siblings, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-21  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 21 February 2013 03:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>> Currently, all imx pinctrl drivers maintain a big array of struct
>> imx_pin_reg which hard-codes data like register offset and mux mode
>> setting for each pin function.  Every time a new imx SoC support is
>> added, we need to add such a big mount of data.  With moving to single
>> kernel build, it's only matter of time to be blamed on memory consuming.
>>
>> With DTC pre-processor support in place, the patch moves all these data
>> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
>> changing the PIN_FUNC_ID parsing code a little bit.
>
> There are a couple of potential issues with this patch, which I'm in two
> minds about:
>
> 1)
>
> This is an incompatible change to the DT binding definition. A DT
> written to the old specification won't work with a newer kernel and
> vice-versa. This isn't supposed to happen with device tree.
>
> Right now I believe we're still being flexible about DT binding changes,
> but I've seen hints that this kind of thing will start getting lots of
> push-back in the near future...
>
I wonder it may be hard to avoid it, especially for some complicated devices or
non-standard devices during development process.
No sure if any better way to control it.

> That all said, I'd also love to change the Tegra pinctrl binding now
> that we have CPP, since I could replace all the strings in the current
> binding with integers and presumably save some space in the .dtb. Hence,
> I'd love to maintain the flexibility to keep changing the .dts and
> kernel code in lock-step.
>
> 2)
>
> This patch removes a bunch of tables from the kernel. I like having the
> tables in the kernel, since in theory it could allow a future debugfs or
> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
> state at a semantic level.

Right, that's one of the considerations why i kept the register table in driver
in the first binding design.

> This is only possible if the DT binding
> includes details such as "set this pin to this function", and the driver
> includes the tables to convert that into details such as register
> address and value. I don't think such an "API" could be implemented for
> IMX after this patch.

Theoretically It can, because device tree contains the pin registers
informations
in this way. But the problem is that it can only manipulate the used pins which
are parsed from devices tree. While for those unused pins, since the driver does
not have the pin register information, it can not manipulate it.
But what i'm wondering now is do we really need to manipulate the unused pins
from sysfs or debugfs?
I still can not think out a real using case now.
Anyone else can think one?

> Still, given the IMX binding already merged "pin"
> and "function" into a single integer in the binding, I'm not sure if IMX
> could support that kind of "API" before anyway?
>
At least PIN config could support.
For PIN mux, it may also be implementable since we have all the needed
information
for a pin in driver whether it's used or not.

Regards
Dong Aisheng

> This is part of the reason I pushed hard for the pinctrl APIs to operate
> at the semantic pin/group/function level, and that Tegra's pinctrl
> drivers explicitly have tables listing all the pins/groups/functions,
> rather than just putting a bunch of register values into the DT.
>
> I'm not sure how much of an issue this is, though. LinusW and/or the DT
> maintainers should probably chime in here.
>
> I didn't actually read the driver implementation changes in this patch.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21  5:02               ` Shawn Guo
@ 2013-02-21 17:36                   ` Matt Sealey
  -1 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-21 17:36 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
>> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
>>
> Do you see any downgrade side that the series introduces over the
> existing implementation?

Because it replaces the horribly stupid existing implementation with
something that doesn't solve the fundamental logical problems caused
by the existing implementation. There are three completely obvious
logical inconsistencies with the existing implementation of a pair of
<arbitrary_pin_index pad_mode>;

1) the pin index is completely arbitrary and in any binding every
published for any of these SoC, either broken by design (MX5 and MX6
have duplicated pin data soaking up arbitrary pin ids in the current
binding, or are not defined in SoC register order (i.e. arbitrary
renumbering).

2) the pin index is not internally consistent within the device tree
binding - it is a reference to an array inside source code. Your patch
hopes to solve this, but also hopes to solve other things too. It
fails on the second part.

3) the pad setting value has been hijacked to include bits that
otherwise would not be set in the same register (SION bit and a
special flag to mean, set up everything except the pad settings)

What you've fixed it to do, as I read this patch, is this;

<arbitrary_pin_name pad_mode>

which the preprocessor expands to;

<reg_mux mux_mode reg_insel insel_mode reg_pad pad_mode>

The real problem here is as follows;

1) the pin name and function name are still completely arbitrary (in
so far as the old iomux.h macros way, the newer iomux-v3.h way, the
current bindings and the new binding you're pushing do not match the
CPU documentation at all)

2) copy pasting a line of 5 values from an example document and adding
your pad mode bits to the end is no more time consuming or
space-consuming than copying a 38-character macro name. New board
designs will use data from the FSL IOMUX tool or other sources and not
bother using macro definitions to define pads.

3) macros can be wrong and they will inherit into every device tree,
breaking every board that uses them. That said, so can the examples,
but at least reading the device tree for a board you can cross-check
all the values against, say, the output of many tools provided by
Freescale or existing code or platform support without doing a back
reference or preprocessing the device tree and removing comments).

I am a big fan of a device tree, in and of itself, being internally
consistent (I keep using that phrase, and I mean it). That means not
only does it not try and reference any magic outside data inside some
other code (e.g. table indices in arbitrary packing and format) but it
also does not cause a chain of cross-referencing where values are
hidden behind other values. To confirm device tree pinctrl settings
with this patch I need to preprocess my device tree - and then go over
the output with all my comments stripped out to look at the arrays of
numbers the macros produce. I have therefore five references to look
at: my original device tree (unprocessed, commented), the macro
definitions, the preprocessed output (macros expanded, comments
stripped by preprocessor), and the actual CPU documentation and board
schematics/design data that the values are all derived from.

Why would anyone here need anything more than the device tree as
unprocessed data with comments, and the CPU documentation and board
data defining the function? We cut here 5 down to 3. You cannot do
without these 3 - you cannot magically "guess" that a pad setting will
work just because a macro has the correct name.

In the event a macro does not exist, people will end up either adding
that macro (therefore changing the binding constantly, since the
macros are part of the binding) or putting in the raw values to avoid
the preprocessor. There's a really good reason standards documents
don't change that often; standards need to be frozen and we're not
talking here about freezing standards, but allowing opportunities for
constant, "agile" development of the board boot process and driver
data passing.

I would rather that we go think of a better solution here. We're using
a preprocessor and just using it to expand a name into another value -
why don't we actually use macros to ease the coding of the device tree
entries? That way data isn't moved elsewhere, but the macro can easily
check ranges and report errors in values.. for instance, instead of

MX51_PIN_EIM_23__GPIO1_2 0x6528

<
MUX_REG(0x174) ALT(0x5|SION) INS_REG(0x3d8) INS(0x7) PAD_REG(0x654)
PAD(0x7633|PU_100K), /* MX51_EIM_23 GPIO1_2 */
>;

With the ability to expand the bits required - adding SION ot the ALT
mode, using macros to define the pin bits instead of an opaque value.
Stick a comment after it and it's clear the definition. Copy paste
that into a tree and preprocess it and it becomes the same 6 values,
but in the tree itself it is clear which registers are set (you can
search the docs for these values, where the semi-arbitrary pin naming
scheme in the binding does NOT have a *clearly* searchable part) and
the macro can confirm you didn't put a weird value in there (in this
case, all the registers are in certain ranges and all of them are
32-bit aligned so some extra parsing can be done).

Or even one big macro - IOMUXV3(MX51_EIM_23_GPIO__1_2, 0x174,
0x5|SION, 0x3d8, 0x7, 0x654, 0x7633|PU_100K),

Just discard the first argument, validate the rest against masks etc.
and alignment, and off you go. No information is lost internally to
the tree.

This way we get a little closer back to the original FSL BSP method of
defining iomux and the values above are directly copyable from the
iomux tool, existing source code, bootloaders, other operating systems
(licensing notwithstanding) and hand-written scribbles by the board
designers. There was nothing wrong with this, but there has been some
significant refactoring going on that does not make functionality any
better and has only been done with a view to reduce the precompiled
file size of some arbitrary file - because a descriptive string is
seemingly "better" than the actual values. By reducing the amount of
real data actually contained in the source tree, you make the source
code harder to verify. By increasing the amount of needless
cross-referencing and obfuscation of the real data, you increase the
difficulty of actually creating device trees. This is especially true
since none of the CPU docs or board design data will use any of the
semantics of the "Linux" side of the binding - but they WILL use
register values and ball grids and data from IBIS models.

> Sorry, I do not really understand your nack.

Simple; I've been designing with device trees since before the
arch/ppc->arch/powerpc move, with real OpenFirmware, with a good
understanding of the original specifications and bindings, the intents
and the correct ways of doing things. I figure out board designs,
requirements and then do the software on prototype boards and final
consumer-facing and industrial designs.

Every incremental improvement to the iomux definition model has made
it harder to use; to the point that without keeping track of this list
and then going through and comparing the models it is very, very
difficult to go from older code to new device trees. I've set the task
of porting one board or another to a modern device tree and the
engineers end up asking what the hell is going on with the new method.
That means I have to figure it out myself and train them; and every
time, it gets more and more difficult to explain WHY it's being done
the way it's currently done in lieu of the much easier methods in the
past.

If we go from my point of view - and I take a somewhat "holistic"
approach to product design - what we're doing here is increasing time
to market because I can't use existing tools or existing code to
manage the bring-up of a new design. Unfortunately, in my experience,
there isn't a board engineer on the planet who designs his board from
the firmware binding upwards, and certainly not by "how Linux wants to
do it."

In the "fight" between the best hardware design and bringing up the
software, it pains me to have to add more work to the schedule.

Preprocessing trees is a really nice functional improvement, but this
patch only serves to change nothing (by obfuscating the real data
*behind* a binding) or increase work for programmers taking design
data into a tree. It may look like since there is "less data" in the
tree it is easier to check, but that is not the case and has never
been the case. Also, the data in the binding sometimes does not match
the board design because the current bindings are entirely derived
from existing boards - some of which are not implementing current
design methodologies with the appropriate SoCs or using errata
workarounds for hardware components, which means all these pin
definitions may not apply - do we add a new macro to the binding to
support it or just paste in 6 values for the same effect? How does
that make the device trees look? Ugly? Yes. But they're not meant to
be pretty. Having an aligned list of exactly-the-same-length strings
in a column gains you NOTHING above using the real values and adding a
comment.

It is not the purpose of the device tree concept to "make your driver
code smaller" by encoding information that is easily attainable at
runtime. The tree needs to provide enough information, however, to
make that information easily attainable. That stipulation is also true
of the readability of device trees - just as XML developers do not
read data out by hand, but use parsers, so do we do with device trees.
Just as XML developers hand-code their XML files sometimes, we
sometimes hand-code our device trees. But most XML processing is
machine-driven and translating data from one format to another, to and
from XML. There is always input data, though. That input data must be
clearly defined. The less easy it is to read a device tree entry and
figure out what the crap it was for, the harder it is to verify it's
correctness. Moving values into the preprocessor stage does nothing
except turn an array of seemingly obtuse, uncommented values into a
string literal. I say, use the obtuse values and comment them in your
trees. Use the preprocessor for VALIDATION of those values (or
expansion of offset into absolute address for example), but not for
generation. You are adding too many steps between writing the tree and
the final binary output.

If we do have full C preprocessor support for a device tree now then
we should use the preprocessor to it's fullest, rather than using it
as an overcomplicated replacement for "sed" or "awk".

--
Matt Sealey <matt-sEEEE4iEDtaXzmuOJsdVMQ@public.gmane.org>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21 17:36                   ` Matt Sealey
  0 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-21 17:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
>> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
>>
> Do you see any downgrade side that the series introduces over the
> existing implementation?

Because it replaces the horribly stupid existing implementation with
something that doesn't solve the fundamental logical problems caused
by the existing implementation. There are three completely obvious
logical inconsistencies with the existing implementation of a pair of
<arbitrary_pin_index pad_mode>;

1) the pin index is completely arbitrary and in any binding every
published for any of these SoC, either broken by design (MX5 and MX6
have duplicated pin data soaking up arbitrary pin ids in the current
binding, or are not defined in SoC register order (i.e. arbitrary
renumbering).

2) the pin index is not internally consistent within the device tree
binding - it is a reference to an array inside source code. Your patch
hopes to solve this, but also hopes to solve other things too. It
fails on the second part.

3) the pad setting value has been hijacked to include bits that
otherwise would not be set in the same register (SION bit and a
special flag to mean, set up everything except the pad settings)

What you've fixed it to do, as I read this patch, is this;

<arbitrary_pin_name pad_mode>

which the preprocessor expands to;

<reg_mux mux_mode reg_insel insel_mode reg_pad pad_mode>

The real problem here is as follows;

1) the pin name and function name are still completely arbitrary (in
so far as the old iomux.h macros way, the newer iomux-v3.h way, the
current bindings and the new binding you're pushing do not match the
CPU documentation at all)

2) copy pasting a line of 5 values from an example document and adding
your pad mode bits to the end is no more time consuming or
space-consuming than copying a 38-character macro name. New board
designs will use data from the FSL IOMUX tool or other sources and not
bother using macro definitions to define pads.

3) macros can be wrong and they will inherit into every device tree,
breaking every board that uses them. That said, so can the examples,
but at least reading the device tree for a board you can cross-check
all the values against, say, the output of many tools provided by
Freescale or existing code or platform support without doing a back
reference or preprocessing the device tree and removing comments).

I am a big fan of a device tree, in and of itself, being internally
consistent (I keep using that phrase, and I mean it). That means not
only does it not try and reference any magic outside data inside some
other code (e.g. table indices in arbitrary packing and format) but it
also does not cause a chain of cross-referencing where values are
hidden behind other values. To confirm device tree pinctrl settings
with this patch I need to preprocess my device tree - and then go over
the output with all my comments stripped out to look at the arrays of
numbers the macros produce. I have therefore five references to look
at: my original device tree (unprocessed, commented), the macro
definitions, the preprocessed output (macros expanded, comments
stripped by preprocessor), and the actual CPU documentation and board
schematics/design data that the values are all derived from.

Why would anyone here need anything more than the device tree as
unprocessed data with comments, and the CPU documentation and board
data defining the function? We cut here 5 down to 3. You cannot do
without these 3 - you cannot magically "guess" that a pad setting will
work just because a macro has the correct name.

In the event a macro does not exist, people will end up either adding
that macro (therefore changing the binding constantly, since the
macros are part of the binding) or putting in the raw values to avoid
the preprocessor. There's a really good reason standards documents
don't change that often; standards need to be frozen and we're not
talking here about freezing standards, but allowing opportunities for
constant, "agile" development of the board boot process and driver
data passing.

I would rather that we go think of a better solution here. We're using
a preprocessor and just using it to expand a name into another value -
why don't we actually use macros to ease the coding of the device tree
entries? That way data isn't moved elsewhere, but the macro can easily
check ranges and report errors in values.. for instance, instead of

MX51_PIN_EIM_23__GPIO1_2 0x6528

<
MUX_REG(0x174) ALT(0x5|SION) INS_REG(0x3d8) INS(0x7) PAD_REG(0x654)
PAD(0x7633|PU_100K), /* MX51_EIM_23 GPIO1_2 */
>;

With the ability to expand the bits required - adding SION ot the ALT
mode, using macros to define the pin bits instead of an opaque value.
Stick a comment after it and it's clear the definition. Copy paste
that into a tree and preprocess it and it becomes the same 6 values,
but in the tree itself it is clear which registers are set (you can
search the docs for these values, where the semi-arbitrary pin naming
scheme in the binding does NOT have a *clearly* searchable part) and
the macro can confirm you didn't put a weird value in there (in this
case, all the registers are in certain ranges and all of them are
32-bit aligned so some extra parsing can be done).

Or even one big macro - IOMUXV3(MX51_EIM_23_GPIO__1_2, 0x174,
0x5|SION, 0x3d8, 0x7, 0x654, 0x7633|PU_100K),

Just discard the first argument, validate the rest against masks etc.
and alignment, and off you go. No information is lost internally to
the tree.

This way we get a little closer back to the original FSL BSP method of
defining iomux and the values above are directly copyable from the
iomux tool, existing source code, bootloaders, other operating systems
(licensing notwithstanding) and hand-written scribbles by the board
designers. There was nothing wrong with this, but there has been some
significant refactoring going on that does not make functionality any
better and has only been done with a view to reduce the precompiled
file size of some arbitrary file - because a descriptive string is
seemingly "better" than the actual values. By reducing the amount of
real data actually contained in the source tree, you make the source
code harder to verify. By increasing the amount of needless
cross-referencing and obfuscation of the real data, you increase the
difficulty of actually creating device trees. This is especially true
since none of the CPU docs or board design data will use any of the
semantics of the "Linux" side of the binding - but they WILL use
register values and ball grids and data from IBIS models.

> Sorry, I do not really understand your nack.

Simple; I've been designing with device trees since before the
arch/ppc->arch/powerpc move, with real OpenFirmware, with a good
understanding of the original specifications and bindings, the intents
and the correct ways of doing things. I figure out board designs,
requirements and then do the software on prototype boards and final
consumer-facing and industrial designs.

Every incremental improvement to the iomux definition model has made
it harder to use; to the point that without keeping track of this list
and then going through and comparing the models it is very, very
difficult to go from older code to new device trees. I've set the task
of porting one board or another to a modern device tree and the
engineers end up asking what the hell is going on with the new method.
That means I have to figure it out myself and train them; and every
time, it gets more and more difficult to explain WHY it's being done
the way it's currently done in lieu of the much easier methods in the
past.

If we go from my point of view - and I take a somewhat "holistic"
approach to product design - what we're doing here is increasing time
to market because I can't use existing tools or existing code to
manage the bring-up of a new design. Unfortunately, in my experience,
there isn't a board engineer on the planet who designs his board from
the firmware binding upwards, and certainly not by "how Linux wants to
do it."

In the "fight" between the best hardware design and bringing up the
software, it pains me to have to add more work to the schedule.

Preprocessing trees is a really nice functional improvement, but this
patch only serves to change nothing (by obfuscating the real data
*behind* a binding) or increase work for programmers taking design
data into a tree. It may look like since there is "less data" in the
tree it is easier to check, but that is not the case and has never
been the case. Also, the data in the binding sometimes does not match
the board design because the current bindings are entirely derived
from existing boards - some of which are not implementing current
design methodologies with the appropriate SoCs or using errata
workarounds for hardware components, which means all these pin
definitions may not apply - do we add a new macro to the binding to
support it or just paste in 6 values for the same effect? How does
that make the device trees look? Ugly? Yes. But they're not meant to
be pretty. Having an aligned list of exactly-the-same-length strings
in a column gains you NOTHING above using the real values and adding a
comment.

It is not the purpose of the device tree concept to "make your driver
code smaller" by encoding information that is easily attainable at
runtime. The tree needs to provide enough information, however, to
make that information easily attainable. That stipulation is also true
of the readability of device trees - just as XML developers do not
read data out by hand, but use parsers, so do we do with device trees.
Just as XML developers hand-code their XML files sometimes, we
sometimes hand-code our device trees. But most XML processing is
machine-driven and translating data from one format to another, to and
from XML. There is always input data, though. That input data must be
clearly defined. The less easy it is to read a device tree entry and
figure out what the crap it was for, the harder it is to verify it's
correctness. Moving values into the preprocessor stage does nothing
except turn an array of seemingly obtuse, uncommented values into a
string literal. I say, use the obtuse values and comment them in your
trees. Use the preprocessor for VALIDATION of those values (or
expansion of offset into absolute address for example), but not for
generation. You are adding too many steps between writing the tree and
the final binary output.

If we do have full C preprocessor support for a device tree now then
we should use the preprocessor to it's fullest, rather than using it
as an overcomplicated replacement for "sed" or "awk".

--
Matt Sealey <matt@genesi-usa.com>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21 17:36                   ` Matt Sealey
@ 2013-02-21 17:57                       ` Matt Sealey
  -1 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-21 17:57 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

I feel like I should be more concise, so here are what I would
consider MY goals for iomux definition on Freescale processors;

Freescale provide spreadsheets, GUI tools and XML and C header output
for the iomux model.

If you can't copy it right from the documentation or a script or
program (C, Python, whatever) any of the above into a device tree
without first encoding or parsing the binding in a suitable format for
the program, then the binding is not desirable - for me, at least. If
we can't go back to the original data from BSP kernels and port it to
new device trees without a 3-step cross-reference and a preprocessing
step for verification, you are adding items to my in tray...

Usually it's spit out from the IOMUX tool as XML and example C source
(with certain definitions) with header files for the chip so you can
drop it right into your bringup tool, bootloader, OS or whatever.
Using that as a reference worked fine - it's register offsets
(absolute from IOMUX tool), values. Copy pasting from the spreadsheet
worked fine. Printing out the docs page and marking the bits worked
fine. You're now telling me with this patchset that I have to have
another documentation source and additionally verify that it even
applies to the board by comparing it to all of the above.

Therefore, nack :D

Either use the preprocessor to really verify the data, but don't use
it just to turn 5 values into a string literal.

-- 
Matt Sealey <matt-sEEEE4iEDtaXzmuOJsdVMQ@public.gmane.org>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21 17:57                       ` Matt Sealey
  0 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-21 17:57 UTC (permalink / raw)
  To: linux-arm-kernel

I feel like I should be more concise, so here are what I would
consider MY goals for iomux definition on Freescale processors;

Freescale provide spreadsheets, GUI tools and XML and C header output
for the iomux model.

If you can't copy it right from the documentation or a script or
program (C, Python, whatever) any of the above into a device tree
without first encoding or parsing the binding in a suitable format for
the program, then the binding is not desirable - for me, at least. If
we can't go back to the original data from BSP kernels and port it to
new device trees without a 3-step cross-reference and a preprocessing
step for verification, you are adding items to my in tray...

Usually it's spit out from the IOMUX tool as XML and example C source
(with certain definitions) with header files for the chip so you can
drop it right into your bringup tool, bootloader, OS or whatever.
Using that as a reference worked fine - it's register offsets
(absolute from IOMUX tool), values. Copy pasting from the spreadsheet
worked fine. Printing out the docs page and marking the bits worked
fine. You're now telling me with this patchset that I have to have
another documentation source and additionally verify that it even
applies to the board by comparing it to all of the above.

Therefore, nack :D

Either use the preprocessor to really verify the data, but don't use
it just to turn 5 values into a string literal.

-- 
Matt Sealey <matt@genesi-usa.com>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
  2013-02-21  9:36           ` Dong Aisheng
@ 2013-02-21 19:57               ` Stephen Warren
  -1 siblings, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-21 19:57 UTC (permalink / raw)
  To: Dong Aisheng
  Cc: Rob Herring, Uwe Kleine-König, devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On 02/21/2013 02:36 AM, Dong Aisheng wrote:
> On 21 February 2013 03:04, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
>> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>>> Currently, all imx pinctrl drivers maintain a big array of struct
>>> imx_pin_reg which hard-codes data like register offset and mux mode
>>> setting for each pin function.  Every time a new imx SoC support is
>>> added, we need to add such a big mount of data.  With moving to single
>>> kernel build, it's only matter of time to be blamed on memory consuming.
>>>
>>> With DTC pre-processor support in place, the patch moves all these data
>>> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
>>> changing the PIN_FUNC_ID parsing code a little bit.
...
>> This patch removes a bunch of tables from the kernel. I like having the
>> tables in the kernel, since in theory it could allow a future debugfs or
>> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
>> state at a semantic level.
> 
> Right, that's one of the considerations why i kept the register table in driver
> in the first binding design.
> 
>> This is only possible if the DT binding
>> includes details such as "set this pin to this function", and the driver
>> includes the tables to convert that into details such as register
>> address and value. I don't think such an "API" could be implemented for
>> IMX after this patch.
> 
> Theoretically It can, because device tree contains the pin registers
> informations

> in this way. But the problem is that it can only manipulate the used pins which
> are parsed from devices tree. While for those unused pins, since the driver does
> not have the pin register information, it can not manipulate it.

Right, that's the main issue I was trying to highlight; the driver no
longer provides complete knowledge of the HW, but only learns about
stuff that happens to be used/defined in the board-specific DT.

> But what i'm wondering now is do we really need to manipulate the unused pins
> from sysfs or debugfs?
> I still can not think out a real using case now.
> Anyone else can think one?

For early board bringup, it may be useful to boot with a minimal set of
entries in the DT (enough to support e.g. serial console and some device
for a root filesystem) and then interactively tweak the rest of the
pinmux to define the rest of the board, and perhaps even save the result
somehow, and add it to the next iteration of the DT.

Also, consider a hobbyist-oriented board that has 50 unused pins that
could be GPIO, or mapped to some otherwise unused SD, I2C, SPI, ...
controller. Do we want to force the user to write a new DT and reboot,
or would it be better to provide some runtime API to set up those pins
based on what they had connected to the board, and then instantiate
drivers or use the sysfs GPIO interface, after doing so?

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
@ 2013-02-21 19:57               ` Stephen Warren
  0 siblings, 0 replies; 55+ messages in thread
From: Stephen Warren @ 2013-02-21 19:57 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/21/2013 02:36 AM, Dong Aisheng wrote:
> On 21 February 2013 03:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 02/20/2013 12:08 AM, Shawn Guo wrote:
>>> Currently, all imx pinctrl drivers maintain a big array of struct
>>> imx_pin_reg which hard-codes data like register offset and mux mode
>>> setting for each pin function.  Every time a new imx SoC support is
>>> added, we need to add such a big mount of data.  With moving to single
>>> kernel build, it's only matter of time to be blamed on memory consuming.
>>>
>>> With DTC pre-processor support in place, the patch moves all these data
>>> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
>>> changing the PIN_FUNC_ID parsing code a little bit.
...
>> This patch removes a bunch of tables from the kernel. I like having the
>> tables in the kernel, since in theory it could allow a future debugfs or
>> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
>> state at a semantic level.
> 
> Right, that's one of the considerations why i kept the register table in driver
> in the first binding design.
> 
>> This is only possible if the DT binding
>> includes details such as "set this pin to this function", and the driver
>> includes the tables to convert that into details such as register
>> address and value. I don't think such an "API" could be implemented for
>> IMX after this patch.
> 
> Theoretically It can, because device tree contains the pin registers
> informations

> in this way. But the problem is that it can only manipulate the used pins which
> are parsed from devices tree. While for those unused pins, since the driver does
> not have the pin register information, it can not manipulate it.

Right, that's the main issue I was trying to highlight; the driver no
longer provides complete knowledge of the HW, but only learns about
stuff that happens to be used/defined in the board-specific DT.

> But what i'm wondering now is do we really need to manipulate the unused pins
> from sysfs or debugfs?
> I still can not think out a real using case now.
> Anyone else can think one?

For early board bringup, it may be useful to boot with a minimal set of
entries in the DT (enough to support e.g. serial console and some device
for a root filesystem) and then interactively tweak the rest of the
pinmux to define the rest of the board, and perhaps even save the result
somehow, and add it to the next iteration of the DT.

Also, consider a hobbyist-oriented board that has 50 unused pins that
could be GPIO, or mapped to some otherwise unused SD, I2C, SPI, ...
controller. Do we want to force the user to write a new DT and reboot,
or would it be better to provide some runtime API to set up those pins
based on what they had connected to the board, and then instantiate
drivers or use the sysfs GPIO interface, after doing so?

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21 17:36                   ` Matt Sealey
@ 2013-02-21 21:43                       ` Sascha Hauer
  -1 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-21 21:43 UTC (permalink / raw)
  To: Matt Sealey
  Cc: Dong Aisheng, devicetree-discuss, Rob Herring,
	Uwe Kleine-König, Linux ARM Kernel ML

On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> >>
> > Do you see any downgrade side that the series introduces over the
> > existing implementation?
> 
> Because it replaces the horribly stupid existing implementation with
> something that doesn't solve the fundamental logical problems caused
> by the existing implementation. There are three completely obvious
> logical inconsistencies with the existing implementation of a pair of
> <arbitrary_pin_index pad_mode>;
> 
> 1) the pin index is completely arbitrary and in any binding every
> published for any of these SoC, either broken by design (MX5 and MX6
> have duplicated pin data soaking up arbitrary pin ids in the current
> binding, or are not defined in SoC register order (i.e. arbitrary
> renumbering).

The pin index is indeed completely arbitrary, mostly because the iomuxv3
does not make it possible to number pins. More sane SoCs offered that,
there a Pin number could be easily translated into a register offset. I
don't know what drugs the FSL engineers have taken to come up with a
register layout in which each pin is configured via three register sets
which do not stand in any relationship to each other.

Unfortunately the pinctrl framework forces us to use a pin index as it
needs something to detect resource conflicts. BUT, I think I agree here
with you: This pin number should not be exposed to the devicetree, it
only adds a level of indirection.

> 
> 2) the pin index is not internally consistent within the device tree
> binding - it is a reference to an array inside source code. Your patch
> hopes to solve this, but also hopes to solve other things too. It
> fails on the second part.
> 
> 3) the pad setting value has been hijacked to include bits that
> otherwise would not be set in the same register (SION bit and a
> special flag to mean, set up everything except the pad settings)
> 
> What you've fixed it to do, as I read this patch, is this;
> 
> <arbitrary_pin_name pad_mode>
> 
> which the preprocessor expands to;
> 
> <reg_mux mux_mode reg_insel insel_mode reg_pad pad_mode>
> 
> The real problem here is as follows;
> 
> 1) the pin name and function name are still completely arbitrary (in
> so far as the old iomux.h macros way, the newer iomux-v3.h way, the
> current bindings and the new binding you're pushing do not match the
> CPU documentation at all)
> 
> 2) copy pasting a line of 5 values from an example document and adding
> your pad mode bits to the end is no more time consuming or
> space-consuming than copying a 38-character macro name. New board
> designs will use data from the FSL IOMUX tool or other sources and not
> bother using macro definitions to define pads.
> 
> 3) macros can be wrong and they will inherit into every device tree,
> breaking every board that uses them. That said, so can the examples,
> but at least reading the device tree for a board you can cross-check
> all the values against, say, the output of many tools provided by
> Freescale or existing code or platform support without doing a back
> reference or preprocessing the device tree and removing comments).
>

Yes, macros can be wrong, but they tend to get fixed. Duplicated
information almost never gets fixed in all instances they occur.

> 
> MX51_PIN_EIM_23__GPIO1_2 0x6528
> 
> <
> MUX_REG(0x174) ALT(0x5|SION) INS_REG(0x3d8) INS(0x7) PAD_REG(0x654)
> PAD(0x7633|PU_100K), /* MX51_EIM_23 GPIO1_2 */
> >;

This is basically what the current iomux header do, only that we added
the mux/padctrl/selinput register triplet to a single macro. This in my
eyes still makes sense, because digging through the datasheet guessing
that for a single pin I have to configure registers 0x174, 0x3d8 and
0x654 is cumbersome.

Where it became ugly is the predefined values for pullup/dse.

Yes, I would really like to have something like you describe above in
the devicetree together with the register triplets as handy macros.
Also I still like the <pinname>__<function> naming since that's another
thing I don't have to look up in the datasheet everytime.
If your data comes from the iomux tool then you simply wouldn't use the
register triplet macros.

This would leave the question how we make up a pin number for the
pinctrl framework, but as said, this should be solved inside the kernel
and not pushed into the devicetree.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-21 21:43                       ` Sascha Hauer
  0 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-21 21:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> >>
> > Do you see any downgrade side that the series introduces over the
> > existing implementation?
> 
> Because it replaces the horribly stupid existing implementation with
> something that doesn't solve the fundamental logical problems caused
> by the existing implementation. There are three completely obvious
> logical inconsistencies with the existing implementation of a pair of
> <arbitrary_pin_index pad_mode>;
> 
> 1) the pin index is completely arbitrary and in any binding every
> published for any of these SoC, either broken by design (MX5 and MX6
> have duplicated pin data soaking up arbitrary pin ids in the current
> binding, or are not defined in SoC register order (i.e. arbitrary
> renumbering).

The pin index is indeed completely arbitrary, mostly because the iomuxv3
does not make it possible to number pins. More sane SoCs offered that,
there a Pin number could be easily translated into a register offset. I
don't know what drugs the FSL engineers have taken to come up with a
register layout in which each pin is configured via three register sets
which do not stand in any relationship to each other.

Unfortunately the pinctrl framework forces us to use a pin index as it
needs something to detect resource conflicts. BUT, I think I agree here
with you: This pin number should not be exposed to the devicetree, it
only adds a level of indirection.

> 
> 2) the pin index is not internally consistent within the device tree
> binding - it is a reference to an array inside source code. Your patch
> hopes to solve this, but also hopes to solve other things too. It
> fails on the second part.
> 
> 3) the pad setting value has been hijacked to include bits that
> otherwise would not be set in the same register (SION bit and a
> special flag to mean, set up everything except the pad settings)
> 
> What you've fixed it to do, as I read this patch, is this;
> 
> <arbitrary_pin_name pad_mode>
> 
> which the preprocessor expands to;
> 
> <reg_mux mux_mode reg_insel insel_mode reg_pad pad_mode>
> 
> The real problem here is as follows;
> 
> 1) the pin name and function name are still completely arbitrary (in
> so far as the old iomux.h macros way, the newer iomux-v3.h way, the
> current bindings and the new binding you're pushing do not match the
> CPU documentation at all)
> 
> 2) copy pasting a line of 5 values from an example document and adding
> your pad mode bits to the end is no more time consuming or
> space-consuming than copying a 38-character macro name. New board
> designs will use data from the FSL IOMUX tool or other sources and not
> bother using macro definitions to define pads.
> 
> 3) macros can be wrong and they will inherit into every device tree,
> breaking every board that uses them. That said, so can the examples,
> but at least reading the device tree for a board you can cross-check
> all the values against, say, the output of many tools provided by
> Freescale or existing code or platform support without doing a back
> reference or preprocessing the device tree and removing comments).
>

Yes, macros can be wrong, but they tend to get fixed. Duplicated
information almost never gets fixed in all instances they occur.

> 
> MX51_PIN_EIM_23__GPIO1_2 0x6528
> 
> <
> MUX_REG(0x174) ALT(0x5|SION) INS_REG(0x3d8) INS(0x7) PAD_REG(0x654)
> PAD(0x7633|PU_100K), /* MX51_EIM_23 GPIO1_2 */
> >;

This is basically what the current iomux header do, only that we added
the mux/padctrl/selinput register triplet to a single macro. This in my
eyes still makes sense, because digging through the datasheet guessing
that for a single pin I have to configure registers 0x174, 0x3d8 and
0x654 is cumbersome.

Where it became ugly is the predefined values for pullup/dse.

Yes, I would really like to have something like you describe above in
the devicetree together with the register triplets as handy macros.
Also I still like the <pinname>__<function> naming since that's another
thing I don't have to look up in the datasheet everytime.
If your data comes from the iomux tool then you simply wouldn't use the
register triplet macros.

This would leave the question how we make up a pin number for the
pinctrl framework, but as said, this should be solved inside the kernel
and not pushed into the devicetree.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21 17:36                   ` Matt Sealey
@ 2013-02-22  5:52                       ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-22  5:52 UTC (permalink / raw)
  To: Matt Sealey
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> >>
> > Do you see any downgrade side that the series introduces over the
> > existing implementation?
> 
> Because it replaces the horribly stupid existing implementation with
> something that doesn't solve the fundamental logical problems caused
> by the existing implementation.

When did I say that the series is targeting to solve those "fundamental
logical problems" in *your* view?

...

> What you've fixed it to do, as I read this patch, is this;
> 
> <arbitrary_pin_name pad_mode>
> 
No, it's not arbitrary_pin_name.  It's pin function name which comes
from hardware manual.  It may not exactly match the public reference
manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
example, the manual says:

Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
  000 ALT0 — Select signal SD2_DATA1.
  001 ALT1 — Select signal ECSPI5_SS0.
  010 ALT2 — Select signal EIM_CS2.
  011 ALT3 — Select signal AUD4_TXFS.
  100 ALT4 — Select signal KEY_COL7.
  101 ALT5 — Select signal GPIO1_IO14.

And imx6q-pinfunc.h gives:

  MX6Q_PAD_SD2_DAT1__USDHC2_DAT1
  MX6Q_PAD_SD2_DAT1__ECSPI5_SS0
  MX6Q_PAD_SD2_DAT1__WEIM_WEIM_CS_2
  MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS
  MX6Q_PAD_SD2_DAT1__KPP_COL_7
  MX6Q_PAD_SD2_DAT1__GPIO_1_14

Trust me, no one would manually and arbitrarily write down those huge
number of names.  It comes from Freescale BSP code which is in turn
retrieved from an early design database during BSP pre-coding phase.
It happens all the time that the names in the final document change
than early developing one.

> which the preprocessor expands to;
> 
> <reg_mux mux_mode reg_insel insel_mode reg_pad pad_mode>
> 
> The real problem here is as follows;
> 
> 1) the pin name and function name are still completely arbitrary (in
> so far as the old iomux.h macros way, the newer iomux-v3.h way, the
> current bindings and the new binding you're pushing do not match the
> CPU documentation at all)
> 
No, it's not true, as explained above.

> 2) copy pasting a line of 5 values from an example document and adding
> your pad mode bits to the end is no more time consuming or
> space-consuming than copying a 38-character macro name.

DTB is meant to be machine-parseable, but DTS is meant to be
human-readable because it's edited by human-being, and macro name
is obviously more friendly here.

...

> 3) macros can be wrong and they will inherit into every device tree,
> breaking every board that uses them.

The macros should eventually come from some tool/program and design
database.  It should stand little chance to be wrong.  Even there is
something wrong with the macros, it should be noticed from the very
beginning, exactly because it will get any board device tree using
the macros wrong.

With the help of macros, patch #3 changes the PIN_FUNC_ID from an
integer to a tuple of integers without touching any DTS files at all.

Shawn

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-22  5:52                       ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-22  5:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> >>
> > Do you see any downgrade side that the series introduces over the
> > existing implementation?
> 
> Because it replaces the horribly stupid existing implementation with
> something that doesn't solve the fundamental logical problems caused
> by the existing implementation.

When did I say that the series is targeting to solve those "fundamental
logical problems" in *your* view?

...

> What you've fixed it to do, as I read this patch, is this;
> 
> <arbitrary_pin_name pad_mode>
> 
No, it's not arbitrary_pin_name.  It's pin function name which comes
from hardware manual.  It may not exactly match the public reference
manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
example, the manual says:

Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
  000 ALT0 ? Select signal SD2_DATA1.
  001 ALT1 ? Select signal ECSPI5_SS0.
  010 ALT2 ? Select signal EIM_CS2.
  011 ALT3 ? Select signal AUD4_TXFS.
  100 ALT4 ? Select signal KEY_COL7.
  101 ALT5 ? Select signal GPIO1_IO14.

And imx6q-pinfunc.h gives:

  MX6Q_PAD_SD2_DAT1__USDHC2_DAT1
  MX6Q_PAD_SD2_DAT1__ECSPI5_SS0
  MX6Q_PAD_SD2_DAT1__WEIM_WEIM_CS_2
  MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS
  MX6Q_PAD_SD2_DAT1__KPP_COL_7
  MX6Q_PAD_SD2_DAT1__GPIO_1_14

Trust me, no one would manually and arbitrarily write down those huge
number of names.  It comes from Freescale BSP code which is in turn
retrieved from an early design database during BSP pre-coding phase.
It happens all the time that the names in the final document change
than early developing one.

> which the preprocessor expands to;
> 
> <reg_mux mux_mode reg_insel insel_mode reg_pad pad_mode>
> 
> The real problem here is as follows;
> 
> 1) the pin name and function name are still completely arbitrary (in
> so far as the old iomux.h macros way, the newer iomux-v3.h way, the
> current bindings and the new binding you're pushing do not match the
> CPU documentation at all)
> 
No, it's not true, as explained above.

> 2) copy pasting a line of 5 values from an example document and adding
> your pad mode bits to the end is no more time consuming or
> space-consuming than copying a 38-character macro name.

DTB is meant to be machine-parseable, but DTS is meant to be
human-readable because it's edited by human-being, and macro name
is obviously more friendly here.

...

> 3) macros can be wrong and they will inherit into every device tree,
> breaking every board that uses them.

The macros should eventually come from some tool/program and design
database.  It should stand little chance to be wrong.  Even there is
something wrong with the macros, it should be noticed from the very
beginning, exactly because it will get any board device tree using
the macros wrong.

With the help of macros, patch #3 changes the PIN_FUNC_ID from an
integer to a tuple of integers without touching any DTS files at all.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-22  5:52                       ` Shawn Guo
@ 2013-02-22  7:27                           ` Sascha Hauer
  -1 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-22  7:27 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Fri, Feb 22, 2013 at 01:52:04PM +0800, Shawn Guo wrote:
> On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> > On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> > >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> > >>
> > > Do you see any downgrade side that the series introduces over the
> > > existing implementation?
> > 
> > Because it replaces the horribly stupid existing implementation with
> > something that doesn't solve the fundamental logical problems caused
> > by the existing implementation.
> 
> When did I say that the series is targeting to solve those "fundamental
> logical problems" in *your* view?
> 
> ...
> 
> > What you've fixed it to do, as I read this patch, is this;
> > 
> > <arbitrary_pin_name pad_mode>
> > 
> No, it's not arbitrary_pin_name.  It's pin function name which comes
> from hardware manual.  It may not exactly match the public reference
> manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> example, the manual says:
> 
> Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
>   000 ALT0 — Select signal SD2_DATA1.
>   001 ALT1 — Select signal ECSPI5_SS0.
>   010 ALT2 — Select signal EIM_CS2.
>   011 ALT3 — Select signal AUD4_TXFS.
>   100 ALT4 — Select signal KEY_COL7.
>   101 ALT5 — Select signal GPIO1_IO14.

What makes them arbitrary is the fact that 110 and 111 are not encoded,
so there is no way to calculate the register number from the pin number.

Also

commit 4a5f7eff8b0b34354e5c63272835e5e2dfe1c933
Author: Dong Aisheng <dong.aisheng@linaro.org>
Date:   Fri Jul 6 17:09:23 2012 +0800

    pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID

Shows that they are indeed arbitrary.

I'm really with Matt here when he says that this number doesn't have to
be in the binding.

What we make from this is another story. Changing this will be painful.
It will get even more painful though when the bindings are more
established in the future.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-22  7:27                           ` Sascha Hauer
  0 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-22  7:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 22, 2013 at 01:52:04PM +0800, Shawn Guo wrote:
> On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> > On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> > >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> > >>
> > > Do you see any downgrade side that the series introduces over the
> > > existing implementation?
> > 
> > Because it replaces the horribly stupid existing implementation with
> > something that doesn't solve the fundamental logical problems caused
> > by the existing implementation.
> 
> When did I say that the series is targeting to solve those "fundamental
> logical problems" in *your* view?
> 
> ...
> 
> > What you've fixed it to do, as I read this patch, is this;
> > 
> > <arbitrary_pin_name pad_mode>
> > 
> No, it's not arbitrary_pin_name.  It's pin function name which comes
> from hardware manual.  It may not exactly match the public reference
> manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> example, the manual says:
> 
> Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
>   000 ALT0 ? Select signal SD2_DATA1.
>   001 ALT1 ? Select signal ECSPI5_SS0.
>   010 ALT2 ? Select signal EIM_CS2.
>   011 ALT3 ? Select signal AUD4_TXFS.
>   100 ALT4 ? Select signal KEY_COL7.
>   101 ALT5 ? Select signal GPIO1_IO14.

What makes them arbitrary is the fact that 110 and 111 are not encoded,
so there is no way to calculate the register number from the pin number.

Also

commit 4a5f7eff8b0b34354e5c63272835e5e2dfe1c933
Author: Dong Aisheng <dong.aisheng@linaro.org>
Date:   Fri Jul 6 17:09:23 2012 +0800

    pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID

Shows that they are indeed arbitrary.

I'm really with Matt here when he says that this number doesn't have to
be in the binding.

What we make from this is another story. Changing this will be painful.
It will get even more painful though when the bindings are more
established in the future.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-22  7:27                           ` Sascha Hauer
@ 2013-02-22  7:36                               ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-22  7:36 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Fri, Feb 22, 2013 at 08:27:43AM +0100, Sascha Hauer wrote:
> On Fri, Feb 22, 2013 at 01:52:04PM +0800, Shawn Guo wrote:
> > On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> > > On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > > > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> > > >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> > > >>
> > > > Do you see any downgrade side that the series introduces over the
> > > > existing implementation?
> > > 
> > > Because it replaces the horribly stupid existing implementation with
> > > something that doesn't solve the fundamental logical problems caused
> > > by the existing implementation.
> > 
> > When did I say that the series is targeting to solve those "fundamental
> > logical problems" in *your* view?
> > 
> > ...
> > 
> > > What you've fixed it to do, as I read this patch, is this;
> > > 
> > > <arbitrary_pin_name pad_mode>
> > > 
> > No, it's not arbitrary_pin_name.  It's pin function name which comes
> > from hardware manual.  It may not exactly match the public reference
> > manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> > example, the manual says:
> > 
> > Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
> >   000 ALT0 — Select signal SD2_DATA1.
> >   001 ALT1 — Select signal ECSPI5_SS0.
> >   010 ALT2 — Select signal EIM_CS2.
> >   011 ALT3 — Select signal AUD4_TXFS.
> >   100 ALT4 — Select signal KEY_COL7.
> >   101 ALT5 — Select signal GPIO1_IO14.
> 
> What makes them arbitrary is the fact that 110 and 111 are not encoded,
> so there is no way to calculate the register number from the pin number.
> 
> Also
> 
> commit 4a5f7eff8b0b34354e5c63272835e5e2dfe1c933
> Author: Dong Aisheng <dong.aisheng@linaro.org>
> Date:   Fri Jul 6 17:09:23 2012 +0800
> 
>     pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID
> 
> Shows that they are indeed arbitrary.
> 
> I'm really with Matt here when he says that this number doesn't have to
> be in the binding.

I think you are still talking about that arbitrary index in the old
binding, while I'm arguing against Matt's the comment on the new one,
saying the macro/pin name is arbitrary.

Shawn

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-22  7:36                               ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-22  7:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 22, 2013 at 08:27:43AM +0100, Sascha Hauer wrote:
> On Fri, Feb 22, 2013 at 01:52:04PM +0800, Shawn Guo wrote:
> > On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> > > On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > > > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> > > >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> > > >>
> > > > Do you see any downgrade side that the series introduces over the
> > > > existing implementation?
> > > 
> > > Because it replaces the horribly stupid existing implementation with
> > > something that doesn't solve the fundamental logical problems caused
> > > by the existing implementation.
> > 
> > When did I say that the series is targeting to solve those "fundamental
> > logical problems" in *your* view?
> > 
> > ...
> > 
> > > What you've fixed it to do, as I read this patch, is this;
> > > 
> > > <arbitrary_pin_name pad_mode>
> > > 
> > No, it's not arbitrary_pin_name.  It's pin function name which comes
> > from hardware manual.  It may not exactly match the public reference
> > manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> > example, the manual says:
> > 
> > Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
> >   000 ALT0 ? Select signal SD2_DATA1.
> >   001 ALT1 ? Select signal ECSPI5_SS0.
> >   010 ALT2 ? Select signal EIM_CS2.
> >   011 ALT3 ? Select signal AUD4_TXFS.
> >   100 ALT4 ? Select signal KEY_COL7.
> >   101 ALT5 ? Select signal GPIO1_IO14.
> 
> What makes them arbitrary is the fact that 110 and 111 are not encoded,
> so there is no way to calculate the register number from the pin number.
> 
> Also
> 
> commit 4a5f7eff8b0b34354e5c63272835e5e2dfe1c933
> Author: Dong Aisheng <dong.aisheng@linaro.org>
> Date:   Fri Jul 6 17:09:23 2012 +0800
> 
>     pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID
> 
> Shows that they are indeed arbitrary.
> 
> I'm really with Matt here when he says that this number doesn't have to
> be in the binding.

I think you are still talking about that arbitrary index in the old
binding, while I'm arguing against Matt's the comment on the new one,
saying the macro/pin name is arbitrary.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-21 21:43                       ` Sascha Hauer
@ 2013-02-22  7:58                           ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-22  7:58 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Thu, Feb 21, 2013 at 10:43:03PM +0100, Sascha Hauer wrote:
> This would leave the question how we make up a pin number for the
> pinctrl framework, but as said, this should be solved inside the kernel
> and not pushed into the devicetree.
> 
Ok, Dong has the same opinion to remove pin number from device tree,
I start working it out, and will roll out the new version.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-22  7:58                           ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-22  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 21, 2013 at 10:43:03PM +0100, Sascha Hauer wrote:
> This would leave the question how we make up a pin number for the
> pinctrl framework, but as said, this should be solved inside the kernel
> and not pushed into the devicetree.
> 
Ok, Dong has the same opinion to remove pin number from device tree,
I start working it out, and will roll out the new version.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-22  7:36                               ` Shawn Guo
@ 2013-02-22  8:12                                   ` Sascha Hauer
  -1 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-22  8:12 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Fri, Feb 22, 2013 at 03:36:32PM +0800, Shawn Guo wrote:
> On Fri, Feb 22, 2013 at 08:27:43AM +0100, Sascha Hauer wrote:
> > On Fri, Feb 22, 2013 at 01:52:04PM +0800, Shawn Guo wrote:
> > > On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> > > > On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > > > > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> > > > >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> > > > >>
> > > > > Do you see any downgrade side that the series introduces over the
> > > > > existing implementation?
> > > > 
> > > > Because it replaces the horribly stupid existing implementation with
> > > > something that doesn't solve the fundamental logical problems caused
> > > > by the existing implementation.
> > > 
> > > When did I say that the series is targeting to solve those "fundamental
> > > logical problems" in *your* view?
> > > 
> > > ...
> > > 
> > > > What you've fixed it to do, as I read this patch, is this;
> > > > 
> > > > <arbitrary_pin_name pad_mode>
> > > > 
> > > No, it's not arbitrary_pin_name.  It's pin function name which comes
> > > from hardware manual.  It may not exactly match the public reference
> > > manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> > > example, the manual says:
> > > 
> > > Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
> > >   000 ALT0 — Select signal SD2_DATA1.
> > >   001 ALT1 — Select signal ECSPI5_SS0.
> > >   010 ALT2 — Select signal EIM_CS2.
> > >   011 ALT3 — Select signal AUD4_TXFS.
> > >   100 ALT4 — Select signal KEY_COL7.
> > >   101 ALT5 — Select signal GPIO1_IO14.
> > 
> > What makes them arbitrary is the fact that 110 and 111 are not encoded,
> > so there is no way to calculate the register number from the pin number.
> > 
> > Also
> > 
> > commit 4a5f7eff8b0b34354e5c63272835e5e2dfe1c933
> > Author: Dong Aisheng <dong.aisheng@linaro.org>
> > Date:   Fri Jul 6 17:09:23 2012 +0800
> > 
> >     pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID
> > 
> > Shows that they are indeed arbitrary.
> > 
> > I'm really with Matt here when he says that this number doesn't have to
> > be in the binding.
> 
> I think you are still talking about that arbitrary index in the old
> binding, while I'm arguing against Matt's the comment on the new one,
> saying the macro/pin name is arbitrary.

Sorry, I haven't read the above carefully enough. We are talking about
the names here, not the numbers I referred to.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-22  8:12                                   ` Sascha Hauer
  0 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-22  8:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 22, 2013 at 03:36:32PM +0800, Shawn Guo wrote:
> On Fri, Feb 22, 2013 at 08:27:43AM +0100, Sascha Hauer wrote:
> > On Fri, Feb 22, 2013 at 01:52:04PM +0800, Shawn Guo wrote:
> > > On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> > > > On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > > > > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> > > > >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> > > > >>
> > > > > Do you see any downgrade side that the series introduces over the
> > > > > existing implementation?
> > > > 
> > > > Because it replaces the horribly stupid existing implementation with
> > > > something that doesn't solve the fundamental logical problems caused
> > > > by the existing implementation.
> > > 
> > > When did I say that the series is targeting to solve those "fundamental
> > > logical problems" in *your* view?
> > > 
> > > ...
> > > 
> > > > What you've fixed it to do, as I read this patch, is this;
> > > > 
> > > > <arbitrary_pin_name pad_mode>
> > > > 
> > > No, it's not arbitrary_pin_name.  It's pin function name which comes
> > > from hardware manual.  It may not exactly match the public reference
> > > manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> > > example, the manual says:
> > > 
> > > Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
> > >   000 ALT0 ? Select signal SD2_DATA1.
> > >   001 ALT1 ? Select signal ECSPI5_SS0.
> > >   010 ALT2 ? Select signal EIM_CS2.
> > >   011 ALT3 ? Select signal AUD4_TXFS.
> > >   100 ALT4 ? Select signal KEY_COL7.
> > >   101 ALT5 ? Select signal GPIO1_IO14.
> > 
> > What makes them arbitrary is the fact that 110 and 111 are not encoded,
> > so there is no way to calculate the register number from the pin number.
> > 
> > Also
> > 
> > commit 4a5f7eff8b0b34354e5c63272835e5e2dfe1c933
> > Author: Dong Aisheng <dong.aisheng@linaro.org>
> > Date:   Fri Jul 6 17:09:23 2012 +0800
> > 
> >     pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID
> > 
> > Shows that they are indeed arbitrary.
> > 
> > I'm really with Matt here when he says that this number doesn't have to
> > be in the binding.
> 
> I think you are still talking about that arbitrary index in the old
> binding, while I'm arguing against Matt's the comment on the new one,
> saying the macro/pin name is arbitrary.

Sorry, I haven't read the above carefully enough. We are talking about
the names here, not the numbers I referred to.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
  2013-02-21 19:57               ` Stephen Warren
@ 2013-02-26  8:02                   ` Dong Aisheng
  -1 siblings, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-26  8:02 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Dong Aisheng, Rob Herring, Uwe Kleine-König,
	devicetree-discuss,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Thu, Feb 21, 2013 at 12:57:02PM -0700, Stephen Warren wrote:
> On 02/21/2013 02:36 AM, Dong Aisheng wrote:
> > On 21 February 2013 03:04, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> >> On 02/20/2013 12:08 AM, Shawn Guo wrote:
> >>> Currently, all imx pinctrl drivers maintain a big array of struct
> >>> imx_pin_reg which hard-codes data like register offset and mux mode
> >>> setting for each pin function.  Every time a new imx SoC support is
> >>> added, we need to add such a big mount of data.  With moving to single
> >>> kernel build, it's only matter of time to be blamed on memory consuming.
> >>>
> >>> With DTC pre-processor support in place, the patch moves all these data
> >>> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
> >>> changing the PIN_FUNC_ID parsing code a little bit.
> ...
> >> This patch removes a bunch of tables from the kernel. I like having the
> >> tables in the kernel, since in theory it could allow a future debugfs or
> >> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
> >> state at a semantic level.
> > 
> > Right, that's one of the considerations why i kept the register table in driver
> > in the first binding design.
> > 
> >> This is only possible if the DT binding
> >> includes details such as "set this pin to this function", and the driver
> >> includes the tables to convert that into details such as register
> >> address and value. I don't think such an "API" could be implemented for
> >> IMX after this patch.
> > 
> > Theoretically It can, because device tree contains the pin registers
> > informations
> 
> > in this way. But the problem is that it can only manipulate the used pins which
> > are parsed from devices tree. While for those unused pins, since the driver does
> > not have the pin register information, it can not manipulate it.
> 
> Right, that's the main issue I was trying to highlight; the driver no
> longer provides complete knowledge of the HW, but only learns about
> stuff that happens to be used/defined in the board-specific DT.
> 
> > But what i'm wondering now is do we really need to manipulate the unused pins
> > from sysfs or debugfs?
> > I still can not think out a real using case now.
> > Anyone else can think one?
> 
> For early board bringup, it may be useful to boot with a minimal set of
> entries in the DT (enough to support e.g. serial console and some device
> for a root filesystem) and then interactively tweak the rest of the
> pinmux to define the rest of the board, and perhaps even save the result
> somehow, and add it to the next iteration of the DT.
> 
> Also, consider a hobbyist-oriented board that has 50 unused pins that
> could be GPIO, or mapped to some otherwise unused SD, I2C, SPI, ...
> controller. Do we want to force the user to write a new DT and reboot,
> or would it be better to provide some runtime API to set up those pins
> based on what they had connected to the board, and then instantiate
> drivers or use the sysfs GPIO interface, after doing so?
> 

Yes, it can be useful sometimes.
In order to do that, we have to add the whole register table in driver.
Considering the defects, since using memtool can do the same things,
maybe it's not worth for IMX to do that.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree
@ 2013-02-26  8:02                   ` Dong Aisheng
  0 siblings, 0 replies; 55+ messages in thread
From: Dong Aisheng @ 2013-02-26  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 21, 2013 at 12:57:02PM -0700, Stephen Warren wrote:
> On 02/21/2013 02:36 AM, Dong Aisheng wrote:
> > On 21 February 2013 03:04, Stephen Warren <swarren@wwwdotorg.org> wrote:
> >> On 02/20/2013 12:08 AM, Shawn Guo wrote:
> >>> Currently, all imx pinctrl drivers maintain a big array of struct
> >>> imx_pin_reg which hard-codes data like register offset and mux mode
> >>> setting for each pin function.  Every time a new imx SoC support is
> >>> added, we need to add such a big mount of data.  With moving to single
> >>> kernel build, it's only matter of time to be blamed on memory consuming.
> >>>
> >>> With DTC pre-processor support in place, the patch moves all these data
> >>> into device tree by redefining the PIN_FUNC_ID in imxXX-pinfunc.h and
> >>> changing the PIN_FUNC_ID parsing code a little bit.
> ...
> >> This patch removes a bunch of tables from the kernel. I like having the
> >> tables in the kernel, since in theory it could allow a future debugfs or
> >> sysfs interface to pinctrl that allows manipulation of the pinctrl HW
> >> state at a semantic level.
> > 
> > Right, that's one of the considerations why i kept the register table in driver
> > in the first binding design.
> > 
> >> This is only possible if the DT binding
> >> includes details such as "set this pin to this function", and the driver
> >> includes the tables to convert that into details such as register
> >> address and value. I don't think such an "API" could be implemented for
> >> IMX after this patch.
> > 
> > Theoretically It can, because device tree contains the pin registers
> > informations
> 
> > in this way. But the problem is that it can only manipulate the used pins which
> > are parsed from devices tree. While for those unused pins, since the driver does
> > not have the pin register information, it can not manipulate it.
> 
> Right, that's the main issue I was trying to highlight; the driver no
> longer provides complete knowledge of the HW, but only learns about
> stuff that happens to be used/defined in the board-specific DT.
> 
> > But what i'm wondering now is do we really need to manipulate the unused pins
> > from sysfs or debugfs?
> > I still can not think out a real using case now.
> > Anyone else can think one?
> 
> For early board bringup, it may be useful to boot with a minimal set of
> entries in the DT (enough to support e.g. serial console and some device
> for a root filesystem) and then interactively tweak the rest of the
> pinmux to define the rest of the board, and perhaps even save the result
> somehow, and add it to the next iteration of the DT.
> 
> Also, consider a hobbyist-oriented board that has 50 unused pins that
> could be GPIO, or mapped to some otherwise unused SD, I2C, SPI, ...
> controller. Do we want to force the user to write a new DT and reboot,
> or would it be better to provide some runtime API to set up those pins
> based on what they had connected to the board, and then instantiate
> drivers or use the sysfs GPIO interface, after doing so?
> 

Yes, it can be useful sometimes.
In order to do that, we have to add the whole register table in driver.
Considering the defects, since using memtool can do the same things,
maybe it's not worth for IMX to do that.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-22  5:52                       ` Shawn Guo
@ 2013-02-27  6:51                           ` Matt Sealey
  -1 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-27  6:51 UTC (permalink / raw)
  To: Shawn Guo
  Cc: devicetree-discuss, Rob Herring, Uwe Kleine-König,
	Dong Aisheng, Linux ARM Kernel ML

On Thu, Feb 21, 2013 at 11:52 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
>> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
>> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
>> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
>> >>
>> > Do you see any downgrade side that the series introduces over the
>> > existing implementation?
>>
>> Because it replaces the horribly stupid existing implementation with
>> something that doesn't solve the fundamental logical problems caused
>> by the existing implementation.
>
> When did I say that the series is targeting to solve those "fundamental
> logical problems" in *your* view?
>
> ...

Why would you submit a series that doesn't solve such problems? :)

To replace an illogical, ridiculous system of arbitrary pin numbering
with an illogical mapping of registers to arbitrary names is..
illogical.

>> What you've fixed it to do, as I read this patch, is this;
>>
>> <arbitrary_pin_name pad_mode>
>>
> No, it's not arbitrary_pin_name.  It's pin function name which comes
> from hardware manual.  It may not exactly match the public reference
> manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> example, the manual says:
>
> Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
>   000 ALT0 — Select signal SD2_DATA1.
>   001 ALT1 — Select signal ECSPI5_SS0.
>   010 ALT2 — Select signal EIM_CS2.
>   011 ALT3 — Select signal AUD4_TXFS.
>   100 ALT4 — Select signal KEY_COL7.
>   101 ALT5 — Select signal GPIO1_IO14.
>
> And imx6q-pinfunc.h gives:
>
>   MX6Q_PAD_SD2_DAT1__USDHC2_DAT1
>   MX6Q_PAD_SD2_DAT1__ECSPI5_SS0
>   MX6Q_PAD_SD2_DAT1__WEIM_WEIM_CS_2
>   MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS
>   MX6Q_PAD_SD2_DAT1__KPP_COL_7
>   MX6Q_PAD_SD2_DAT1__GPIO_1_14

So, SD2_DAT1 with function SD2_DAT1 in the manual is SD2_DAT1__USDHC2_DAT1 ?

KEY_COL7 -> KPP_COL_7?
EIM_CS2 -> WEIM_WEIM_CS_2?
AUD4_TXFS -> AUDMUX_AUD4_TXFS?
GPIO1_IO14 -> GPIO_1_14?

This is what I call arbitrary.

Since the documented NAMING of pins changes between SoC revisions
(where pins change definition or group), manual revisions (where
people fix definitions), and even existing source code, it makes no
sense whatsoever to give things like this a name. Especially as it is
possible to break out the pin definitions and see that your "use a
macro to encode 5 values at once and leave the most-often changing
value to the device tree" method misses one thing: it is not easy to
set the SION bit in the ALT register for each of these without
replacing the macro. Sometimes SION is important for debugging,
sometimes it is not... some pins need SION *forever* and other times..
not. On i.MX6 using RMII ethernet, you need SION to loopback the clock
input to the MAC.. but it's possible you'd want to temporarily disable
this in a build. The only way here is to replace the pin definition
macro part with the actual register values, set your SION bit, and
rebuild the device tree.

The only canonical thing you can guarantee is that in general the
registers fit within certain ranges (although on i.MX51 the ranges did
change between revisions, this is another problem), and accept certain
values.

The only reasonable thing we can be doing with pre-processing IOMUX
data is make sure it fits those ranges (within reason) and possibly
use the preprocessing to ensure that invalid values never make it into
a device tree (i.e. there are bits in the pad settings which are
never, ever set on a particular SoC, and masking and bailing out using
#error or pitching a #warning would be much more useful than allowing
random bits to go into register areas that are "reserved".

I half-agree with Sascha. I am responsible for porting the i.MX51
iomux-v3.h stuff to U-Boot because using the naming scheme worked so
much better there than mxc_request_iomux clutter since most boards
came with almost exactly the same settings on exactly the same buses
because it was a limited choice on i.MX51. This MOSTLY works but there
are several - if not a ridiculous number - of entries which needed to
be modified for any particular board. And the remit came from the
U-Boot guys simply that we should not commit into the tree any pins
which no board makes use of.

Here, we have potential for a huge file full of macros of which a good
deal of them will end up with NOBODY using, and therefore just clutter
the file. If we go with the U-Boot model, we only add macros to define
a pin configuration set if at least ONE board requires that
definition. This will keep it nice and clean and make sure nobody
commits huge swaths of macros which nobody is testing.

Since I did that work, I've changed my mind; actually naming the pins
by their intended function simply doesn't ADD anything to the device
tree functionality, nor does it really help Sascha out any more than
simply having a *really good reference* would help him out.

For example, please explain to me why;

MX51_PIN_EIM_23__GPIO1_2 0x6528

is clearer than;

0x174 0x5 0x3d8 0x7 0x654 0x7633, /* EIM_23 GPIO1_2 and some pullup
settings or so comment comment comment */

In the processed device tree all you're going to see is the numbers.
No pin naming at all. No comments. They certainly don't appear in the
blob. Looking at the device tree in /proc/device-tree or processed
output before compiling, the magic macro information is COMPLETELY
lost, which means all it does is add an arbitrary binding of a name to
a set of values in the raw, unprocessed source - just to "explain"
what that pin does.

How does a comment not do this already in the raw, unprocessed source?

How does giving it a macro name help people looking at trees that have
gone through processing?

Answer: it doesn't. We're adding work (preprocessing) for no
significant benefit except to stop a raw, source code device tree from
being a clutter of numbers. Since it ends up as a clutter of numbers
anyway at runtime, adding cross-referencing and potential for
typographical errors at all stages plus any possible automation
errors..

>> 2) copy pasting a line of 5 values from an example document and adding
>> your pad mode bits to the end is no more time consuming or
>> space-consuming than copying a 38-character macro name.
>
> DTB is meant to be machine-parseable, but DTS is meant to be
> human-readable because it's edited by human-being, and macro name
> is obviously more friendly here.

Last I checked, I can read numbers just fine, I can even convert hex
to decimal in my head; when I feel sleepy and not quite up to it, I
have a calculator. I can also paste the numbers directly into my PDF
reader to find the exact register definition within the IOMUX chapter
- instant lookup. Looking at the DT, then looking at the macro header,
then searching for the PDF is an extra step. To me, it is not obvious
that this is "more friendly," simply because it is adding a level of
indirection.

>> 3) macros can be wrong and they will inherit into every device tree,
>> breaking every board that uses them.
>
> The macros should eventually come from some tool/program and design
> database.  It should stand little chance to be wrong.  Even there is
> something wrong with the macros, it should be noticed from the very
> beginning, exactly because it will get any board device tree using
> the macros wrong.

Your examples seem to have mismatching database revisions, then?

> With the help of macros, patch #3 changes the PIN_FUNC_ID from an
> integer to a tuple of integers without touching any DTS files at all.

Understood, but I don't see the benefit of converting "98" to
"MX51_PIN_EIM_23__GPIO_1_2" when eventually it gets converted into a
string of 5 numbers which are in the manual. At least how the benefit
outweighs a comment in the DTS if there really needs to be some
explanation of the fields (these already exist in the current trees to
explain what the numbers mean in the first place).

Especially as nobody can agree what the canonical pin naming should be
despite several (I count 6) implementations of naming the pins, and
that in several cases the values returned by the macros may not be
EXACTLY what you wanted (SION bit is the biggest example), it still
maps an arbitrary value (number in the old version, string literal
macro name in the series you sent).

If someone gets the macro wrong - a typo or missed pin - or needs to
continually add new macros for new boards - this is going to create an
inordinate amount of churn in the macro file and therefore in a
binding. God forbid if the binding has to change. Please don't submit
a file with every pin you THINK is in the i.MX5/6 and think it is
done, because we know already from the patch Sascha referenced..
people miss things and get things wrong.

If the binding is simply "an array of 6 values per pin configuration,
please see the manual for the register offsets and bit definitions"
then the ONLY error can be in the authorship of the device tree source
code and the onus is on.. that guy. Not the "Linux source code being
wrong" or "the binding being out of date". You cannot by any means
introduce automation errors or mistakes in a binding this way.
Bindings - and any preprocessor macros which they depend on - should
be fixed. Not constantly fluctuating at the time someone finds a
mistake, or on the assumption that someone will be cross-checking
every single value in a huge list of pins in a binding where it is
possible it cannot be tested on a real board.

--
Matt Sealey <matt@genesi-usa.com>
Product Development Analyst, Genesi USA, Inc.
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-27  6:51                           ` Matt Sealey
  0 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-27  6:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 21, 2013 at 11:52 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
>> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
>> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
>> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
>> >>
>> > Do you see any downgrade side that the series introduces over the
>> > existing implementation?
>>
>> Because it replaces the horribly stupid existing implementation with
>> something that doesn't solve the fundamental logical problems caused
>> by the existing implementation.
>
> When did I say that the series is targeting to solve those "fundamental
> logical problems" in *your* view?
>
> ...

Why would you submit a series that doesn't solve such problems? :)

To replace an illogical, ridiculous system of arbitrary pin numbering
with an illogical mapping of registers to arbitrary names is..
illogical.

>> What you've fixed it to do, as I read this patch, is this;
>>
>> <arbitrary_pin_name pad_mode>
>>
> No, it's not arbitrary_pin_name.  It's pin function name which comes
> from hardware manual.  It may not exactly match the public reference
> manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> example, the manual says:
>
> Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
>   000 ALT0 ? Select signal SD2_DATA1.
>   001 ALT1 ? Select signal ECSPI5_SS0.
>   010 ALT2 ? Select signal EIM_CS2.
>   011 ALT3 ? Select signal AUD4_TXFS.
>   100 ALT4 ? Select signal KEY_COL7.
>   101 ALT5 ? Select signal GPIO1_IO14.
>
> And imx6q-pinfunc.h gives:
>
>   MX6Q_PAD_SD2_DAT1__USDHC2_DAT1
>   MX6Q_PAD_SD2_DAT1__ECSPI5_SS0
>   MX6Q_PAD_SD2_DAT1__WEIM_WEIM_CS_2
>   MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS
>   MX6Q_PAD_SD2_DAT1__KPP_COL_7
>   MX6Q_PAD_SD2_DAT1__GPIO_1_14

So, SD2_DAT1 with function SD2_DAT1 in the manual is SD2_DAT1__USDHC2_DAT1 ?

KEY_COL7 -> KPP_COL_7?
EIM_CS2 -> WEIM_WEIM_CS_2?
AUD4_TXFS -> AUDMUX_AUD4_TXFS?
GPIO1_IO14 -> GPIO_1_14?

This is what I call arbitrary.

Since the documented NAMING of pins changes between SoC revisions
(where pins change definition or group), manual revisions (where
people fix definitions), and even existing source code, it makes no
sense whatsoever to give things like this a name. Especially as it is
possible to break out the pin definitions and see that your "use a
macro to encode 5 values at once and leave the most-often changing
value to the device tree" method misses one thing: it is not easy to
set the SION bit in the ALT register for each of these without
replacing the macro. Sometimes SION is important for debugging,
sometimes it is not... some pins need SION *forever* and other times..
not. On i.MX6 using RMII ethernet, you need SION to loopback the clock
input to the MAC.. but it's possible you'd want to temporarily disable
this in a build. The only way here is to replace the pin definition
macro part with the actual register values, set your SION bit, and
rebuild the device tree.

The only canonical thing you can guarantee is that in general the
registers fit within certain ranges (although on i.MX51 the ranges did
change between revisions, this is another problem), and accept certain
values.

The only reasonable thing we can be doing with pre-processing IOMUX
data is make sure it fits those ranges (within reason) and possibly
use the preprocessing to ensure that invalid values never make it into
a device tree (i.e. there are bits in the pad settings which are
never, ever set on a particular SoC, and masking and bailing out using
#error or pitching a #warning would be much more useful than allowing
random bits to go into register areas that are "reserved".

I half-agree with Sascha. I am responsible for porting the i.MX51
iomux-v3.h stuff to U-Boot because using the naming scheme worked so
much better there than mxc_request_iomux clutter since most boards
came with almost exactly the same settings on exactly the same buses
because it was a limited choice on i.MX51. This MOSTLY works but there
are several - if not a ridiculous number - of entries which needed to
be modified for any particular board. And the remit came from the
U-Boot guys simply that we should not commit into the tree any pins
which no board makes use of.

Here, we have potential for a huge file full of macros of which a good
deal of them will end up with NOBODY using, and therefore just clutter
the file. If we go with the U-Boot model, we only add macros to define
a pin configuration set if at least ONE board requires that
definition. This will keep it nice and clean and make sure nobody
commits huge swaths of macros which nobody is testing.

Since I did that work, I've changed my mind; actually naming the pins
by their intended function simply doesn't ADD anything to the device
tree functionality, nor does it really help Sascha out any more than
simply having a *really good reference* would help him out.

For example, please explain to me why;

MX51_PIN_EIM_23__GPIO1_2 0x6528

is clearer than;

0x174 0x5 0x3d8 0x7 0x654 0x7633, /* EIM_23 GPIO1_2 and some pullup
settings or so comment comment comment */

In the processed device tree all you're going to see is the numbers.
No pin naming at all. No comments. They certainly don't appear in the
blob. Looking at the device tree in /proc/device-tree or processed
output before compiling, the magic macro information is COMPLETELY
lost, which means all it does is add an arbitrary binding of a name to
a set of values in the raw, unprocessed source - just to "explain"
what that pin does.

How does a comment not do this already in the raw, unprocessed source?

How does giving it a macro name help people looking at trees that have
gone through processing?

Answer: it doesn't. We're adding work (preprocessing) for no
significant benefit except to stop a raw, source code device tree from
being a clutter of numbers. Since it ends up as a clutter of numbers
anyway at runtime, adding cross-referencing and potential for
typographical errors at all stages plus any possible automation
errors..

>> 2) copy pasting a line of 5 values from an example document and adding
>> your pad mode bits to the end is no more time consuming or
>> space-consuming than copying a 38-character macro name.
>
> DTB is meant to be machine-parseable, but DTS is meant to be
> human-readable because it's edited by human-being, and macro name
> is obviously more friendly here.

Last I checked, I can read numbers just fine, I can even convert hex
to decimal in my head; when I feel sleepy and not quite up to it, I
have a calculator. I can also paste the numbers directly into my PDF
reader to find the exact register definition within the IOMUX chapter
- instant lookup. Looking at the DT, then looking at the macro header,
then searching for the PDF is an extra step. To me, it is not obvious
that this is "more friendly," simply because it is adding a level of
indirection.

>> 3) macros can be wrong and they will inherit into every device tree,
>> breaking every board that uses them.
>
> The macros should eventually come from some tool/program and design
> database.  It should stand little chance to be wrong.  Even there is
> something wrong with the macros, it should be noticed from the very
> beginning, exactly because it will get any board device tree using
> the macros wrong.

Your examples seem to have mismatching database revisions, then?

> With the help of macros, patch #3 changes the PIN_FUNC_ID from an
> integer to a tuple of integers without touching any DTS files at all.

Understood, but I don't see the benefit of converting "98" to
"MX51_PIN_EIM_23__GPIO_1_2" when eventually it gets converted into a
string of 5 numbers which are in the manual. At least how the benefit
outweighs a comment in the DTS if there really needs to be some
explanation of the fields (these already exist in the current trees to
explain what the numbers mean in the first place).

Especially as nobody can agree what the canonical pin naming should be
despite several (I count 6) implementations of naming the pins, and
that in several cases the values returned by the macros may not be
EXACTLY what you wanted (SION bit is the biggest example), it still
maps an arbitrary value (number in the old version, string literal
macro name in the series you sent).

If someone gets the macro wrong - a typo or missed pin - or needs to
continually add new macros for new boards - this is going to create an
inordinate amount of churn in the macro file and therefore in a
binding. God forbid if the binding has to change. Please don't submit
a file with every pin you THINK is in the i.MX5/6 and think it is
done, because we know already from the patch Sascha referenced..
people miss things and get things wrong.

If the binding is simply "an array of 6 values per pin configuration,
please see the manual for the register offsets and bit definitions"
then the ONLY error can be in the authorship of the device tree source
code and the onus is on.. that guy. Not the "Linux source code being
wrong" or "the binding being out of date". You cannot by any means
introduce automation errors or mistakes in a binding this way.
Bindings - and any preprocessor macros which they depend on - should
be fixed. Not constantly fluctuating at the time someone finds a
mistake, or on the assumption that someone will be cross-checking
every single value in a huge list of pins in a binding where it is
possible it cannot be tested on a real board.

--
Matt Sealey <matt@genesi-usa.com>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-27  6:51                           ` Matt Sealey
@ 2013-02-27  7:44                               ` Sascha Hauer
  -1 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-27  7:44 UTC (permalink / raw)
  To: Matt Sealey
  Cc: Dong Aisheng, devicetree-discuss, Rob Herring,
	Uwe Kleine-König, Linux ARM Kernel ML

On Wed, Feb 27, 2013 at 12:51:56AM -0600, Matt Sealey wrote:
> On Thu, Feb 21, 2013 at 11:52 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> >> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> >> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> >> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> >> >>
> >> > Do you see any downgrade side that the series introduces over the
> >> > existing implementation?
> >>
> >> Because it replaces the horribly stupid existing implementation with
> >> something that doesn't solve the fundamental logical problems caused
> >> by the existing implementation.
> >
> > When did I say that the series is targeting to solve those "fundamental
> > logical problems" in *your* view?
> >
> > ...
> 
> Why would you submit a series that doesn't solve such problems? :)
> 
> To replace an illogical, ridiculous system of arbitrary pin numbering
> with an illogical mapping of registers to arbitrary names is..
> illogical.
> 
> >> What you've fixed it to do, as I read this patch, is this;
> >>
> >> <arbitrary_pin_name pad_mode>
> >>
> > No, it's not arbitrary_pin_name.  It's pin function name which comes
> > from hardware manual.  It may not exactly match the public reference
> > manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> > example, the manual says:
> >
> > Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
> >   000 ALT0 — Select signal SD2_DATA1.
> >   001 ALT1 — Select signal ECSPI5_SS0.
> >   010 ALT2 — Select signal EIM_CS2.
> >   011 ALT3 — Select signal AUD4_TXFS.
> >   100 ALT4 — Select signal KEY_COL7.
> >   101 ALT5 — Select signal GPIO1_IO14.
> >
> > And imx6q-pinfunc.h gives:
> >
> >   MX6Q_PAD_SD2_DAT1__USDHC2_DAT1
> >   MX6Q_PAD_SD2_DAT1__ECSPI5_SS0
> >   MX6Q_PAD_SD2_DAT1__WEIM_WEIM_CS_2
> >   MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS
> >   MX6Q_PAD_SD2_DAT1__KPP_COL_7
> >   MX6Q_PAD_SD2_DAT1__GPIO_1_14
> 
> So, SD2_DAT1 with function SD2_DAT1 in the manual is SD2_DAT1__USDHC2_DAT1 ?
> 
> KEY_COL7 -> KPP_COL_7?
> EIM_CS2 -> WEIM_WEIM_CS_2?
> AUD4_TXFS -> AUDMUX_AUD4_TXFS?
> GPIO1_IO14 -> GPIO_1_14?
> 
> This is what I call arbitrary.
> 
> Since the documented NAMING of pins changes between SoC revisions
> (where pins change definition or group), manual revisions (where
> people fix definitions), and even existing source code, it makes no
> sense whatsoever to give things like this a name. Especially as it is
> possible to break out the pin definitions and see that your "use a
> macro to encode 5 values at once and leave the most-often changing
> value to the device tree" method misses one thing: it is not easy to
> set the SION bit in the ALT register for each of these without
> replacing the macro. Sometimes SION is important for debugging,
> sometimes it is not... some pins need SION *forever* and other times..
> not. On i.MX6 using RMII ethernet, you need SION to loopback the clock
> input to the MAC.. but it's possible you'd want to temporarily disable
> this in a build. The only way here is to replace the pin definition
> macro part with the actual register values, set your SION bit, and
> rebuild the device tree.
> 
> The only canonical thing you can guarantee is that in general the
> registers fit within certain ranges (although on i.MX51 the ranges did
> change between revisions, this is another problem), and accept certain
> values.
> 
> The only reasonable thing we can be doing with pre-processing IOMUX
> data is make sure it fits those ranges (within reason) and possibly
> use the preprocessing to ensure that invalid values never make it into
> a device tree (i.e. there are bits in the pad settings which are
> never, ever set on a particular SoC, and masking and bailing out using
> #error or pitching a #warning would be much more useful than allowing
> random bits to go into register areas that are "reserved".
> 
> I half-agree with Sascha. I am responsible for porting the i.MX51
> iomux-v3.h stuff to U-Boot because using the naming scheme worked so
> much better there than mxc_request_iomux clutter since most boards
> came with almost exactly the same settings on exactly the same buses
> because it was a limited choice on i.MX51. This MOSTLY works but there
> are several - if not a ridiculous number - of entries which needed to
> be modified for any particular board. And the remit came from the
> U-Boot guys simply that we should not commit into the tree any pins
> which no board makes use of.
> 
> Here, we have potential for a huge file full of macros of which a good
> deal of them will end up with NOBODY using, and therefore just clutter
> the file. If we go with the U-Boot model, we only add macros to define
> a pin configuration set if at least ONE board requires that
> definition. This will keep it nice and clean and make sure nobody
> commits huge swaths of macros which nobody is testing.

Great, so you end up patching this file over and over again, maintaining
out of boards always require patches to the iomux file, maintainers have
to deal with merge conflicts.

> 
> Since I did that work, I've changed my mind; actually naming the pins
> by their intended function simply doesn't ADD anything to the device
> tree functionality, nor does it really help Sascha out any more than
> simply having a *really good reference* would help him out.
> 
> For example, please explain to me why;
> 
> MX51_PIN_EIM_23__GPIO1_2 0x6528
> 
> is clearer than;
> 
> 0x174 0x5 0x3d8 0x7 0x654 0x7633, /* EIM_23 GPIO1_2 and some pullup
> settings or so comment comment comment */

Look what you have to do to get the pin muxing for a single pin from the
datasheet.

- identify the name, grep for it in the datasheet, find 0x78 for the mux
  register.
- identify the mode wanted, it's ALT1 for GPIO1_2
- Look if it is involved in daisy chain, grep again if it is
- grep again for EIM_D23, find 0x40c for the PAD_CTL register

That's exactly the steps that are annoying, error prone and you can get
rid of by having a macro like we currently have. If you found a bug in
the macro, fix it and everyone benefits.

Also you should notice that with the new patches Shawn has posted nobody
is forced to use these macros. If you don't like them, go and dump the
raw hex numbers into your devicetrees.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-27  7:44                               ` Sascha Hauer
  0 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-27  7:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 12:51:56AM -0600, Matt Sealey wrote:
> On Thu, Feb 21, 2013 at 11:52 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > On Thu, Feb 21, 2013 at 11:36:36AM -0600, Matt Sealey wrote:
> >> On Wed, Feb 20, 2013 at 11:02 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> >> > On Wed, Feb 20, 2013 at 06:03:39PM -0600, Matt Sealey wrote:
> >> >> I am not sure I am getting this point across, but.. damn it.. nack nack nack :D
> >> >>
> >> > Do you see any downgrade side that the series introduces over the
> >> > existing implementation?
> >>
> >> Because it replaces the horribly stupid existing implementation with
> >> something that doesn't solve the fundamental logical problems caused
> >> by the existing implementation.
> >
> > When did I say that the series is targeting to solve those "fundamental
> > logical problems" in *your* view?
> >
> > ...
> 
> Why would you submit a series that doesn't solve such problems? :)
> 
> To replace an illogical, ridiculous system of arbitrary pin numbering
> with an illogical mapping of registers to arbitrary names is..
> illogical.
> 
> >> What you've fixed it to do, as I read this patch, is this;
> >>
> >> <arbitrary_pin_name pad_mode>
> >>
> > No, it's not arbitrary_pin_name.  It's pin function name which comes
> > from hardware manual.  It may not exactly match the public reference
> > manual, but they are obvious to be identified.  For imx6q pad SD2_DAT1
> > example, the manual says:
> >
> > Select 1 of 6 iomux modes to be used for pad: SD2_DAT1.
> >   000 ALT0 ? Select signal SD2_DATA1.
> >   001 ALT1 ? Select signal ECSPI5_SS0.
> >   010 ALT2 ? Select signal EIM_CS2.
> >   011 ALT3 ? Select signal AUD4_TXFS.
> >   100 ALT4 ? Select signal KEY_COL7.
> >   101 ALT5 ? Select signal GPIO1_IO14.
> >
> > And imx6q-pinfunc.h gives:
> >
> >   MX6Q_PAD_SD2_DAT1__USDHC2_DAT1
> >   MX6Q_PAD_SD2_DAT1__ECSPI5_SS0
> >   MX6Q_PAD_SD2_DAT1__WEIM_WEIM_CS_2
> >   MX6Q_PAD_SD2_DAT1__AUDMUX_AUD4_TXFS
> >   MX6Q_PAD_SD2_DAT1__KPP_COL_7
> >   MX6Q_PAD_SD2_DAT1__GPIO_1_14
> 
> So, SD2_DAT1 with function SD2_DAT1 in the manual is SD2_DAT1__USDHC2_DAT1 ?
> 
> KEY_COL7 -> KPP_COL_7?
> EIM_CS2 -> WEIM_WEIM_CS_2?
> AUD4_TXFS -> AUDMUX_AUD4_TXFS?
> GPIO1_IO14 -> GPIO_1_14?
> 
> This is what I call arbitrary.
> 
> Since the documented NAMING of pins changes between SoC revisions
> (where pins change definition or group), manual revisions (where
> people fix definitions), and even existing source code, it makes no
> sense whatsoever to give things like this a name. Especially as it is
> possible to break out the pin definitions and see that your "use a
> macro to encode 5 values at once and leave the most-often changing
> value to the device tree" method misses one thing: it is not easy to
> set the SION bit in the ALT register for each of these without
> replacing the macro. Sometimes SION is important for debugging,
> sometimes it is not... some pins need SION *forever* and other times..
> not. On i.MX6 using RMII ethernet, you need SION to loopback the clock
> input to the MAC.. but it's possible you'd want to temporarily disable
> this in a build. The only way here is to replace the pin definition
> macro part with the actual register values, set your SION bit, and
> rebuild the device tree.
> 
> The only canonical thing you can guarantee is that in general the
> registers fit within certain ranges (although on i.MX51 the ranges did
> change between revisions, this is another problem), and accept certain
> values.
> 
> The only reasonable thing we can be doing with pre-processing IOMUX
> data is make sure it fits those ranges (within reason) and possibly
> use the preprocessing to ensure that invalid values never make it into
> a device tree (i.e. there are bits in the pad settings which are
> never, ever set on a particular SoC, and masking and bailing out using
> #error or pitching a #warning would be much more useful than allowing
> random bits to go into register areas that are "reserved".
> 
> I half-agree with Sascha. I am responsible for porting the i.MX51
> iomux-v3.h stuff to U-Boot because using the naming scheme worked so
> much better there than mxc_request_iomux clutter since most boards
> came with almost exactly the same settings on exactly the same buses
> because it was a limited choice on i.MX51. This MOSTLY works but there
> are several - if not a ridiculous number - of entries which needed to
> be modified for any particular board. And the remit came from the
> U-Boot guys simply that we should not commit into the tree any pins
> which no board makes use of.
> 
> Here, we have potential for a huge file full of macros of which a good
> deal of them will end up with NOBODY using, and therefore just clutter
> the file. If we go with the U-Boot model, we only add macros to define
> a pin configuration set if at least ONE board requires that
> definition. This will keep it nice and clean and make sure nobody
> commits huge swaths of macros which nobody is testing.

Great, so you end up patching this file over and over again, maintaining
out of boards always require patches to the iomux file, maintainers have
to deal with merge conflicts.

> 
> Since I did that work, I've changed my mind; actually naming the pins
> by their intended function simply doesn't ADD anything to the device
> tree functionality, nor does it really help Sascha out any more than
> simply having a *really good reference* would help him out.
> 
> For example, please explain to me why;
> 
> MX51_PIN_EIM_23__GPIO1_2 0x6528
> 
> is clearer than;
> 
> 0x174 0x5 0x3d8 0x7 0x654 0x7633, /* EIM_23 GPIO1_2 and some pullup
> settings or so comment comment comment */

Look what you have to do to get the pin muxing for a single pin from the
datasheet.

- identify the name, grep for it in the datasheet, find 0x78 for the mux
  register.
- identify the mode wanted, it's ALT1 for GPIO1_2
- Look if it is involved in daisy chain, grep again if it is
- grep again for EIM_D23, find 0x40c for the PAD_CTL register

That's exactly the steps that are annoying, error prone and you can get
rid of by having a macro like we currently have. If you found a bug in
the macro, fix it and everyone benefits.

Also you should notice that with the new patches Shawn has posted nobody
is forced to use these macros. If you don't like them, go and dump the
raw hex numbers into your devicetrees.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-27  7:44                               ` Sascha Hauer
@ 2013-02-27 18:16                                   ` Matt Sealey
  -1 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-27 18:16 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Dong Aisheng, devicetree-discuss, Rob Herring,
	Uwe Kleine-König, Linux ARM Kernel ML

On Wed, Feb 27, 2013 at 1:44 AM, Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> On Wed, Feb 27, 2013 at 12:51:56AM -0600, Matt Sealey wrote:
>> For example, please explain to me why;
>>
>> MX51_PIN_EIM_23__GPIO1_2 0x6528
>>
>> is clearer than;
>>
>> 0x174 0x5 0x3d8 0x7 0x654 0x7633, /* EIM_23 GPIO1_2 and some pullup
>> settings or so comment comment comment */
>
> Look what you have to do to get the pin muxing for a single pin from the
> datasheet.
>
> - identify the name, grep for it in the datasheet, find 0x78 for the mux
>   register.
> - identify the mode wanted, it's ALT1 for GPIO1_2
> - Look if it is involved in daisy chain, grep again if it is
> - grep again for EIM_D23, find 0x40c for the PAD_CTL register
>
> That's exactly the steps that are annoying, error prone and you can get
> rid of by having a macro like we currently have. If you found a bug in
> the macro, fix it and everyone benefits.

And everyone ends up with broken device trees until someone notices.
In my experience, nobody usually notices until a very, very long time
has passed. At least if the register values you're picking doing board
support for your boards will only affect your board if they're wrong
and not be global.

> Also you should notice that with the new patches Shawn has posted nobody
> is forced to use these macros. If you don't like them, go and dump the
> raw hex numbers into your devicetrees.

I do notice that, what I'm a little perturbed by is that it doesn't
seem to improve the situation (the amount of work required to use and
VERIFY the values in each macro - on the assumption that any of them
could be wrong and cross-check them with the schematics, the board
designer if necessary, and then put them in a device tree as known
working. Not all of the data files used in PCB design packages
actually match the docs anyway so there are some cross-checks against
yet another Freescale design database. If I asked someone here to go
find the pin settings for USDHC2 on a board we have, they would first
have to figure out which pad this was coming out of, go to the manual,
find the signals that exit on that pad, look at the IOMUX, cross check
it with some example code and the FSL IOMUX tool... pre-processing and
using macros doesn't make that any easier until we have a single,
fixed, totally verified and unchangeable set of macros which will
cover all the usual cases. If the intent is that we just glob in 2500
pin definitions at the start and "hope" that someone "eventually"
notices any errors.. this is not normal in embedded design.

I think that in the grand scheme of things it will just serve to hide
errors behind a macro..

Shawn, I might be much happier about the patch if I knew for sure that it

a) followed some Freescale design database export of pins vs. alt
modes and default mux settings (this must exist because the manuals
and IOMUX tool data are generated from some XML files) and that
b) that data was available to generate the macros used in the binding.

Assuming the manual is correct is not a bad way to go - sometimes it
is definitely NOT, but the information we're using right now is
derived from there anyway.. it should still follow the names listed
there (i.e. SD2_DAT4__SD2_DAT4 and not SD2_DAT4__USDHC2_DATA4 if the
first one is what can be derived from the manual)

I would also be MUCH happier if macros were also present to support
cross-checking the ranges of iomux registers being defined such that
they can be cross-checked at pre-processing time for those people who
do not want to use the macros verbatim. This way immediate errors
(accidental typo putting a wrong register in a field which is out of
range for the valid addresses for that register block) will be caught
in using the macros.

I guess I will have to capitulate on it since I've got absolutely no
power to lock Shawn in a room until it's done right, but I loathe
automation for automation's sake. There always has to be a human
present and the amount of work he has to do is not "annoying" when it
is looking something up in the manual and coding something to suit.
That's what we all do for a living, for crying out loud. And when a
human is doing some amount of work, making it easier to make a mistake
and creating an assumption that there is an easy way out via
preprocessor macros is counter-productive (someone still has to write
every macro, and someone still has to verify every single one of them
at some point).

-- 
Matt Sealey <matt-sEEEE4iEDtaXzmuOJsdVMQ@public.gmane.org>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-27 18:16                                   ` Matt Sealey
  0 siblings, 0 replies; 55+ messages in thread
From: Matt Sealey @ 2013-02-27 18:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 1:44 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Wed, Feb 27, 2013 at 12:51:56AM -0600, Matt Sealey wrote:
>> For example, please explain to me why;
>>
>> MX51_PIN_EIM_23__GPIO1_2 0x6528
>>
>> is clearer than;
>>
>> 0x174 0x5 0x3d8 0x7 0x654 0x7633, /* EIM_23 GPIO1_2 and some pullup
>> settings or so comment comment comment */
>
> Look what you have to do to get the pin muxing for a single pin from the
> datasheet.
>
> - identify the name, grep for it in the datasheet, find 0x78 for the mux
>   register.
> - identify the mode wanted, it's ALT1 for GPIO1_2
> - Look if it is involved in daisy chain, grep again if it is
> - grep again for EIM_D23, find 0x40c for the PAD_CTL register
>
> That's exactly the steps that are annoying, error prone and you can get
> rid of by having a macro like we currently have. If you found a bug in
> the macro, fix it and everyone benefits.

And everyone ends up with broken device trees until someone notices.
In my experience, nobody usually notices until a very, very long time
has passed. At least if the register values you're picking doing board
support for your boards will only affect your board if they're wrong
and not be global.

> Also you should notice that with the new patches Shawn has posted nobody
> is forced to use these macros. If you don't like them, go and dump the
> raw hex numbers into your devicetrees.

I do notice that, what I'm a little perturbed by is that it doesn't
seem to improve the situation (the amount of work required to use and
VERIFY the values in each macro - on the assumption that any of them
could be wrong and cross-check them with the schematics, the board
designer if necessary, and then put them in a device tree as known
working. Not all of the data files used in PCB design packages
actually match the docs anyway so there are some cross-checks against
yet another Freescale design database. If I asked someone here to go
find the pin settings for USDHC2 on a board we have, they would first
have to figure out which pad this was coming out of, go to the manual,
find the signals that exit on that pad, look at the IOMUX, cross check
it with some example code and the FSL IOMUX tool... pre-processing and
using macros doesn't make that any easier until we have a single,
fixed, totally verified and unchangeable set of macros which will
cover all the usual cases. If the intent is that we just glob in 2500
pin definitions at the start and "hope" that someone "eventually"
notices any errors.. this is not normal in embedded design.

I think that in the grand scheme of things it will just serve to hide
errors behind a macro..

Shawn, I might be much happier about the patch if I knew for sure that it

a) followed some Freescale design database export of pins vs. alt
modes and default mux settings (this must exist because the manuals
and IOMUX tool data are generated from some XML files) and that
b) that data was available to generate the macros used in the binding.

Assuming the manual is correct is not a bad way to go - sometimes it
is definitely NOT, but the information we're using right now is
derived from there anyway.. it should still follow the names listed
there (i.e. SD2_DAT4__SD2_DAT4 and not SD2_DAT4__USDHC2_DATA4 if the
first one is what can be derived from the manual)

I would also be MUCH happier if macros were also present to support
cross-checking the ranges of iomux registers being defined such that
they can be cross-checked at pre-processing time for those people who
do not want to use the macros verbatim. This way immediate errors
(accidental typo putting a wrong register in a field which is out of
range for the valid addresses for that register block) will be caught
in using the macros.

I guess I will have to capitulate on it since I've got absolutely no
power to lock Shawn in a room until it's done right, but I loathe
automation for automation's sake. There always has to be a human
present and the amount of work he has to do is not "annoying" when it
is looking something up in the manual and coding something to suit.
That's what we all do for a living, for crying out loud. And when a
human is doing some amount of work, making it easier to make a mistake
and creating an assumption that there is an easy way out via
preprocessor macros is counter-productive (someone still has to write
every macro, and someone still has to verify every single one of them
at some point).

-- 
Matt Sealey <matt@genesi-usa.com>
Product Development Analyst, Genesi USA, Inc.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-27 18:16                                   ` Matt Sealey
@ 2013-02-27 20:00                                       ` Sascha Hauer
  -1 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-27 20:00 UTC (permalink / raw)
  To: Matt Sealey
  Cc: Dong Aisheng, devicetree-discuss, Rob Herring,
	Uwe Kleine-König, Linux ARM Kernel ML

On Wed, Feb 27, 2013 at 12:16:20PM -0600, Matt Sealey wrote:
> On Wed, Feb 27, 2013 at 1:44 AM, Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > On Wed, Feb 27, 2013 at 12:51:56AM -0600, Matt Sealey wrote:
> 
> I do notice that, what I'm a little perturbed by is that it doesn't
> seem to improve the situation (the amount of work required to use and
> VERIFY the values in each macro - on the assumption that any of them
> could be wrong and cross-check them with the schematics, the board
> designer if necessary, and then put them in a device tree as known
> working. Not all of the data files used in PCB design packages
> actually match the docs anyway so there are some cross-checks against
> yet another Freescale design database. If I asked someone here to go
> find the pin settings for USDHC2 on a board we have, they would first
> have to figure out which pad this was coming out of, go to the manual,
> find the signals that exit on that pad, look at the IOMUX, cross check
> it with some example code and the FSL IOMUX tool... pre-processing and
> using macros doesn't make that any easier until we have a single,
> fixed, totally verified and unchangeable set of macros which will
> cover all the usual cases. If the intent is that we just glob in 2500
> pin definitions at the start and "hope" that someone "eventually"
> notices any errors.. this is not normal in embedded design.

If the macro is unused then who cares about the bugs in it? If on the
other hand it is used, then people will notice the bugs quite fast and
will fix them. If you don't like the macros, then don't use them. If
you have a better idea how the macros should look like, send patches.

Please try and make your point in the amount of text I quoted above,
preferably even shorter, because that's the maximum amount of text I
think most people are willing to read per mail. The shorter you write
the more people will read your mails up to the end and maybe react to
it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-27 20:00                                       ` Sascha Hauer
  0 siblings, 0 replies; 55+ messages in thread
From: Sascha Hauer @ 2013-02-27 20:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 12:16:20PM -0600, Matt Sealey wrote:
> On Wed, Feb 27, 2013 at 1:44 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Wed, Feb 27, 2013 at 12:51:56AM -0600, Matt Sealey wrote:
> 
> I do notice that, what I'm a little perturbed by is that it doesn't
> seem to improve the situation (the amount of work required to use and
> VERIFY the values in each macro - on the assumption that any of them
> could be wrong and cross-check them with the schematics, the board
> designer if necessary, and then put them in a device tree as known
> working. Not all of the data files used in PCB design packages
> actually match the docs anyway so there are some cross-checks against
> yet another Freescale design database. If I asked someone here to go
> find the pin settings for USDHC2 on a board we have, they would first
> have to figure out which pad this was coming out of, go to the manual,
> find the signals that exit on that pad, look at the IOMUX, cross check
> it with some example code and the FSL IOMUX tool... pre-processing and
> using macros doesn't make that any easier until we have a single,
> fixed, totally verified and unchangeable set of macros which will
> cover all the usual cases. If the intent is that we just glob in 2500
> pin definitions at the start and "hope" that someone "eventually"
> notices any errors.. this is not normal in embedded design.

If the macro is unused then who cares about the bugs in it? If on the
other hand it is used, then people will notice the bugs quite fast and
will fix them. If you don't like the macros, then don't use them. If
you have a better idea how the macros should look like, send patches.

Please try and make your point in the amount of text I quoted above,
preferably even shorter, because that's the maximum amount of text I
think most people are willing to read per mail. The shorter you write
the more people will read your mails up to the end and maybe react to
it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
  2013-02-27 18:16                                   ` Matt Sealey
@ 2013-02-28  3:06                                       ` Shawn Guo
  -1 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-28  3:06 UTC (permalink / raw)
  To: Matt Sealey
  Cc: Sascha Hauer, Rob Herring, Uwe Kleine-König, Dong Aisheng,
	devicetree-discuss, Linux ARM Kernel ML

On Wed, Feb 27, 2013 at 12:16:20PM -0600, Matt Sealey wrote:
> Shawn, I might be much happier about the patch if I knew for sure that it
> 
> a) followed some Freescale design database export of pins vs. alt
> modes and default mux settings

This is the case today.

> (this must exist because the manuals
> and IOMUX tool data are generated from some XML files) and that

The problem seems to be that the ALT function names are a little
inconsistent between XML files and design database.  I'm checking with
design team right now to see how this happens, and ensure this will
never happen again in the future.

And I will ensure the macro for later SoCs, e.g. imx6dl and imx6sl,
will be consistent with Reference Manual.

> b) that data was available to generate the macros used in the binding.

Ok.  I will check with IOMUX-tool people to see if we can have the data
integrated and exported with the tool.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name
@ 2013-02-28  3:06                                       ` Shawn Guo
  0 siblings, 0 replies; 55+ messages in thread
From: Shawn Guo @ 2013-02-28  3:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 12:16:20PM -0600, Matt Sealey wrote:
> Shawn, I might be much happier about the patch if I knew for sure that it
> 
> a) followed some Freescale design database export of pins vs. alt
> modes and default mux settings

This is the case today.

> (this must exist because the manuals
> and IOMUX tool data are generated from some XML files) and that

The problem seems to be that the ALT function names are a little
inconsistent between XML files and design database.  I'm checking with
design team right now to see how this happens, and ensure this will
never happen again in the future.

And I will ensure the macro for later SoCs, e.g. imx6dl and imx6sl,
will be consistent with Reference Manual.

> b) that data was available to generate the macros used in the binding.

Ok.  I will check with IOMUX-tool people to see if we can have the data
integrated and exported with the tool.

Shawn

^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2013-02-28  3:06 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-20  7:08 [PATCH 0/3] Get rid of big array from imx pinctrl driver Shawn Guo
2013-02-20  7:08 ` [PATCH 1/3] ARM: dts: imx: use pre-processor for device trees Shawn Guo
2013-02-20  9:26   ` Dong Aisheng
2013-02-20  9:25 ` [PATCH 0/3] Get rid of big array from imx pinctrl driver Dong Aisheng
     [not found] ` <1361344089-16804-3-git-send-email-shawn.guo@linaro.org>
2013-02-20  9:30   ` [PATCH 2/3] ARM: dts: imx: replace magic number with pin function name Dong Aisheng
     [not found]   ` <1361344089-16804-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-02-20 18:46     ` Stephen Warren
2013-02-20 18:46       ` Stephen Warren
     [not found]       ` <51251A11.2030300-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-21  0:03         ` Matt Sealey
2013-02-21  0:03           ` Matt Sealey
     [not found]           ` <CAKGA1bkHH1XC38_VM=QhDrr33uqqSbwe0n+GfXEPs43K_Do=CQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-21  0:34             ` Stephen Warren
2013-02-21  0:34               ` Stephen Warren
2013-02-21  5:02             ` Shawn Guo
2013-02-21  5:02               ` Shawn Guo
     [not found]               ` <20130221050247.GD17738-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-02-21 17:36                 ` Matt Sealey
2013-02-21 17:36                   ` Matt Sealey
     [not found]                   ` <CAKGA1bn22xctSj_33HQsWwnVB=RO2OJ=eYvgRD-kF+PiQcnC4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-21 17:57                     ` Matt Sealey
2013-02-21 17:57                       ` Matt Sealey
2013-02-21 21:43                     ` Sascha Hauer
2013-02-21 21:43                       ` Sascha Hauer
     [not found]                       ` <20130221214303.GB1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-22  7:58                         ` Shawn Guo
2013-02-22  7:58                           ` Shawn Guo
2013-02-22  5:52                     ` Shawn Guo
2013-02-22  5:52                       ` Shawn Guo
     [not found]                       ` <20130222055203.GB27371-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-02-22  7:27                         ` Sascha Hauer
2013-02-22  7:27                           ` Sascha Hauer
     [not found]                           ` <20130222072743.GC1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-22  7:36                             ` Shawn Guo
2013-02-22  7:36                               ` Shawn Guo
     [not found]                               ` <20130222073630.GC27371-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-02-22  8:12                                 ` Sascha Hauer
2013-02-22  8:12                                   ` Sascha Hauer
2013-02-27  6:51                         ` Matt Sealey
2013-02-27  6:51                           ` Matt Sealey
     [not found]                           ` <CAKGA1bmw+CzBDLHty1+L1VdeWLgkPpLSLpGKBJEeQj-ByyzicA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-27  7:44                             ` Sascha Hauer
2013-02-27  7:44                               ` Sascha Hauer
     [not found]                               ` <20130227074404.GD1906-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-02-27 18:16                                 ` Matt Sealey
2013-02-27 18:16                                   ` Matt Sealey
     [not found]                                   ` <CAKGA1bmqdCiocc_O6hU3ym6uJ-bAjwKMNrt43Qs_dkjEGpX-KQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-27 20:00                                     ` Sascha Hauer
2013-02-27 20:00                                       ` Sascha Hauer
2013-02-28  3:06                                     ` Shawn Guo
2013-02-28  3:06                                       ` Shawn Guo
2013-02-21  4:59         ` Shawn Guo
2013-02-21  4:59           ` Shawn Guo
     [not found] ` <1361344089-16804-4-git-send-email-shawn.guo@linaro.org>
2013-02-20  9:44   ` [PATCH 3/3] pinctrl: imx: move hard-coding data into device tree Dong Aisheng
2013-02-21  6:04     ` Shawn Guo
     [not found]   ` <1361344089-16804-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-02-20 19:04     ` Stephen Warren
2013-02-20 19:04       ` Stephen Warren
     [not found]       ` <51251E5A.1080806-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-21  5:30         ` Shawn Guo
2013-02-21  5:30           ` Shawn Guo
     [not found]           ` <20130221053020.GE17738-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-02-21  7:55             ` Sascha Hauer
2013-02-21  7:55               ` Sascha Hauer
2013-02-21  9:36         ` Dong Aisheng
2013-02-21  9:36           ` Dong Aisheng
     [not found]           ` <CAP1dx+w2bLcztrRJOYs07xxSqVgo3bggJHMFt5LyL5jXQ-h6Mg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-21 19:57             ` Stephen Warren
2013-02-21 19:57               ` Stephen Warren
     [not found]               ` <51267C0E.6070902-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-26  8:02                 ` Dong Aisheng
2013-02-26  8:02                   ` Dong Aisheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.