Re: Bug: shared usb dt document is incorrect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 29, 2015 at 12:29 PM, Tim Bird <tim.bird@xxxxxxxxxxxxxx> wrote:
>
>
> On 07/28/2015 07:54 PM, Rob Herring wrote:
>> On Tue, Jul 28, 2015 at 8:06 PM, Tim Bird <tim.bird@xxxxxxxxxxxxxx> wrote:
>>> Antoine and Rob,
>>>
>>> I was just doing some testing with USB on a Qualcomm SoC.
>>>
>>> I followed the instructions in the binding document:
>>> Documentation/devicetree/bindings/usb/ci-hdrc-usb2.txt
>>>
>>> which has a compatible for "qcom,ci-hdrc", and is, in general,
>>> for chipidea-based USB controllers.
>>>
>>> It says in the document that the property usb-phy is deprecated, and to
>>> use phys and phy-names instead.  However, the Qualcomm
>>> driver for this still uses usb-phy.  That driver is in:
>>> drivers/usb/chipidea/ci_hdrc_msm.c
>>
>> Deprecated means it still exists in the wild and should be maintained,
>> but don't use it for new dts files.
> OK.  But for the Qualcomm driver, the new binding doesn't work (see below).
> Since the binding doc specifically says: 'Use "phys" instead [of "usb-phy"].',
> it is wrong as currently written, for this controller/phy combination.

Perhaps we need to specify which compatible strings still use the old binding.

>>> I'm guessing I should update the Qualcomm driver to use
>>> phys and phy-names, but wanted to check with you-all to
>>> verify that this is the preferred method of getting
>>> phys by phandle now.  It's either change the driver
>>> or make an exception in the binding document, I believe.
>>
>> That would be fine along with updating the dts files, but the doc
>> should remain for some time.
>
> Does this mean I should try phys/phy-names, and if that doesn't work
> try usb-phy, for backwards compatibility?
>
>>> I presume I should be changing devm_usb_get_phy_by_phandle()
>>> to of_phy_get(), but let me know if there's more to it than that.
>>
>> devm_phy_get actually. The driver already supports it. See
>> ci_hdrc_probe in core.c.
>
> In my case the probe that is running is ci_hdrc_msm_probe(), in ci_hdrc_msm.c
> This probe uses devm_usb_get_phy_by_phandle(..."usb-phy").  If I specify phys/phy-names
> in my dts, the probe fails silently - leading ultimately to USB not working.
> If I specify "usb-phy" in my dts, everything works. In this case, that property
> is NOT deprecated.  It's the only one that works.

In my mind deprecated means "not recommended to be used", not that it
can't be used. If you were doing a new SOC, then I'd tell you don't
use usb-phy, but in this case as usb-phy is still used on QC SOCs I
think it is okay.

> I don't understand what's going on with the different probe routines and how the
> SoC-specific parts interact with the core.  I just know that the kernel behaviour
> and the binding doc don't match, and I'd like to help fix it if I can.

I believe the msm probe calls the core which then creates sub-devices
for the host and device sides. Then the host and device drivers are
probed. The SOC probe can fill in a phy or the core code will do it.
The problem with the core code is that it will not do a deferred
probe. It may still work though if you remove this from the msm probe:

        phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
        if (IS_ERR(phy))
                return PTR_ERR(phy);

        ci_hdrc_msm_platdata.usb_phy = phy;


You can support the old and new bindings just by doing:

phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
if (IS_ERR(phy) == -EPROBE_DEFER)
  return PTR_ERR(phy);
else {
  phy = devm_usb_get_phy_by_phandle(&pdev->dev, "phys", 0);
  if (IS_ERR(phy))
    return PTR_ERR(phy);
}

Not the prettiest code. If the QC maintainers don't care about
compatibility with old dtb's then you could just switch everything
(dts's and driver) to use phys instead.

Perhaps this should be in a wrapper function as I'd like to see all
users of usb-phy migrate to phys and the driver shouldn't really care
what the property name is.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux