]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
serial: sh-sci: Add support for RZ/G3E RSCI clks
authorBiju Das <biju.das.jz@bp.renesas.com>
Sat, 29 Nov 2025 16:43:09 +0000 (16:43 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Dec 2025 14:07:07 +0000 (15:07 +0100)
RZ/G3E RSCI has 6 clocks (5 module clocks + 1 external clock). Add
support for the module clocks.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20251129164325.209213-14-biju.das.jz@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci-common.h
drivers/tty/serial/sh-sci.c

index abcd5bcc7c3692a162296f539c65dacb8ee6232c..5d30771278b4289509062515b5b032df06e92c3a 100644 (file)
@@ -16,6 +16,9 @@ enum SCI_CLKS {
        SCI_SCK,                /* Optional External Clock */
        SCI_BRG_INT,            /* Optional BRG Internal Clock Source */
        SCI_SCIF_CLK,           /* Optional BRG External Clock Source */
+       SCI_FCK_DIV4,           /* Optional Functional Clock frequency-divided by 4 */
+       SCI_FCK_DIV16,          /* Optional Functional Clock frequency-divided by 16 */
+       SCI_FCK_DIV64,          /* Optional Functional Clock frequency-divided by 64 */
        SCI_NUM_CLKS
 };
 
index a63370f22574b7580ac49c7034db012291bd7cba..5d7e78f95c70626bda185ce05f6674a7f07206a1 100644 (file)
@@ -3172,6 +3172,9 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
                [SCI_SCK] = "sck",
                [SCI_BRG_INT] = "brg_int",
                [SCI_SCIF_CLK] = "scif_clk",
+               [SCI_FCK_DIV4] = "tclk_div4",
+               [SCI_FCK_DIV16] = "tclk_div16",
+               [SCI_FCK_DIV64] = "tclk_div64",
        };
        struct clk *clk;
        unsigned int i;
@@ -3181,6 +3184,9 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
        } else if (sci_port->type == RSCI_PORT_SCIF16) {
                clk_names[SCI_FCK] = "operation";
                clk_names[SCI_BRG_INT] = "bus";
+       } else if (sci_port->type == RSCI_PORT_SCIF32) {
+               clk_names[SCI_FCK] = "tclk";
+               clk_names[SCI_BRG_INT] = "pclk";
        }
 
        for (i = 0; i < SCI_NUM_CLKS; i++) {
@@ -3194,6 +3200,10 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
                    (i == SCI_FCK || i == SCI_BRG_INT))
                        return dev_err_probe(dev, -ENODEV, "failed to get %s\n", name);
 
+               if (!clk && sci_port->type == RSCI_PORT_SCIF32 &&
+                   (i != SCI_SCK && i != SCI_SCIF_CLK))
+                       return dev_err_probe(dev, -ENODEV, "failed to get %s\n", name);
+
                if (!clk && i == SCI_FCK) {
                        /*
                         * Not all SH platforms declare a clock lookup entry