Re: [PATCH v7 4/7] usb: phy: tegra: Support OTG mode programming

From: Dmitry Osipenko
Date: Mon Oct 04 2021 - 17:24:43 EST


05.10.2021 00:22, Thierry Reding пишет:
> On Tue, Oct 05, 2021 at 12:13:48AM +0300, Dmitry Osipenko wrote:
>> 05.10.2021 00:05, Thierry Reding пишет:
>>> On Mon, Sep 27, 2021 at 07:36:52PM +0300, Dmitry Osipenko wrote:
>>>> 12.09.2021 21:17, Dmitry Osipenko пишет:
>>>>> Support programming USB PHY into OTG mode.
>>>>>
>>>>> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
>>>>> ---
>>>>> drivers/usb/phy/phy-tegra-usb.c | 198 +++++++++++++++++++++++++++++-
>>>>> include/linux/usb/tegra_usb_phy.h | 5 +
>>>>> 2 files changed, 198 insertions(+), 5 deletions(-)
>>>>
>>>> Greg / Felipe, could you please ack this patch to allow Thierry to take
>>>> this series via the Tegra tree? It depends on the soc/tegra patch of
>>>> this patchset.
>>>
>>> Looking at the series, I don't think this necessarily needs to go
>>> through the Tegra tree. Given that you have backwards-compatibility with
>>> older device trees, applying this separately to the USB tree should work
>>> fine. Once the soc/tegra and DT bits and the USB bits get combined they
>>> should enable the new functionality, but nothing should break if things
>>> are applied separately.
>>>
>>> If so, I can just pick up the rest and let Felipe or Greg pick this one
>>> up.
>>>
>>> Dmitry, can you confirm that this patch should be applicable separately?
>>> If so:
>>>
>>> Acked-by: Thierry Reding <treding@xxxxxxxxxx>
>>>
>>
>> This PHY patch has this hunk:
>>
>> + phy->pmc_regmap = dev_get_regmap(&pmc_pdev->dev, "usb_sleepwalk");
>> + if (!phy->pmc_regmap)
>> + return -EINVAL;
>>
>> If this patch and the DT patches will be applied before the soc/tegra
>> patch, then USB PHY driver will fail to probe.
>
> I had missed that. I was assuming that this other hunk took care of the
> backwards-compatibility:
>
> + /* older device-trees don't have PMC regmap */
> + if (!phy->pmc_regmap)
> + return 0;
>
> but that's rather pointless given your check above, right? Why not just
> return 0 instead and let the remaining code skip sleepwalk configuration
> if the regmap doesn't exist?

Because regmap must exists if node exists.