diff mbox series

usb: host: ehci-vf: Fix portnr initialization

Message ID 20210204113315.1319084-1-dominik.wild@gmail.com
State New
Delegated to: Marek Vasut
Headers show
Series usb: host: ehci-vf: Fix portnr initialization | expand

Commit Message

Dominik Wild Feb. 4, 2021, 11:33 a.m. UTC
As of 29f7d05a347ab7a42577c67fdfb787ef91537302 dev->seq will be set
after device_ofdata_to_platdata(), therefore dev->seq must be read
later during probe

Signed-off-by: Dominik Wild <dominik.wild@gmail.com>
---
 drivers/usb/host/ehci-vf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass March 4, 2021, 3:46 a.m. UTC | #1
Hi Dominik,

On Thu, 4 Feb 2021 at 06:01, Dominik Wild <dominik.wild@gmail.com> wrote:
>
> As of 29f7d05a347ab7a42577c67fdfb787ef91537302 dev->seq will be set
> after device_ofdata_to_platdata(), therefore dev->seq must be read
> later during probe
>
> Signed-off-by: Dominik Wild <dominik.wild@gmail.com>
> ---
>  drivers/usb/host/ehci-vf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
> index 25f76c9fa9..4dac940d08 100644
> --- a/drivers/usb/host/ehci-vf.c
> +++ b/drivers/usb/host/ehci-vf.c
> @@ -222,8 +222,6 @@ static int vf_usb_of_to_plat(struct udevice *dev)
>         int node = dev_of_offset(dev);
>         const char *mode;
>
> -       priv->portnr = dev_seq(dev);
> -
>         priv->ehci = dev_read_addr_ptr(dev);
>         mode = fdt_getprop(dt_blob, node, "dr_mode", NULL);
>         if (mode) {
> @@ -317,6 +315,8 @@ static int ehci_usb_probe(struct udevice *dev)
>         struct ehci_hcor *hcor;
>         int ret;
>
> +       priv->portnr = dev_seq(dev);
> +
>         ret = ehci_vf_common_init(ehci, priv->portnr);
>         if (ret)
>                 return ret;
> --
> 2.25.1
>

I am a bit surprised at this...the sequence number should normally be
set during the bind step. Is this missing from USB binding? I can't
recall how it works right now.

Regards,
Simon
Simon Glass March 4, 2021, 1:20 p.m. UTC | #2
+U-Boot Mailing List

On Thu, 4 Mar 2021 at 03:50, Dominik Wild <dominik.wild@gmail.com> wrote:
>
> Hi Simon
>
> Okay, I had another look and figured that you worked on sequence numbers in December. The thing is that I started the bisect from v2021.01 and up to this version the sequence number was always -1. But I can now confirm that the ehci-vf driver is working again from v2021.4-rc1.

OK thanks for checking this. So it means that it is broken in
v2021.01. Now I am wondering what actually fixed it?

Regards,
Simon

> Am Do., 4. März 2021 um 04:47 Uhr schrieb Simon Glass <sjg@chromium.org>:
>>
>> Hi Dominik,
>>
>> On Thu, 4 Feb 2021 at 06:01, Dominik Wild <dominik.wild@gmail.com> wrote:
>> >
>> > As of 29f7d05a347ab7a42577c67fdfb787ef91537302 dev->seq will be set
>> > after device_ofdata_to_platdata(), therefore dev->seq must be read
>> > later during probe
>> >
>> > Signed-off-by: Dominik Wild <dominik.wild@gmail.com>
>> > ---
>> >  drivers/usb/host/ehci-vf.c | 4 ++--
>> >  1 file changed, 2 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
>> > index 25f76c9fa9..4dac940d08 100644
>> > --- a/drivers/usb/host/ehci-vf.c
>> > +++ b/drivers/usb/host/ehci-vf.c
>> > @@ -222,8 +222,6 @@ static int vf_usb_of_to_plat(struct udevice *dev)
>> >         int node = dev_of_offset(dev);
>> >         const char *mode;
>> >
>> > -       priv->portnr = dev_seq(dev);
>> > -
>> >         priv->ehci = dev_read_addr_ptr(dev);
>> >         mode = fdt_getprop(dt_blob, node, "dr_mode", NULL);
>> >         if (mode) {
>> > @@ -317,6 +315,8 @@ static int ehci_usb_probe(struct udevice *dev)
>> >         struct ehci_hcor *hcor;
>> >         int ret;
>> >
>> > +       priv->portnr = dev_seq(dev);
>> > +
>> >         ret = ehci_vf_common_init(ehci, priv->portnr);
>> >         if (ret)
>> >                 return ret;
>> > --
>> > 2.25.1
>> >
>>
>> I am a bit surprised at this...the sequence number should normally be
>> set during the bind step. Is this missing from USB binding? I can't
>> recall how it works right now.
>>
>> Regards,
>> Simon
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index 25f76c9fa9..4dac940d08 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -222,8 +222,6 @@  static int vf_usb_of_to_plat(struct udevice *dev)
 	int node = dev_of_offset(dev);
 	const char *mode;
 
-	priv->portnr = dev_seq(dev);
-
 	priv->ehci = dev_read_addr_ptr(dev);
 	mode = fdt_getprop(dt_blob, node, "dr_mode", NULL);
 	if (mode) {
@@ -317,6 +315,8 @@  static int ehci_usb_probe(struct udevice *dev)
 	struct ehci_hcor *hcor;
 	int ret;
 
+	priv->portnr = dev_seq(dev);
+
 	ret = ehci_vf_common_init(ehci, priv->portnr);
 	if (ret)
 		return ret;