cip-dev.lists.cip-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 6.1.y-cip 00/13] Update IA55 driver
@ 2024-03-27  8:34 Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 01/13] pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper Claudiu
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:34 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Hi,

This series updates the Renesas IA55 IRQ driver with patches from
mainline kernel. Along with it, a patch for Renesas pin controller driver
was cherry-picked from mainline kernel.

Thank you,
Claudiu Beznea

Biju Das (5):
  irqchip/renesas-rzg2l: Flush posted write in irq_eoi()
  irqchip/renesas-rzg2l: Rename rzg2l_tint_eoi()
  irqchip/renesas-rzg2l: Rename rzg2l_irq_eoi()
  irqchip/renesas-rzg2l: Prevent spurious interrupts when setting
    trigger type
  irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same
    time

Christophe JAILLET (1):
  pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper

Claudiu Beznea (5):
  irqchip/renesas-rzg2l: Use tabs instead of spaces
  irqchip/renesas-rzg2l: Align struct member names to tabs
  irqchip/renesas-rzg2l: Document structure members
  irqchip/renesas-rzg2l: Implement restriction when writing ISCR
    register
  irqchip/renesas-rzg2l: Add macro to retrieve TITSR register offset
    based on register's index

Geert Uytterhoeven (1):
  irqchip/renesas-rzg2l: Convert to irq_data_get_irq_chip_data()

Nick Alcock (1):
  irqchip: remove MODULE_LICENSE in non-modules

 drivers/irqchip/irq-renesas-rzg2l.c     | 115 ++++++++++++++++--------
 drivers/pinctrl/renesas/pinctrl-rzg2l.c |  32 ++-----
 2 files changed, 85 insertions(+), 62 deletions(-)

-- 
2.39.2



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

* [PATCH 6.1.y-cip 01/13] pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
@ 2024-03-27  8:34 ` Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 02/13] irqchip: remove MODULE_LICENSE in non-modules Claudiu
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:34 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

commit 95eb19869401850f069723b296170b8b3bd5be9e upstream.

The devm_clk_get_enabled() helper:
   - calls devm_clk_get()
   - calls clk_prepare_enable() and registers what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the need of a dedicated function used
with devm_add_action_or_reset().

While at it, use dev_err_probe() which filters -EPROBE_DEFER.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/a4a586337d692f0ca396b80d275ba634eb419593.1690058500.git.christophe.jaillet@wanadoo.fr
[geert: Make clk local to rzg2l_pinctrl_probe()]
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 32 ++++---------------------
 1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index 22abac051ab6..b0ef821e7016 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -145,7 +145,6 @@ struct rzg2l_pinctrl {
 	const struct rzg2l_pinctrl_data	*data;
 	void __iomem			*base;
 	struct device			*dev;
-	struct clk			*clk;
 
 	struct gpio_chip		gpio_chip;
 	struct pinctrl_gpio_range	gpio_range;
@@ -1480,14 +1479,10 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl)
 	return 0;
 }
 
-static void rzg2l_pinctrl_clk_disable(void *data)
-{
-	clk_disable_unprepare(data);
-}
-
 static int rzg2l_pinctrl_probe(struct platform_device *pdev)
 {
 	struct rzg2l_pinctrl *pctrl;
+	struct clk *clk;
 	int ret;
 
 	BUILD_BUG_ON(ARRAY_SIZE(rzg2l_gpio_configs) * RZG2L_PINS_PER_PORT >
@@ -1510,12 +1505,10 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev)
 	if (IS_ERR(pctrl->base))
 		return PTR_ERR(pctrl->base);
 
-	pctrl->clk = devm_clk_get(pctrl->dev, NULL);
-	if (IS_ERR(pctrl->clk)) {
-		ret = PTR_ERR(pctrl->clk);
-		dev_err(pctrl->dev, "failed to get GPIO clk : %i\n", ret);
-		return ret;
-	}
+	clk = devm_clk_get_enabled(pctrl->dev, NULL);
+	if (IS_ERR(clk))
+		return dev_err_probe(pctrl->dev, PTR_ERR(clk),
+				     "failed to enable GPIO clk\n");
 
 	spin_lock_init(&pctrl->lock);
 	spin_lock_init(&pctrl->bitmap_lock);
@@ -1523,21 +1516,6 @@ static int rzg2l_pinctrl_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pctrl);
 
-	ret = clk_prepare_enable(pctrl->clk);
-	if (ret) {
-		dev_err(pctrl->dev, "failed to enable GPIO clk: %i\n", ret);
-		return ret;
-	}
-
-	ret = devm_add_action_or_reset(&pdev->dev, rzg2l_pinctrl_clk_disable,
-				       pctrl->clk);
-	if (ret) {
-		dev_err(pctrl->dev,
-			"failed to register GPIO clk disable action, %i\n",
-			ret);
-		return ret;
-	}
-
 	ret = rzg2l_pinctrl_register(pctrl);
 	if (ret)
 		return ret;
-- 
2.39.2



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

* [PATCH 6.1.y-cip 02/13] irqchip: remove MODULE_LICENSE in non-modules
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 01/13] pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper Claudiu
@ 2024-03-27  8:34 ` Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 03/13] irqchip/renesas-rzg2l: Convert to irq_data_get_irq_chip_data() Claudiu
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:34 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Nick Alcock <nick.alcock@oracle.com>

commit e3f1f02548adbf973af29c6ee6304a45121bff03 upstream.

Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 0922e7ca04fa..6390d1d78f2e 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -391,4 +391,3 @@ IRQCHIP_MATCH("renesas,rzg2l-irqc", rzg2l_irqc_init)
 IRQCHIP_PLATFORM_DRIVER_END(rzg2l_irqc)
 MODULE_AUTHOR("Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>");
 MODULE_DESCRIPTION("Renesas RZ/G2L IRQC Driver");
-MODULE_LICENSE("GPL");
-- 
2.39.2



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

* [PATCH 6.1.y-cip 03/13] irqchip/renesas-rzg2l: Convert to irq_data_get_irq_chip_data()
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 01/13] pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 02/13] irqchip: remove MODULE_LICENSE in non-modules Claudiu
@ 2024-03-27  8:34 ` Claudiu
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 04/13] irqchip/renesas-rzg2l: Use tabs instead of spaces Claudiu
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:34 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit 8a4f44f3e9b05c38606b2ae02f933d6b64a340dd upstream.

Use the existing irq_data_get_irq_chip_data() helper instead of
open-coding the same operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/8e47cc6400e5a82c854c855948d2665a3a3197e3.1695819391.git.geert+renesas@glider.be
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 6390d1d78f2e..fe8d516f3614 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -130,8 +130,8 @@ static void rzg2l_irqc_irq_enable(struct irq_data *d)
 	unsigned int hw_irq = irqd_to_hwirq(d);
 
 	if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ) {
+		unsigned long tint = (uintptr_t)irq_data_get_irq_chip_data(d);
 		struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
-		unsigned long tint = (uintptr_t)d->chip_data;
 		u32 offset = hw_irq - IRQC_TINT_START;
 		u32 tssr_offset = TSSR_OFFSET(offset);
 		u8 tssr_index = TSSR_INDEX(offset);
-- 
2.39.2



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

* [PATCH 6.1.y-cip 04/13] irqchip/renesas-rzg2l: Use tabs instead of spaces
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (2 preceding siblings ...)
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 03/13] irqchip/renesas-rzg2l: Convert to irq_data_get_irq_chip_data() Claudiu
@ 2024-03-27  8:34 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 05/13] irqchip/renesas-rzg2l: Align struct member names to tabs Claudiu
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:34 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

commit c90b5c4e6554c1194d5f7cfe13dfd710a7661cab upstream.

Use tabs instead of spaces in definition of TINT_EXTRACT_HWIRQ()
and TINT_EXTRACT_GPIOINT() macros to align with coding style
requirements described in Documentation/process/coding-style.rst,
"Indentation" chapter.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231120111820.87398-3-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index fe8d516f3614..cc42cbd05762 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -53,8 +53,8 @@
 #define IITSR_IITSEL_EDGE_BOTH		3
 #define IITSR_IITSEL_MASK(n)		IITSR_IITSEL((n), 3)
 
-#define TINT_EXTRACT_HWIRQ(x)           FIELD_GET(GENMASK(15, 0), (x))
-#define TINT_EXTRACT_GPIOINT(x)         FIELD_GET(GENMASK(31, 16), (x))
+#define TINT_EXTRACT_HWIRQ(x)		FIELD_GET(GENMASK(15, 0), (x))
+#define TINT_EXTRACT_GPIOINT(x)		FIELD_GET(GENMASK(31, 16), (x))
 
 struct rzg2l_irqc_priv {
 	void __iomem *base;
-- 
2.39.2



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

* [PATCH 6.1.y-cip 05/13] irqchip/renesas-rzg2l: Align struct member names to tabs
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (3 preceding siblings ...)
  2024-03-27  8:34 ` [PATCH 6.1.y-cip 04/13] irqchip/renesas-rzg2l: Use tabs instead of spaces Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 06/13] irqchip/renesas-rzg2l: Document structure members Claudiu
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

commit 02f6507640173addeeb3af035d2c6f0b3cff1567 upstream.

Align struct member names to tabs to follow the requirements from
maintainer-tip file. 3 tabs were used at the moment as the next commits
will add a new member which requires 3 tabs for a better view.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231120111820.87398-4-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index cc42cbd05762..90971ab06f0c 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -57,9 +57,9 @@
 #define TINT_EXTRACT_GPIOINT(x)		FIELD_GET(GENMASK(31, 16), (x))
 
 struct rzg2l_irqc_priv {
-	void __iomem *base;
-	struct irq_fwspec fwspec[IRQC_NUM_IRQ];
-	raw_spinlock_t lock;
+	void __iomem			*base;
+	struct irq_fwspec		fwspec[IRQC_NUM_IRQ];
+	raw_spinlock_t			lock;
 };
 
 static struct rzg2l_irqc_priv *irq_data_to_priv(struct irq_data *data)
-- 
2.39.2



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

* [PATCH 6.1.y-cip 06/13] irqchip/renesas-rzg2l: Document structure members
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (4 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 05/13] irqchip/renesas-rzg2l: Align struct member names to tabs Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 07/13] irqchip/renesas-rzg2l: Implement restriction when writing ISCR register Claudiu
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

commit b94f455372ad6e6b4da8e8ed9864d9c7daaf54b8 upstream.

Document structure members to follow the requirements specified in
maintainer-tip, section 4.3.7. Struct declarations and initializers.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231120111820.87398-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 90971ab06f0c..0a77927b678b 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -56,6 +56,12 @@
 #define TINT_EXTRACT_HWIRQ(x)		FIELD_GET(GENMASK(15, 0), (x))
 #define TINT_EXTRACT_GPIOINT(x)		FIELD_GET(GENMASK(31, 16), (x))
 
+/**
+ * struct rzg2l_irqc_priv - IRQ controller private data structure
+ * @base:	Controller's base address
+ * @fwspec:	IRQ firmware specific data
+ * @lock:	Lock to serialize access to hardware registers
+ */
 struct rzg2l_irqc_priv {
 	void __iomem			*base;
 	struct irq_fwspec		fwspec[IRQC_NUM_IRQ];
-- 
2.39.2



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

* [PATCH 6.1.y-cip 07/13] irqchip/renesas-rzg2l: Implement restriction when writing ISCR register
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (5 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 06/13] irqchip/renesas-rzg2l: Document structure members Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 08/13] irqchip/renesas-rzg2l: Add macro to retrieve TITSR register offset based on register's index Claudiu
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

commit ef88eefb1a81a8701eabb7d5ced761a66a465a49 upstream.

The RZ/G2L manual (chapter "IRQ Status Control Register (ISCR)") describes
the operation to clear interrupts through the ISCR register as follows:

[Write operation]

  When "Falling-edge detection", "Rising-edge detection" or
  "Falling/Rising-edge detection" is set in IITSR:

    - In case ISTAT is 1
	0: IRQn interrupt detection status is cleared.
	1: Invalid to write.
    - In case ISTAT is 0
	Invalid to write.

  When "Low-level detection" is set in IITSR.:
        Invalid to write.

Take the interrupt type into account when clearing interrupts through the
ISCR register to avoid writing the ISCR when the interrupt type is level.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231120111820.87398-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 0a77927b678b..d450417948e4 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -78,11 +78,17 @@ static void rzg2l_irq_eoi(struct irq_data *d)
 	unsigned int hw_irq = irqd_to_hwirq(d) - IRQC_IRQ_START;
 	struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
 	u32 bit = BIT(hw_irq);
-	u32 reg;
+	u32 iitsr, iscr;
 
-	reg = readl_relaxed(priv->base + ISCR);
-	if (reg & bit)
-		writel_relaxed(reg & ~bit, priv->base + ISCR);
+	iscr = readl_relaxed(priv->base + ISCR);
+	iitsr = readl_relaxed(priv->base + IITSR);
+
+	/*
+	 * ISCR can only be cleared if the type is falling-edge, rising-edge or
+	 * falling/rising-edge.
+	 */
+	if ((iscr & bit) && (iitsr & IITSR_IITSEL_MASK(hw_irq)))
+		writel_relaxed(iscr & ~bit, priv->base + ISCR);
 }
 
 static void rzg2l_tint_eoi(struct irq_data *d)
-- 
2.39.2



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

* [PATCH 6.1.y-cip 08/13] irqchip/renesas-rzg2l: Add macro to retrieve TITSR register offset based on register's index
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (6 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 07/13] irqchip/renesas-rzg2l: Implement restriction when writing ISCR register Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 09/13] irqchip/renesas-rzg2l: Flush posted write in irq_eoi() Claudiu
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

commit 2eca4731cc66563b3919d8753dbd74d18c39f662 upstream.

There are 2 TITSR registers available on the IA55 interrupt controller.

Add a macro that retrieves the TITSR register offset based on it's
index. This macro is useful in when adding suspend/resume support so both
TITSR registers can be accessed in a for loop.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20231120111820.87398-7-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index d450417948e4..34add75080e0 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -28,8 +28,7 @@
 #define ISCR				0x10
 #define IITSR				0x14
 #define TSCR				0x20
-#define TITSR0				0x24
-#define TITSR1				0x28
+#define TITSR(n)			(0x24 + (n) * 4)
 #define TITSR0_MAX_INT			16
 #define TITSEL_WIDTH			0x2
 #define TSSR(n)				(0x30 + ((n) * 4))
@@ -200,8 +199,7 @@ static int rzg2l_tint_set_edge(struct irq_data *d, unsigned int type)
 	struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
 	unsigned int hwirq = irqd_to_hwirq(d);
 	u32 titseln = hwirq - IRQC_TINT_START;
-	u32 offset;
-	u8 sense;
+	u8 index, sense;
 	u32 reg;
 
 	switch (type & IRQ_TYPE_SENSE_MASK) {
@@ -217,17 +215,17 @@ static int rzg2l_tint_set_edge(struct irq_data *d, unsigned int type)
 		return -EINVAL;
 	}
 
-	offset = TITSR0;
+	index = 0;
 	if (titseln >= TITSR0_MAX_INT) {
 		titseln -= TITSR0_MAX_INT;
-		offset = TITSR1;
+		index = 1;
 	}
 
 	raw_spin_lock(&priv->lock);
-	reg = readl_relaxed(priv->base + offset);
+	reg = readl_relaxed(priv->base + TITSR(index));
 	reg &= ~(IRQ_MASK << (titseln * TITSEL_WIDTH));
 	reg |= sense << (titseln * TITSEL_WIDTH);
-	writel_relaxed(reg, priv->base + offset);
+	writel_relaxed(reg, priv->base + TITSR(index));
 	raw_spin_unlock(&priv->lock);
 
 	return 0;
-- 
2.39.2



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

* [PATCH 6.1.y-cip 09/13] irqchip/renesas-rzg2l: Flush posted write in irq_eoi()
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (7 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 08/13] irqchip/renesas-rzg2l: Add macro to retrieve TITSR register offset based on register's index Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 10/13] irqchip/renesas-rzg2l: Rename rzg2l_tint_eoi() Claudiu
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 9eec61df55c51415409c7cc47e9a1c8de94a0522 upstream.

The irq_eoi() callback of the RZ/G2L interrupt chip clears the relevant
interrupt cause bit in the TSCR register by writing to it.

This write is not sufficient because the write is posted and therefore not
guaranteed to immediately clear the bit. Due to that delay the CPU can
raise the just handled interrupt again.

Prevent this by reading the register back which causes the posted write to
be flushed to the hardware before the read completes.

Fixes: 3fed09559cd8 ("irqchip: Add RZ/G2L IA55 Interrupt Controller driver")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 34add75080e0..552bc7fa7cff 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -86,8 +86,14 @@ static void rzg2l_irq_eoi(struct irq_data *d)
 	 * ISCR can only be cleared if the type is falling-edge, rising-edge or
 	 * falling/rising-edge.
 	 */
-	if ((iscr & bit) && (iitsr & IITSR_IITSEL_MASK(hw_irq)))
+	if ((iscr & bit) && (iitsr & IITSR_IITSEL_MASK(hw_irq))) {
 		writel_relaxed(iscr & ~bit, priv->base + ISCR);
+		/*
+		 * Enforce that the posted write is flushed to prevent that the
+		 * just handled interrupt is raised again.
+		 */
+		readl_relaxed(priv->base + ISCR);
+	}
 }
 
 static void rzg2l_tint_eoi(struct irq_data *d)
@@ -98,8 +104,14 @@ static void rzg2l_tint_eoi(struct irq_data *d)
 	u32 reg;
 
 	reg = readl_relaxed(priv->base + TSCR);
-	if (reg & bit)
+	if (reg & bit) {
 		writel_relaxed(reg & ~bit, priv->base + TSCR);
+		/*
+		 * Enforce that the posted write is flushed to prevent that the
+		 * just handled interrupt is raised again.
+		 */
+		readl_relaxed(priv->base + TSCR);
+	}
 }
 
 static void rzg2l_irqc_eoi(struct irq_data *d)
-- 
2.39.2



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

* [PATCH 6.1.y-cip 10/13] irqchip/renesas-rzg2l: Rename rzg2l_tint_eoi()
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (8 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 09/13] irqchip/renesas-rzg2l: Flush posted write in irq_eoi() Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 11/13] irqchip/renesas-rzg2l: Rename rzg2l_irq_eoi() Claudiu
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 7cb6362c63df233172eaecddaf9ce2ce2f769112 upstream.

Rename rzg2l_tint_eoi()->rzg2l_clear_tint_int() and simplify the code by
removing redundant priv and hw_irq local variables.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 552bc7fa7cff..41b47572c294 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -96,11 +96,9 @@ static void rzg2l_irq_eoi(struct irq_data *d)
 	}
 }
 
-static void rzg2l_tint_eoi(struct irq_data *d)
+static void rzg2l_clear_tint_int(struct rzg2l_irqc_priv *priv, unsigned int hwirq)
 {
-	unsigned int hw_irq = irqd_to_hwirq(d) - IRQC_TINT_START;
-	struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
-	u32 bit = BIT(hw_irq);
+	u32 bit = BIT(hwirq - IRQC_TINT_START);
 	u32 reg;
 
 	reg = readl_relaxed(priv->base + TSCR);
@@ -123,7 +121,7 @@ static void rzg2l_irqc_eoi(struct irq_data *d)
 	if (hw_irq >= IRQC_IRQ_START && hw_irq <= IRQC_IRQ_COUNT)
 		rzg2l_irq_eoi(d);
 	else if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ)
-		rzg2l_tint_eoi(d);
+		rzg2l_clear_tint_int(priv, hw_irq);
 	raw_spin_unlock(&priv->lock);
 	irq_chip_eoi_parent(d);
 }
-- 
2.39.2



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

* [PATCH 6.1.y-cip 11/13] irqchip/renesas-rzg2l: Rename rzg2l_irq_eoi()
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (9 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 10/13] irqchip/renesas-rzg2l: Rename rzg2l_tint_eoi() Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 12/13] irqchip/renesas-rzg2l: Prevent spurious interrupts when setting trigger type Claudiu
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Biju Das <biju.das.jz@bp.renesas.com>

commit b4b5cd61a6fdd92ede0dc39f0850a182affd1323 upstream.

Rename rzg2l_irq_eoi()->rzg2l_clear_irq_int() and simplify the code by
removing redundant priv local variable.

Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 41b47572c294..fb04e5450497 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -72,10 +72,9 @@ static struct rzg2l_irqc_priv *irq_data_to_priv(struct irq_data *data)
 	return data->domain->host_data;
 }
 
-static void rzg2l_irq_eoi(struct irq_data *d)
+static void rzg2l_clear_irq_int(struct rzg2l_irqc_priv *priv, unsigned int hwirq)
 {
-	unsigned int hw_irq = irqd_to_hwirq(d) - IRQC_IRQ_START;
-	struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
+	unsigned int hw_irq = hwirq - IRQC_IRQ_START;
 	u32 bit = BIT(hw_irq);
 	u32 iitsr, iscr;
 
@@ -119,7 +118,7 @@ static void rzg2l_irqc_eoi(struct irq_data *d)
 
 	raw_spin_lock(&priv->lock);
 	if (hw_irq >= IRQC_IRQ_START && hw_irq <= IRQC_IRQ_COUNT)
-		rzg2l_irq_eoi(d);
+		rzg2l_clear_irq_int(priv, hw_irq);
 	else if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ)
 		rzg2l_clear_tint_int(priv, hw_irq);
 	raw_spin_unlock(&priv->lock);
-- 
2.39.2



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

* [PATCH 6.1.y-cip 12/13] irqchip/renesas-rzg2l: Prevent spurious interrupts when setting trigger type
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (10 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 11/13] irqchip/renesas-rzg2l: Rename rzg2l_irq_eoi() Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 13/13] irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time Claudiu
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 853a6030303f8a8fa54929b68e5665d9b21aa405 upstream.

RZ/G2L interrupt chips require that the interrupt is masked before changing
the NMI, IRQ, TINT interrupt settings. Aside of that, after setting an edge
trigger type it is required to clear the interrupt status register in order
to avoid spurious interrupts.

The current implementation fails to do either of that and therefore is
prone to generate spurious interrupts when setting the trigger type.

Address this by:

  - Ensuring that the interrupt is masked at the chip level across the
    update for the TINT chip

  - Clearing the interrupt status register after updating the trigger mode
    for edge type interrupts

[ tglx: Massaged changelog and reverted the spin_lock_irqsave() change as
  	the set_type() callback is always called with interrupts disabled. ]

Fixes: 3fed09559cd8 ("irqchip: Add RZ/G2L IA55 Interrupt Controller driver")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 36 +++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index fb04e5450497..3acdecf39404 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -168,8 +168,10 @@ static void rzg2l_irqc_irq_enable(struct irq_data *d)
 
 static int rzg2l_irq_set_type(struct irq_data *d, unsigned int type)
 {
-	unsigned int hw_irq = irqd_to_hwirq(d) - IRQC_IRQ_START;
 	struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
+	unsigned int hwirq = irqd_to_hwirq(d);
+	u32 iitseln = hwirq - IRQC_IRQ_START;
+	bool clear_irq_int = false;
 	u16 sense, tmp;
 
 	switch (type & IRQ_TYPE_SENSE_MASK) {
@@ -179,14 +181,17 @@ static int rzg2l_irq_set_type(struct irq_data *d, unsigned int type)
 
 	case IRQ_TYPE_EDGE_FALLING:
 		sense = IITSR_IITSEL_EDGE_FALLING;
+		clear_irq_int = true;
 		break;
 
 	case IRQ_TYPE_EDGE_RISING:
 		sense = IITSR_IITSEL_EDGE_RISING;
+		clear_irq_int = true;
 		break;
 
 	case IRQ_TYPE_EDGE_BOTH:
 		sense = IITSR_IITSEL_EDGE_BOTH;
+		clear_irq_int = true;
 		break;
 
 	default:
@@ -195,21 +200,40 @@ static int rzg2l_irq_set_type(struct irq_data *d, unsigned int type)
 
 	raw_spin_lock(&priv->lock);
 	tmp = readl_relaxed(priv->base + IITSR);
-	tmp &= ~IITSR_IITSEL_MASK(hw_irq);
-	tmp |= IITSR_IITSEL(hw_irq, sense);
+	tmp &= ~IITSR_IITSEL_MASK(iitseln);
+	tmp |= IITSR_IITSEL(iitseln, sense);
+	if (clear_irq_int)
+		rzg2l_clear_irq_int(priv, hwirq);
 	writel_relaxed(tmp, priv->base + IITSR);
 	raw_spin_unlock(&priv->lock);
 
 	return 0;
 }
 
+static u32 rzg2l_disable_tint_and_set_tint_source(struct irq_data *d, struct rzg2l_irqc_priv *priv,
+						  u32 reg, u32 tssr_offset, u8 tssr_index)
+{
+	u32 tint = (u32)(uintptr_t)irq_data_get_irq_chip_data(d);
+	u32 tien = reg & (TIEN << TSSEL_SHIFT(tssr_offset));
+
+	/* Clear the relevant byte in reg */
+	reg &= ~(TSSEL_MASK << TSSEL_SHIFT(tssr_offset));
+	/* Set TINT and leave TIEN clear */
+	reg |= tint << TSSEL_SHIFT(tssr_offset);
+	writel_relaxed(reg, priv->base + TSSR(tssr_index));
+
+	return reg | tien;
+}
+
 static int rzg2l_tint_set_edge(struct irq_data *d, unsigned int type)
 {
 	struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
 	unsigned int hwirq = irqd_to_hwirq(d);
 	u32 titseln = hwirq - IRQC_TINT_START;
+	u32 tssr_offset = TSSR_OFFSET(titseln);
+	u8 tssr_index = TSSR_INDEX(titseln);
 	u8 index, sense;
-	u32 reg;
+	u32 reg, tssr;
 
 	switch (type & IRQ_TYPE_SENSE_MASK) {
 	case IRQ_TYPE_EDGE_RISING:
@@ -231,10 +255,14 @@ static int rzg2l_tint_set_edge(struct irq_data *d, unsigned int type)
 	}
 
 	raw_spin_lock(&priv->lock);
+	tssr = readl_relaxed(priv->base + TSSR(tssr_index));
+	tssr = rzg2l_disable_tint_and_set_tint_source(d, priv, tssr, tssr_offset, tssr_index);
 	reg = readl_relaxed(priv->base + TITSR(index));
 	reg &= ~(IRQ_MASK << (titseln * TITSEL_WIDTH));
 	reg |= sense << (titseln * TITSEL_WIDTH);
 	writel_relaxed(reg, priv->base + TITSR(index));
+	rzg2l_clear_tint_int(priv, hwirq);
+	writel_relaxed(tssr, priv->base + TSSR(tssr_index));
 	raw_spin_unlock(&priv->lock);
 
 	return 0;
-- 
2.39.2



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

* [PATCH 6.1.y-cip 13/13] irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (11 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 12/13] irqchip/renesas-rzg2l: Prevent spurious interrupts when setting trigger type Claudiu
@ 2024-03-27  8:35 ` Claudiu
  2024-03-27 11:53 ` [PATCH 6.1.y-cip 00/13] Update IA55 driver Pavel Machek
  2024-03-28 10:44 ` Pavel Machek
  14 siblings, 0 replies; 16+ messages in thread
From: Claudiu @ 2024-03-27  8:35 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu, pavel
  Cc: cip-dev, biju.das.jz, prabhakar.mahadev-lad.rj, claudiu.beznea

From: Biju Das <biju.das.jz@bp.renesas.com>

commit dce0919c83c325ac9dec5bc8838d5de6d32c01b1 upstream.

As per the hardware team, TIEN and TINT source should not set at the same
time due to a possible hardware race leading to spurious IRQ.

Currently on some scenarios hardware settings for TINT detection is not in
sync with TINT source as the enable/disable overrides source setting value
leading to hardware inconsistent state. For eg: consider the case GPIOINT0
is used as TINT interrupt and configuring GPIOINT5 as edge type. During
rzg2l_irq_set_type(), TINT source for GPIOINT5 is set. On disable(),
clearing of the entire bytes of TINT source selection for GPIOINT5 is same
as GPIOINT0 with TIEN disabled. Apart from this during enable(), the
setting of GPIOINT5 with TIEN results in spurious IRQ as due to a HW race,
it is possible that IP can use the TIEN with previous source value
(GPIOINT0).

So, just update TIEN during enable/disable as TINT source is already set
during rzg2l_irq_set_type(). This will make the consistent hardware
settings for detection method tied with TINT source and allows to simplify
the code.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzg2l.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index 3acdecf39404..9b0a748ea2cb 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -138,7 +138,7 @@ static void rzg2l_irqc_irq_disable(struct irq_data *d)
 
 		raw_spin_lock(&priv->lock);
 		reg = readl_relaxed(priv->base + TSSR(tssr_index));
-		reg &= ~(TSSEL_MASK << TSSEL_SHIFT(tssr_offset));
+		reg &= ~(TIEN << TSSEL_SHIFT(tssr_offset));
 		writel_relaxed(reg, priv->base + TSSR(tssr_index));
 		raw_spin_unlock(&priv->lock);
 	}
@@ -150,7 +150,6 @@ static void rzg2l_irqc_irq_enable(struct irq_data *d)
 	unsigned int hw_irq = irqd_to_hwirq(d);
 
 	if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ) {
-		unsigned long tint = (uintptr_t)irq_data_get_irq_chip_data(d);
 		struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
 		u32 offset = hw_irq - IRQC_TINT_START;
 		u32 tssr_offset = TSSR_OFFSET(offset);
@@ -159,7 +158,7 @@ static void rzg2l_irqc_irq_enable(struct irq_data *d)
 
 		raw_spin_lock(&priv->lock);
 		reg = readl_relaxed(priv->base + TSSR(tssr_index));
-		reg |= (TIEN | tint) << TSSEL_SHIFT(tssr_offset);
+		reg |= TIEN << TSSEL_SHIFT(tssr_offset);
 		writel_relaxed(reg, priv->base + TSSR(tssr_index));
 		raw_spin_unlock(&priv->lock);
 	}
-- 
2.39.2



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

* Re: [PATCH 6.1.y-cip 00/13] Update IA55 driver
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (12 preceding siblings ...)
  2024-03-27  8:35 ` [PATCH 6.1.y-cip 13/13] irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time Claudiu
@ 2024-03-27 11:53 ` Pavel Machek
  2024-03-28 10:44 ` Pavel Machek
  14 siblings, 0 replies; 16+ messages in thread
From: Pavel Machek @ 2024-03-27 11:53 UTC (permalink / raw)
  To: Claudiu
  Cc: nobuhiro1.iwamatsu, pavel, cip-dev, biju.das.jz,
	prabhakar.mahadev-lad.rj

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

Hi!

> This series updates the Renesas IA55 IRQ driver with patches from
> mainline kernel. Along with it, a patch for Renesas pin controller driver
> was cherry-picked from mainline kernel.

This series looks good to me. A lot of that are cleanups, include
whitespace-only, but I guess they are localised to "your" code so we
can apply them.

I can apply it if it passes testing and there are no other comments.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: [PATCH 6.1.y-cip 00/13] Update IA55 driver
  2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
                   ` (13 preceding siblings ...)
  2024-03-27 11:53 ` [PATCH 6.1.y-cip 00/13] Update IA55 driver Pavel Machek
@ 2024-03-28 10:44 ` Pavel Machek
  14 siblings, 0 replies; 16+ messages in thread
From: Pavel Machek @ 2024-03-28 10:44 UTC (permalink / raw)
  To: Claudiu
  Cc: nobuhiro1.iwamatsu, pavel, cip-dev, biju.das.jz,
	prabhakar.mahadev-lad.rj

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

Hi!

> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Hi,
> 
> This series updates the Renesas IA55 IRQ driver with patches from
> mainline kernel. Along with it, a patch for Renesas pin controller driver
> was cherry-picked from mainline kernel.

Thanks for series, applied.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2024-03-28 10:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27  8:34 [PATCH 6.1.y-cip 00/13] Update IA55 driver Claudiu
2024-03-27  8:34 ` [PATCH 6.1.y-cip 01/13] pinctrl: renesas: rzg2l: Use devm_clk_get_enabled() helper Claudiu
2024-03-27  8:34 ` [PATCH 6.1.y-cip 02/13] irqchip: remove MODULE_LICENSE in non-modules Claudiu
2024-03-27  8:34 ` [PATCH 6.1.y-cip 03/13] irqchip/renesas-rzg2l: Convert to irq_data_get_irq_chip_data() Claudiu
2024-03-27  8:34 ` [PATCH 6.1.y-cip 04/13] irqchip/renesas-rzg2l: Use tabs instead of spaces Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 05/13] irqchip/renesas-rzg2l: Align struct member names to tabs Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 06/13] irqchip/renesas-rzg2l: Document structure members Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 07/13] irqchip/renesas-rzg2l: Implement restriction when writing ISCR register Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 08/13] irqchip/renesas-rzg2l: Add macro to retrieve TITSR register offset based on register's index Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 09/13] irqchip/renesas-rzg2l: Flush posted write in irq_eoi() Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 10/13] irqchip/renesas-rzg2l: Rename rzg2l_tint_eoi() Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 11/13] irqchip/renesas-rzg2l: Rename rzg2l_irq_eoi() Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 12/13] irqchip/renesas-rzg2l: Prevent spurious interrupts when setting trigger type Claudiu
2024-03-27  8:35 ` [PATCH 6.1.y-cip 13/13] irqchip/renesas-rzg2l: Do not set TIEN and TINT source at the same time Claudiu
2024-03-27 11:53 ` [PATCH 6.1.y-cip 00/13] Update IA55 driver Pavel Machek
2024-03-28 10:44 ` Pavel Machek

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).