serial: 8250_dw: fall back to poll if there's no interrupt
Subsystems (4)
cover serial: 8250_dw: fall back to poll if there's no interrupt
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
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 | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.40.1
PATCH 1/2 dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
--- Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 - 1 file changed, 1 deletion(-)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -1
@@ -117,7 +117,6 @@ properties: required: - compatible - reg - - interrupts unevaluatedProperties: false
Signature · 1 line
2.40.1
Re: [PATCH 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
Quoted 2 lines · Jisheng Zhang
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
What is the user for this where the interrupt is not actually wired up in the hardware?
Quoted 21 lines
Signed-off-by Jisheng Zhang <[email protected]>--- Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 - 1 file changed, 1 deletion(-)Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0
-1@@ -117,7 +117,6 @@ properties: required: - compatible - reg - - interrupts unevaluatedProperties: falseSignature · 1 line
2.40.1
Andy Shevchenko
reviewerRe: [PATCH 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
Quoted 6 lines · Conor Dooley
Quoted 2 lines · Jisheng Zhang
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
What is the user for this where the interrupt is not actually wired up in the hardware?
FYI: kernel console doesn't use interrupts, so for example it might be the debug port. Note, I have no idea of the Zhang's case, just my assumption.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Conor Dooley
Quoted 2 lines · Jisheng Zhang
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
What is the user for this where the interrupt is not actually wired up in the hardware?
FYI: kernel console doesn't use interrupts, so for example it might be the debug port. Note, I have no idea of the Zhang's case, just my assumption.
I'm less interested in what the software is doing, it's what the device that has not connected the interrupt is that I am curious about.
Andy Shevchenko
reviewerRe: [PATCH 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
Quoted 6 lines · Conor Dooley
Quoted 5 lines · Andy Shevchenko
Quoted 4 lines · Conor Dooley
Quoted 2 lines · Jisheng Zhang
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
What is the user for this where the interrupt is not actually wired up in the hardware?
FYI: kernel console doesn't use interrupts, so for example it might be the debug port. Note, I have no idea of the Zhang's case, just my assumption.
I'm less interested in what the software is doing, it's what the device that has not connected the interrupt is that I am curious about.
As I said. The hw may be purely for debugging purposes (and yes, I have heard about such a hardware).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Conor Dooley
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Conor Dooley
On Wed, Aug 02, 2023 at 11:05:44PM +0800, Jisheng Zhang wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
What is the user for this where the interrupt is not actually wired up in the hardware?
FYI: kernel console doesn't use interrupts, so for example it might be the debug port. Note, I have no idea of the Zhang's case, just my assumption.
Hi Conor, Andy,
Andy's assumption about the uart dedicated for debug purpose is true, since it's for log only, so no interrupt need at all. We can also see such no irq support in litex uart driver(liteuart.c) and even a 8250 variant(8250_ioc3.c).
Thanks
Quoted 12 lines
Quoted 3 lines
I'm less interested in what the software is doing, it's what the device that has not connected the interrupt is that I am curious about.
As I said. The hw may be purely for debugging purposes (and yes, I have heard about such a hardware).
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 2/2 serial: 8250_dw: fall back to poll if there's no interrupt
In reply to Jisheng ZhangWhen 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.
--- drivers/tty/serial/8250/8250_dw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_dw.c +6 -2
@@ -524,8 +524,12 @@ static int dw8250_probe(struct platform_device *pdev)return dev_err_probe (dev, -EINVAL ,"no registers defined\n" ); irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -return irq; +if (irq <0 ) { +if (irq != -ENXIO ) +return irq; +/* no interrupt -> fall back to polling */ + irq =0 ; + }spin_lock_init (&p->lock); p->mapbase = regs->start;
Signature · 1 line
2.40.1
Andy Shevchenko
reviewerQuoted 3 lines · Jisheng Zhang
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.
...
Quoted 1 line
irq =
platform_get_irq(pdev, 0);
You will still have an error message. Perhaps you need to replace it with
irq = platform_get_irq_optional(pdev, 0);
drivers/tty/serial/8250/8250_dw.c static int dw8250_probe(struct platform_device *pdev) · line 532
Quoted 8 lines
drivers/tty/serial/8250/8250_dw.c +6
-2-if (irq <0 ) -return irq; +if (irq <0 ) { +if (irq != -ENXIO ) +return irq; +/* no interrupt -> fall back to polling */ + irq =0 ; + }
This can be slightly modified:
/* no interrupt -> fall back to polling */ if (irq == -ENXIO) irq = 0; if (irq < 0) return irq;
Signature · 2 lines
With Best Regards, Andy Shevchenko