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; > } > } > } 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