SG2044 relys on an internal divisor when calculating bitrate, which
means a wrong clock for the most common bitrates. So add a quirk for
this uart device to skip the set rate call and only relys on the
internal UART divisor.
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
drivers/tty/serial/8250/8250_dw.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index ab9e7f204260..6b7c75670f29 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -750,6 +750,11 @@ static const struct dw8250_platform_data dw8250_renesas_rzn1_data = {
.quirks = DW_UART_QUIRK_CPR_VALUE | DW_UART_QUIRK_IS_DMA_FC,
};
+static const struct dw8250_platform_data dw8250_sophgo_sg2044_data = {
+ .usr_reg = DW_UART_USR,
+ .quirks = DW_UART_QUIRK_SKIP_SET_RATE,
+};
+
static const struct dw8250_platform_data dw8250_starfive_jh7100_data = {
.usr_reg = DW_UART_USR,
.quirks = DW_UART_QUIRK_SKIP_SET_RATE,
@@ -760,6 +765,7 @@ static const struct of_device_id dw8250_of_match[] = {
{ .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data },
{ .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data },
{ .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data },
+ { .compatible = "sophgo,sg2044-uart", .data = &dw8250_sophgo_sg2044_data },
{ .compatible = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data },
{ /* Sentinel */ }
};
--
2.47.0
On Thu, Oct 10, 2024 at 07:39:06AM +0800, Inochi Amaoto wrote: > SG2044 relys on an internal divisor when calculating bitrate, which > means a wrong clock for the most common bitrates. So add a quirk for > this uart device to skip the set rate call and only relys on the > internal UART divisor. ... > +static const struct dw8250_platform_data dw8250_sophgo_sg2044_data = { > + .usr_reg = DW_UART_USR, > + .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > +}; > + > static const struct dw8250_platform_data dw8250_starfive_jh7100_data = { > .usr_reg = DW_UART_USR, > .quirks = DW_UART_QUIRK_SKIP_SET_RATE, For the bare minimum this should be deduplicated as to have one record for now. static const struct dw8250_platform_data dw8250_skip_set_rate_data = { .usr_reg = DW_UART_USR, .quirks = DW_UART_QUIRK_SKIP_SET_RATE, }; If we need different quirks in the future, they can be split again. Or, if you certain that new quirks will come, mention this in the commit message. ... > { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, > { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, > { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, > + { .compatible = "sophgo,sg2044-uart", .data = &dw8250_sophgo_sg2044_data }, > { .compatible = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data }, I think my proposal for having a common compatible for those two is a no-go as compatible strings are for the (unique) hardware and shouldn't be abstracted based on some Linux or other OS shortcuts / quirks. -- With Best Regards, Andy Shevchenko
On Thu, Oct 10, 2024 at 06:00:34PM +0300, Andy Shevchenko wrote: > On Thu, Oct 10, 2024 at 07:39:06AM +0800, Inochi Amaoto wrote: > > SG2044 relys on an internal divisor when calculating bitrate, which > > means a wrong clock for the most common bitrates. So add a quirk for > > this uart device to skip the set rate call and only relys on the > > internal UART divisor. > > ... > > > +static const struct dw8250_platform_data dw8250_sophgo_sg2044_data = { > > + .usr_reg = DW_UART_USR, > > + .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > > +}; > > + > > static const struct dw8250_platform_data dw8250_starfive_jh7100_data = { > > .usr_reg = DW_UART_USR, > > .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > > For the bare minimum this should be deduplicated as to have one record for now. > > static const struct dw8250_platform_data dw8250_skip_set_rate_data = { > .usr_reg = DW_UART_USR, > .quirks = DW_UART_QUIRK_SKIP_SET_RATE, > }; > > If we need different quirks in the future, they can be split again. > Or, if you certain that new quirks will come, mention this in > the commit message. > Yes, renaming this quirk as a common one is better. I will prefer if this patch is necessary. Duplication is not a good idea. > ... > > > { .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data }, > > { .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data }, > > { .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data }, > > + { .compatible = "sophgo,sg2044-uart", .data = &dw8250_sophgo_sg2044_data }, > > { .compatible = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data }, > > I think my proposal for having a common compatible for those two is a no-go > as compatible strings are for the (unique) hardware and shouldn't be abstracted > based on some Linux or other OS shortcuts / quirks. > Yes, a common compatible is not a good idea. But it is OK to share a common quirk, which means they have the same problem. Regards, Inochi
© 2016 - 2024 Red Hat, Inc.