[U-Boot] [PATCH v2 3/5] usb: host: extend generic EHCI driver with PHY
Patrice CHOTARD
patrice.chotard at st.com
Mon May 15 08:03:22 UTC 2017
Hi Simon
On 05/15/2017 05:03 AM, Simon Glass wrote:
> Hi Patrice,
>
> On 12 May 2017 at 11:27, <patrice.chotard at st.com> wrote:
>> From: Patrice Chotard <patrice.chotard at st.com>
>>
>> Add support of generic PHY framework
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
>> ---
>>
>> v2: _ split previous path 1, add generic PHY framework
>>
>> drivers/usb/host/ehci-generic.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
>> index 0c29f63..0000808 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>
>> @@ -23,6 +25,7 @@ struct generic_ehci {
>> struct ehci_ctrl ctrl;
>> struct clk clks[EHCI_MAX_CLOCKS];
>> struct reset_ctl resets[EHCI_MAX_RESETS];
>> + struct phy phy;
>> };
>>
>> static void ehci_assert_resets(struct udevice *dev) {
>> @@ -92,6 +95,10 @@ static int ehci_usb_probe(struct udevice *dev)
>> reset_free(&reset);
>> }
>>
>> + if (!generic_phy_get_by_index(dev, 0, &priv->phy))
>
> Can you check for the error you expect here when it is not present? I
> think it might be -ENOENT? That way you are not ignoring a real error.
ok
>
>> + if (generic_phy_init(&priv->phy))
>> + error("failed to init usb phy %d\n", i);
>
> Shouldn't you return the error here? I don't think USB will work
> without the PHY.
Agree, i forgot it
Thanks
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)));
>> @@ -100,6 +107,8 @@ static int ehci_usb_probe(struct udevice *dev)
>> if (!ret)
>> return ret;
>>
>> + generic_phy_exit(&priv->phy);
>> +
>> reset_err:
>> ehci_assert_resets(dev);
>> clk_err:
>> @@ -109,7 +118,9 @@ clk_err:
>> }
>>
>> static int ehci_usb_remove(struct udevice *dev) {
>> + struct generic_ehci *priv = dev_get_priv(dev);
>>
>> + generic_phy_exit(&priv->phy);
>> ehci_assert_resets(dev);
>> ehci_disable_clocks(dev);
>>
>> --
>> 1.9.1
>>
>
> Regards,
> Simon
>
More information about the U-Boot
mailing list