devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt
@ 2023-08-06  9:20 Jisheng Zhang
  2023-08-06  9:20 ` [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional Jisheng Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jisheng Zhang @ 2023-08-06  9:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen, Andy Shevchenko, Jiri Slaby
  Cc: linux-serial, devicetree, linux-kernel

When there's no irq(this can be due to various reasons, for example,
no irq from HW support, or we just want to use poll solution, and so
on), falling back to poll is still better than no support at all.

patch1 makes the interrupt property in dt-binding optional
patch2 falls back to poll if there's no interrupt

since v1:
 - adopt Andy's suggestion to simplified the code

Jisheng Zhang (2):
  dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
  serial: 8250_dw: fall back to poll if there's no interrupt

 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml         | 1 -
 drivers/tty/serial/8250/8250_dw.c                            | 5 ++++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.40.1


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

* [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
  2023-08-06  9:20 [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
@ 2023-08-06  9:20 ` Jisheng Zhang
  2023-08-21 15:51   ` Rob Herring
  2023-08-06  9:20 ` [PATCH v2 2/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
  2023-08-06 10:20 ` [PATCH v2 0/2] " Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Jisheng Zhang @ 2023-08-06  9:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen, Andy Shevchenko, Jiri Slaby
  Cc: linux-serial, devicetree, linux-kernel

The driver fall back to poll style when there's no irq. "poll" still
looks better than no support.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
index 3862411c77b5..17c553123f96 100644
--- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
@@ -117,7 +117,6 @@ properties:
 required:
   - compatible
   - reg
-  - interrupts
 
 unevaluatedProperties: false
 
-- 
2.40.1


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

* [PATCH v2 2/2] serial: 8250_dw: fall back to poll if there's no interrupt
  2023-08-06  9:20 [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
  2023-08-06  9:20 ` [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional Jisheng Zhang
@ 2023-08-06  9:20 ` Jisheng Zhang
  2023-08-06 10:20 ` [PATCH v2 0/2] " Greg Kroah-Hartman
  2 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2023-08-06  9:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Ilpo Järvinen, Andy Shevchenko, Jiri Slaby
  Cc: linux-serial, devicetree, linux-kernel

When there's no irq(this can be due to various reasons, for example,
no irq from HW support, or we just want to use poll solution, and so
on), falling back to poll is still better than no support at all.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 drivers/tty/serial/8250/8250_dw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 7db51781289e..f4cafca1a7da 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -523,7 +523,10 @@ static int dw8250_probe(struct platform_device *pdev)
 	if (!regs)
 		return dev_err_probe(dev, -EINVAL, "no registers defined\n");
 
-	irq = platform_get_irq(pdev, 0);
+	irq = platform_get_irq_optional(pdev, 0);
+	/* no interrupt -> fall back to polling */
+	if (irq == -ENXIO)
+		irq = 0;
 	if (irq < 0)
 		return irq;
 
-- 
2.40.1


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

* Re: [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt
  2023-08-06 10:20 ` [PATCH v2 0/2] " Greg Kroah-Hartman
@ 2023-08-06 10:16   ` Jisheng Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2023-08-06 10:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Ilpo Järvinen, Andy Shevchenko, Jiri Slaby, linux-serial,
	devicetree, linux-kernel

On Sun, Aug 06, 2023 at 12:20:11PM +0200, Greg Kroah-Hartman wrote:
> On Sun, Aug 06, 2023 at 05:20:54PM +0800, Jisheng Zhang wrote:
> > When there's no irq(this can be due to various reasons, for example,
> > no irq from HW support, or we just want to use poll solution, and so
> > on), falling back to poll is still better than no support at all.
> 
> Ouch, really?  Why not just fix the hardware instead?
> 

Hi Greg,

The HW may be designed as that to save interrupt lines if the uart
is dedicated to debug purpose. I also see similar support in other
uart drivers, for example liteuart.c, altera_uart.c, altera_jtaguart.c
8250_ioc3.c and so on.

Thanks

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

* Re: [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt
  2023-08-06  9:20 [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
  2023-08-06  9:20 ` [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional Jisheng Zhang
  2023-08-06  9:20 ` [PATCH v2 2/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
@ 2023-08-06 10:20 ` Greg Kroah-Hartman
  2023-08-06 10:16   ` Jisheng Zhang
  2 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-06 10:20 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Ilpo Järvinen, Andy Shevchenko, Jiri Slaby, linux-serial,
	devicetree, linux-kernel

On Sun, Aug 06, 2023 at 05:20:54PM +0800, Jisheng Zhang wrote:
> When there's no irq(this can be due to various reasons, for example,
> no irq from HW support, or we just want to use poll solution, and so
> on), falling back to poll is still better than no support at all.

Ouch, really?  Why not just fix the hardware instead?


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

* Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
  2023-08-06  9:20 ` [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional Jisheng Zhang
@ 2023-08-21 15:51   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2023-08-21 15:51 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: devicetree, Rob Herring, linux-serial, Greg Kroah-Hartman,
	linux-kernel, Ilpo Järvinen, Andy Shevchenko, Conor Dooley,
	Krzysztof Kozlowski, Jiri Slaby


On Sun, 06 Aug 2023 17:20:55 +0800, Jisheng Zhang wrote:
> The driver fall back to poll style when there's no irq. "poll" still
> looks better than no support.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 -
>  1 file changed, 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

end of thread, other threads:[~2023-08-21 15:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-06  9:20 [PATCH v2 0/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
2023-08-06  9:20 ` [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional Jisheng Zhang
2023-08-21 15:51   ` Rob Herring
2023-08-06  9:20 ` [PATCH v2 2/2] serial: 8250_dw: fall back to poll if there's no interrupt Jisheng Zhang
2023-08-06 10:20 ` [PATCH v2 0/2] " Greg Kroah-Hartman
2023-08-06 10:16   ` Jisheng Zhang

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