Skip to content

Commit 8f18d3c

Browse files
bijudasgregkh
authored andcommitted
serial: sh-sci: Add support for RZ/G3L RSCI
Add support for RZ/G3L RSCI. The RSCI IP found on the RZ/G3L SoC is similar to RZ/G3E, but it has 3 clocks (2 module clocks + 1 external clock) instead of 6 clocks (5 module clocks + 1 external clock) on the RZ/G3E. Both RZ/G3L and RZ/G3E have a 32-bit FIFO, but RZ/G3L has a single TCLK with internal dividers, whereas the RZ/G3E has explicit clocks for TCLK and its dividers. Add a new port type RSCI_PORT_SCIF32_SINGLE_TCLK to handle this clock difference. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260312082708.98835-3-biju.das.jz@bp.renesas.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6672462 commit 8f18d3c

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

drivers/tty/serial/rsci.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,13 @@ struct sci_of_data of_rsci_rzg3e_data = {
695695
.params = &rsci_rzg3e_port_params,
696696
};
697697

698+
struct sci_of_data of_rsci_rzg3l_data = {
699+
.type = RSCI_PORT_SCIF32_SINGLE_TCLK,
700+
.ops = &rsci_port_ops,
701+
.uart_ops = &rsci_uart_ops,
702+
.params = &rsci_rzg3e_port_params,
703+
};
704+
698705
struct sci_of_data of_rsci_rzt2h_data = {
699706
.type = RSCI_PORT_SCIF16,
700707
.ops = &rsci_port_ops,
@@ -703,6 +710,11 @@ struct sci_of_data of_rsci_rzt2h_data = {
703710
};
704711

705712
#ifdef CONFIG_SERIAL_SH_SCI_EARLYCON
713+
static int __init rsci_rzg3l_early_console_setup(struct earlycon_device *device,
714+
const char *opt)
715+
{
716+
return scix_early_console_setup(device, &of_rsci_rzg3l_data);
717+
}
706718

707719
static int __init rsci_rzg3e_early_console_setup(struct earlycon_device *device,
708720
const char *opt)
@@ -716,6 +728,7 @@ static int __init rsci_rzt2h_early_console_setup(struct earlycon_device *device,
716728
return scix_early_console_setup(device, &of_rsci_rzt2h_data);
717729
}
718730

731+
OF_EARLYCON_DECLARE(rsci, "renesas,r9a08g046-rsci", rsci_rzg3l_early_console_setup);
719732
OF_EARLYCON_DECLARE(rsci, "renesas,r9a09g047-rsci", rsci_rzg3e_early_console_setup);
720733
OF_EARLYCON_DECLARE(rsci, "renesas,r9a09g077-rsci", rsci_rzt2h_early_console_setup);
721734

drivers/tty/serial/rsci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "sh-sci-common.h"
77

88
extern struct sci_of_data of_rsci_rzg3e_data;
9+
extern struct sci_of_data of_rsci_rzg3l_data;
910
extern struct sci_of_data of_rsci_rzt2h_data;
1011

1112
#endif /* __RSCI_H__ */

drivers/tty/serial/sh-sci-common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
enum SCI_PORT_TYPE {
1010
RSCI_PORT_SCIF16 = BIT(7) | 0,
1111
RSCI_PORT_SCIF32 = BIT(7) | 1,
12+
RSCI_PORT_SCIF32_SINGLE_TCLK = BIT(7) | 2,
1213
};
1314

1415
enum SCI_CLKS {

drivers/tty/serial/sh-sci.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,8 @@ static int sci_handle_errors(struct uart_port *port)
11841184

11851185
static bool sci_is_rsci_type(u8 type)
11861186
{
1187-
return (type == RSCI_PORT_SCIF16 || type == RSCI_PORT_SCIF32);
1187+
return (type == RSCI_PORT_SCIF16 || type == RSCI_PORT_SCIF32 ||
1188+
type == RSCI_PORT_SCIF32_SINGLE_TCLK);
11881189
}
11891190

11901191
static int sci_handle_fifo_overrun(struct uart_port *port)
@@ -3181,7 +3182,8 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
31813182

31823183
if (sci_port->type == PORT_HSCIF) {
31833184
clk_names[SCI_SCK] = "hsck";
3184-
} else if (sci_port->type == RSCI_PORT_SCIF16) {
3185+
} else if (sci_port->type == RSCI_PORT_SCIF16 ||
3186+
sci_port->type == RSCI_PORT_SCIF32_SINGLE_TCLK) {
31853187
clk_names[SCI_FCK] = "operation";
31863188
clk_names[SCI_BRG_INT] = "bus";
31873189
} else if (sci_port->type == RSCI_PORT_SCIF32) {
@@ -3196,7 +3198,8 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)
31963198
if (IS_ERR(clk))
31973199
return PTR_ERR(clk);
31983200

3199-
if (!clk && sci_port->type == RSCI_PORT_SCIF16 &&
3201+
if (!clk && (sci_port->type == RSCI_PORT_SCIF16 ||
3202+
sci_port->type == RSCI_PORT_SCIF32_SINGLE_TCLK) &&
32003203
(i == SCI_FCK || i == SCI_BRG_INT))
32013204
return dev_err_probe(dev, -ENODEV, "failed to get %s\n", name);
32023205

@@ -3330,6 +3333,7 @@ static int sci_init_single(struct platform_device *dev,
33303333
break;
33313334
case PORT_SCIFA:
33323335
case RSCI_PORT_SCIF32:
3336+
case RSCI_PORT_SCIF32_SINGLE_TCLK:
33333337
sci_port->rx_trigger = 32;
33343338
break;
33353339
case PORT_SCIF:
@@ -3663,6 +3667,10 @@ static const struct of_device_id of_sci_match[] __maybe_unused = {
36633667
.data = &of_sci_scif_rzv2h,
36643668
},
36653669
#ifdef CONFIG_SERIAL_RSCI
3670+
{
3671+
.compatible = "renesas,r9a08g046-rsci",
3672+
.data = &of_rsci_rzg3l_data,
3673+
},
36663674
{
36673675
.compatible = "renesas,r9a09g047-rsci",
36683676
.data = &of_rsci_rzg3e_data,

0 commit comments

Comments
 (0)