Skip to contentSkip to conversation

Inconsistent sifive,fu540-c000-uart binding.

RFC In review Sebastian Andrzej Siewior 4 participants 7 messages Mar 4, 2024 – Mar 7, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw
| $ git grep fu540-c000-uart
| Documentation/devicetree/bindings/serial/sifive-serial.yaml:          - sifive,fu540-c000-uart
| Documentation/devicetree/bindings/serial/sifive-serial.yaml:        compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| Documentation/devicetree/bindings/sifive/sifive-blocks-ip-versioning.txt:"sifive,fu540-c000-uart".  This way, if SoC-specific
| Documentation/devicetree/bindings/sifive/sifive-blocks-ip-versioning.txt:    compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| arch/riscv/boot/dts/sifive/fu540-c000.dtsi:                     compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| arch/riscv/boot/dts/sifive/fu540-c000.dtsi:                     compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| drivers/tty/serial/sifive.c:OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
| drivers/tty/serial/sifive.c:    { .compatible = "sifive,fu540-c000-uart0" },

note that the driver has a trailing 0 in the binding while the yaml description and the DT part does not.
The 'sifive,uart' has a trailing 0 where the 0 denotes the version UART IP.

Was this also intended for the fu540-c000-uart binding? Should the 0 be added everywhere or removed from the driver?

Sebastian

#1 lore raw
Quoted 10 lines · Sebastian Andrzej Siewior
| $ git grep fu540-c000-uart
| Documentation/devicetree/bindings/serial/sifive-serial.yaml:          - sifive,fu540-c000-uart
| Documentation/devicetree/bindings/serial/sifive-serial.yaml:        compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| Documentation/devicetree/bindings/sifive/sifive-blocks-ip-versioning.txt:"sifive,fu540-c000-uart".  This way, if SoC-specific
| Documentation/devicetree/bindings/sifive/sifive-blocks-ip-versioning.txt:    compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| arch/riscv/boot/dts/sifive/fu540-c000.dtsi:                     compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| arch/riscv/boot/dts/sifive/fu540-c000.dtsi:                     compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| drivers/tty/serial/sifive.c:OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
| drivers/tty/serial/sifive.c:    { .compatible = "sifive,fu540-c000-uart0" },
Quoted 7 lines

note that the driver has a trailing 0 in the binding while the yaml description and the DT part does not.
The 'sifive,uart' has a trailing 0 where the 0 denotes the version UART IP.

Was this also intended for the fu540-c000-uart binding? Should the 0 be added everywhere or removed from the driver?

I suspect that the driver is what's incorrect, given there's little value in putting the IP version in the SoC-specific compatible as it's a fixed implementation. I'd change the driver to match the bindings.

Cheers,
Conor.

#2 lore raw
Quoted 16 lines · Conor Dooley
Quoted 15 lines · Sebastian Andrzej Siewior
| $ git grep fu540-c000-uart
| Documentation/devicetree/bindings/serial/sifive-serial.yaml:          - sifive,fu540-c000-uart
| Documentation/devicetree/bindings/serial/sifive-serial.yaml:        compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| Documentation/devicetree/bindings/sifive/sifive-blocks-ip-versioning.txt:"sifive,fu540-c000-uart".  This way, if SoC-specific
| Documentation/devicetree/bindings/sifive/sifive-blocks-ip-versioning.txt:    compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| arch/riscv/boot/dts/sifive/fu540-c000.dtsi:                     compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| arch/riscv/boot/dts/sifive/fu540-c000.dtsi:                     compatible = "sifive,fu540-c000-uart", "sifive,uart0";
| drivers/tty/serial/sifive.c:OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
| drivers/tty/serial/sifive.c:    { .compatible = "sifive,fu540-c000-uart0" },

note that the driver has a trailing 0 in the binding while the yaml description and the DT part does not.
The 'sifive,uart' has a trailing 0 where the 0 denotes the version UART IP.

Quoted 6 lines
Quoted 2 lines

Was this also intended for the fu540-c000-uart binding? Should the 0 be added everywhere or removed from the driver?

I suspect that the driver is what's incorrect, given there's little value in putting the IP version in the SoC-specific compatible as it's a fixed implementation. I'd change the driver to match the bindings.

Agreed

- Paul

#3 lore raw

PATCH 1/1 serial: sifive: Remove 0 from fu540-c000-uart0 binding.

The driver is using "sifive,fu540-c000-uart0" as a binding. The device tree and documentation states "sifive,fu540-c000-uart" instead. This means the binding is not matched and not used.

This did not cause any problems because the alternative binding, used in the device tree, "sifive,uart0" is not handling the hardware any different.

Align the binding in the driver with the documentation.

---

Quoted 6 lines · Paul Walmsley
Quoted 3 lines · Conor Dooley

I suspect that the driver is what's incorrect, given there's little value in putting the IP version in the SoC-specific compatible as it's a fixed implementation. I'd change the driver to match the bindings.

Agreed

I didn't add any stable/ fixes tags as I guess there is no point in backporting this.

Quoted 1 line

- Paul

 drivers/tty/serial/sifive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/sifive.c +2 -2
index 0670fd9f84967..cbfce65c9d221 100644
@@ -761,7 +761,7 @@ static int __init early_sifive_serial_setup(struct earlycon_device *dev,
 }
 
 OF_EARLYCON_DECLARE(sifive, "sifive,uart0", early_sifive_serial_setup);
-OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
+OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart",
 		    early_sifive_serial_setup);
 #endif /* CONFIG_SERIAL_EARLYCON */
 
@@ -1032,7 +1032,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(sifive_uart_pm_ops, sifive_serial_suspend,
 				sifive_serial_resume);
 
 static const struct of_device_id sifive_serial_of_match[] = {
-	{ .compatible = "sifive,fu540-c000-uart0" },
+	{ .compatible = "sifive,fu540-c000-uart" },
 	{ .compatible = "sifive,uart0" },
 	{},
 };
Signature · 3 lines
2.43.0

Sebastian
Reviewed-by on v1 1/1
#4 lore raw

Re: [PATCH] serial: sifive: Remove 0 from fu540-c000-uart0 binding.

Quoted 18 lines · Sebastian Andrzej Siewior

The driver is using "sifive,fu540-c000-uart0" as a binding. The device tree and documentation states "sifive,fu540-c000-uart" instead. This means the binding is not matched and not used.

This did not cause any problems because the alternative binding, used in the device tree, "sifive,uart0" is not handling the hardware any different.

Align the binding in the driver with the documentation.

---

Quoted 5 lines · Paul Walmsley
Quoted 3 lines · Conor Dooley

I suspect that the driver is what's incorrect, given there's little value in putting the IP version in the SoC-specific compatible as it's a fixed implementation. I'd change the driver to match the bindings.

Quoted 5 lines
Quoted 1 line

Agreed

I didn't add any stable/ fixes tags as I guess there is no point in backporting this.

Every documented device falls back to "sifive,uart0", as you mention above, so I think that's reasonable.

Thanks,
Conor.

Quoted 32 lines
Quoted 2 lines

- Paul

 drivers/tty/serial/sifive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/sifive.c +2 -2
index 0670fd9f84967..cbfce65c9d221 100644
@@ -761,7 +761,7 @@ static int __init early_sifive_serial_setup(struct earlycon_device *dev,
 }
 
 OF_EARLYCON_DECLARE(sifive, "sifive,uart0", early_sifive_serial_setup);
-OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
+OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart",
 		    early_sifive_serial_setup);
 #endif /* CONFIG_SERIAL_EARLYCON */
 
@@ -1032,7 +1032,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(sifive_uart_pm_ops, sifive_serial_suspend,
 				sifive_serial_resume);
 
 static const struct of_device_id sifive_serial_of_match[] = {
-	{ .compatible = "sifive,fu540-c000-uart0" },
+	{ .compatible = "sifive,fu540-c000-uart" },
 	{ .compatible = "sifive,uart0" },
 	{},
 };
Signature · 3 lines
2.43.0

Sebastian
maintainer
#5 lore raw

Re: [PATCH] serial: sifive: Remove 0 from fu540-c000-uart0 binding.

Hi Conor, Sebastian,

Quoted 19 lines · Conor Dooley
Quoted 18 lines · Sebastian Andrzej Siewior

The driver is using "sifive,fu540-c000-uart0" as a binding. The device tree and documentation states "sifive,fu540-c000-uart" instead. This means the binding is not matched and not used.

This did not cause any problems because the alternative binding, used in the device tree, "sifive,uart0" is not handling the hardware any different.

Align the binding in the driver with the documentation.

---

Quoted 5 lines · Paul Walmsley
Quoted 3 lines · Conor Dooley

I suspect that the driver is what's incorrect, given there's little value in putting the IP version in the SoC-specific compatible as it's a fixed implementation. I'd change the driver to match the bindings.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Agreed

I didn't add any stable/ fixes tags as I guess there is no point in backporting this.

Every documented device falls back to "sifive,uart0", as you mention above, so I think that's reasonable.

Right. In fact this means the sifive,fu540-c000-uart compatible can be removed from the driver entirely, since the driver would match sifive,uart0 anyway.

Regards,
Samuel

Quoted 37 lines

Thanks,
Conor.

Quoted 32 lines
Quoted 2 lines

- Paul

 drivers/tty/serial/sifive.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/sifive.c +2 -2
index 0670fd9f84967..cbfce65c9d221 100644
@@ -761,7 +761,7 @@ static int __init early_sifive_serial_setup(struct earlycon_device *dev,
 }
 
 OF_EARLYCON_DECLARE(sifive, "sifive,uart0", early_sifive_serial_setup);
-OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
+OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart",
 		    early_sifive_serial_setup);
 #endif /* CONFIG_SERIAL_EARLYCON */
 
@@ -1032,7 +1032,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(sifive_uart_pm_ops, sifive_serial_suspend,
 				sifive_serial_resume);
 
 static const struct of_device_id sifive_serial_of_match[] = {
-	{ .compatible = "sifive,fu540-c000-uart0" },
+	{ .compatible = "sifive,fu540-c000-uart" },
 	{ .compatible = "sifive,uart0" },
 	{},
 };
Signature · 3 lines
2.43.0

Sebastian
#6 lore raw

Re: [PATCH] serial: sifive: Remove 0 from fu540-c000-uart0 binding.

Quoted 25 lines · Samuel Holland

Hi Conor, Sebastian,

Quoted 22 lines · Conor Dooley
Quoted 20 lines · Sebastian Andrzej Siewior

The driver is using "sifive,fu540-c000-uart0" as a binding. The device tree and documentation states "sifive,fu540-c000-uart" instead. This means the binding is not matched and not used.

This did not cause any problems because the alternative binding, used in the device tree, "sifive,uart0" is not handling the hardware any different.

Align the binding in the driver with the documentation.

---

Quoted 6 lines · Paul Walmsley
Quoted 3 lines · Conor Dooley

I suspect that the driver is what's incorrect, given there's little value in putting the IP version in the SoC-specific compatible as it's a fixed implementation. I'd change the driver to match the bindings.

Agreed

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I didn't add any stable/ fixes tags as I guess there is no point in backporting this.

Every documented device falls back to "sifive,uart0", as you mention above, so I think that's reasonable.

Right. In fact this means the sifive,fu540-c000-uart compatible can be removed from the driver entirely, since the driver would match sifive,uart0 anyway.

I'm always a bit hesitant when it comes to removing compatibles that are backed up by a mandatory fallback in where there could be some old firmware/DT floating around that didn't have the fallback. I think in this case that's pretty moot though, so ye, it could totally be dropped from the driver entirely. I'm happy with either, both cases are an undocumented compatible being removed ;)