linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jianqun Xu <jay.xu@rock-chips.com>
To: linus.walleij@linaro.org, heiko@sntech.de
Cc: linux-gpio@vger.kernel.org, Jianqun Xu <jay.xu@rock-chips.com>,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: [PATCH 4/5] pinctrl: rockchip: create irq mapping in gpio_to_irq
Date: Mon,  7 Sep 2020 10:59:26 +0800	[thread overview]
Message-ID: <20200907025927.9713-5-jay.xu@rock-chips.com> (raw)
In-Reply-To: <20200907025927.9713-1-jay.xu@rock-chips.com>

Remove totally irq mappings create in probe, the gpio irq mapping will
be created when do
    gpio_to_irq ->
        rockchip_gpio_to_irq ->
            irq_create_mapping

This patch can speed up system boot on, also abandon many unused irq
mappings' create.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/pinctrl/pinctrl-rockchip.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 58fd4d822591..c98bd352f831 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -3198,7 +3198,7 @@ static void rockchip_irq_demux(struct irq_desc *desc)
 
 		irq = __ffs(pend);
 		pend &= ~BIT(irq);
-		virq = irq_linear_revmap(bank->domain, irq);
+		virq = irq_find_mapping(bank->domain, irq);
 
 		if (!virq) {
 			dev_err(bank->drvdata->dev, "unmapped irq %d\n", irq);
@@ -3377,7 +3377,7 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 	unsigned int clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
 	struct irq_chip_generic *gc;
 	int ret;
-	int i, j;
+	int i;
 
 	for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
 		if (!bank->valid) {
@@ -3404,7 +3404,7 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 
 		ret = irq_alloc_domain_generic_chips(bank->domain, 32, 1,
 					 "rockchip_gpio_irq", handle_level_irq,
-					 clr, 0, IRQ_GC_INIT_MASK_CACHE);
+					 clr, 0, 0);
 		if (ret) {
 			dev_err(&pdev->dev, "could not alloc generic chips for bank %s\n",
 				bank->name);
@@ -3413,14 +3413,6 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 			continue;
 		}
 
-		/*
-		 * Linux assumes that all interrupts start out disabled/masked.
-		 * Our driver only uses the concept of masked and always keeps
-		 * things enabled, so for us that's all masked and all enabled.
-		 */
-		writel_relaxed(0xffffffff, bank->reg_base + GPIO_INTMASK);
-		writel_relaxed(0xffffffff, bank->reg_base + GPIO_INTEN);
-
 		gc = irq_get_domain_generic_chip(bank->domain, 0);
 		gc->reg_base = bank->reg_base;
 		gc->private = bank;
@@ -3437,13 +3429,17 @@ static int rockchip_interrupts_register(struct platform_device *pdev,
 		gc->chip_types[0].chip.irq_set_type = rockchip_irq_set_type;
 		gc->wake_enabled = IRQ_MSK(bank->nr_pins);
 
+		/*
+		 * Linux assumes that all interrupts start out disabled/masked.
+		 * Our driver only uses the concept of masked and always keeps
+		 * things enabled, so for us that's all masked and all enabled.
+		 */
+		writel_relaxed(0xffffffff, bank->reg_base + GPIO_INTMASK);
+		writel_relaxed(0xffffffff, bank->reg_base + GPIO_INTEN);
+		gc->mask_cache = 0xffffffff;
+
 		irq_set_chained_handler_and_data(bank->irq,
 						 rockchip_irq_demux, bank);
-
-		/* map the gpio irqs here, when the clock is still running */
-		for (j = 0 ; j < 32 ; j++)
-			irq_create_mapping(bank->domain, j);
-
 		clk_disable(bank->clk);
 	}
 
-- 
2.17.1




_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2020-09-07  2:59 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31  8:47 [PATCH 0/6] rockchip-pinctrl fixes for GKI Jianqun Xu
2020-08-31  8:47 ` [PATCH 1/6] pinctrl: rockchip: make driver be tristate module Jianqun Xu
2020-09-01 10:13   ` kernel test robot
2020-09-05 21:51     ` Heiko Stübner
2020-09-05 22:01   ` Heiko Stübner
2020-09-05 22:23     ` Heiko Stübner
2020-08-31  8:47 ` [PATCH 2/6] pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq Jianqun Xu
2020-09-05 21:54   ` Heiko Stübner
2020-08-31  8:47 ` [PATCH 3/6] pinctrl: rockchip: create irq mapping in gpio_to_irq Jianqun Xu
2020-09-05 22:03   ` Heiko Stübner
2020-08-31  8:47 ` [PATCH 4/6] pinctrl: rockchip: do not set gpio if bank invalid Jianqun Xu
2020-09-05 22:09   ` Heiko Stübner
2020-08-31  8:50 ` [PATCH 5/6] pinctrl: rockchip: fix crash caused by invalid gpio bank Jianqun Xu
2020-09-05 22:14   ` Heiko Stübner
2020-08-31  8:50 ` [PATCH 6/6] pinctrl: rockchip: populate platform device for rockchip gpio Jianqun Xu
2020-09-06 10:20   ` Heiko Stübner
2020-09-07  2:59 ` [PATCH v2 0/5] rockchip-pinctrl fixes for GKI Jianqun Xu
2020-09-07  2:59   ` [PATCH 1/5] pinctrl: rockchip: depend on OF Jianqun Xu
2020-09-07  2:59   ` [PATCH 2/5] pinctrl: rockchip: make driver be tristate module Jianqun Xu
2020-09-07 11:35     ` kernel test robot
2020-09-12 11:41     ` Heiko Stübner
2020-09-14  0:38     ` [PATCH 2/2] " Jianqun Xu
2020-09-20 22:14       ` Heiko Stübner
2020-09-20 22:18         ` Heiko Stübner
2020-09-29 13:21           ` Linus Walleij
2020-10-13  6:40             ` jay.xu
2020-09-07  2:59   ` [PATCH 3/5] pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq Jianqun Xu
2020-09-07  2:59   ` Jianqun Xu [this message]
2020-09-07  3:38   ` [PATCH 5/5] pinctrl: rockchip: populate platform device for rockchip gpio Jianqun Xu
2020-09-08  2:19     ` [PATCH] " Jianqun Xu
2020-09-20 22:16       ` Heiko Stübner
2020-09-12 11:35   ` [PATCH v2 0/5] rockchip-pinctrl fixes for GKI Linus Walleij

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=20200907025927.9713-5-jay.xu@rock-chips.com \
    --to=jay.xu@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.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 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).