[U-Boot] [PATCH 1/1] usb: host: xhci-dwc3: add missing #ifdef CONFIG_PHY
Patrice CHOTARD
patrice.chotard at st.com
Thu Jul 20 11:48:44 UTC 2017
Hi Marek
On 07/20/2017 01:37 PM, Marek Vasut wrote:
> On 07/20/2017 01:34 PM, patrice.chotard at st.com wrote:
>> From: Patrice Chotard <patrice.chotard at st.com>
>>
>> To avoid compilation breakage on platform that don't
>> support DM PHY, add the missing CONFIG_PHY flag.
>
> Can we fix this _without_ introducing boatload of ifdefs throughout the
> code ?
You mean fix directly in phy framework ?
I will check that ....
Patrice
>
>> Introduced by patch :
>> 84e53877 "usb: host: xhci-dwc3: Add generic PHY support"
>>
>> Cc: Ran Wang <ran.wang_1 at nxp.com>
>> Cc: Bin Meng <bmeng.cn at gmail.com>
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
>> ---
>> drivers/usb/host/xhci-dwc3.c | 13 ++++++++++++-
>> 1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
>> index 374fe74..e34f937 100644
>> --- a/drivers/usb/host/xhci-dwc3.c
>> +++ b/drivers/usb/host/xhci-dwc3.c
>> @@ -21,9 +21,11 @@
>>
>> DECLARE_GLOBAL_DATA_PTR;
>>
>> +#ifdef CONFIG_PHY
>> struct xhci_dwc3_platdata {
>> struct phy usb_phy;
>> };
>> +#endif
>>
>> void dwc3_set_mode(struct dwc3 *dwc3_reg, u32 mode)
>> {
>> @@ -113,17 +115,21 @@ void dwc3_set_fladj(struct dwc3 *dwc3_reg, u32 val)
>>
>> static int xhci_dwc3_probe(struct udevice *dev)
>> {
>> +#ifdef CONFIG_PHY
>> struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
>> +#endif
>> struct xhci_hcor *hcor;
>> struct xhci_hccr *hccr;
>> struct dwc3 *dwc3_reg;
>> enum usb_dr_mode dr_mode;
>> - int ret;
>>
>> hccr = (struct xhci_hccr *)devfdt_get_addr(dev);
>> hcor = (struct xhci_hcor *)((phys_addr_t)hccr +
>> HC_LENGTH(xhci_readl(&(hccr)->cr_capbase)));
>>
>> +#ifdef CONFIG_PHY
>> + int ret;
>> +
>> ret = generic_phy_get_by_index(dev, 0, &plat->usb_phy);
>> if (ret) {
>> if (ret != -ENOENT) {
>> @@ -137,6 +143,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
>> return ret;
>> }
>> }
>> +#endif
>>
>> dwc3_reg = (struct dwc3 *)((char *)(hccr) + DWC3_REG_OFFSET);
>>
>> @@ -154,6 +161,7 @@ static int xhci_dwc3_probe(struct udevice *dev)
>>
>> static int xhci_dwc3_remove(struct udevice *dev)
>> {
>> +#ifdef CONFIG_PHY
>> struct xhci_dwc3_platdata *plat = dev_get_platdata(dev);
>> int ret;
>>
>> @@ -164,6 +172,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
>> return ret;
>> }
>> }
>> +#endif
>>
>> return xhci_deregister(dev);
>> }
>> @@ -181,6 +190,8 @@ U_BOOT_DRIVER(xhci_dwc3) = {
>> .remove = xhci_dwc3_remove,
>> .ops = &xhci_usb_ops,
>> .priv_auto_alloc_size = sizeof(struct xhci_ctrl),
>> +#ifdef CONFIG_PHY
>> .platdata_auto_alloc_size = sizeof(struct xhci_dwc3_platdata),
>> +#endif
>> .flags = DM_FLAG_ALLOC_PRIV_DMA,
>> };
>>
>
>
More information about the U-Boot
mailing list