From: Drew Fustini <drew@beagleboard.org>
To: Tony Lindgren <tony@atomide.com>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
linux-omap@vger.kernel.org
Cc: Jason Kridner <jkridner@beagleboard.org>,
Robert Nelson <robertcnelson@gmail.com>
Subject: [RFC PATCH] pinctrl-single: parse #pinctrl-cells = 2
Date: Tue, 16 Jun 2020 01:09:06 +0200 [thread overview]
Message-ID: <20200615230906.GA3967771@x1> (raw)
These changes are based on feedback from Tony [1] concerning changing
pinctrl-single to be able to handle pinctrl-cells = 2 for for the
"pinctrl-single,pins" property.
AM33XX_PADCONF macro is modified to keep pin conf and pin mux seperate.
If "pinctrl-single,pins" has 3 arguments (offset, conf, mux) then
pcs_parse_one_pinctrl_entry() does an OR operation on to get the
value to store in the register.
[1] https://lore.kernel.org/linux-omap/20200609180404.GR37466@atomide.com/#t
Signed-off-by: Drew Fustini <drew@beagleboard.org>
---
arch/arm/boot/dts/am33xx-l4.dtsi | 4 ++--
drivers/pinctrl/pinctrl-single.c | 14 ++++++++++++--
include/dt-bindings/pinctrl/omap.h | 2 +-
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/arch/arm/boot/dts/am33xx-l4.dtsi b/arch/arm/boot/dts/am33xx-l4.dtsi
index 340ea331e54d..0b0439b53a0e 100644
--- a/arch/arm/boot/dts/am33xx-l4.dtsi
+++ b/arch/arm/boot/dts/am33xx-l4.dtsi
@@ -288,9 +288,9 @@ scm: scm@0 {
ranges = <0 0 0x2000>;
am33xx_pinmux: pinmux@800 {
- compatible = "pinctrl-single";
+ compatible = "pinconf-single";
reg = <0x800 0x238>;
- #pinctrl-cells = <1>;
+ #pinctrl-cells = <2>;
pinctrl-single,register-width = <32>;
pinctrl-single,function-mask = <0x7f>;
};
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 02f677eb1d53..080083b8b5be 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1017,11 +1017,21 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
break;
}
- /* Index plus one value cell */
offset = pinctrl_spec.args[0];
vals[found].reg = pcs->base + offset;
- vals[found].val = pinctrl_spec.args[1];
+ pr_info("%s: args_count=%d offset=0x%x", __func__,
+ pinctrl_spec.args_count, offset);
+ pr_info("%s: args[1]=0x%x", __func__, pinctrl_spec.args[1]);
+
+ if (pinctrl_spec.args_count == 2) {
+ vals[found].val = pinctrl_spec.args[1];
+ } else if (pinctrl_spec.args_count == 3) {
+ pr_info("%s: args[2]=0x%x", __func__, pinctrl_spec.args[2]);
+ vals[found].val = (pinctrl_spec.args[1] | pinctrl_spec.args[2]);
+ }
+
+ pr_info("%s: vals[%d].val=0x%x", __func__, found, vals[found].val);
dev_dbg(pcs->dev, "%pOFn index: 0x%x value: 0x%x\n",
pinctrl_spec.np, offset, pinctrl_spec.args[1]);
diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h
index 625718042413..2d2a8c737822 100644
--- a/include/dt-bindings/pinctrl/omap.h
+++ b/include/dt-bindings/pinctrl/omap.h
@@ -65,7 +65,7 @@
#define DM814X_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
#define DM816X_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
#define AM33XX_IOPAD(pa, val) OMAP_IOPAD_OFFSET((pa), 0x0800) (val)
-#define AM33XX_PADCONF(pa, dir, mux) OMAP_IOPAD_OFFSET((pa), 0x0800) ((dir) | (mux))
+#define AM33XX_PADCONF(pa, conf, mux) OMAP_IOPAD_OFFSET((pa), 0x0800) (conf) (mux)
/*
* Macros to allow using the offset from the padconf physical address
--
2.25.1
next reply other threads:[~2020-06-15 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 23:09 Drew Fustini [this message]
2020-06-16 14:26 ` [RFC PATCH] pinctrl-single: parse #pinctrl-cells = 2 Tony Lindgren
2020-06-16 16:53 ` Drew Fustini
2020-06-17 16:54 ` Tony Lindgren
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=20200615230906.GA3967771@x1 \
--to=drew@beagleboard.org \
--cc=haojian.zhuang@linaro.org \
--cc=jkridner@beagleboard.org \
--cc=linus.walleij@linaro.org \
--cc=linux-omap@vger.kernel.org \
--cc=robertcnelson@gmail.com \
--cc=tony@atomide.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox