Commit Graph

168 Commits

Author SHA1 Message Date
Simon Glass
291391bed5 Add support for SMSC95XX USB 2.0 10/100MBit Ethernet Adapter
The SMSC95XX is a USB hub with a built-in Ethernet adapter. This adds support
for this, using the USB host network framework.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Eric Bénard <eric@eukrea.com>
2011-08-08 21:05:23 +02:00
Laurence Withers
0bf98f1d13 DaVinci: rename gpio_defs.h to gpio.h
In preparation for a generic GPIO driver for the DA8xx processors,
rename <asm/arch/gpio_defs.h> to <asm/arch/gpio.h> and fix up all files
which include it.

Signed-off-by: Laurence Withers <lwithers@guralp.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
2011-08-03 12:49:19 +02:00
Matthias Weisser
dddb7c9ffd imx: Add support for USB EHCI on imx25
Adding support for USB host on imx25 using the internal PHY. Changing the name
of base address define for imx31 to get some unification.

Signed-off-by: Matthias Weisser <weisserm@arcor.de>
2011-07-14 15:41:24 +02:00
Mike Frysinger
181f565c2d usb: convert to partial linking
Looks like this was missed during the conversion to partial linking.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-25 09:53:10 +02:00
Zhao Chenhui
ae46d2a952 ehci-pci: Fix PCI EHCI driver for 36-bit
Convert the PCI base address into a virtual address.

Signed-off-by: Zhao Chenhui <b35336@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
2011-06-25 09:53:10 +02:00
Cliff Cai
b17ce92a42 musb: process control messages after roothub accepted it
When dealing with non-multipoint devices, if the software root hub code
accepted the message, then we still need to process it normally.  So only
return quickly when the root hub skipped the message or is otherwise in
an error state.

Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-06-25 09:53:10 +02:00
Reinhard Meyer
86592f6059 AT91: change includes from asm/arch/io.h to asm/io.h
and remove the now unused asm/arch-at91/io.h

Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2011-05-18 07:56:51 +02:00
Reinhard Meyer
372f2783a7 AT91: fix related at91 driver files
Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2011-05-18 07:56:51 +02:00
Stefano Babic
8627111543 IMX: MX31: Cleanup include files and drop nasty #ifdef in drivers
As exception among the i.MX processors, the i.MX31 has headers
without general names (mx31-regs.h, mx31.h instead of imx-regs.h and
clock.h). This requires several nasty #ifdef in the drivers to
include the correct header. The patch cleans up the driver and
renames the header files as for the other i.MX processors.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2011-04-27 19:38:05 +02:00
Wolfgang Denk
4db2fa7f94 Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
Conflicts:
	drivers/usb/host/ehci-pci.c

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-04-05 12:24:20 +02:00
Zhao Chenhui
298f8af17b echi: add ULI1575 PCI ID
Add ULI1575 EHCI controller to the list of the supported devices.

Signed-off-by: Zhao Chenhui <b35336@freescale.com>
Acked-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2011-04-04 09:24:42 -05:00
Trübenbach, Ralf
0a5f7e1bdc ehci-pci: Add PCI EHCI controller
This patch adds support for the PI7C9X442SL PCIe EHCI host controller
from Pericom.

Tested at P4080DS eval board from Freescale.

Signed-off-by: Ralf Trübenbach <ralf.truebenbach@men.de>
Cc: Remy Bohmer <linux@bohmer.net>
2011-04-02 09:38:24 +02:00
Mike Frysinger
081b59e453 usb: musb: blackfin: check anomaly workarounds at runtime too
The anomaly workarounds we need for older silicon might break things
if used on newer versions where the anomalies don't exist.  So check
the silicon rev at runtime too.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-02 09:38:24 +02:00
Mike Frysinger
38e0745e4d usb: musb: blackfin: make clkin configurable
Not everyone has a 24MHz clkin to the USB, so let board porters override.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-02 09:38:24 +02:00
Wolfgang Denk
14666418e9 Coding Style cleanup: remove trailing empty lines
Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-03-27 21:48:08 +02:00
Vitaly Kuzmichev
e4ae66608b USB-RNDIS: Send RNDIS state on disconnecting
Add waiting for receiving Ethernet gadget state on the Windows host
side before dropping pullup, but keep it for debug.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-02-19 20:32:38 +01:00
Vitaly Kuzmichev
7612a43d08 USB: Add USB RNDIS gadget protocol
Port USB gadget RNDIS protocol support from linux-2.6.26
(.27 gadget stack actually has composite drivers).

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-02-19 20:32:37 +01:00
Vitaly Kuzmichev
8b6b66b427 USB-CDC: Move struct declaration before its use
Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-02-19 20:32:37 +01:00
Vitaly Kuzmichev
c85d70ef64 USB-CDC: Port struct net_device_stats
Port struct net_device_stats and statistics collecting needed for
RNDIS protocol.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-02-19 20:32:37 +01:00
Vitaly Kuzmichev
b3649f3bbf USB-CDC: handle interrupt after dropped pullup
Disconnecting USB gadget with pending interrupt may cause its wrong
handling in the next time when interface will be started again
(especially actual for RNDIS). This interrupt may force the gadget
to queue unexpected response before setup stage.
Despite the fact that such interrupt handled after dropped pullup
also may add pending response, this will not bring to any issues due to
usb_ep_disable (which clears the queue) called on gadget unregistering.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-02-19 20:32:36 +01:00
Simon Glass
9b70e00773 Add support for ASIX AX88772 USB 2.0 10/100Mbit Ethernet Adaptor
Driver originally written by NVIDIA Corporation, modified to
handle odd-length packets.

Signed-off-by: Simon Glass <sjg@chromium.org>
2011-02-19 20:32:36 +01: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
Vitaly Kuzmichev
58939fcc5c USB-CDC: Move MAC addresses setting into usb_eth_init
This allows to change device and host MAC addresses without performing
reset.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-01-19 17:29:55 +01:00
Vitaly Kuzmichev
8f7aa831c3 USB-CDC: Do not rename netdev after its registration
Calling eth_bind at usb_eth_init time causes renaming of the network
device from 'usb_ether' to 'usb0'. Fixing this to keep the first name.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2011-01-19 17:29:55 +01:00
Lei Wen
988ee3e3f0 usb_ether: register usb ethernet gadget at each eth init
Since the ether may not be the only one usb gadget would be used
in the uboot, it is neccessary to do the register each time the
eth begin to work to make usb gadget driver less confussed when
we want to use two different usb gadget at the same time.

Usb gadget driver could simple ignore the register operation, if
it find the driver has been registered already.

Signed-off-by: Lei Wen <leiwen@marvell.com>
2011-01-19 17:29:55 +01:00
Stefan Roese
a42a9d71b5 usb: Remove usb_dev_init() from ehci-ppc4xx.c
Calling usb_dev_init() from within the EHCI host driver is wrong.
The EHCI host driver should have no dependency/interconnection to the
USB device driver.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
2010-11-26 21:24:57 +01:00
Stefan Roese
273d72044c usb: Clear CMD_RUN while issuing CMD_RESET in ehci_reset()
This patch fixes a problem noticed on lwmon5 (PPC440EPx) using the
common EHCI driver, when "usb reset" is issued multiple times.
Upon the 2nd (and further) "usb reset" command, the command fails
with the following messages:

=> usb reset
(Re)start USB...
USB:   Register 1111 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 5 USB Device(s) found
       scanning bus for storage devices... 2 Storage Device(s) found
=> usb reset
(Re)start USB...
USB:   EHCI fail to reset
Error, couldn't init Lowlevel part

This patch fixes this problem. Now "usb reset" can be called multiple
times.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
2010-11-26 21:23:25 +01:00
Stefan Roese
67333f76b6 usb: Add WATCHDOG_RESET call to polling loop
This watchdog reset call is needed here, otherwise the lwmon5 board
(PPC440EPx based) will reset upon the "usb reset" command.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
2010-11-26 21:21:50 +01:00
Anatolij Gustschin
222d6dff27 usb: fix for USB_ST_STALLED status reporting in ehci_submit_async()
Checking the status field of the qTD token in the current code
do not take into acount cases where endpoint stall (halted) bit
is set together with XactErr status bit. As a result clearing
stall on an endpoint won't be done if this status bit was also
set. Check for halted bit and report USB_ST_STALLED status
if the host controller also indicates endpoit stall condition.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2010-11-26 21:21:16 +01:00
Sebastien Carlier
6d8962e814 Switch from archive libraries to partial linking
Before this commit, weak symbols were not overridden by non-weak symbols
found in archive libraries when linking with recent versions of
binutils.  As stated in the System V ABI, "the link editor does not
extract archive members to resolve undefined weak symbols".

This commit changes all Makefiles to use partial linking (ld -r) instead
of creating library archives, which forces all symbols to participate in
linking, allowing non-weak symbols to override weak symbols as intended.
This approach is also used by Linux, from which the gmake function
cmd_link_o_target (defined in config.mk and used in all Makefiles) is
inspired.

The name of each former library archive is preserved except for
extensions which change from ".a" to ".o".  This commit updates
references accordingly where needed, in particular in some linker
scripts.

This commit reveals board configurations that exclude some features but
include source files that depend these disabled features in the build,
resulting in undefined symbols.  Known such cases include:
- disabling CMD_NET but not CMD_NFS;
- enabling CONFIG_OF_LIBFDT but not CONFIG_QE.

Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
2010-11-17 21:02:18 +01:00
Wolfgang Denk
071bc92330 Coding Style cleanup
Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-10-27 22:48:30 +02:00
Wolfgang Denk
09c83a45b7 ehci-hcd.c: fix hanging under higher load
This patch solves a problem with USB hanging under higher load on a
i.MX31 board.  It falls into class of typical USB problems and fixes:
if you don't understand the real cause, add a delay somewhere.

The problem appeared after introduction of ELF relocation, which
results in smaller code, which appears to run faster (probably because
it fits better in the cache); turning off the instruction cache,
adding debug printf()s and increasing the delay have all been found to
make the problem go away.

Moving the original "udelay(1)" up in the code to it's new place made
the problem appear much less frequently. Increasing the delay to 2
microseconds then made the code run reliably in all (hour-long) tests.
To be on the safe side, we set it to 5 microseconds here.

Signed-off-by: Heiko schocher <hs@denx.de>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
Cc: Stefano Babic <sbabic@denx.de>
2010-10-22 21:44:37 +02:00
Mike Frysinger
0228348e9c usb: musb: constify a bit
These ep and root hub structures need not be writable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-22 21:41:46 +02:00
Wolfgang Denk
8b675fe18e USB: fix Queue Element Transfer Descriptor changes
Commit 3ed1607 "USB: sync Queue Element Transfer Descriptor against
EHCI spec" added an "__attribute__ ((aligned (32)))" to the
declaration of struct qTD, as used for example in the Linux kernel as
well.

However, it turns out that this attribute causes errors in "usb start"
(like "ERROR: NOT USB_CONFIG_DESC 7b" and similar). Drop the attribute
again.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Dan Lykowski <lykowdk@gmail.com>
Cc: Remy Bohmer <linux@bohmer.net>
Cc: Stefano Babic <sbabic@denx.de>
2010-10-22 21:41:45 +02:00
Florian Fainelli
af68c06670 ehci-pci: print hccr, hcor and hc_lenght
It is useful to know the EHCI-PCI hccr, hcor and hc_lenght to make sure it was
successfully registered, and at the correct location.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2010-10-22 21:41:45 +02:00
Wolfgang Denk
3ed16071b0 USB: sync Queue Element Transfer Descriptor against EHCI spec
Appendix B "EHCI 64-Bit Data Structures" of the "Enhanced Host
Controller Interface Specification for Universal Serial Bus" (Rev.
1.0, March 12, 2002) defines additional fields which were missing in
U-Boot's struct qTD; as these are also present in recent versions of
struct ehci_qtd in the Linux kernel, we add them here, too.

This fixes some nasty memory corruption problems.

Reported-by: Dan Lykowski <lykowdk@gmail.com>
See http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/76942

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Remy Bohmer <linux@bohmer.net>
Cc: Dan Lykowski <lykowdk@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Tested-by: Stefano Babic <sbabic@denx.de>
2010-10-20 00:23:57 +02:00
Wolfgang Denk
083d506937 Merge branch 'master' of git://git.denx.de/u-boot-imx
Conflicts:
	board/logicpd/imx31_litekit/config.mk
	boards.cfg

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-10-19 20:58:16 +02:00
Damien Dusha
29c6fbe047 MPC5121: Add USB EHCI support
Signed-off-by: Francesco Rendine <francesco.rendine@valueteam.com>
Signed-off-by: Damien Dusha <d.dusha@gmail.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>

Coding style cleanup; slight file restructuring.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Acked-by: Remy Bohmer <linux@bohmer.net>
2010-10-18 22:33:32 +02:00
Stefano Babic
a2f9bff998 MX31: add delay between USB port setup and reset
Sometimes a usb tree is not popolated after a system reset.
It seems a delay is required after setting the USB ports
for the MX.31 before resetting the ehci controller.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-18 15:21:36 +02:00
Wolfgang Denk
6ca803750e Merge branch 'master' of git://git.denx.de/u-boot-imx 2010-10-17 19:57:38 +02:00
Stefano Babic
5b591502f9 MX31: Add support for MXC EHCI controller
The patch adds the EHCI controller for the i.MX31 Soc.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-10-13 18:11:44 +02:00
Bryan Wu
4ee691f6ac usb: musb: only write CLRDATATOG when appropriate
This is a change similar to what is already in the Linux driver.  We
should only program the CLRDATATOG bit when the current mode indicates
that it is needed.

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>
2010-10-13 12:08:43 +02:00
Vitaly Kuzmichev
98fae9707f USB-CDC: Prevent rx_req being enqueued twice
After gadget reinitializaton (after tftp has been done once)
packet_received may become equal to 1 due to nuking OUT_EP
while disabling it in eth_reset_config.

rx_submit called from usb_eth_init queues rx_req first time.
But the first call of usb_eth_recv from NetLoop queues rx_req
again due to packet_received = 1.

The following flow shows the path of functions calls when
this happens:

 net/net.c:NetLoop
 |
 +-net/eth.c:eth_init
 |   ether.c:usb_eth_init
 |   |
 |   +-udc_driver:usb_gadget_handle_interrupts
 |   |   udc_driver:...
 |   |     ether.c:eth_setup
 |   |       ether.c:eth_set_config
 |   |         ether.c:eth_reset_config
 |   |           udc_driver:usb_ep_disable
 |   |             udc_driver:nuke
 |   |               ether.c:rx_complete
 |   |                 ether.c: packet_received = 1;
 |   |
 |   +-ether.c:rx_submit
 |       udc_driver:usb_ep_queue --- The first time when rx_req is queued
 |
 +-net/eth.c:eth_rx
     ether.c:usb_eth_recv
     |
     +-udc_driver:usb_gadget_handle_interrupts
     |   udc_driver:... --- no interrupts, returning
     +-ether.c: if (packet_received) { ...
         ether.c:rx_submit
           udc_driver:usb_ep_queue --- The second time!

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2010-10-13 12:07:58 +02:00
Vitaly Kuzmichev
ac5d32d15c USB-CDC: Fix tx/rx_req memory leaks
Remove and fix needless and destructive operations with tx/rx_req.

1) 'req' in rx_complete is always not NULL and always equals to rx_req
2) Free allocated tx_req if rx_req allocation has failed
3) Do not zero out tx/rx_req in usb_eth_init, leave this for
eth_reset_config which will be called at the next use of usb0
4) Additional check in usb_eth_recv is not required

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2010-10-13 12:07:58 +02:00
Marek Vasut
f2443d10ff USB: Make non-bulk delay longer in OHCI
This fixes TIMEOUT with my Kingston 32GB USB3.0 flashdrive, which I experienced
on my PXA270 (USB 1.1) Vpac270 board.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
2010-10-13 12:07:58 +02:00
Vitaly Kuzmichev
6142e0ae0f USB-CDC: Fix coding style issues
Fixes most of checkpatch warnings and errors in USB gadget stack.

The most frequently encountered problems are:
1) "(foo*)", "foo * bar", "foo* bar"
2) C99 // comments
3) No spaces before/after/around '?', ':', '=', '==', ',', '&', '('
4) Spaces before '['
5) Spaces between function names and '('
6) Block braces in wrong places
7) Spaces before tabs
8) Macros with complex values not enclosed in parenthesis
9) Multiline comments start just after /*

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2010-09-20 21:57:17 +02:00
Stefano Babic
a170f2c797 USB-CDC: called handle_interrupts inside usb_eth_send
The patch removes an endless loop  in the usb_eth_send
if the tx_complete is not called before going
in the loop. The driver interrupt routine is called
allowing the driver to check if the TX is completed.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-09-20 21:57:17 +02:00
Stefano Babic
8046077219 USB-CDC: correct wrong alignment in ether.c
The buffer for the status request must be word aligned
because it is accessed with 32 bit pointer in the
eth_status_complete function.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-09-20 21:57:17 +02:00
Vitaly Kuzmichev
c0ef513188 USB-CDC: change simple_strtol to simple_strtoul
The patch is based on commit bb9496c6f7e853e5d4edd5397c9d45f1968d623c
(done by Julia Lawall <julia@diku.dk>) from linux-2.6.git.

Since num is unsigned, it would seem better to use simple_strtoul that
simple_strtol.

Signed-off-by: Vitaly Kuzmichev <vkuzmichev@mvista.com>
2010-09-20 21:57:17 +02:00