All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Silbe <x-linux@se-silbe.de>
To: Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] arm64: dts: imx8mq: add defines for IOMUXC_SW_PAD_CTL register values
Date: Sun, 24 Oct 2021 17:28:32 +0200	[thread overview]
Message-ID: <20211024152832.649738-1-x-linux@se-silbe.de> (raw)

The IOMUXC_SW_PAD_CTL_* registers on i.MX8M Dual/QuadLite/Quad all
have the same basic structure. Add defines for a common subset
supported by most of the registers. They can be used in Device Tree
source files instead of magic values, making the sources a lot more
readable and easier to write as well.

Signed-off-by: Sascha Silbe <x-linux@se-silbe.de>
---
 .../arm64/boot/dts/freescale/imx8mq-pinfunc.h | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

The board I'm using this for is an out-of-tree prototype. If there's
interest I can convert the in-tree DTS files. I have don't have any of
those boards but comparing the built DTBs before vs. after the change
should be sufficient.


diff --git a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h
index 68e8fa1729741..384ceb5422761 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h
+++ b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h
@@ -7,6 +7,34 @@
 #ifndef __DTS_IMX8MQ_PINFUNC_H
 #define __DTS_IMX8MQ_PINFUNC_H
 
+/* Software Input On bit from IOMUXC_SW_MUX_CTL_PAD_* registers. Magic
+ * value defined in
+ * Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
+ */
+#define PAD_SION (1 << 30)
+/* input high/low thresholds, 0 = LVCMOS, 1 = LVTTL */
+#define PAD_LVTTL (1 << 8)
+/* Schmitt-Trigger, 0 = disabled, 1 = enabled */
+#define PAD_HYS (1 << 7)
+/* Internal pull-up resistor, 0 = disabled, 1 = enabled */
+#define PAD_PUE (1 << 6)
+/* Open Drain, 0 = push-pull, 1 = open drain */
+#define PAD_ODE (1 << 5)
+/* Slew Rate, 50/100/150/200 MHz */
+#define PAD_SRE_50MHZ 0
+#define PAD_SRE_100MHZ (1 << 3)
+#define PAD_SRE_150MHZ (2 << 3)
+#define PAD_SRE_200MHZ (3 << 3)
+/* Drive Strength; names are based on nominal impedance at 3.3V */
+#define PAD_DSE_HIZ 0
+#define PAD_DSE_255OHM 1
+#define PAD_DSE_105OHM 2
+#define PAD_DSE_75OHM 3
+#define PAD_DSE_85OHM 4
+#define PAD_DSE_65OHM 5
+#define PAD_DSE_45OHM 6
+#define PAD_DSE_40OHM 7
+
 /*
  * The pin function ID is a tuple of
  * <mux_reg conf_reg input_reg mux_mode input_val>

base-commit: 9c0c4d24ac000e52d55348961d3a3ba42065e0cf
prerequisite-patch-id: d2d09cbe2907cd6c1ece0fcc6b576faf1ef8dd37
prerequisite-patch-id: 42e69450ab3e60fd3705232ae05fa1c8acfb467b
prerequisite-patch-id: 9360e270fb7fbccc22d2a66c41830746bdb80784
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Sascha Silbe <x-linux@se-silbe.de>
To: Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] arm64: dts: imx8mq: add defines for IOMUXC_SW_PAD_CTL register values
Date: Sun, 24 Oct 2021 17:28:32 +0200	[thread overview]
Message-ID: <20211024152832.649738-1-x-linux@se-silbe.de> (raw)

The IOMUXC_SW_PAD_CTL_* registers on i.MX8M Dual/QuadLite/Quad all
have the same basic structure. Add defines for a common subset
supported by most of the registers. They can be used in Device Tree
source files instead of magic values, making the sources a lot more
readable and easier to write as well.

Signed-off-by: Sascha Silbe <x-linux@se-silbe.de>
---
 .../arm64/boot/dts/freescale/imx8mq-pinfunc.h | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

The board I'm using this for is an out-of-tree prototype. If there's
interest I can convert the in-tree DTS files. I have don't have any of
those boards but comparing the built DTBs before vs. after the change
should be sufficient.


diff --git a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h
index 68e8fa1729741..384ceb5422761 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h
+++ b/arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h
@@ -7,6 +7,34 @@
 #ifndef __DTS_IMX8MQ_PINFUNC_H
 #define __DTS_IMX8MQ_PINFUNC_H
 
+/* Software Input On bit from IOMUXC_SW_MUX_CTL_PAD_* registers. Magic
+ * value defined in
+ * Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
+ */
+#define PAD_SION (1 << 30)
+/* input high/low thresholds, 0 = LVCMOS, 1 = LVTTL */
+#define PAD_LVTTL (1 << 8)
+/* Schmitt-Trigger, 0 = disabled, 1 = enabled */
+#define PAD_HYS (1 << 7)
+/* Internal pull-up resistor, 0 = disabled, 1 = enabled */
+#define PAD_PUE (1 << 6)
+/* Open Drain, 0 = push-pull, 1 = open drain */
+#define PAD_ODE (1 << 5)
+/* Slew Rate, 50/100/150/200 MHz */
+#define PAD_SRE_50MHZ 0
+#define PAD_SRE_100MHZ (1 << 3)
+#define PAD_SRE_150MHZ (2 << 3)
+#define PAD_SRE_200MHZ (3 << 3)
+/* Drive Strength; names are based on nominal impedance at 3.3V */
+#define PAD_DSE_HIZ 0
+#define PAD_DSE_255OHM 1
+#define PAD_DSE_105OHM 2
+#define PAD_DSE_75OHM 3
+#define PAD_DSE_85OHM 4
+#define PAD_DSE_65OHM 5
+#define PAD_DSE_45OHM 6
+#define PAD_DSE_40OHM 7
+
 /*
  * The pin function ID is a tuple of
  * <mux_reg conf_reg input_reg mux_mode input_val>

base-commit: 9c0c4d24ac000e52d55348961d3a3ba42065e0cf
prerequisite-patch-id: d2d09cbe2907cd6c1ece0fcc6b576faf1ef8dd37
prerequisite-patch-id: 42e69450ab3e60fd3705232ae05fa1c8acfb467b
prerequisite-patch-id: 9360e270fb7fbccc22d2a66c41830746bdb80784
-- 
2.30.2


             reply	other threads:[~2021-10-24 15:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-24 15:28 Sascha Silbe [this message]
2021-10-24 15:28 ` [PATCH] arm64: dts: imx8mq: add defines for IOMUXC_SW_PAD_CTL register values Sascha Silbe
2021-10-29  2:14 ` Rob Herring
2021-10-29  2:14   ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211024152832.649738-1-x-linux@se-silbe.de \
    --to=x-linux@se-silbe.de \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.