Commit Graph

41 Commits

Author SHA1 Message Date
Milind Choudhary 359439d288 usb: Clean up newly allocated device nodes in case of configuration failure
If probe of a newly connected device fails for some reason, clean up
the allocated entry in usb_dev array.

Signed-off-by: Milind Choudhary <milindc@codeaurora.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-12-17 15:38:15 +01:00
Ilya Yanok 673a524b6a musb-new: omap2plus backend driver
Backend driver for MUSB OTG controllers found on TI OMAP2/3/4
(tested only on OMAP3 Beagle).

Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-11-20 00:16:08 +01:00
Ilya Yanok 833a53c627 musb-new: am35x backend driver
Backend driver for MUSB OTG controllers found on TI AM35x.

It seems that on AM35X interrupt status registers can be updated
_before_ core registers. As we don't use true interrupts in U-Boot
and poll interrupt status registers instead this can result in
interrupt handler being called with non-updated core registers.
This confuses the code and result in hanged transfers.
Add a small delay in am35x_interrupt as a workaround.

Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-11-20 00:16:07 +01:00
Ilya Yanok 37931f02c2 musb-new: dsps backend driver
Backend driver for MUSB OTG controllers found on TI AM33xx and
TI81xx SoCs (tested with AM33xx only).

Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-11-20 00:16:06 +01:00
Ilya Yanok c60795f41d usb: use linux/usb/ch9.h instead of usbdescriptors.h
Linux usb/ch9.h seems to have all the same information (and more)
as usbdescriptors.h so use the former instead of the later one.

As a consequense of this change USB_SPEED_* values don't correspond
directly to EHCI speed encoding anymore, I've added necessary
recoding in EHCI driver. Also there is no point to put speed into
pipe anymore so it's removed and a bunch of host drivers fixed to
look at usb_device->speed instead.

Old usbdescriptors.h included is not removed as it seems to be
used by old USB device code.

This makes usb.h and usbdevice.h incompatible. Fortunately the
only place that tries to include both are the old MUSB code and
it needs usb.h only for USB_DMA_MINALIGN used in aligned attribute
on musb_regs structure but this attribute seems to be unneeded
(old MUSB code doesn't support any DMA at all).

Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-11-20 00:16:06 +01:00
Lukasz Dalek e5f24753c9 usb.h: Add udc_disconnect prototype to usb.h
PXA25x gadget implements common function usb_disconnect().
This patch adds this function prototype into usb.h for boards using it.

Signed-off-by: Lukasz Dalek <luk0104@gmail.com>
2012-10-15 11:54:02 -07:00
Lucas Stach c7e3b2b586 usb: lowlevel interface change to support multiple controllers
Carry an index in the lowlevel usb functions to make specify the
respective usb controller.

Also pass through an controller struct from lowlevel_init to the
creation of the root usb device of this controller.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Reviewed-by: Marek Vasut <marex@denx.de>
2012-10-15 11:54:00 -07:00
Tom Rini 71c5de4f4a ehci-hcd.c, musb_core, usb.h: Add USB_DMA_MINALIGN define for cache alignment
The USB spec says that 32 bytes is the minimum required alignment.
However on some platforms we have a larger minimum requirement for cache
coherency.  In those cases, use that value rather than the USB spec
minimum.  We add a cpp check to <usb.h> to define USB_DMA_MINALIGN and
make use of it in ehci-hcd.c and musb_core.h.  We cannot use MAX() here
as we are not allowed to have tests inside of align(...).

Signed-off-by: Tom Rini <trini@ti.com>
[marek.vasut]: introduce some crazy macro voodoo
Signed-off-by: Marek Vasut <marex@denx.de>
[ilya.yanok]: moved external buffer fixes to separate patch,
we use {ALLOC,DEFINE}_ALIGN_BUFFER macros with alignment of USB_DMA_MINALIGN
for qh_list, qh and qtd structures to make sure they are proper aligned
for both controller and cache operations.
Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-07-18 14:43:29 +02:00
Puneet Saxena f57661394a USB: Align buffers at cacheline
This avoids cache-alignment warnings shown in console
when a usb command is entered.

Whenever X bytes of unaligned buffer is invalidated, arm core
invalidates X + Y bytes as per the cache line size and throws
these warnings.

Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Marek Vasut <marex@denx.de>
2012-05-20 08:32:32 +02:00
Mike Frysinger 5b84dd67cf usb: replace wait_ms() with mdelay()
Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func.  This also fixes the build errors:

ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Marek Vasut <marex@denx.de>
2012-03-19 00:08:16 +01:00
amartin@nvidia.com f9636e8d38 USB: move keyboard polling into kbd driver
This moves keyboard polling logic from USB HCD drivers into USB
keyboard driver.  Remove usb_event_poll() as keyboard polling was
the only user of this API.  With this patch USB keyboard works with
EHCI controllers again.  Tested on a tegra2 seaboard.

Signed-off-by: Allen Martin <amartin@nvidia.com>
2012-03-03 16:56:29 +01:00
Marek Vasut 23faf2bc9e USB: Separate out USB hub driver
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Remy Bohmer <linux@bohmer.net>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-03-03 16:55:24 +01:00
Jason Cooper 80b350a7ab usb: increase non-bulk timeout for slow chipsets.
If you take a look at 96820a35, you'll see the original timeout was
CONFIG_SYS_HZ.  Which is 1000.  After the mentioned change, non-bulk timeout
was changed to 100.  This causes timeout failures on the dreamplug platform
when trying to initialize the usb microsd reader.

Signed-off-by: Jason Cooper <u-boot@lakedaemon.net>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-08-08 22:34:57 +02:00
Simon Glass 89d48367ed Add USB host ethernet adapter support
This adds support for using USB Ethernet dongles in host mode. This is just
the framework - drivers will come later. A new config option called
CONFIG_USB_HOST_ETHER can be defined in board config files to switch this
on.

The was originally written by NVIDIA and was cleaned up for release by the
Chromium authors.

Signed-off-by: Simon Glass <sjg@chromium.org>
2011-02-19 20:32:36 +01:00
Simon Glass 96820a3587 Fix EHCI usb submit timeout and unify with OHCI
Changed both to use a common timeout for URB submission, since they were using
different values and EHCI's was too short.

Also fixed EHCI to actually check if urb submission succeeded, rather than
silently continuing into the weeds.

Change-Id: I7f71499ffaa05187d8e5618db2419e1606007b82

Signed-off-by: Simon Glass <sjg@chromium.org>
2011-02-19 20:32:34 +01:00
Ajay Kumar Gupta dbea324200 musb: MSC host support for AM35x
Tested MSC Host on AM3517EVM.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
2010-08-12 16:40:00 +02:00
Sergei Shtylyov d0fe1128c4 USB: fix create_pipe()
create_pipe() can give wrong result if an expression is passed as the 'endpoint'
argument -- due to missing parentheses.

Thanks to Martin Mueller for finding the bug and providing the patch.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
2010-05-27 20:59:48 +02:00
Bryan Wu e608f221c1 usb: musb: add support for Blackfin MUSB
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
2010-01-09 10:25:09 +01:00
Ajay Kumar Gupta 7359273d94 DA8xx: Add MUSB host support
Tested USB host functionality on DA830 EVM.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Swaminathan S <swami.iyer@ti.com>
2010-01-09 10:25:07 +01:00
Tom Rix f298e4b6dd OMAP3 Add usb device support
This change adds the usb device support for musb.

Omap3 platform support added at the same level as davinci.

The interface for usbtty to use the musb device support was added.

Verified on omap3 beagle, zoom1 and zoom2.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
2009-12-20 12:47:37 +01:00
Tom Rix 8f8bd565f3 USB Consolidate descriptor definitions
The header files usb.h and usbdescriptors.h have the same nameed
structure definitions for

usb_config_descriptor
usb_interface_descriptor
usb_endpoint_descriptor
usb_device_descriptor
usb_string_descriptor

These are out right duplicates in usb.h

usb_device_descriptor
usb_string_descriptor

This one has extra unused elements

usb_endpoint_descriptor

	unsigned char	bRefresh
	unsigned char	bSynchAddress;

These in usb.h have extra elements at the end of the usb 2.0
specified descriptor and are used.

usb_config_descriptor
usb_interface_descriptor

The change is to consolidate the definition of the descriptors
to usbdescriptors.h.  The dublicates in usb.h are removed.
The extra element structure will have their name shorted by
removing the '_descriptor' suffix.

So

usb_config_descriptor -> usb_config
usb_interface_descriptor -> usb_interface

For these, the common descriptor elements are accessed now
by an element 'desc'.

As an example

-	if (iface->bInterfaceClass != USB_CLASS_HUB)
+	if (iface->desc.bInterfaceClass != USB_CLASS_HUB)

This has been compile tested on MAKEALL arm, ppc and mips.

Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
2009-12-20 12:47:37 +01:00
Thomas Abraham 538ef96771 usb : musb : Enabling DM6446 (TI DaVinci) USB module power
Enabling DM6446 (TI DaVinci) USB module power and MUSB low-level
controller hook up to USB core layer.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
Signed-off-by: Swaminathan S <swami.iyer@ti.com>
Signed-off-by: Thomas Abraham <t-abraham@ti.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
2009-01-28 19:57:30 +01:00
Mike Frysinger c7d703f3f3 usb.h: use standard __LITTLE_ENDIAN from Linux headers
Rather than forcing people to define a custom "LITTLEENDIAN", just use the
__LITTLE_ENDIAN one from the Linux byteorder headers that every arch is
already setting up.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Remy Bohmer <linux@bohmer.net>
2009-01-28 19:57:29 +01:00
michael 51ab142b8b [PATCH] This patch add varius fix to the ehci.
- fix ehci_readl, ehci_writel
- introduce new define in ehci.h
- introduce the handshake function for waiting on a register
- fix usb_ehci_fsl with the new HC_LENGTH macro

Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
Signed-off-by: Remy Böhmer <linux@bohmer.net>
2009-01-28 19:57:28 +01:00
Michael Trimarchi 3e126484df Prepare USB layer for ehci
Prepare USB layer for ehci support

Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it>
Signed-off-by: Remy Böhmer <linux@bohmer.net>
2009-01-28 19:57:27 +01:00
Stefan Althoefer d277682731 USB: descriptor handling
Hi,

I found a bug when working with the u-boot USB subsystem on IXP425 processor
(big endian Xscale aka ARMv5).
I recognized that the second usb_endpoint_descriptor of the attached memory
stick was corrupted.

The reason for this are the packed structures below (either u-boot and
u-boot-usb):

--------------
/* Endpoint descriptor */
struct usb_endpoint_descriptor {
	unsigned char  bLength;
	unsigned char  bDescriptorType;
	unsigned char  bEndpointAddress;
	unsigned char  bmAttributes;
	unsigned short wMaxPacketSize;
	unsigned char  bInterval;
	unsigned char  bRefresh;
	unsigned char  bSynchAddress;

} __attribute__ ((packed));
/* Interface descriptor */
struct usb_interface_descriptor {
	unsigned char  bLength;
	unsigned char  bDescriptorType;
	unsigned char  bInterfaceNumber;
	unsigned char  bAlternateSetting;
	unsigned char  bNumEndpoints;
	unsigned char  bInterfaceClass;
	unsigned char  bInterfaceSubClass;
	unsigned char  bInterfaceProtocol;
	unsigned char  iInterface;

	unsigned char  no_of_ep;
	unsigned char  num_altsetting;
	unsigned char  act_altsetting;
	struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
} __attribute__ ((packed));
------------

As usb_endpoint_descriptor is only 7byte in length, the start of all
odd ep_desc[] structures is not word aligned. This makes wMaxPacketSize
of these structures also not word aligned.

ARMv5 Architecture however does not support non-aligned multibyte
data type (see A2.8 of ARM Architecture Reference Manual).

Signed-off-by: Stefan Althoefer <stefan.althoefer@web.de>
Signed-off-by: Remy Böhmer <linux@bohmer.net>
2008-12-09 21:26:45 +01:00
Michael Trimarchi de39f8c19d USB style patch, 80 chars strict
USB Code style patch

Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it>
Signed-off-by: Remy Böhmer <linux@bohmer.net>
2008-11-28 21:24:12 +01:00
Remy Bohmer 4886720844 fix USB initialisation procedure
The max packet size is encoded as 0,1,2,3 for 8,16,32,64 bytes.
At some places directly 8,16,32,64 was used instead of the encoded
value. Made a enum for the options to make this more clear and to help
preventing similar errors in the future.

After fixing this bug it became clear that another bug existed where
the 'pipe' is and-ed with PIPE_* flags, where it should have been
'usb_pipetype(pipe)', or even better usb_pipeint(pipe).

Also removed the triple 'get_device_descriptor' sequence, it has no use,
and Windows nor Linux behaves that way.
There is also a poll going on with a timeout when usb_control_msg() fails.
However, the poll is useless, because the flag will never be set on a error,
because there is no code that runs in a parallel that can set this flag.
Changed this to something more logical.

Tested on AT91SAM9261ek and compared the flow on the USB bus to what
Linux is doing. There is no difference anymore in the early initialisation
sequence.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>
2008-10-14 16:42:44 +02:00
Yoshihiro Shimoda fd0f2f3796 usb: add support for R8A66597 usb controller
add support for Renesas R8A66597 usb controller.
This patch supports USB Host mode.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>
2008-08-07 17:37:36 +02:00
Anatolij Gustschin e813eae3bf Fix compilation error in cmd_usb.c
This patch fixes compilation error
cmd_usb.c: In function 'do_usb':
cmd_usb.c:552: error: void value not ignored as it ought to be

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2008-03-27 00:12:56 +01:00
Zhang Wei fdcfaa1b02 USB event poll support
This patch adds USB event poll support, which could be used in usbkbd
and other usb devices driver when the asynchronous interrupt
processing is supported.

Signed-off-by: Zhang Wei <wei.zhang@freescale.com
2007-06-06 10:08:13 +02:00
Rodolfo Giometti 822af351ad Support for the Philips ISP116x HCD (Host Controller Driver)
Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
2007-04-03 14:27:18 +02:00
Markus Klotzbuecher ae3b770e4e Fix some endianness issues related to the generic ohci driver 2006-11-27 11:46:46 +01:00
Markus Klotzbuecher 7b59b3c7a8 Introduced the configuration option CONFIG_USB_OHCI_NEW in order to be able
to choose between the old and the generic OHCI drivers.
2006-11-27 11:44:58 +01:00
Bartlomiej Sieka 7455af41d1 Add rudimentary handling of alternate settings of USB interfaces - to fix
problems with some USB storage devices. Some code readability improvements.
2006-08-02 00:54:18 +02:00
Wolfgang Denk 9c998aa831 Fix low-level OHCI transfers for ARM920t and MPC5xxx
A new, Windows compatible init sequence was also backported from Linux 2.6,
but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour
of the memopry sticks we tested. Maybe it's not relevant for mass storage
devices. For recerence, see file common/usb.c, function usb_new_device(),
section #ifdef NEW_INIT_SEQ.
2005-07-21 11:57:57 +02:00
wdenk 5cf91d6bdc * Modify KUP4X board configuration to use SL811 driver for USB memory
sticks (including FAT / VFAT filesystem support)

* Add SL811 Host Controller Interface driver for USB

* Add CFG_I2C_EEPROM_ADDR_OVERFLOW desription to README

* Patch by Pantelis Antoniou, 19 Apr 2004:
  Allow to use shell style syntax (i. e. ${var} ) with standard parser.
  Minor patches for Intracom boards.

* Patch by Christian Pell, 19 Apr 2004:
  cleanup support for CF/IDE on PCMCIA for PXA25X
2004-04-23 20:32:05 +00:00
wdenk 3f85ce2785 * CVS add missing files
* Cleanup compiler warnings

* Fix problem with side effects in macros in include/usb.h

* Patch by David Benson, 13 Nov 2003:
  bug 841358 - fix TFTP download size limit

* Fixing bug 850768:
  improper flush_cache() in load_serial()

* Fixing bug 834943:
  MPC8540 - missing volatile declarations

* Patch by Stephen Williams, 09 Feb 2004:
  Add support for Xilinx SystemACE chip:
  - New files common/cmd_ace.c and include/systemace.h
  - Hook systemace support into cmd_fat and the partition manager

* Patch by Travis Sawyer, 09 Feb 2004:
  Add bi_opbfreq & bi_iic_fast to 440GX bd_info as needed for Linux
2004-02-23 16:11:30 +00:00
wdenk 149dded2b1 * Add support for USB Mass Storage Devices (BBB)
(tested with USB memory sticks only)

* Avoid flicker on TRAB's VFD
2003-09-10 18:20:28 +00:00
wdenk 8bde7f776c * Code cleanup:
- remove trailing white space, trailing empty lines, C++ comments, etc.
  - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
  - major rework of command structure
    (work done mostly by Michal Cendrowski and Joakim Kristiansen)
2003-06-27 21:31:46 +00:00
wdenk 012771d88a Initial revision 2002-03-08 21:31:05 +00:00