Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dragan Simic <dsimic@manjaro.org>
To: Alex Bee <knaerzche@gmail.com>
Cc: Philipp Puschmann <p.puschmann@pironex.com>,
	Diederik de Haas <didi.debian@cknow.org>,
	linux-rockchip@lists.infradead.org, robh@kernel.org,
	krzk+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH] arm64: dts: rockchip: Add uart dma names to the SoC dtsi for RK356x
Date: Wed, 10 Jul 2024 20:21:43 +0200	[thread overview]
Message-ID: <cfc99aaebd6aaa7f7a4c2eb4f5bdf13d@manjaro.org> (raw)
In-Reply-To: <cebcc2e7-27e2-4414-91f1-b83bd42876a7@gmail.com>

Hello Alex,

On 2024-07-10 20:05, Alex Bee wrote:
> Am 10.07.24 um 17:14 schrieb Philipp Puschmann:
>> Am 10.07.24 um 16:56 schrieb Dragan Simic:
>>> On 2024-07-10 12:20, Philipp Puschmann wrote:
>>>> Am 10.07.24 um 12:02 schrieb Diederik de Haas:
>>>>> On Wednesday, 10 July 2024 11:33:56 CEST Philipp Puschmann wrote:
>>>>>> DMA names are required by of_dma_request_slave_channel function 
>>>>>> that is
>>>>>> called during uart probe. So to enable DMA for uarts add the names 
>>>>>> as in
>>>>>> the RK3568 TRM.
>>>>> 
>>>>> Setting it on channels without flow control apparently causes 
>>>>> issues. See
>>>>> 
>>>>> https://lore.kernel.org/linux-rockchip/20240628120130.24076-1-didi.debian@cknow.org/
>>>> 
>>>> Ah is see. The only problem that i have is to enable/disable dmas by
>>>> having or not having
>>>> dma-names properties, where the latter case is followed by kernel
>>>> error messages. That
>>>> is very counterintuitive. Maybe a explicit boolean like dma-broken
>>>> would be better. That
>>>> could be set on dtsi level as default and deleted on board dts if
>>>> wanted. With such
>>>> a boolean we could also prevent the misleading "dma-names property 
>>>> of"
>>>> error message
>>>> and replace it with a hint that dma is disabled on purpose.
>>> 
>>>  From what I've read in the prior discussions, this seems like a 
>>> driver
>>> issue, so the driver should be fixed instead.
>> 
>> I would tend to disagree. The serial driver just uses the generic dma 
>> API. The error
>> message comes from of_dma_request_slave_channel() in 
>> drivers/dma/of-dma.c
>> and is called from dma_request_chan() inn drivers/dma/dmaengine.c.
>> 
>> The first function expects a device tree node and "dmas" and 
>> "dma-names" properties.
>> And "dma-names" is misused as "enable" switch and if not present (aka 
>> disabled) it
>> dumps "dma-names property of node X missing or empty". For me it's 
>> clear that
>> a clean way to disable or enable using dma via dts would be better to 
>> tell the
>> of_dma_request_slave_channel function that dma is disabled on purpose, 
>> so it
>> could return ENODEV but without printing a misleading error level 
>> message.
> 
> I'm with Philipp here. Topmost because DT should have to do nothing 
> with a
> (speculative) driver issue, it represents hardware.

I agree that, ideally, it should actually be seen and treated as a SoC
feature, i.e. DMA should be described and enabled at the SoC dtsi level.

> I would go further and
> say boards using a (non-kernel console) uart, which can't use dma for
> whatever reason should disable it. It will never be an issue for the 
> kernel
> console (i.e. "stdout-path = "serialX..." in DT or "console=ttySX" in
> cmdline) as the kernel will not use dma for this console. It's by the 
> way
> even worse for RK3399 Soc DT, which just doesn't expose the dma 
> channels
> for the uarts and for RK3368 which does not a expose a single dma 
> channel
> of the peripheral dmac (I tent to speculate for the very same reason).

I also agree about the specific boards disabling DMA if they cannot use
it for whatever reason, simply because DMA would (or should) be enabled
at the SoC dtsi level.

Though, I'd like to have some time for researching it further, in an 
attempt
to figure out what's actually going on.

>>>>>> Signed-off-by: Philipp Puschmann <p.puschmann@pironex.com>
>>>>>> ---
>>>>>>   arch/arm64/boot/dts/rockchip/rk356x.dtsi | 10 ++++++++++
>>>>>>   1 file changed, 10 insertions(+)
>>>>>> 
>>>>>> diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>>>>>> b/arch/arm64/boot/dts/rockchip/rk356x.dtsi index 
>>>>>> d8543b5557ee..4ae40661ca6a
>>>>>> 100644
>>>>>> --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>>>>>> +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi
>>>>>> @@ -489,6 +489,7 @@ uart0: serial@fdd50000 {
>>>>>>           clocks = <&pmucru SCLK_UART0>, <&pmucru PCLK_UART0>;
>>>>>>           clock-names = "baudclk", "apb_pclk";
>>>>>>           dmas = <&dmac0 0>, <&dmac0 1>;
>>>>>> +        dma-names = "tx", "rx";
>>>>>>           pinctrl-0 = <&uart0_xfer>;
>>>>>>           pinctrl-names = "default";
>>>>>>           reg-io-width = <4>;
>>>>>> @@ -1389,6 +1390,7 @@ uart1: serial@fe650000 {
>>>>>>           clocks = <&cru SCLK_UART1>, <&cru PCLK_UART1>;
>>>>>>           clock-names = "baudclk", "apb_pclk";
>>>>>>           dmas = <&dmac0 2>, <&dmac0 3>;
>>>>>> +        dma-names = "tx", "rx";
>>>>>>           pinctrl-0 = <&uart1m0_xfer>;
>>>>>>           pinctrl-names = "default";
>>>>>>           reg-io-width = <4>;
>>>>>> ...
>>>> 
>>>> _______________________________________________
>>>> Linux-rockchip mailing list
>>>> Linux-rockchip@lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>> 
>> _______________________________________________
>> Linux-rockchip mailing list
>> Linux-rockchip@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-rockchip
> 
> 
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

      reply	other threads:[~2024-07-10 18:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  9:33 [PATCH] arm64: dts: rockchip: Add uart dma names to the SoC dtsi for RK356x Philipp Puschmann
2024-07-10 10:02 ` Diederik de Haas
2024-07-10 10:20   ` Philipp Puschmann
2024-07-10 10:53     ` Diederik de Haas
2024-07-10 11:58       ` Philipp Puschmann
2024-07-10 14:56     ` Dragan Simic
2024-07-10 15:14       ` Philipp Puschmann
2024-07-10 15:37         ` Dragan Simic
2024-07-10 18:05         ` Alex Bee
2024-07-10 18:21           ` Dragan Simic [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfc99aaebd6aaa7f7a4c2eb4f5bdf13d@manjaro.org \
    --to=dsimic@manjaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=didi.debian@cknow.org \
    --cc=knaerzche@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=p.puschmann@pironex.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox