lkml.org 
[lkml]   [2020]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] ARM: dts: at91: add serial MFD sub-node for usart
Date
On 02.11.2020 11:01, Lee Jones wrote:
> On Fri, 30 Oct 2020, Nicolas Ferre wrote:
>
>> On 30/10/2020 at 12:07, Codrin Ciubotariu wrote:
>>> The "atmel,at91sam9260-usart" driver is a MFD driver, so it needs sub-nodes
>>> to match the registered platform device. For this reason, we add a serial
>>> subnode to all the "atmel,at91sam9260-usart" serial compatible nods. This
>>> will also remove the boot warning:
>>> "atmel_usart_serial: Failed to locate of_node [id: -2]"
>>
>> I don't remember this warning was raised previously even if the MFD driver
>> was added a while ago (Sept. 2018).
>>
>> I would say it's due to 466a62d7642f ("mfd: core: Make a best effort attempt
>> to match devices with the correct of_nodes") which was added on mid August
>> and corrected with 22380b65dc70 ("mfd: mfd-core: Ensure disabled devices are
>> ignored without error") but maybe not covering our case.
>>
>> So, well, I don't know what's the best option to this change. Moreover, I
>> would say that all other USART related properties go into the child not if
>> there is a need for one.
>>
>> Lee, I suspect that we're not the only ones experiencing this ugly warning
>> during the boot log: can you point us out how to deal with it for our
>> existing atmel_serial.c users?
>
> You should not be instantiating drivers through Device Tree which are
> not described there. If the correct representation of the H/W already
> exists in Device Tree i.e. no SPI and UART IP really exists, use the
> MFD core API to register them utilising the platform API instead.
>
> This should do it:
>
> diff --git a/drivers/mfd/at91-usart.c b/drivers/mfd/at91-usart.c
> index 6a8351a4588e2..939bd2332a4f6 100644
> --- a/drivers/mfd/at91-usart.c
> +++ b/drivers/mfd/at91-usart.c
> @@ -17,12 +17,10 @@
>
> static const struct mfd_cell at91_usart_spi_subdev = {
> .name = "at91_usart_spi",
> - .of_compatible = "microchip,at91sam9g45-usart-spi",
> };
>
> static const struct mfd_cell at91_usart_serial_subdev = {
> .name = "atmel_usart_serial",
> - .of_compatible = "atmel,at91rm9200-usart-serial",
> };
>
> static int at91_usart_mode_probe(struct platform_device *pdev)

[snip]

Hi Lee, thank you for looking through our usart driver and for sharing
your thoughts. Removing the usage of compatible string means that for
similar serial/SPI IPs we would need to create new platform drivers.
This is not ideal, but it's a solution. What I proposed is more
flexible, but, as you pointed out, I am not sure it correctly describes
the HW, because the decision of whether to use this IP as a serial or a
SPI is a configurable one.

Thanks and best regards,
Codrin
\
 
 \ /
  Last update: 2020-11-02 13:12    [W:0.081 / U:1.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site