Re: [PATCH 2/2] ARM: dts: imx6qdl: support child mfd cells for the reset controller

From: Krzysztof Kozlowski
Date: Mon Jan 16 2023 - 05:16:36 EST


On 16/01/2023 10:26, Ahmad Fatoum wrote:
> On 16.01.23 10:14, Krzysztof Kozlowski wrote:
>> On 16/01/2023 09:27, Ahmad Fatoum wrote:
>>> Hello Krzysztof,
>>>
>>> On 16.01.23 09:20, Krzysztof Kozlowski wrote:
>>>> On 13/01/2023 18:32, Bastian Krause wrote:
>>>>> The actual syscon-reboot-mode child node can be added by a board
>>>>> device-tree or fixed up by the bootloader. For the child node to be
>>>>> probed, the compatible needs to include simple-mfd. The binding now
>>>>> specifies this, so have the SoC dtsi adhere to it.
>>>>>
>>>>> Suggested-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
>>>>> Signed-off-by: Bastian Krause <bst@xxxxxxxxxxxxxx>
>>>>> ---
>>>>> arch/arm/boot/dts/imx6qdl.dtsi | 3 ++-
>>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
>>>>> index ff1e0173b39be..b16be39458aa6 100644
>>>>> --- a/arch/arm/boot/dts/imx6qdl.dtsi
>>>>> +++ b/arch/arm/boot/dts/imx6qdl.dtsi
>>>>> @@ -865,7 +865,8 @@ epit2: epit@20d4000 { /* EPIT2 */
>>>>> };
>>>>>
>>>>> src: reset-controller@20d8000 {
>>>>> - compatible = "fsl,imx6q-src", "fsl,imx51-src";
>>>>> + compatible = "fsl,imx6q-src", "fsl,imx51-src",
>>>>> + "syscon", "simple-mfd";
>>>>
>>>> You need children here. Otherwise simple-mfd does not make sense. If you
>>>> expect something else to add children (I don't understand why, usually
>>>> reboot capability is fixed per SoC and only sometimes extended with some
>>>> other means), then this "else" will also change compatible.
>>>
>>> It's about syscon-reboot-mode, not syscon-reboot. Such modes are board-
>>> not soc-specific.
>>
>> syscon-reboot-mode is also mostly SoC specific. What exactly would
>> differ on different boards? Register offsets of SoC component? Register
>> values used by SoC power management unit?
>
> The modes supported. Let's say you want a bootloader mode that drops
> the board's bootloader into a fastboot gadget mode. You'd add a
> syscon-reboot-mode pointing at one of the non-volatile registers and
> you would define a magic value to indicate fastboot, both in the
> bootloader and Linux.

Bootloader and other firmware (e.g. ATF) is tightly tied to SoC, not to
board. There might be differences between firmware used and OS (e.g.
ChromeOS uses their own bootloader, different than Linux and Android on
the same SoC), but again this is not board specific.

>
> In theory, the reboot mode could also talk to the bootrom[1] to change
> the bootsource. This is also not board-agnostic, because it may not
> make sense to have a spinor reboot mode if your board doesn't have one.
>
> We have this scheme for STM32MP1 already and that's why I suggested
> Bastian to do it likewise for i.MX as he needs this functionality:
> https://lore.kernel.org/all/20201021102855.18026-1-a.fatoum@xxxxxxxxxxxxxx/

I don't understand why you use clearly wrong patches as examples. Bad
patterns and bugs are not reason to use same approach.

The binding is wrong - you do not allow syscon-reboot-mode and if you
ever tested your patches, you would see the errors.

> https://elixir.bootlin.com/barebox/latest/source/arch/arm/dts/stm32mp151.dtsi#L44

Whether this part is correct, tricky to say. Why these offsets are not
valid for other board?


Best regards,
Krzysztof