Hi,

On Tue, Dec 10, 2013 at 04:25:25PM +0530, Vivek Gautam wrote:
> @@ -170,6 +189,15 @@ static int xhci_plat_probe(struct platform_device *pdev)
>       }
>  
>       /*
> +      * The parent of the xhci-plat device may pass in a PHY via
> +      * platform data.  If it exists, store it in our struct usb_hcd
> +      * so that we can use it later.
> +      */
> +     phy_generic = dev_get_platdata(&pdev->dev);
> +     if (phy_generic)
> +             xhci->shared_hcd->phy_generic = *phy_generic;

Getting the handle to the phy from platform data like this is not
going to work for long. It should be possible to get it normally with
phy_get(). It's not going to be possible to get the handle from the
platform data like this if the xhci-hcd platform device is created
from ACPI or DT. You are also not considering case where you have two
phys.

Vivek, I have made a patch set for the phy framework allowing
associations between the phys and their users to be made in same way
gpios and clk make them. With those you should be able to create a
lookup entry to the phy framework in drivers/usb/dwc3/host.c. Then we
could use phy_get() here already. Please check them. Subject of the
thread:

"phy: remove the need for the phys to know about their users"

The lookup table can then be added in drivers/usb/dwc3/host.c with
something like this:

int dwc3_host_init(struct dwc3 *dwc)
{
        struct platform_device  *xhci;
        struct phy_lookup_table *table;
        ...
        table->dev_id = dev_name(&xhci->dev);
        if (dwc->usb2_generic_phy)
                table->table[0].phy_name = 
dev_name(&dwc->usb2_generic_phy->dev);
        if (dwc->usb3_generic_phy)
                table->table[1].phy_name = 
dev_name(&dwc->usb3_generic_phy->dev);
        phy_add_lookup_table(table);
        ...

Br,

-- 
heikki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to