Re: [PATCH v6 14/48] mfd: ti_am335x_tscadc: Don't search the tree for our clock

From: H. Nikolaus Schaller
Date: Mon Mar 07 2022 - 06:30:09 EST


Hi Miquel,

> Am 07.03.2022 um 12:10 schrieb Miquel Raynal <miquel.raynal@xxxxxxxxxxx>:
>
> Hi Nikolaus,
>
> hns@xxxxxxxxxxxxx wrote on Fri, 4 Mar 2022 23:38:25 +0100:
>
>> Hi Miquel,
>> I recently found that our BeagleBoneBlack with external touch screen stopped
>> to find it.
>>
>> A git bisect revealed this patch (merged into v5.16-rc1) as the first bad:
>>
>>> Am 15.10.2021 um 10:14 schrieb Miquel Raynal <miquel.raynal@xxxxxxxxxxx>:
>>>
>>> There is a single clock available in our node, which is named
>>> "fck". The clock handler then points to adc_tsc_fck but no need to point
>>> directly to it and do a full tree search.
>>>
>>> Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
>>> ---
>>> drivers/mfd/ti_am335x_tscadc.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
>>> index e2c4416f192d..8af44c08d925 100644
>>> --- a/drivers/mfd/ti_am335x_tscadc.c
>>> +++ b/drivers/mfd/ti_am335x_tscadc.c
>>> @@ -206,7 +206,7 @@ static int ti_tscadc_probe(struct platform_device *pdev)
>>> * This frequency is valid since TSC_ADC_SS controller design
>>> * assumes the OCP clock is at least 6x faster than the ADC clock.
>>> */
>>> - clk = devm_clk_get(&pdev->dev, "adc_tsc_fck");
>>> + clk = devm_clk_get(&pdev->dev, NULL);
>>> if (IS_ERR(clk)) {
>>> dev_err(&pdev->dev, "failed to get TSC fck\n");
>>> err = PTR_ERR(clk);
>>> --
>>> 2.27.0
>>>
>>
>> While I understand the reasons for this change there seems to be something
>> missing now in the device tree because the clock isn't found any more.
>>
>> After knowing about the problem I could also locate the log entry:
>>
>> [ 4.456680] ti_am3359-tscadc 44e0d000.tscadc: failed to get TSC fck
>>
>> Reverting your patch makes it work again.
>
> Sorry for the wrong behavior on your side and thanks for the
> investigation.
>
>> Is there missing a change in the am335x-boneblack or am335x DTS?
>
> I've looked at the code and indeed the am33xx-clock.dtsi file defines
> the touchscreen clock, but unfortunately the am33xx-l4.dtsi file which
> defines the touchscreen node does not reference the clock. The bindings
> clearly require the clocks to be referenced but I believe this was not
> noticed until now because the clock exist and clk_get() did a lookup
> across the tree.

I had expected something like this.

>
> On my side I tested it with an am437x SoC which uses another base
> device tree, which properly references the touchscreen clock where it's
> needed.
>
> I will send a patch (untested), can you give it a try and report if it
> fixes your issue?

Yes, please.

BR and thanks,
Nikolaus