serial: sh-sci: Add OF support - incremental
Subsystems (3)
PATCH v5 1/1 serial: sh-sci: Add OF support - incremental
This is an incremental patch to the "[PATCH v4 1/3] serial: sh-sci: Add OF support" implementing suggestions from Arnd.
- The compatible pattern has been reworked to include devices with legacy register sets.
- DT property interrupt-names added
- Renamed renesas,scbrr-algo-id into renesas,clock-algorithm
- Replaced #ifdef CONFIG_OF with
+ if (!IS_ENABLED(CONFIG_OF) || !np)
+ return NULL;
I opted to show the changes in an incremental patch as it may be easier to follow the changes and as Paul has the v3 already in his repo.
--- .../bindings/tty/serial/renesas,sci-serial.txt | 41 +++++----- arch/arm/boot/dts/r8a7740.dtsi | 45 ++++++----- drivers/tty/serial/sh-sci.c | 81 ++++++++++++-------- 3 files changed, 95 insertions(+), 72 deletions(-)
Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt +18 -23
@@ -1,10 +1,18 @@ * Renesas SH-Mobile Serial Communication Interface Required properties: -- compatible : Should be "renesas,sci-<port type>-uart", where <port type> may be - SCI, SCIF, IRDA, SCIFA or SCIFB. +- compatible : Should be "renesas,sci-<port type>-serial", where <port type> is + "sci", "scif", "irda", "scifa", "scifb" + or for legacy devices + "sh2_scif_fifodata", "sh3_scif", "sh4_scif", "sh4_scif_no_scsptr", + "sh4_scif_fifodata", "sh7705_scif". - reg : Address and length of the register set for the device -- interrupts : Should contain the following IRQs: ERI, RXI, TXI and BRI. +- interrupts : Should contain the following IRQs in this order: + ERI: receive-error interrupt + RXI: receive-FIFO-data-full interrupt + TXI: transmit-FIFO-data-empty interrupt + BRI: break reception interrupt +- interrupt-names: The IRQ names "eri", "rxi", "txi" and "bri". - cell-index : The device id. - renesas,scscr : Should contain a bitfield used by the Serial Control Register. b7 = SCSCR_TIE
@@ -15,7 +23,8 @@ Required properties: b2 = SCSCR_TOIE b1 = SCSCR_CKE1 b0 = SCSCR_CKE0 -- renesas,scbrr-algo-id : Algorithm ID for the Bit Rate Register +- renesas,clock-algorithm : Choose the clock frequency by selecting one of the + following algorithm IDs for the Bit Rate Register. 1 = SCBRR_ALGO_1 ((clk + 16 * bps) / (16 * bps) - 1) 2 = SCBRR_ALGO_2 ((clk + 16 * bps) / (32 * bps) - 1) 3 = SCBRR_ALGO_3 (((clk * 2) + 16 * bps) / (16 * bps) - 1)
@@ -23,31 +32,17 @@ Required properties: 5 = SCBRR_ALGO_5 (((clk * 1000 / 32) / bps) - 1) Optional properties: -- renesas,autoconf : Set if device is capable of auto configuration -- renesas,regtype : Overwrite the register layout. In most cases you can rely - on auto-probing (omit this property or set to 0) but some legacy devices - use a non-default register layout. Possible layouts are - 0 = SCIx_PROBE_REGTYPE (default) - 1 = SCIx_SCI_REGTYPE - 2 = SCIx_IRDA_REGTYPE - 3 = SCIx_SCIFA_REGTYPE - 4 = SCIx_SCIFB_REGTYPE - 5 = SCIx_SH2_SCIF_FIFODATA_REGTYPE - 6 = SCIx_SH3_SCIF_REGTYPE - 7 = SCIx_SH4_SCIF_REGTYPE - 8 = SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE - 9 = SCIx_SH4_SCIF_FIFODATA_REGTYPE - 10 = SCIx_SH7705_SCIF_REGTYPE - +- renesas,autoconf : Set if device is capable of auto configuration. Example: - sci at 0xe6c50000 { - compatible = "renesas,sci-SCIFA-uart"; + sci at e6c50000 { + compatible = "renesas,sci-scifa-serial"; interrupt-parent = <&intca>; reg = <0xe6c50000 0x100>; interrupts = <0x0c20>, <0x0c20>, <0x0c20>, <0x0c20>; + interrupt-names = "eri", "rxi", "txi", "bri"; cell-index = <1>; renesas,scscr = <0x30>; - renesas,scbrr-algo-id = <4>; + renesas,clock-algorithm = <4>; renesas,autoconf; };
arch/arm/boot/dts/r8a7740.dtsi +27 -18
128 lines not on this page · raw message
drivers/tty/serial/sh-sci.c +50 -31
115 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v5 1/1 serial: sh-sci: Add OF support - incremental
Quoted 11 lines · Bastian Hecht
This is an incremental patch to the "[PATCH v4 1/3] serial: sh-sci: Add OF support" implementing suggestions from Arnd.
- The compatible pattern has been reworked to include devices with legacy register sets.
- DT property interrupt-names added
- Renamed renesas,scbrr-algo-id into renesas,clock-algorithm
- Replaced #ifdefCONFIG_OFwith
+ if (!IS_ENABLED(CONFIG_OF) || !np)
+ return NULL;
Quoted 2 lines
I opted to show the changes in an incremental patch as it may be easier to follow the changes and as Paul has the v3 already in his repo.
Ok, makes sense.
Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt Required properties: · line 39
Quoted 4 lines
Documentation/devicetree/bindings/tty/serial/renesas,sci-serial.txt +2
-2- sci at 0xe6c50000 { - compatible = "renesas,sci-SCIFA-uart"; + sci at e6c50000 { + compatible = "renesas,sci-scifa-serial";
As mentioned, I meant the name to be changed, not the compatible value.
Quoted 13 lines
drivers/tty/serial/sh-sci.c +13
-0+ { .compatible = "renesas,sci-sci-serial", + .data = (void *)SCIx_SCI_REGTYPE }, + { .compatible = "renesas,sci-scif-serial", + .data = (void *)SCIx_SH4_SCIF_REGTYPE, }, + { .compatible = "renesas,sci-irda-serial", + .data = (void *)SCIx_IRDA_REGTYPE }, + { .compatible = "renesas,sci-scifa-serial", + .data = (void *)SCIx_SCIFA_REGTYPE }, + { .compatible = "renesas,sci-scifb-serial", + .data = (void *)SCIx_SCIFB_REGTYPE }, + { .compatible = "renesas,sci-sh2_scif_fifodata-serial", + .data = (void *)SCIx_SH2_SCIF_FIFODATA_REGTYPE }, + { .compatible = "renesas,sci-sh3_scif-serial",
drivers/tty/serial/sh-sci.c static int sci_remove(struct platform_device *dev) · line 2380
Quoted 10 lines
drivers/tty/serial/sh-sci.c +9
-0+ .data = (void *)SCIx_SH3_SCIF_REGTYPE }, + { .compatible = "renesas,sci-sh4_scif-serial", + .data = (void *)SCIx_SH4_SCIF_REGTYPE }, + { .compatible = "renesas,sci-sh4_scif_no_scsptr-serial", + .data = (void *)SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE }, + { .compatible = "renesas,sci-sh4_scif_fifodata-serial", + .data = (void *)SCIx_SH4_SCIF_FIFODATA_REGTYPE }, + { .compatible = "renesas,sci-sh7705_scif-serial", + .data = (void *)SCIx_SH7705_SCIF_REGTYPE }, {},
Ah nice, it's not even more complex than before.
Looks good,