2018-02-28 10:54:48

by Bich HEMON

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
1.9.1


2018-02-28 10:54:05

by Bich HEMON

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

Update bindings with interrupt-names and wakeup-source information

Signed-off-by: Bich Hemon <[email protected]>
---
Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
index d150b04..aaeb564 100644
--- a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
+++ b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
@@ -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@40004c00 {
--
1.9.1

2018-02-28 10:55:16

by Bich HEMON

[permalink] [raw]
Subject: [PATCH 2/2] serial: stm32: update interrupt initialization

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

Signed-off-by: Bich Hemon <[email protected]>
---
drivers/tty/serial/stm32-usart.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 0fa735b..5c85cbc 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -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);
--
1.9.1

2018-02-28 15:41:42

by Andy Shevchenko

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

On Wed, Feb 28, 2018 at 12:51 PM, Bich HEMON <[email protected]> wrote:
> For each port, get each IRQ using its specific name instead of its index.
>
> Signed-off-by: Bich Hemon <[email protected]>
> ---
> drivers/tty/serial/stm32-usart.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
> index 0fa735b..5c85cbc 100644
> --- a/drivers/tty/serial/stm32-usart.c
> +++ b/drivers/tty/serial/stm32-usart.c
> @@ -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...

> + 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

> stm32port->fifoen = stm32port->info->cfg.has_fifo;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> --
> 1.9.1



--
With Best Regards,
Andy Shevchenko

2018-02-28 15:43:00

by Andy Shevchenko

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

On Wed, Feb 28, 2018 at 5:40 PM, Andy Shevchenko
<[email protected]> wrote:
> On Wed, Feb 28, 2018 at 12:51 PM, Bich HEMON <[email protected]> wrote:

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


--
With Best Regards,
Andy Shevchenko

2018-03-06 00:51:55

by Rob Herring (Arm)

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

On Wed, Feb 28, 2018 at 10:51:17AM +0000, Bich HEMON wrote:
> For each port, get each IRQ using its specific name instead of its index.
>
> Signed-off-by: Bich Hemon <[email protected]>
> ---
> drivers/tty/serial/stm32-usart.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
> index 0fa735b..5c85cbc 100644
> --- a/drivers/tty/serial/stm32-usart.c
> +++ b/drivers/tty/serial/stm32-usart.c
> @@ -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.

> stm32port->fifoen = stm32port->info->cfg.has_fifo;
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> --
> 1.9.1

2018-03-06 00:53:28

by Rob Herring (Arm)

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

On Wed, Feb 28, 2018 at 10:51:17AM +0000, Bich HEMON wrote:
> Update bindings with interrupt-names and wakeup-source information
>
> Signed-off-by: Bich Hemon <[email protected]>
> ---
> Documentation/devicetree/bindings/serial/st,stm32-usart.txt | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
> index d150b04..aaeb564 100644
> --- a/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
> +++ b/Documentation/devicetree/bindings/serial/st,stm32-usart.txt
> @@ -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.

> - 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@40004c00 {
> --
> 1.9.1

2018-03-06 10:00:40

by Bich HEMON

[permalink] [raw]
Subject: Re: [PATCH 0/2] Update interrupt names

Hi all,

On 02/28/2018 11:51 AM, Bich HEMON wrote:
> 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