mbox series

[v7,0/7] Add OTG mode support to Tegra USB PHY and Nexus 7

Message ID 20210912181718.1328-1-digetx@gmail.com
Headers show
Series Add OTG mode support to Tegra USB PHY and Nexus 7 | expand

Message

Dmitry Osipenko Sept. 12, 2021, 6:17 p.m. UTC
This series adds USB OTG mode support to the NVIDIA Tegra USB PHY driver
and Nexus 7 tablet.

Changelog:

v7: - v6 partially missed 5.15 kernel, only the power/supply patches has
      been merged. Re-sending the remaining patches for 5.16. The usb/phy
      patch needs ack from the subsystem maintainer.

v6: - Added r-b from Rob Herring to the OTG properties DT binding patch.

    - Corrected "smb347-charger: generic regmap caching" patch, it now
      sets the .num_reg_defaults_raw, initializing cache properly.

    - Added new patch "smb347-charger: Add missing pin control activation",
      which prevents never-enabled charging on Nexus 7.

    - The "otg-fsm: Fix hrtimer list corruption" patch of v5 was already
      applied to next, so it's not included anymore.

v5: - Replaced "Remove caching of charger state" patch with "Utilize
      generic regmap caching" after Sebastian's notice about disabled
      regmap caching.

v4: - Added r-b from Rob Herring.

    - Added unevaluatedProperties into SMB binding for VBUS regulator,
      which was Requested by Rob Herring.

    - Added cell to nvidia,pmc phandle instead of explicit h/w ID
      property. Requested by Rob Herring.

    - Added stack trace to commit message and ack from Peter Chen to
      OTG FSM patch.

v3: - Further improved interrupt handling in the PHY driver by removing
      assumption that interrupt is enabled by the CI driver at the time
      of set_wakeup() invocation, which makes this function a bit more
      universal.

v2: - The PHY's interrupt is now enabled from PHY's set_wakeup() callback.
      It prevents getting a spurious interrupt during the CI driver probe
      time.


Dmitry Osipenko (7):
  dt-bindings: phy: tegra20-usb-phy: Convert to schema
  dt-bindings: phy: tegra20-usb-phy: Document properties needed for OTG
    mode
  soc/tegra: pmc: Expose USB regmap to all SoCs
  usb: phy: tegra: Support OTG mode programming
  ARM: tegra: Add new properties to USB PHY device-tree nodes
  ARM: tegra: nexus7: Enable USB OTG mode
  arm64: tegra132: Add new properties to USB PHY device-tree node

 .../bindings/phy/nvidia,tegra20-usb-phy.txt   |  74 ----
 .../bindings/phy/nvidia,tegra20-usb-phy.yaml  | 373 ++++++++++++++++++
 arch/arm/boot/dts/tegra114.dtsi               |   4 +
 arch/arm/boot/dts/tegra124.dtsi               |   6 +
 arch/arm/boot/dts/tegra20.dtsi                |   6 +
 .../tegra30-asus-nexus7-grouper-common.dtsi   |  25 +-
 arch/arm/boot/dts/tegra30.dtsi                |   6 +
 arch/arm64/boot/dts/nvidia/tegra132.dtsi      |   6 +
 drivers/soc/tegra/pmc.c                       |   6 +-
 drivers/usb/phy/phy-tegra-usb.c               | 198 +++++++++-
 include/linux/usb/tegra_usb_phy.h             |   5 +
 11 files changed, 625 insertions(+), 84 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/phy/nvidia,tegra20-usb-phy.txt
 create mode 100644 Documentation/devicetree/bindings/phy/nvidia,tegra20-usb-phy.yaml

Comments

Dmitry Osipenko Sept. 27, 2021, 4:36 p.m. UTC | #1
12.09.2021 21:17, Dmitry Osipenko пишет:
> Support programming USB PHY into OTG mode.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  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.
Thierry Reding Oct. 4, 2021, 9:05 p.m. UTC | #2
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@gmail.com>
> > ---
> >  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@nvidia.com>
Dmitry Osipenko Oct. 4, 2021, 9:13 p.m. UTC | #3
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@gmail.com>
>>> ---
>>>  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@nvidia.com>
> 

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.
Thierry Reding Oct. 4, 2021, 9:13 p.m. UTC | #4
On Sun, Sep 12, 2021 at 09:17:11PM +0300, Dmitry Osipenko wrote:
> This series adds USB OTG mode support to the NVIDIA Tegra USB PHY driver
> and Nexus 7 tablet.
> 
> Changelog:
> 
> v7: - v6 partially missed 5.15 kernel, only the power/supply patches has
>       been merged. Re-sending the remaining patches for 5.16. The usb/phy
>       patch needs ack from the subsystem maintainer.
> 
> v6: - Added r-b from Rob Herring to the OTG properties DT binding patch.
> 
>     - Corrected "smb347-charger: generic regmap caching" patch, it now
>       sets the .num_reg_defaults_raw, initializing cache properly.
> 
>     - Added new patch "smb347-charger: Add missing pin control activation",
>       which prevents never-enabled charging on Nexus 7.
> 
>     - The "otg-fsm: Fix hrtimer list corruption" patch of v5 was already
>       applied to next, so it's not included anymore.
> 
> v5: - Replaced "Remove caching of charger state" patch with "Utilize
>       generic regmap caching" after Sebastian's notice about disabled
>       regmap caching.
> 
> v4: - Added r-b from Rob Herring.
> 
>     - Added unevaluatedProperties into SMB binding for VBUS regulator,
>       which was Requested by Rob Herring.
> 
>     - Added cell to nvidia,pmc phandle instead of explicit h/w ID
>       property. Requested by Rob Herring.
> 
>     - Added stack trace to commit message and ack from Peter Chen to
>       OTG FSM patch.
> 
> v3: - Further improved interrupt handling in the PHY driver by removing
>       assumption that interrupt is enabled by the CI driver at the time
>       of set_wakeup() invocation, which makes this function a bit more
>       universal.
> 
> v2: - The PHY's interrupt is now enabled from PHY's set_wakeup() callback.
>       It prevents getting a spurious interrupt during the CI driver probe
>       time.
> 
> 
> Dmitry Osipenko (7):
>   dt-bindings: phy: tegra20-usb-phy: Convert to schema
>   dt-bindings: phy: tegra20-usb-phy: Document properties needed for OTG
>     mode
>   soc/tegra: pmc: Expose USB regmap to all SoCs
>   usb: phy: tegra: Support OTG mode programming
>   ARM: tegra: Add new properties to USB PHY device-tree nodes
>   ARM: tegra: nexus7: Enable USB OTG mode
>   arm64: tegra132: Add new properties to USB PHY device-tree node

I've applied patches 3 and 5-7 to the Tegra tree.

Thanks,
Thierry
Thierry Reding Oct. 4, 2021, 9:22 p.m. UTC | #5
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@gmail.com>
> >>> ---
> >>>  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@nvidia.com>
> > 
> 
> 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?

Thierry
Dmitry Osipenko Oct. 4, 2021, 9:24 p.m. UTC | #6
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@gmail.com>
>>>>> ---
>>>>>  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@nvidia.com>
>>>
>>
>> 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.