Skip to contentSkip to conversation

Update interrupt names

PATCH In review Bich HEMON 3 participants 8 messages Feb 28, 2018 – Mar 6, 2018

Subsystems (3)
lore
Share & tools
lore

Bich HEMON

author
#0 lore raw

cover Update interrupt names

This patchset updates existing stm32 usart driver by updating interrupt initialization by name.

Bich Hemon (2):
dt-bindings: serial: stm32: add wakeup option using note
serial: stm32: update interrupt initialization

 Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 4 ++++
 drivers/tty/serial/stm32-usart.c                            | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 dt-bindings: serial: stm32: add wakeup option using note

Update bindings with interrupt-names and wakeup-source information

---
 Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/st,stm32-usart.txt +4 -0
index d150b04..aaeb564 100644
@@ -10,6 +10,7 @@ Required properties:
 - interrupts:
   - The interrupt line for the USART instance,
   - An optional wake-up interrupt.
+- interrupt-names: Contains "event" for the USART interrupt line.
 - clocks: The input clock of the USART instance
 
 Optional properties:
@@ -17,6 +18,9 @@ Optional properties:
 - st,hw-flow-ctrl: bool flag to enable hardware flow control.
 - dmas: phandle(s) to DMA controller node(s). Refer to stm32-dma.txt
 - dma-names: "rx" and/or "tx"
+- wakeup-source: bool flag to indicate this device has wakeup capabilities
+- interrupt-names : Should contain "wakeup" if optional wake-up interrupt is
+  used.
 
 Examples:
 usart4: serial at 40004c00 {
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH 1/2] dt-bindings: serial: stm32: add wakeup option using note

Quoted 12 lines · Bich HEMON

Update bindings with interrupt-names and wakeup-source information

---
 Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/st,stm32-usart.txt +0 -0
index d150b04..aaeb564 100644

Documentation/devicetree/bindings/serial/st,stm32-usart.txt Required properties: · line 13

Quoted 4 lines
Documentation/devicetree/bindings/serial/st,stm32-usart.txt +1 -0
@@ -10,6 +10,7 @@ Required properties:
 - interrupts:
   - The interrupt line for the USART instance,
   - An optional wake-up interrupt.
+- interrupt-names: Contains "event" for the USART interrupt line.

This should be moved down into optional properties.

Quoted 15 lines
Documentation/devicetree/bindings/serial/st,stm32-usart.txt +3 -0
 - clocks: The input clock of the USART instance
 
 Optional properties:
@@ -17,6 +18,9 @@ Optional properties:
 - st,hw-flow-ctrl: bool flag to enable hardware flow control.
 - dmas: phandle(s) to DMA controller node(s). Refer to stm32-dma.txt
 - dma-names: "rx" and/or "tx"
+- wakeup-source: bool flag to indicate this device has wakeup capabilities
+- interrupt-names : Should contain "wakeup" if optional wake-up interrupt is
+  used.
 
 Examples:
 usart4: serial at 40004c00 {
Signature · 1 line
1.9.1
author
#3 lore raw

PATCH 2/2 serial: stm32: update interrupt initialization

In reply to Bich HEMON

For each port, get each IRQ using its specific name instead of its index.

---
 drivers/tty/serial/stm32-usart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/stm32-usart.c +2 -2
index 0fa735b..5c85cbc 100644
@@ -680,8 +680,8 @@ static int stm32_init_port(struct stm32_port *stm32port,
 	port->flags	= UPF_BOOT_AUTOCONF;
 	port->ops	= &stm32_uart_ops;
 	port->dev	= &pdev->dev;
-	port->irq	= platform_get_irq(pdev, 0);
-	stm32port->wakeirq = platform_get_irq(pdev, 1);
+	port->irq	= platform_get_irq_byname(pdev, "event");
+	stm32port->wakeirq = platform_get_irq_byname(pdev, "wakeup");
 	stm32port->fifoen = stm32port->info->cfg.has_fifo;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 2/2] serial: stm32: update interrupt initialization

Quoted 12 lines · Bich HEMON

For each port, get each IRQ using its specific name instead of its index.

---
 drivers/tty/serial/stm32-usart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/stm32-usart.c +0 -0
index 0fa735b..5c85cbc 100644

drivers/tty/serial/stm32-usart.c static int stm32_init_port(struct stm32_port *stm32port, · line 684

Quoted 7 lines
drivers/tty/serial/stm32-usart.c +1 -2
@@ -680,8 +680,8 @@ static int stm32_init_port(struct stm32_port *stm32port,
        port->flags     = UPF_BOOT_AUTOCONF;
        port->ops       = &stm32_uart_ops;
        port->dev       = &pdev->dev;
-       port->irq       = platform_get_irq(pdev, 0);
-       stm32port->wakeirq = platform_get_irq(pdev, 1);
 
+       port->irq       = platform_get_irq_byname(pdev, "event");

This is I have no idea about...

drivers/tty/serial/stm32-usart.c static int stm32_init_port(struct stm32_port *stm32port, · line 684

Quoted 1 line
drivers/tty/serial/stm32-usart.c +1 -0
+       stm32port->wakeirq = platform_get_irq_byname(pdev, "wakeup");

But this one is redundant since Tony's patch:
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=da997b22c40473b7db60bde6ea188d35565d10c8

Quoted 5 lines
drivers/tty/serial/stm32-usart.c +0 -0
        stm32port->fifoen = stm32port->info->cfg.has_fifo;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

--
1.9.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

Re: [PATCH 2/2] serial: stm32: update interrupt initialization

Quoted 9 lines · Andy Shevchenko

drivers/tty/serial/stm32-usart.c static int stm32_init_port(struct stm32_port *stm32port,

Quoted 4 lines · Bich HEMON
drivers/tty/serial/stm32-usart.c +1 -2
-       port->irq       = platform_get_irq(pdev, 0);
-       stm32port->wakeirq = platform_get_irq(pdev, 1);
 
+       stm32port->wakeirq = platform_get_irq_byname(pdev, "wakeup");

But this one is redundant since Tony's patch:
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=da997b22c40473b7db60bde6ea188d35565d10c8

Oh, it'a bout getting a resource by name...

Sorry, discard my previous comment.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#6 lore raw

Re: [PATCH 2/2] serial: stm32: update interrupt initialization

In reply to Bich HEMON
Quoted 12 lines · Bich HEMON

For each port, get each IRQ using its specific name instead of its index.

---
 drivers/tty/serial/stm32-usart.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/stm32-usart.c +0 -0
index 0fa735b..5c85cbc 100644

drivers/tty/serial/stm32-usart.c static int stm32_init_port(struct stm32_port *stm32port, · line 684

Quoted 7 lines
drivers/tty/serial/stm32-usart.c +2 -2
@@ -680,8 +680,8 @@ static int stm32_init_port(struct stm32_port *stm32port,
 	port->flags	= UPF_BOOT_AUTOCONF;
 	port->ops	= &stm32_uart_ops;
 	port->dev	= &pdev->dev;
-	port->irq	= platform_get_irq(pdev, 0);
-	stm32port->wakeirq = platform_get_irq(pdev, 1);
+	port->irq	= platform_get_irq_byname(pdev, "event");
+	stm32port->wakeirq = platform_get_irq_byname(pdev, "wakeup");

This change is not necessary. The interrupts should be at fixed indices.

Quoted 5 lines
drivers/tty/serial/stm32-usart.c +0 -0
 	stm32port->fifoen = stm32port->info->cfg.has_fifo;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Signature · 1 line
1.9.1
author
#7 lore raw
In reply to Bich HEMON

Hi all,

Quoted 11 lines · Bich HEMON

This patchset updates existing stm32 usart driver by updating interrupt initialization by name.

Bich Hemon (2):
dt-bindings: serial: stm32: add wakeup option using note
serial: stm32: update interrupt initialization

  Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 4 ++++
  drivers/tty/serial/stm32-usart.c                            | 4 ++--
  2 files changed, 6 insertions(+), 2 deletions(-)

Please note that this patch set is abandoned. As Rob pointed that out, the interrupt indices are fixed, so there is no need to keep these patches.

Best regards,

Bich