From: Lee Jones <lee.jones@linaro.org>
To: Codrin.Ciubotariu@microchip.com
Cc: Nicolas.Ferre@microchip.com, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, richard.genoud@gmail.com,
alexandre.belloni@bootlin.com, Ludovic.Desroches@microchip.com
Subject: Re: [PATCH] ARM: dts: at91: add serial MFD sub-node for usart
Date: Tue, 3 Nov 2020 08:56:20 +0000 [thread overview]
Message-ID: <20201103085620.GM4488@dell> (raw)
In-Reply-To: <9f99dcf1-239d-b3b3-4b7d-e6d628bb3fed@microchip.com>
On Mon, 02 Nov 2020, Codrin.Ciubotariu@microchip.com wrote:
> On 02.11.2020 14:55, Codrin.Ciubotariu@microchip.com wrote:
> > On 02.11.2020 14:29, Lee Jones wrote:
> >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >>
> >> On Mon, 02 Nov 2020, Codrin.Ciubotariu@microchip.com wrote:
> >>
> >>> 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.
> >>
> >> Why would you need to do that?
> >
> > In the case we will have to support another similar IP, but with a
> > different set of features. Not a new platform driver from scratch, but
> > at least a new struct platform_driver for each variant.
>
> I guess we could use struct mfd_cell.platform_data to select the
> features for the serial/SPI. This platform data can be per compatible of
> our MFD driver. I will send a patch with the changes you suggested.
Yes, that is what platform data is for.
> Thank you!
NP.
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
prev parent reply other threads:[~2020-11-03 8:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 11:07 [PATCH] ARM: dts: at91: add serial MFD sub-node for usart Codrin Ciubotariu
2020-10-30 13:38 ` Nicolas Ferre
2020-10-30 14:24 ` Codrin.Ciubotariu
2020-11-02 9:07 ` Lee Jones
2020-11-02 12:41 ` Codrin.Ciubotariu
2020-11-02 9:01 ` Lee Jones
2020-11-02 12:11 ` Codrin.Ciubotariu
2020-11-02 12:29 ` Lee Jones
2020-11-02 12:55 ` Codrin.Ciubotariu
2020-11-02 16:56 ` Codrin.Ciubotariu
2020-11-03 8:56 ` Lee Jones [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=20201103085620.GM4488@dell \
--to=lee.jones@linaro.org \
--cc=Codrin.Ciubotariu@microchip.com \
--cc=Ludovic.Desroches@microchip.com \
--cc=Nicolas.Ferre@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.genoud@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).