Re: [RFC PATCH] drivers: usb: otg: add device tree support to otg library

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

 



On 06/26/2012 01:13 PM, ABRAHAM, KISHON VIJAY wrote:
> Hi,
> 
> On Tue, Jun 26, 2012 at 4:11 PM, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote:
>> On 06/26/2012 11:37 AM, Kishon Vijay Abraham I wrote:
>>> Adds an API to get usb phy by passing a device node phandle value. Since
>>> now it's possible to obtain phy by phandle, the checks in usb_add_phy
>>> for a valid phy type is removed (now it's just a debug message if a user
>>> tries to add a phy with undefined type).
>>> This also allows to add multiple phys of same type.
>>>
>>> Cc: Richard Zhao <richard.zhao@xxxxxxxxxxxxx>
>>> Cc: Marek Vasut <marex@xxxxxxx>
>>> Signed-off-by: Kishon Vijay Abraham I <kishon@xxxxxx>
>>> ---
>>> Had to remove the restricion on adding multiple phys of same type as now it
>>> would be possible to get the phys by phandle value. However there is no
>>> clear way to get a phy when there are multiple phys of same type without
>>> a phandle (non-dt). So in non-dt environment, adding and getting phy API's
>>> should be used with caution. Currently multiple-phys of the same type
>>> doesn't exist in kernel.
>>
>> In the current chipidea bindings for the mxs we link the usb phy
>> directly to the usb device:
>>
>>                usb0: usb@80080000 {
>>                        compatible = "fsl,imx28-usb", "fsl,imx27-usb";
>>                        reg = <0x80080000 0x10000>;
>>                        interrupts = <93>;
>>                        fsl,usbphy = <&usbphy0>;
>>                        status = "disabled";
>>                };
>>
>> And then extract it from the DT with this code:
>>
>>>       phy_np = of_parse_phandle(pdev->dev.of_node, "fsl,usbphy", 0);
>>>       if (phy_np) {
>>>               data->phy_np = phy_np;
>>>               phy_pdev = of_find_device_by_node(phy_np);
>>>               if (phy_pdev) {
>>>                       struct usb_phy *phy;
>>>                       phy = pdev_to_phy(phy_pdev);
>>>                       if (phy &&
>>>                           try_module_get(phy_pdev->dev.driver->owner)) {
>>>                               usb_phy_init(phy);
>>>                               data->phy = phy;
>>>                       }
>>>               }
>>>       }
> 
> This is like bypassing the otg_library to add or get the phy :-(

The problem is, we don't have _the_ phy, we have one phy per usb port
and we have two USB ports.

> Ideally you should make use of the otg library function for it. Having
> a generic function in the otg library to get phy by phandle will help
> other phy users to use it instead of implementing their own version of
> get_phy from phandle.

+1

The code I pointed you at is the topmost patch in:
https://github.com/riczhao/kernel-imx/commits/topics/usb-driver
As soon as your code is available, let's convert it to use your generic
function.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux