diff mbox series

[1/6] arm64: dts: ti: k3-am65: Remove UART baud rate selection

Message ID 20240326185441.29656-1-afd@ti.com (mailing list archive)
State New, archived
Headers show
Series [1/6] arm64: dts: ti: k3-am65: Remove UART baud rate selection | expand

Commit Message

Andrew Davis March 26, 2024, 6:54 p.m. UTC
As described in the binding document for the "current-speed" property:

"This should only be present in case a driver has no chance to know the
baud rate of the slave device."

This is not the case for the UART used in K3 devices, the current
baud-rate can be calculated from the registers. Having this property
has the effect of actually skipping the baud-rate setup in some drivers
as it assumes it will already be set to this rate, which may not always
be the case.

It seems this property's purpose was mistaken as selecting the desired
baud-rate, which it does not. It would have been wrong to select that
here anyway as DT is not the place for configuration, especially when
there are already more standard ways to set serial baud-rates.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi   | 1 -
 arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi    | 1 -
 arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi | 1 -
 3 files changed, 3 deletions(-)

Comments

Nishanth Menon March 26, 2024, 8:21 p.m. UTC | #1
On 13:54-20240326, Andrew Davis wrote:
> As described in the binding document for the "current-speed" property:
> 
> "This should only be present in case a driver has no chance to know the
> baud rate of the slave device."
> 
> This is not the case for the UART used in K3 devices, the current
> baud-rate can be calculated from the registers. Having this property

I do not understand the explanation above -> how does one do this?
If you are talking of the 8250 divider registers, someone has to program
those - how do you compute the baud rate from registers that aren't
programmed? Note: I am not commenting on the rationale of removing the
property, just trying to understand the assertion above.

> has the effect of actually skipping the baud-rate setup in some drivers
> as it assumes it will already be set to this rate, which may not always
> be the case.
> 
> It seems this property's purpose was mistaken as selecting the desired
> baud-rate, which it does not. It would have been wrong to select that
> here anyway as DT is not the place for configuration, especially when
> there are already more standard ways to set serial baud-rates.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  arch/arm64/boot/dts/ti/k3-am65-main.dtsi   | 1 -
>  arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi    | 1 -
>  arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi | 1 -
>  3 files changed, 3 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
> index ff857117d7193..670557c89f756 100644
> --- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
> @@ -89,7 +89,6 @@ main_uart0: serial@2800000 {
>  		reg = <0x00 0x02800000 0x00 0x100>;
>  		interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
>  		clock-frequency = <48000000>;
> -		current-speed = <115200>;
>  		power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>;
>  		status = "disabled";
>  	};
> diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
> index 6ff3ccc39fb44..4f808e5089755 100644
> --- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
> @@ -43,7 +43,6 @@ mcu_uart0: serial@40a00000 {
>  		reg = <0x00 0x40a00000 0x00 0x100>;
>  		interrupts = <GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
>  		clock-frequency = <96000000>;
> -		current-speed = <115200>;
>  		power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>;
>  		status = "disabled";
>  	};
> diff --git a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
> index 37527890ddeaf..eee072e44a42f 100644
> --- a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
> +++ b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
> @@ -59,7 +59,6 @@ wkup_uart0: serial@42300000 {
>  		reg = <0x42300000 0x100>;
>  		interrupts = <GIC_SPI 697 IRQ_TYPE_LEVEL_HIGH>;
>  		clock-frequency = <48000000>;
> -		current-speed = <115200>;
>  		power-domains = <&k3_pds 150 TI_SCI_PD_EXCLUSIVE>;
>  		status = "disabled";
>  	};
> -- 
> 2.39.2
>
Andrew Davis March 26, 2024, 8:55 p.m. UTC | #2
On 3/26/24 3:21 PM, Nishanth Menon wrote:
> On 13:54-20240326, Andrew Davis wrote:
>> As described in the binding document for the "current-speed" property:
>>
>> "This should only be present in case a driver has no chance to know the
>> baud rate of the slave device."
>>
>> This is not the case for the UART used in K3 devices, the current
>> baud-rate can be calculated from the registers. Having this property
> 
> I do not understand the explanation above -> how does one do this?
> If you are talking of the 8250 divider registers, someone has to program
> those - how do you compute the baud rate from registers that aren't
> programmed? Note: I am not commenting on the rationale of removing the
> property, just trying to understand the assertion above.
> 

This divider register, when "unprogrammed", has a default value. When one
wants to use a TTY/serial device they pick the baud-rate(stty, termios, etc.),
that then programs the register with the value they selected.

As stated below, this property does not program that register, it only
tells the driver what it should have already been set to. Some drivers
need this as they do not have a way to know what the divider is actually
set to.

Setting this in our case is wrong for two reasons:
1) Our driver can and does just check the divider itself.
2) We do not setup most of these UARTs before the kernel starts, so
    if our driver *did* care about this property it would not reflect
    the actual divider value (which is unprogrammed at this point).

Andrew

>> has the effect of actually skipping the baud-rate setup in some drivers
>> as it assumes it will already be set to this rate, which may not always
>> be the case.
>>
>> It seems this property's purpose was mistaken as selecting the desired
>> baud-rate, which it does not. It would have been wrong to select that
>> here anyway as DT is not the place for configuration, especially when
>> there are already more standard ways to set serial baud-rates.
>>
>> Signed-off-by: Andrew Davis <afd@ti.com>
>> ---
>>   arch/arm64/boot/dts/ti/k3-am65-main.dtsi   | 1 -
>>   arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi    | 1 -
>>   arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi | 1 -
>>   3 files changed, 3 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
>> index ff857117d7193..670557c89f756 100644
>> --- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
>> +++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
>> @@ -89,7 +89,6 @@ main_uart0: serial@2800000 {
>>   		reg = <0x00 0x02800000 0x00 0x100>;
>>   		interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
>>   		clock-frequency = <48000000>;
>> -		current-speed = <115200>;
>>   		power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>;
>>   		status = "disabled";
>>   	};
>> diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
>> index 6ff3ccc39fb44..4f808e5089755 100644
>> --- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
>> +++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
>> @@ -43,7 +43,6 @@ mcu_uart0: serial@40a00000 {
>>   		reg = <0x00 0x40a00000 0x00 0x100>;
>>   		interrupts = <GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
>>   		clock-frequency = <96000000>;
>> -		current-speed = <115200>;
>>   		power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>;
>>   		status = "disabled";
>>   	};
>> diff --git a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
>> index 37527890ddeaf..eee072e44a42f 100644
>> --- a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
>> +++ b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
>> @@ -59,7 +59,6 @@ wkup_uart0: serial@42300000 {
>>   		reg = <0x42300000 0x100>;
>>   		interrupts = <GIC_SPI 697 IRQ_TYPE_LEVEL_HIGH>;
>>   		clock-frequency = <48000000>;
>> -		current-speed = <115200>;
>>   		power-domains = <&k3_pds 150 TI_SCI_PD_EXCLUSIVE>;
>>   		status = "disabled";
>>   	};
>> -- 
>> 2.39.2
>>
>
Nishanth Menon April 9, 2024, 7:39 p.m. UTC | #3
Hi Andrew Davis,

On Tue, 26 Mar 2024 13:54:36 -0500, Andrew Davis wrote:
> As described in the binding document for the "current-speed" property:
> 
> "This should only be present in case a driver has no chance to know the
> baud rate of the slave device."
> 
> This is not the case for the UART used in K3 devices, the current
> baud-rate can be calculated from the registers. Having this property
> has the effect of actually skipping the baud-rate setup in some drivers
> as it assumes it will already be set to this rate, which may not always
> be the case.
> 
> [...]

I have applied the following to branch ti-k3-dts-next on [1].
Thank you!

[1/6] arm64: dts: ti: k3-am65: Remove UART baud rate selection
      commit: 9a1cedcdb98387bfc5d4fb9f1a1ada9121d32757
[2/6] arm64: dts: ti: k3-am64: Remove UART baud rate selection
      commit: 78331a044106f7022915058376ac56ec5d048124
[3/6] arm64: dts: ti: k3-j7200: Remove UART baud rate selection
      commit: 69dfa876d4b03f7bc043b196c472fca5d339722a
[4/6] arm64: dts: ti: k3-j721e: Remove UART baud rate selection
      commit: 14e556b08380b20833c5e2f6a5826d0669e0e0fa
[5/6] arm64: dts: ti: k3-j721s2: Remove UART baud rate selection
      commit: cfcfcd47c9f049be4ebcee90eafaf78b03cdf05f
[6/6] arm64: dts: ti: k3-j784s4: Remove UART baud rate selection
      commit: bd305a20fd338690fdd8ab8c4a50ab9d14066dfe

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent up the chain during
the next merge window (or sooner if it is a relevant bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
index ff857117d7193..670557c89f756 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-main.dtsi
@@ -89,7 +89,6 @@  main_uart0: serial@2800000 {
 		reg = <0x00 0x02800000 0x00 0x100>;
 		interrupts = <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
-		current-speed = <115200>;
 		power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>;
 		status = "disabled";
 	};
diff --git a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
index 6ff3ccc39fb44..4f808e5089755 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi
@@ -43,7 +43,6 @@  mcu_uart0: serial@40a00000 {
 		reg = <0x00 0x40a00000 0x00 0x100>;
 		interrupts = <GIC_SPI 565 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <96000000>;
-		current-speed = <115200>;
 		power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>;
 		status = "disabled";
 	};
diff --git a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
index 37527890ddeaf..eee072e44a42f 100644
--- a/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
+++ b/arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi
@@ -59,7 +59,6 @@  wkup_uart0: serial@42300000 {
 		reg = <0x42300000 0x100>;
 		interrupts = <GIC_SPI 697 IRQ_TYPE_LEVEL_HIGH>;
 		clock-frequency = <48000000>;
-		current-speed = <115200>;
 		power-domains = <&k3_pds 150 TI_SCI_PD_EXCLUSIVE>;
 		status = "disabled";
 	};