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

2012-07-30 Thread Marek Vasut
Dear Jim Lin,

> >-Original Message-
> >From: Marek Vasut [mailto:marek.va...@gmail.com]
> >Sent: Monday, July 30, 2012 8:02 PM
> >To: Jim Lin
> >Cc: Wolfgang Denk; Tom Warren; u-boot@lists.denx.de
> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
> >controllers at once
> >
> >Dear Jim Lin,
> >
> >> >-Original Message-
> >> >From: Marek Vasut [mailto:marek.va...@gmail.com]
> >> >Sent: Friday, July 27, 2012 5:26 PM
> >> >To: u-boot@lists.denx.de
> >> >Cc: Jim Lin; Wolfgang Denk; Tom Warren
> >> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
> >> >controllers at once
> >> >
> >> >> Wolfgang,
> >> >> Is there any chance to get this feature in after Stephen explained to
> >> >> you?
> >> >
> >> >I'll poke into it. Can we not get rid of the added ifdef, eg. by
> >> >setting up the controller number to 1 for those that don't define
> >> >CONFIG_USB_MULTI now (everyone)
> >> 
> >> I assume you want me to add these in next patch.
> >> 1 . Use CONFIG_USB_MULTI, instead of CONFIG_USB_INIT_MULTI
> >> 
> >>  (current patch),
> >> 
> >> 2. If CONFIG_USB_MULTI is not defined, then define
> >> CONFIG_USB_MAX_CONTROLLER_COUNT as 1.
> >
> >Yes, is that a problem? Aka. have this always enabled and don't treat not
> >having multiple controllers as a special case.
> 
> Item 2 is not necessary.
> Because CONFIG_USB_MAX_CONTROLLER_COUNT will not be used if
> CONFIG_USB_MULTI is not defined.

But we don't need CONFIG_USB_MULTI option at all -- just assume it's always 
defined and unless a board has multiple controllers, define 
CONFIG_USB_MAX_CONTROLLER_COUNT to be 1.

Aka. it boils down to sticking

#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
#endif

somewhere in usb.c or so.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-07-30 Thread Jim Lin
>-Original Message-
>From: Marek Vasut [mailto:marek.va...@gmail.com] 
>Sent: Monday, July 30, 2012 8:02 PM
>To: Jim Lin
>Cc: Wolfgang Denk; Tom Warren; u-boot@lists.denx.de
>Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB 
>controllers at once
>
>Dear Jim Lin,
>
>> >-Original Message-
>> >From: Marek Vasut [mailto:marek.va...@gmail.com]
>> >Sent: Friday, July 27, 2012 5:26 PM
>> >To: u-boot@lists.denx.de
>> >Cc: Jim Lin; Wolfgang Denk; Tom Warren
>> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
>> >controllers at once
>> >
>> >> Wolfgang,
>> >> Is there any chance to get this feature in after Stephen explained to
>> >> you?
>> >
>> >I'll poke into it. Can we not get rid of the added ifdef, eg. by setting
>> >up the controller number to 1 for those that don't define
>> >CONFIG_USB_MULTI now (everyone)
>> 
>> I assume you want me to add these in next patch.
>> 1 . Use CONFIG_USB_MULTI, instead of CONFIG_USB_INIT_MULTI
>>  (current patch),
>> 2. If CONFIG_USB_MULTI is not defined, then define
>> CONFIG_USB_MAX_CONTROLLER_COUNT as 1.
>
>Yes, is that a problem? Aka. have this always enabled and don't treat not 
>having 
>multiple controllers as a special case.

Item 2 is not necessary.
Because CONFIG_USB_MAX_CONTROLLER_COUNT will not be used if
CONFIG_USB_MULTI is not defined.

--
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-07-30 Thread Marek Vasut
Dear Jim Lin,

> >-Original Message-
> >From: Marek Vasut [mailto:marek.va...@gmail.com]
> >Sent: Friday, July 27, 2012 5:26 PM
> >To: u-boot@lists.denx.de
> >Cc: Jim Lin; Wolfgang Denk; Tom Warren
> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
> >controllers at once
> >
> >> Wolfgang,
> >> Is there any chance to get this feature in after Stephen explained to
> >> you?
> >
> >I'll poke into it. Can we not get rid of the added ifdef, eg. by setting
> >up the controller number to 1 for those that don't define
> >CONFIG_USB_MULTI now (everyone)
> 
> I assume you want me to add these in next patch.
> 1 . Use CONFIG_USB_MULTI, instead of CONFIG_USB_INIT_MULTI
>  (current patch),
> 2. If CONFIG_USB_MULTI is not defined, then define
> CONFIG_USB_MAX_CONTROLLER_COUNT as 1.

Yes, is that a problem? Aka. have this always enabled and don't treat not 
having 
multiple controllers as a special case.

> > and adding some wrapping goo?
> 
> Don't understand what you meant.
> Could you provide an example?

Just don't treat having 1 controller as a special case, that's all I meant.

> Thanks.
> 
> nvpublic

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-07-30 Thread Jim Lin
>-Original Message-
>From: Marek Vasut [mailto:marek.va...@gmail.com] 
>Sent: Friday, July 27, 2012 5:26 PM
>To: u-boot@lists.denx.de
>Cc: Jim Lin; Wolfgang Denk; Tom Warren
>Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB 
>controllers at once
>
>> Wolfgang,
>> Is there any chance to get this feature in after Stephen explained to you?
>> 
>I'll poke into it. Can we not get rid of the added ifdef, eg. by setting up 
>the 
>controller number to 1 for those that don't define CONFIG_USB_MULTI now 
>(everyone)
I assume you want me to add these in next patch.
1 . Use CONFIG_USB_MULTI, instead of CONFIG_USB_INIT_MULTI
 (current patch),
2. If CONFIG_USB_MULTI is not defined, then define 
CONFIG_USB_MAX_CONTROLLER_COUNT
 as 1.

> and adding some wrapping goo?

Don't understand what you meant.
Could you provide an example?
Thanks.

nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-07-27 Thread Marek Vasut
Dear Jim Lin,

> Wolfgang,
> Is there any chance to get this feature in after Stephen explained to you?
> 
> Thanks.
[...]

I'll poke into it. Can we not get rid of the added ifdef, eg. by setting up the 
controller number to 1 for those that don't define CONFIG_USB_MULTI now 
(everyone) and adding some wrapping goo?

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-07-26 Thread Jim Lin
Wolfgang,
Is there any chance to get this feature in after Stephen explained to you?

Thanks.

>-Original Message-
>From: Stephen Warren [mailto:swar...@wwwdotorg.org] 
>Sent: Thursday, June 28, 2012 12:58 AM
>To: Wolfgang Denk
>Cc: Jim Lin; 'U-Boot@lists.denx.de'; Tom Warren
>Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB 
>controllers at once
>
>On 06/27/2012 12:55 AM, Wolfgang Denk wrote:
>> Dear Jim Lin,
>> 
>> sending the very same message eight (8!) times doesnot make it a bit
>> more convincing - on contrary.
>> 
>> In message <4b9c9637d5087840a465bdcb251780e9e2d6eda...@hkmail02.nvidia.com> 
>> you wrote:
>>>
>>>> U-Boot is not multi-tasking, so you can always access only a single
>>>> USB device at a time ayway.  And it is a decoumented design principle
>>>> that U-Boot must not initialize any devices it does not use itself.
>>>>
>>>> So why?
>>> Because of this complaint and request for devices under different 
>>> controllers
>>> to be working at same time.
>> 
>> You make another claim here, but don't explain how this is supposed to
>> work or whay the exact use case would be where this was needed.
>> U-Boot will not be able to access multiple devices at the same time,
>> so why would it be necessary to enable these?  It should be sufficient
>> to enable the controller that is responsible for the single device
>> that is currently being used.
>> 
>>> "One particularly annoying consequence of this is when you use the Seaboard
>>> configuration on Springbank.
>>> Seaboard selects Tegra's USB3 as "usb 0" device, which is the one you can 
>>> use,
>>> in order not to conflict with the flashing USB port USB1.
>>> However, Springbank only exposes USB1 since USB3 is used internally for the
>>> USB keyboard/mouse. As such, you cannot use the USB port on Springbank under
>>> U-Boot at the moment.
>>> "
>> 
>> I have to admit that I cannot make any sense from this statement.  The
>> only thing I understand is that you are trying to use a configuration
>> for one hardware (Seaboard) on another, incompatible hardware
>> (Springbank).
>> 
>> The simple answer to this problem is: don't do that, then.
>
>Seaboard and Springbank are essentially the same board, and hence are
>almost 100% SW compatible, so there's no problem running a Seaboard
>build of U-Boot/kernel/... on Springbank.
>
>The primary issue here is that many boards have multiple USB ports.
>Users could plug e.g. a USB->Ethernet device into any of the ports.
>Requiring the user to know which port is which ID so they can issue the
>correct "usb start " command is painful; no other SW stack limits
>itself to a single port and so most people don't have a clue which ports
>are numbered what; they just want USB to work.
>
>The specific issue on Springbank is that there are multiple USB ports
>that are useful at the essentially the same time. One of the USB ports
>hosts a built-in USB keyboard (inside a sealed clamshell/netbook case),
>which we would like to use for the U-boot console. Another USB port is
>external, and people will plug in a USB->Ethernet dongle or USB storage
>device there. so, if I need to "usb start 0" to get the keyboard, and
>"usb start 1" to get USB Ethernet, then as soon as I "usb start 1" to
>get the Ethernet, I've just lost the console, and am unable to interact
>with U-Boot any more...

--
nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-07-02 Thread Jim Lin
> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org] 
> Sent: Thursday, June 28, 2012 12:58 AM
> To: Wolfgang Denk> 
> Cc: Jim Lin; 'U-Boot@lists.denx.de'; Tom Warren
> Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB 
> controllers at once

> > On 06/27/2012 12:55 AM, Wolfgang Denk wrote:
> > Dear Jim Lin,
> > 
> > sending the very same message eight (8!) times doesnot make it a bit
> > more convincing - on contrary.
> > 
> > In message <4b9c9637d5087840a465bdcb251780e9e2d6eda...@hkmail02.nvidia.com> 
> > you wrote:
> >>
> >>> U-Boot is not multi-tasking, so you can always access only a single
> >>> USB device at a time ayway.  And it is a decoumented design principle
> >>> that U-Boot must not initialize any devices it does not use itself.> 
> >>>
> >>> So why?
> >> Because of this complaint and request for devices under different 
> >> controllers
> >> to be working at same time.
> > 
> > You make another claim here, but don't explain how this is supposed to
> > work or whay the exact use case would be where this was needed.
> > U-Boot will not be able to access multiple devices at the same time,
> > so why would it be necessary to enable these?  It should be sufficient
> > to enable the controller that is responsible for the single device
> > that is currently being used.
> > 
> >> "One particularly annoying consequence of this is when you use the Seaboard
> >> configuration on Springbank.
> >> Seaboard selects Tegra's USB3 as "usb 0" device, which is the one you can 
> >> use,
> >> in order not to conflict with the flashing USB port USB1.
> >> However, Springbank only exposes USB1 since USB3 is used internally for the
> >> USB keyboard/mouse. As such, you cannot use the USB port on Springbank 
> >> under
> >> U-Boot at the moment.
> >> "
> > 
> > I have to admit that I cannot make any sense from this statement.  The
> > only thing I understand is that you are trying to use a configuration
> > for one hardware (Seaboard) on another, incompatible hardware
> > (Springbank).
> > 
> > The simple answer to this problem is: don't do that, then.

> Seaboard and Springbank are essentially the same board, and hence are
> almost 100% SW compatible, so there's no problem running a Seaboard
> build of U-Boot/kernel/... on Springbank.

> The primary issue here is that many boards have multiple USB ports.
> Users could plug e.g. a USB->Ethernet device into any of the ports.
> Requiring the user to know which port is which ID so they can issue the
> correct "usb start " command is painful; no other SW stack limits
> itself to a single port and so most people don't have a clue which ports
> are numbered what; they just want USB to work.

> The specific issue on Springbank is that there are multiple USB ports
> that are useful at the essentially the same time. One of the USB ports
> hosts a built-in USB keyboard (inside a sealed clamshell/netbook case),
> which we would like to use for the U-boot console. Another USB port is
> external, and people will plug in a USB->Ethernet dongle or USB storage
> device there. so, if I need to "usb start 0" to get the keyboard, and
> "usb start 1" to get USB Ethernet, then as soon as I "usb start 1" to
> get the Ethernet, I've just lost the console, and am unable to interact
> with U-Boot any more..

Wolfgang,
Any further thought about Stephen's request?
Thanks.

nvpublic
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-06-27 Thread Stephen Warren
On 06/27/2012 12:55 AM, Wolfgang Denk wrote:
> Dear Jim Lin,
> 
> sending the very same message eight (8!) times doesnot make it a bit
> more convincing - on contrary.
> 
> In message <4b9c9637d5087840a465bdcb251780e9e2d6eda...@hkmail02.nvidia.com> 
> you wrote:
>>
>>> U-Boot is not multi-tasking, so you can always access only a single
>>> USB device at a time ayway.  And it is a decoumented design principle
>>> that U-Boot must not initialize any devices it does not use itself.
>>>
>>> So why?
>> Because of this complaint and request for devices under different controllers
>> to be working at same time.
> 
> You make another claim here, but don't explain how this is supposed to
> work or whay the exact use case would be where this was needed.
> U-Boot will not be able to access multiple devices at the same time,
> so why would it be necessary to enable these?  It should be sufficient
> to enable the controller that is responsible for the single device
> that is currently being used.
> 
>> "One particularly annoying consequence of this is when you use the Seaboard
>> configuration on Springbank.
>> Seaboard selects Tegra's USB3 as "usb 0" device, which is the one you can 
>> use,
>> in order not to conflict with the flashing USB port USB1.
>> However, Springbank only exposes USB1 since USB3 is used internally for the
>> USB keyboard/mouse. As such, you cannot use the USB port on Springbank under
>> U-Boot at the moment.
>> "
> 
> I have to admit that I cannot make any sense from this statement.  The
> only thing I understand is that you are trying to use a configuration
> for one hardware (Seaboard) on another, incompatible hardware
> (Springbank).
> 
> The simple answer to this problem is: don't do that, then.

Seaboard and Springbank are essentially the same board, and hence are
almost 100% SW compatible, so there's no problem running a Seaboard
build of U-Boot/kernel/... on Springbank.

The primary issue here is that many boards have multiple USB ports.
Users could plug e.g. a USB->Ethernet device into any of the ports.
Requiring the user to know which port is which ID so they can issue the
correct "usb start " command is painful; no other SW stack limits
itself to a single port and so most people don't have a clue which ports
are numbered what; they just want USB to work.

The specific issue on Springbank is that there are multiple USB ports
that are useful at the essentially the same time. One of the USB ports
hosts a built-in USB keyboard (inside a sealed clamshell/netbook case),
which we would like to use for the U-boot console. Another USB port is
external, and people will plug in a USB->Ethernet dongle or USB storage
device there. so, if I need to "usb start 0" to get the keyboard, and
"usb start 1" to get USB Ethernet, then as soon as I "usb start 1" to
get the Ethernet, I've just lost the console, and am unable to interact
with U-Boot any more...
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-06-26 Thread Wolfgang Denk
Dear Jim Lin,

sending the very same message eight (8!) times doesnot make it a bit
more convincing - on contrary.

In message <4b9c9637d5087840a465bdcb251780e9e2d6eda...@hkmail02.nvidia.com> you 
wrote:
>
> > U-Boot is not multi-tasking, so you can always access only a single
> > USB device at a time ayway.  And it is a decoumented design principle
> > that U-Boot must not initialize any devices it does not use itself.
> > 
> > So why?
> Because of this complaint and request for devices under different controllers
> to be working at same time.

You make another claim here, but don't explain how this is supposed to
work or whay the exact use case would be where this was needed.
U-Boot will not be able to access multiple devices at the same time,
so why would it be necessary to enable these?  It should be sufficient
to enable the controller that is responsible for the single device
that is currently being used.

> "One particularly annoying consequence of this is when you use the Seaboard
> configuration on Springbank.
> Seaboard selects Tegra's USB3 as "usb 0" device, which is the one you can use,
> in order not to conflict with the flashing USB port USB1.
> However, Springbank only exposes USB1 since USB3 is used internally for the
> USB keyboard/mouse. As such, you cannot use the USB port on Springbank under
> U-Boot at the moment.
> "

I have to admit that I cannot make any sense from this statement.  The
only thing I understand is that you are trying to use a configuration
for one hardware (Seaboard) on another, incompatible hardware
(Springbank).

The simple answer to this problem is: don't do that, then.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Ordnung ist die Lust der Vernunft,
aber Unordnung die Wonne der Phantasie - Paul Claudel
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-06-26 Thread Wolfgang Denk
Dear Jim Lin,

In message <4b9c9637d5087840a465bdcb251780e9e2d6eda...@hkmail02.nvidia.com> you 
wrote:
> Add support for command line "usb reset" or "usb start" to initialize
> , "usb stop" to stop multiple USB controllers at once.
> Other commands like "usb tree" also support multiple controllers.

Why would this be needed?

U-Boot is not multi-tasking, so you can always access only a single
USB device at a time ayway.  And it is a decoumented design principle
that U-Boot must not initialize any devices it does not use itself.

So why?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
A failure will not appear until a unit has passed final inspection.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2012-06-26 Thread Jim Lin
Add support for command line "usb reset" or "usb start" to initialize
, "usb stop" to stop multiple USB controllers at once.
Other commands like "usb tree" also support multiple controllers.

New added definitions to be defined in header file are:
CONFIG_USB_INIT_MULTI
CONFIG_USB_MAX_CONTROLLER_COUNT

Signed-off-by: Jim Lin 
---
 common/cmd_usb.c  |   10 +++
 common/usb.c  |  100 +++-
 common/usb_hub.c  |4 +
 drivers/usb/host/ehci-hcd.c   |  150 +---
 drivers/usb/host/ehci-tegra.c |2 +-
 drivers/usb/host/ehci.h   |5 ++
 include/usb.h |   10 +++
 7 files changed, 237 insertions(+), 44 deletions(-)

diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 9eba271..4c01a78 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -553,7 +553,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_INIT_MULTI
+   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 1ec30bc..9fb0407 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -64,6 +64,10 @@
 #define USB_HUB_DEBUG  0
 #endif

+#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
+#endif
+
 #define USB_PRINTF(fmt, args...)   debug_cond(USB_DEBUG, fmt, ##args)
 #define USB_HUB_PRINTF(fmt, args...)   debug_cond(USB_HUB_DEBUG, fmt, ##args)

@@ -81,6 +85,86 @@ char usb_started; /* flag for the started/stopped USB status 
*/
  */
 static void usb_scan_devices(void);

+#ifdef CONFIG_USB_INIT_MULTI
+/***
+ * Init USB Device
+ */
+
+int usb_init(void)
+{
+   void *ctrl;
+   int i;
+   struct usb_device *dev;
+
+   running = 0;
+   dev_index = 0;
+   asynch_allowed = 1;
+   usb_hub_reset();
+
+   /* first make all devices unknown */
+   for (i = 0; i < USB_MAX_DEVICE; i++) {
+   memset(&usb_dev[i], 0, sizeof(struct usb_device));
+   usb_dev[i].devnum = -1;
+   }
+
+   /* init low_level USB */
+   printf("USB:   ");
+   for (i = 0; i < CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
+   /* init low_level USB */
+   ctrl = usb_lowlevel_init(i);
+   /*
+* if lowlevel init is OK, scan the bus for devices
+* i.e. search HUBs and configure them
+*/
+   if (ctrl) {
+   running = 1;
+
+   printf("scanning bus for devices... ");
+   dev = usb_alloc_new_device(ctrl);
+   /*
+* device 0 is always present
+* (root hub, so let it analyze)
+*/
+   if (dev)
+   usb_new_device(dev);
+   }
+   }
+
+   if (running) {
+   if (!dev_index)
+   printf("No USB Device found\n");
+   else
+   printf("%d USB Device(s) found\n", dev_index);
+#ifdef CONFIG_USB_KEYBOARD
+   drv_usb_kbd_init();
+#endif
+   USB_PRINTF("scan end\n");
+   usb_started = 1;
+   return 0;
+   } else {
+   printf("Error, couldn't init Lowlevel part\n");
+   usb_started = 0;
+   return -1;
+   }
+}
+
+/**
+ * Stop USB this stops the LowLevel Part and deregisters USB devices.
+ */
+int usb_stop(void)
+{
+   int i;
+
+   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
 /***
  * Init USB Device
  */
@@ -126,6 +210,7 @@ int usb_stop(void)
}
return res;
 }
+#endif

 /*
  * disables the asynch behaviour of the control message. This is used for data
@@ -747,11 +832,18 @@ struct usb_device *usb_get_dev_index(int index)
return &usb_dev[index];
 }

-
+#ifdef CONFIG_USB_INIT_MULTI
+/* Save input pointer 'controller' into device structure.
+ * returns a pointer of a new device structure or NULL, if
+ * no