serial: 8250_dw: fall back to poll if there's no interrupt
Subsystems (4)
v2 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
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(-)
Signature · 1 line
2.40.1
PATCH v2 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 v2 1/2] dt-bindings: serial: snps-dw-apb-uart: make interrupt optional
Quoted 8 lines · Jisheng Zhang
The driver fall back to poll style when there's no irq. "poll" still looks better than no support.
Signed-off-by Jisheng Zhang <[email protected]>--- Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 - 1 file changed, 1 deletion(-)
PATCH v2 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_dw.c +4 -1
@@ -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;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerQuoted 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.
Ouch, really? Why not just fix the hardware instead?
Quoted 7 lines · Greg Kroah-Hartman
Quoted 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.
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