[U-Boot] [PATCH 1/2] usb: extend generic EHCI driver with PHY

Patrice CHOTARD patrice.chotard at st.com
Fri May 12 15:59:53 UTC 2017


Hi Marek

On 05/12/2017 03:20 PM, Marek Vasut wrote:
> On 05/12/2017 03:13 PM, patrice.chotard at st.com wrote:
>> From: Patrice Chotard <patrice.chotard at st.com>
>>
>> Add support of generic PHY framework
>> Replace printf() by error()
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
>> ---
>>  drivers/usb/host/ehci-generic.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
>> index 2190adb..d744a57 100644
>> --- a/drivers/usb/host/ehci-generic.c
>> +++ b/drivers/usb/host/ehci-generic.c
>> @@ -6,6 +6,8 @@
>>
>>  #include <common.h>
>>  #include <clk.h>
>> +#include <fdtdec.h>
>> +#include <generic-phy.h>
>>  #include <reset.h>
>>  #include <asm/io.h>
>>  #include <dm.h>
>> @@ -24,6 +26,7 @@ static int ehci_usb_probe(struct udevice *dev)
>>  {
>>  	struct ehci_hccr *hccr;
>>  	struct ehci_hcor *hcor;
>> +	struct phy usb_phy;
>>  	int i;
>>
>>  	for (i = 0; ; i++) {
>> @@ -34,7 +37,7 @@ static int ehci_usb_probe(struct udevice *dev)
>>  		if (ret < 0)
>>  			break;
>>  		if (clk_enable(&clk))
>> -			printf("failed to enable clock %d\n", i);
>> +			error("failed to enable clock %d\n", i);
>
> Separate patch please

Ok

>
>>  		clk_free(&clk);
>>  	}
>>
>> @@ -46,10 +49,14 @@ static int ehci_usb_probe(struct udevice *dev)
>>  		if (ret < 0)
>>  			break;
>>  		if (reset_deassert(&reset))
>> -			printf("failed to deassert reset %d\n", i);
>> +			error("failed to deassert reset %d\n", i);
>
> DTTO
>
>>  		reset_free(&reset);
>>  	}
>>
>> +	if (!generic_phy_get_by_index(dev, 0, &usb_phy))
>> +		if (generic_phy_init(&usb_phy))
>> +			error("failed to init usb phy %d\n", i);
>
> Is there any de-init for the PHY ?

There is a generic_phy_exit().
As mentionned in PATCH 2 comments, i will add an error path and add a 
remove callback.

Patrice
>
>>  	hccr = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
>>  	hcor = (struct ehci_hcor *)((uintptr_t)hccr +
>>  				    HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
>>
>
>


More information about the U-Boot mailing list