Skip to contentSkip to conversation

serial: 8250_dw: Introduce SG2044 uart support.

PATCH Superseded Inochi Amaoto 5 participants 16 messages Oct 21, 2024 – Oct 23, 2024

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover serial: 8250_dw: Introduce SG2044 uart support.

SG2044 relys on an internal divisor when calculating bitrate, which means a wrong clock for the most common bitrates. So a quirk is needed for this uart device to skip the set rate call and only relys on the internal UART divisor.

Changed from v1:
1. patch 1: improve the bindings commit message.
2. patch 2: rename jh7100 quirk and rename the quirk to

            dw8250_skip_set_rate_data.

Inochi Amaoto (2):
dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts
serial: 8250_dw: Add Sophgo SG2044 quirk

 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml         | 4 ++++
 drivers/tty/serial/8250/8250_dw.c                            | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)

--
2.47.0

#1 lore raw

PATCH v2 1/2 dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
index 4cdb0dcaccf3..6963f89a1848 100644
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart
       - items:
           - enum:
               - starfive,jh7100-hsuart
Signature · 1 line
2.47.0
#2 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 16 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -0
index 4cdb0dcaccf3..6963f89a1848 100644

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 7 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Cheers,
Conor.

#3 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 29 lines · Conor Dooley
Quoted 16 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -0
index 4cdb0dcaccf3..6963f89a1848 100644

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 7 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 2 lines

Cheers,
Conor.

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Regards,
Inochi

#4 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 29 lines · Inochi Amaoto
Quoted 12 lines · Conor Dooley
Quoted 11 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 15 lines

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 12 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
index 4cdb0dcaccf3..6963f89a1848 100644
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 2 lines

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Yeah. But I'd hold off to see if someone gives a rationale for it being done this way before sending that. I've not deleted this thread, and will send an ack if someone justifies why the binding is written like this.

#5 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 30 lines · Conor Dooley
Quoted 29 lines · Inochi Amaoto
Quoted 27 lines · Conor Dooley
Quoted 16 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -0
index 4cdb0dcaccf3..6963f89a1848 100644

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 7 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 7 lines
Quoted 2 lines

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Yeah. But I'd hold off to see if someone gives a rationale for it being done this way before sending that. I've not deleted this thread, and will send an ack if someone justifies why the binding is written like this.

Thanks.

#6 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 31 lines · Inochi Amaoto
Quoted 30 lines · Conor Dooley
Quoted 29 lines · Inochi Amaoto
Quoted 27 lines · Conor Dooley
Quoted 16 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -0
index 4cdb0dcaccf3..6963f89a1848 100644

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 7 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Yeah. But I'd hold off to see if someone gives a rationale for it being done this way before sending that. I've not deleted this thread, and will send an ack if someone justifies why the binding is written like this.

Well, Rob doesn't think they should be separate so please add that additional patch in your next version.

Thanks,
Conor.

#7 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 40 lines · Conor Dooley
Quoted 31 lines · Inochi Amaoto
Quoted 30 lines · Conor Dooley
Quoted 29 lines · Inochi Amaoto
Quoted 27 lines · Conor Dooley
Quoted 16 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -0
index 4cdb0dcaccf3..6963f89a1848 100644

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 7 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Yeah. But I'd hold off to see if someone gives a rationale for it being done this way before sending that. I've not deleted this thread, and will send an ack if someone justifies why the binding is written like this.

Quoted 5 lines

Well, Rob doesn't think they should be separate so please add that additional patch in your next version.

Thanks,
Conor.

It is OK for me. I will add a fix patch in the next version. Can I add you with suggested-by tag in this fix patch?

Regards,
Inochi

#8 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

Quoted 41 lines · Inochi Amaoto
Quoted 40 lines · Conor Dooley
Quoted 38 lines · Inochi Amaoto
Quoted 37 lines · Conor Dooley
Quoted 29 lines · Inochi Amaoto
Quoted 12 lines · Conor Dooley
Quoted 11 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 15 lines

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 12 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
index 4cdb0dcaccf3..6963f89a1848 100644
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 2 lines

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Yeah. But I'd hold off to see if someone gives a rationale for it being done this way before sending that. I've not deleted this thread, and will send an ack if someone justifies why the binding is written like this.

Quoted 8 lines
Quoted 5 lines

Well, Rob doesn't think they should be separate so please add that additional patch in your next version.

Thanks,
Conor.

It is OK for me. I will add a fix patch in the next version. Can I add you with suggested-by tag in this fix patch?

If you want, but I don't really care for one.

maintainer
#9 lore raw

Re: [PATCH v2 1/2] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2044 uarts

In reply to Conor Dooley
Quoted 30 lines · Conor Dooley
Quoted 29 lines · Inochi Amaoto
Quoted 27 lines · Conor Dooley
Quoted 16 lines · Inochi Amaoto

The UART of SG2044 is modified version of the standard Synopsys DesignWare UART. The UART on SG2044 relys on the internal divisor and can not set right clock rate for the common bitrates.

Add compatibles string for the Sophgo SG2044 uarts.

---
 .../devicetree/bindings/serial/snps-dw-apb-uart.yaml          | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +0 -0
index 4cdb0dcaccf3..6963f89a1848 100644

Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml properties: · line 64

Quoted 7 lines
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +4 -0
@@ -58,6 +58,10 @@ properties:
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart
           - const: snps,dw-apb-uart
+      - items:
+          - enum:
+              - sophgo,sg2044-uart
+          - const: snps,dw-apb-uart

Why does each vendor have an items entry of its own? Seems like needless clutter of the file IMO, except for the renesas bit.

Quoted 7 lines
Quoted 2 lines

I just follow others when writing this binding. I think it may need another patch to fix this problem, right?

Yeah. But I'd hold off to see if someone gives a rationale for it being done this way before sending that. I've not deleted this thread, and will send an ack if someone justifies why the binding is written like this.

No reason to be separate.

Rob

#10 lore raw

PATCH v2 2/2 serial: 8250_dw: Add Sophgo SG2044 quirk

In reply to Inochi Amaoto

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.

---
 drivers/tty/serial/8250/8250_dw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_dw.c +3 -2
index ab9e7f204260..51894c93c8a3 100644
@@ -750,7 +750,7 @@ 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_starfive_jh7100_data = {
+static const struct dw8250_platform_data dw8250_skip_set_rate_data = {
 	.usr_reg = DW_UART_USR,
 	.quirks = DW_UART_QUIRK_SKIP_SET_RATE,
 };
@@ -760,7 +760,8 @@ 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 = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data },
+	{ .compatible = "sophgo,sg2044-uart", .data = &dw8250_skip_set_rate_data },
+	{ .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, dw8250_of_match);
Signature · 1 line
2.47.0
reviewer Reviewed-by on v2 2/2
#11 lore raw

Re: [PATCH v2 2/2] serial: 8250_dw: Add Sophgo SG2044 quirk

Quoted 4 lines · Inochi Amaoto

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.

Assuming DT bindings are okay,

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Reviewed-by on v2 2/2
#12 lore raw

Re: [PATCH v2 2/2] serial: 8250_dw: Add Sophgo SG2044 quirk

In reply to Inochi Amaoto
Quoted 6 lines · Inochi Amaoto

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.

I wonder though does this mean the numbers userspace can read from kernel are bogus and if something can be done about that?

Signature · 1 line
 i.
Quoted 28 lines
---
 drivers/tty/serial/8250/8250_dw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_dw.c +3 -2
index ab9e7f204260..51894c93c8a3 100644
@@ -750,7 +750,7 @@ 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_starfive_jh7100_data = {
+static const struct dw8250_platform_data dw8250_skip_set_rate_data = {
 	.usr_reg = DW_UART_USR,
 	.quirks = DW_UART_QUIRK_SKIP_SET_RATE,
 };
@@ -760,7 +760,8 @@ 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 = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data },
+	{ .compatible = "sophgo,sg2044-uart", .data = &dw8250_skip_set_rate_data },
+	{ .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, dw8250_of_match);
#13 lore raw

Re: [PATCH v2 2/2] serial: 8250_dw: Add Sophgo SG2044 quirk

Quoted 7 lines · Ilpo Järvinen
Quoted 5 lines · Inochi Amaoto

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.

Quoted 7 lines
Quoted 1 line

I wonder though does this mean the numbers userspace can read from kernel are bogus and if something can be done about that?

I am not sure whether the clock rate can be read by the userspace. At least it report the right baud speed by using stty.

Regards,
Inochi

Quoted 29 lines
Quoted 29 lines
---
 drivers/tty/serial/8250/8250_dw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_dw.c +3 -2
index ab9e7f204260..51894c93c8a3 100644
@@ -750,7 +750,7 @@ 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_starfive_jh7100_data = {
+static const struct dw8250_platform_data dw8250_skip_set_rate_data = {
 	.usr_reg = DW_UART_USR,
 	.quirks = DW_UART_QUIRK_SKIP_SET_RATE,
 };
@@ -760,7 +760,8 @@ 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 = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data },
+	{ .compatible = "sophgo,sg2044-uart", .data = &dw8250_skip_set_rate_data },
+	{ .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, dw8250_of_match);
maintainer
#14 lore raw

Re: [PATCH v2 2/2] serial: 8250_dw: Add Sophgo SG2044 quirk

Quoted 10 lines · Inochi Amaoto
Quoted 9 lines · Ilpo Järvinen
Quoted 6 lines · Inochi Amaoto

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.

Quoted 8 lines
Quoted 5 lines

I wonder though does this mean the numbers userspace can read from kernel are bogus and if something can be done about that?

I am not sure whether the clock rate can be read by the userspace. At least it report the right baud speed by using stty.

Okay, I meant baud & other settings. Thanks for checking it.

Signature · 1 line
 i.
Quoted 33 lines

Regards,
Inochi

Quoted 29 lines
Quoted 29 lines
---
 drivers/tty/serial/8250/8250_dw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_dw.c +3 -2
index ab9e7f204260..51894c93c8a3 100644
@@ -750,7 +750,7 @@ 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_starfive_jh7100_data = {
+static const struct dw8250_platform_data dw8250_skip_set_rate_data = {
 	.usr_reg = DW_UART_USR,
 	.quirks = DW_UART_QUIRK_SKIP_SET_RATE,
 };
@@ -760,7 +760,8 @@ 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 = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data },
+	{ .compatible = "sophgo,sg2044-uart", .data = &dw8250_skip_set_rate_data },
+	{ .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data },
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, dw8250_of_match);
#15 lore raw

Re: [PATCH v2 2/2] serial: 8250_dw: Add Sophgo SG2044 quirk

Quoted 13 lines · Ilpo Järvinen
Quoted 12 lines · Inochi Amaoto
Quoted 11 lines · Ilpo Järvinen
Quoted 6 lines · Inochi Amaoto

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.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I wonder though does this mean the numbers userspace can read from kernel are bogus and if something can be done about that?

I am not sure whether the clock rate can be read by the userspace. At least it report the right baud speed by using stty.

Okay, I meant baud & other settings. Thanks for checking it.

oBut there is clock rate for user space. I think Ilpo has a point.

Documentation/ABI/testing/sysfs-tty:21:What: /sys/class/tty/ttyS<x>/uartclk

Signature · 2 lines
With Best Regards,
Andy Shevchenko