From: Dmitry Yashin <dmt.yashin@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Heiko Stuebner <heiko@sntech.de>
Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>,
Jianqun Xu <jay.xu@rock-chips.com>,
Jonas Karlman <jonas@kwiboo.se>,
devicetree@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
Dmitry Yashin <dmt.yashin@gmail.com>
Subject: [PATCH v2 1/2] pinctrl: rockchip: delay recalced_mask and route_mask init
Date: Wed, 29 May 2024 19:35:33 +0500 [thread overview]
Message-ID: <20240529143534.32402-2-dmt.yashin@gmail.com> (raw)
In-Reply-To: <20240529143534.32402-1-dmt.yashin@gmail.com>
For some SoC's like rk3308 additional runtime setup needed, so delay
recalced_mask and route_mask init.
Signed-off-by: Dmitry Yashin <dmt.yashin@gmail.com>
---
drivers/pinctrl/pinctrl-rockchip.c | 52 ++++++++++++++++++------------
1 file changed, 32 insertions(+), 20 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index cc647db76927..c290c755b4fb 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3170,6 +3170,36 @@ static int rockchip_pinctrl_register(struct platform_device *pdev,
return 0;
}
+static void iomux_recalced_routes_init(struct rockchip_pinctrl *info)
+{
+ struct rockchip_pin_ctrl *ctrl = info->ctrl;
+ struct rockchip_pin_bank *bank = ctrl->pin_banks;
+ int i, j;
+
+ for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
+
+ /* calculate the per-bank recalced_mask */
+ for (j = 0; j < ctrl->niomux_recalced; j++) {
+ int pin = 0;
+
+ if (ctrl->iomux_recalced[j].num == bank->bank_num) {
+ pin = ctrl->iomux_recalced[j].pin;
+ bank->recalced_mask |= BIT(pin);
+ }
+ }
+
+ /* calculate the per-bank route_mask */
+ for (j = 0; j < ctrl->niomux_routes; j++) {
+ int pin = 0;
+
+ if (ctrl->iomux_routes[j].bank_num == bank->bank_num) {
+ pin = ctrl->iomux_routes[j].pin;
+ bank->route_mask |= BIT(pin);
+ }
+ }
+ }
+}
+
static const struct of_device_id rockchip_pinctrl_dt_match[];
/* retrieve the soc specific data */
@@ -3265,26 +3295,6 @@ static struct rockchip_pin_ctrl *rockchip_pinctrl_get_soc_data(
bank_pins += 8;
}
-
- /* calculate the per-bank recalced_mask */
- for (j = 0; j < ctrl->niomux_recalced; j++) {
- int pin = 0;
-
- if (ctrl->iomux_recalced[j].num == bank->bank_num) {
- pin = ctrl->iomux_recalced[j].pin;
- bank->recalced_mask |= BIT(pin);
- }
- }
-
- /* calculate the per-bank route_mask */
- for (j = 0; j < ctrl->niomux_routes; j++) {
- int pin = 0;
-
- if (ctrl->iomux_routes[j].bank_num == bank->bank_num) {
- pin = ctrl->iomux_routes[j].pin;
- bank->route_mask |= BIT(pin);
- }
- }
}
return ctrl;
@@ -3403,6 +3413,8 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)
return PTR_ERR(info->regmap_pmu);
}
+ iomux_recalced_routes_init(info);
+
ret = rockchip_pinctrl_register(pdev, info);
if (ret)
return ret;
--
2.39.2
next prev parent reply other threads:[~2024-05-29 14:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-29 14:35 [PATCH v2 0/2] pinctrl: rockchip: add rk3308b SoC support Dmitry Yashin
2024-05-29 14:35 ` Dmitry Yashin [this message]
2024-05-29 14:35 ` [PATCH v2 2/2] " Dmitry Yashin
2024-06-03 15:50 ` Luca Ceresoli
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=20240529143534.32402-2-dmt.yashin@gmail.com \
--to=dmt.yashin@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=jay.xu@rock-chips.com \
--cc=jonas@kwiboo.se \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=luca.ceresoli@bootlin.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;
as well as URLs for NNTP newsgroup(s).