serial: sh-sci: Add support for RZ/G2L SoC
authorBiju Das <biju.das.jz@bp.renesas.com>
Fri, 14 May 2021 19:22:12 +0000 (20:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 May 2021 14:21:30 +0000 (16:21 +0200)
Add serial support for RZ/G2L SoC with earlycon and
extended mode register support.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210514192218.13022-11-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c
drivers/tty/serial/sh-sci.h

index ef37fdf..872a2c3 100644 (file)
@@ -306,6 +306,7 @@ static const struct sci_port_params sci_port_params[SCIx_NR_REGTYPES] = {
                        [SCFDR]         = { 0x0E, 16 },
                        [SCSPTR]        = { 0x10, 16 },
                        [SCLSR]         = { 0x12, 16 },
+                       [SEMR]          = { 0x14, 8 },
                },
                .fifosize = 16,
                .overrun_reg = SCLSR,
@@ -2527,6 +2528,8 @@ done:
                        case 27: smr_val |= SCSMR_SRC_27; break;
                        }
                smr_val |= cks;
+               if (sci_getreg(port, SEMR)->size)
+                       serial_port_out(port, SEMR, 0);
                serial_port_out(port, SCSCR, scr_val | s->hscif_tot);
                serial_port_out(port, SCSMR, smr_val);
                serial_port_out(port, SCBRR, brr);
@@ -2561,6 +2564,8 @@ done:
                scr_val = s->cfg->scscr & (SCSCR_CKE1 | SCSCR_CKE0);
                smr_val |= serial_port_in(port, SCSMR) &
                           (SCSMR_CKEDG | SCSMR_SRC_MASK | SCSMR_CKS);
+               if (sci_getreg(port, SEMR)->size)
+                       serial_port_out(port, SEMR, 0);
                serial_port_out(port, SCSCR, scr_val | s->hscif_tot);
                serial_port_out(port, SCSMR, smr_val);
        }
@@ -3170,6 +3175,10 @@ static const struct of_device_id of_sci_match[] = {
                .compatible = "renesas,scif-r7s9210",
                .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE),
        },
+       {
+               .compatible = "renesas,scif-r9a07g044",
+               .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE),
+       },
        /* Family-specific types */
        {
                .compatible = "renesas,rcar-gen1-scif",
@@ -3452,6 +3461,7 @@ static int __init rzscifa_early_console_setup(struct earlycon_device *device,
        port_cfg.regtype = SCIx_RZ_SCIFA_REGTYPE;
        return early_console_setup(device, PORT_SCIF);
 }
+
 static int __init scifa_early_console_setup(struct earlycon_device *device,
                                          const char *opt)
 {
@@ -3471,6 +3481,7 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,
 OF_EARLYCON_DECLARE(sci, "renesas,sci", sci_early_console_setup);
 OF_EARLYCON_DECLARE(scif, "renesas,scif", scif_early_console_setup);
 OF_EARLYCON_DECLARE(scif, "renesas,scif-r7s9210", rzscifa_early_console_setup);
+OF_EARLYCON_DECLARE(scif, "renesas,scif-r9a07g044", rzscifa_early_console_setup);
 OF_EARLYCON_DECLARE(scifa, "renesas,scifa", scifa_early_console_setup);
 OF_EARLYCON_DECLARE(scifb, "renesas,scifb", scifb_early_console_setup);
 OF_EARLYCON_DECLARE(hscif, "renesas,hscif", hscif_early_console_setup);
index c0dfe43..c0ae786 100644 (file)
@@ -31,6 +31,7 @@ enum {
        SCCKS,                          /* BRG Clock Select Register */
        HSRTRGR,                        /* Rx FIFO Data Count Trigger Register */
        HSTTRGR,                        /* Tx FIFO Data Count Trigger Register */
+       SEMR,                           /* Serial extended mode register */
 
        SCIx_NR_REGS,
 };