[U-Boot] [PATCH v2 1/1] USB: EHCI: Initialize multiple USB controllers at once

Marek Vasut marex at denx.de
Tue Aug 14 19:29:52 CEST 2012


Dear Jim Lin,

> >-----Original Message-----
> >From: Marek Vasut [mailto:marex at denx.de]
> >Sent: Sunday, August 12, 2012 7:47 AM
> >To: Jim Lin
> >Cc: u-boot at lists.denx.de; Wolfgang Denk; Tom Warren
> >Subject: Re: [U-Boot] [PATCH v2 1/1] USB: EHCI: Initialize multiple USB
> >controllers at once
> >
> >> diff --git a/common/cmd_usb.c b/common/cmd_usb.c index
> >> a8e3ae5..8d3093b 100644
> >> --- a/common/cmd_usb.c
> >> +++ b/common/cmd_usb.c
> >> @@ -554,7 +554,17 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc,
> >> char
> >> * const argv[]) }
> >> 
> >>         if (strncmp(argv[1], "tree", 4) == 0) {
> >>         
> >>                 printf("\nDevice Tree:\n");
> >> 
> >> +#ifdef CONFIG_USB_MULTI
> >
> >How's this supposed to work? Shouldn't this call usb_show_tree on roots of
> >all the trees?
> 
> You see the following  if dev->parent is NULL that means it's the only root
> hub under a controller , then we show devices under this root hub of the
> controller by usb_show_tree. Root hub under different controller is listed
> as separate device.

So if you set USB_MAX_DEVICE to 1, this code won't need the ifdefs? :)

> >> +               for (i = 0; i < USB_MAX_DEVICE; i++) {
> >> +                       dev = usb_get_dev_index(i);
> >> +                       if (dev == NULL)
> >> +                               break;
> >> +                       if (dev->parent == NULL)
> >> +                               usb_show_tree(dev);
> >> +               }
> >> +#else
> >> 
> >>                 usb_show_tree(usb_get_dev_index(0));
> >> 
> >> +#endif
> >> 
> >>                 return 0;
> >>         
> >>         }
> >>         if (strncmp(argv[1], "inf", 3) == 0) { diff --git
> >> 
> >> a/common/usb.c b/common/usb.c index 1b40228..065c70c 100644
> >> --- a/common/usb.c
> >> +++ b/common/usb.c
> >> 
> >> +#endif
> >> +       USB_PRINTF("scan end\n");
> >> +               usb_started = 1;
> >> +               return 0;
> >> +       } else {
> >> +               printf("Error, couldn't init Lowlevel part\n");

puts();

> >> +               usb_started = 0;
> >> +               return -1;
> >> +       }
> >> +}
> >> +
> >> +/********************************************************************
> >> +*****
> >> ***** + * Stop USB this stops the LowLevel Part and deregisters USB
> >> devices. + */
> >> +int usb_stop(void)
> >> +{
> >> +       int i;
> >> +

if (!started)
  return 0;

... do the work ...

;-)

> >> +       if (usb_started) {
> >> +               asynch_allowed = 1;
> >> +               usb_started = 0;
> >> +               usb_hub_reset();
> >> +               for (i = 0; i < CONFIG_USB_MAX_CONTROLLER_COUNT; i++)
> >> +                       usb_lowlevel_stop(i);
> >> +       }
> >> +       return 0;
> >> +}
> >> +#else
> >> 
> >>  /**********************************************************************
> >>  
> >>   * some forward declerations...
> >>   */
> >> 
> >> @@ -127,6 +210,7 @@ int usb_stop(void)
> >> 
> >>         }
> >>         return res;
> >>  
> >>  }
> >> 
> >> +#endif
> >> 
> >>  /*
> >>  
> >>   * disables the asynch behaviour of the control message. This is used
> >> 
> >> for data @@ -750,11 +834,18 @@ struct usb_device
> >> *usb_get_dev_index(int index) return &usb_dev[index];  }
> >> 
> >> -
> >> +#ifdef CONFIG_USB_MULTI
> >
> >I still believe it's possible to get rid of this MULTI crap, simply set
> >the "multiness" to 1 for non-multi setups. How big overhead will that
> >generate?
> 
> I assume you want me to use code in ifdef CONFIG_USB_MULTI block,
> remove CONFIG_USB_MULTI

Yes!

> and if  CONFIG_USB_MAX_CONTROLLER_COUNT is 1
> , then do non-multi setups.

No ;-) Why can't the "multi setups" be used for "non-multi" configuration?

> nvpublic
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list