Commit Graph

489 Commits

Author SHA1 Message Date
ramneek mehresh
77354e9d50 powerpc/usb:Differentiate USB controller base address
Introduce different macros for storing addresses of multiple
USB controllers. This is required for successful initialization
and usage of multiple USB controllers inside u-boot

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
2013-10-24 09:35:09 -07:00
Troy Kisky
7e575c46c3 usb: rename board_usb_init_type to usb_init_type
commit bba679144d
"usb: rename board_usb_init_type to usb_init_type" missed xhci-omap.c
So, fix that patch here, and fix a checkpatch warning.
WARNING: Avoid unnecessary line continuations

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-22 17:33:09 -04:00
Troy Kisky
449697f14e usb: udc: add udc.h include file
Move common definitions to udc.h
This allows musb_udc.h to be removed as well.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:38 +02:00
Troy Kisky
0f740cb8e4 usb: gadget: mv_udc: split mv_udc.h file
Move defines only needed by mv_udc.c to a file
in the same directory.

This allows usbtty to compile for mv_udc,
but it still doesn't link.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:36 +02:00
Troy Kisky
7b7924cdf8 usb: gadget: mv_udc: optimize ep_enable
Only get head if not ep0.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:33 +02:00
Troy Kisky
1ebf02787a usb: gadget: mv_udc: optimize bounce
Only perform one copy, either in the bounce
routine for IN transfers, or the debounce
rtn for OUT transfer.

On out transfers, only copy the number
of bytes received from the bounce buffer

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:33 +02:00
Troy Kisky
3b59abf583 usb: gadget: mv_udc: fix full speed connections
Set maximum packet length in queue header to wMaxPacketSize
of endpoint.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:33 +02:00
Troy Kisky
d1a5286099 usb: ehci-mx6: add support for otg port
Previously, only host1 was supported using an index of 0.
Now, otg has index 0, host1 is 1, host2 is 2, host3 is 3.
Since OTG requires usbmode to be set after reset, I added
CONFIG_EHCI_HCD_INIT_AFTER_RESET to nitrogen6x.h and
mx6qsabreauto.h.

I also added a weak function board_ehci_power to handle
turning power on/off for otg.

Type is type of device connected (USB stick vs Host.)
Init is type of device desired.
Only power up port if type == init == USB_INIT_HOST.
Only return error if type != init.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:33 +02:00
Troy Kisky
8287314888 usb: gadget: mv_udc: don't check CONFIG_USB_MAX_CONTROLLER_COUNT
i.mx6 has 1 otg controller, and 3 host ports. So,
CONFIG_USB_MAX_CONTROLLER_COUNT can be greater than 1
even though only 1 device mode controller is supported.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:29 +02:00
Troy Kisky
127efc4fe8 usb: ehci-hcd: add enum usb_init_type parameter to ehci_hcd_init.
This paramter will later be used to initialize OTG ports in
host or device mode.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:46:27 +02:00
Troy Kisky
06d513ecb6 usb: add enum usb_init_type parameter to usb_lowlevel_init
This parameter will later be used to verify OTG ports.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:45:26 +02:00
Dan Murphy
3d799c7f5e usb: am437x: Add support for am437x xhci USB host
Add the support for the am437x xhci usb host.

The xHCI host on AM437 is connected to a usb2 phy so need to
add support to enable those clocks.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
2013-10-20 23:42:41 +02:00
Dan Murphy
834e91af43 usb: dra7xx: Add support for dra7xx xhci USB host
Add the support for the dra7xx xhci usb host.
dra7xx does not contain an EHCI controller so the headers
can be removed from the board file.

The xHCI host on dra7xx is connected to a usb2 phy so need to
add support to enable those clocks.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
2013-10-20 23:42:41 +02:00
Dan Murphy
ba55453ccf usb: omap: Move the usb phy code to the usb/phy directory
Moving the usb/phy code from xhci-omap to the usb/phy directory
and moving the associated phy code over to the new file.

Newer TI processors adding xHCI support will have different PHY configurations
so therefore abstracting this code away will prevent messing around with the
xhci-omap file itself.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
2013-10-20 23:42:41 +02:00
Dan Murphy
b216821189 usb: omap5: Update the board_usb_init api
Recent patches declares board_usb_init function prototype for a new
usb architecture.

Turning on the OMAP_XHCI defines cause a redefinition compiler failure.
So update the board_usb_init to the latest prototype.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
2013-10-20 23:42:41 +02:00
Dan Murphy
41b667b834 usb: omap: Move the xhci-omap header file to common location
Moving the xhci-omap header to a more global location so that
other code can reference this code.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
2013-10-20 23:42:41 +02:00
Lukasz Majewski
b958fb9165 usb:g_dnl: Support for TIZEN's THOR function in generic download code
Support of "thor" function in generic download code (g_dnl.c).

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:41 +02:00
Lukasz Majewski
c527937796 usb:g_dnl:f_thor: USB download function to support TIZEN's THOR protocol
Implementation of USB download function which supports THOR protocol.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:41 +02:00
Lukasz Majewski
d6eae7b0b1 usb:g_dnl: Add name parameter to g_dnl_bind_fixup function
New parameter, namely *name has been added to g_dnl_bind_fixup().
It is necessary (for compatibility reasons) to assign new USB idProduct
and idVendor for different usb functions.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:41 +02:00
Lukasz Majewski
7b412ab31f usb:g_dnl: Replace static usb_configuration structure with dynamically allocated one
When the usb_configuration structure is declared as static, it is very
hard to assure, that relevant fields (as e.g. config->interfaces[]) are
cleared out before new call to g_dnl related functions.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
2013-10-20 23:42:40 +02:00
Lukasz Majewski
57ffabe371 usb:udc:s3c: Reduce dcache invalidate range for UDC receive buffer
The s3c udc driver sends data in a max packet size. Therefore the dcache
invalidate range shall be equal to max packet, not the entire
DMA_BUFFER_SIZE.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:40 +02:00
Suriyan Ramasami
98f686c26f usb:smsx95xx LED activity for USB net driver
Add LED activity for SMSX95XX USB Ether driver.

Signed-off-by: “Suriyan Ramasami" <suriyan.r@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
2013-10-20 23:42:40 +02:00
Mateusz Zalega
16297cfb2a usb: new board-specific USB init interface
This commit unifies board-specific USB initialization implementations
under one symbol (usb_board_init), declaration of which is available in
usb.h.

New API allows selective initialization of USB controllers whenever needed.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Lukasz Majewski <l.majewski@samsung.com>
2013-10-20 23:42:40 +02:00
Troy Kisky
b065eb7fd7 usb: gadget: mv_udc: clear desc upon ep_disable
desc is set at ep_enable, so for symmetry,
clear it at ep_disable.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:40 +02:00
Troy Kisky
01773ccc0d usb: gadget: mv_udc: zero transfer descriptor memory on probe
Since we flush the TD, we may as well set it to a known value.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:39 +02:00
Troy Kisky
5fc2e99732 usb: gadget: mv_udc: flush item before head
Make sure the transfer descriptor is flushed
before the queue is updated so that the controller
will not see old information.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:39 +02:00
Troy Kisky
5a90443048 usb: gadget: mv_udc: set is_dualspeed = 1
This controller support full and high speed.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:39 +02:00
Troy Kisky
d0928794d9 usb: gadget: mv_udc: fix typo in error message
Change 'nfo=' to 'info='

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:39 +02:00
Troy Kisky
71fc5f91d2 usb: gadget: ether: return error from rx_submit if no request
This prevents a crash if tftpboot is given a bad filename.

rx_req will be released by eth_reset_config
which is called by eth_disconnect,
which is called using the .disconnect member of usb_gadget_driver by mv_pullup in mv_udc
which is called using the .pullup member of usb_gadget_ops by usb_gadget_disconnect
which is called by usb_eth_halt
which is called using the .halt member of eth_device by eth_halt
which is called by TftpHandler when TFTP_ERR_FILE_NOT_FOUND or TFTP_ERR_ACCESS_DENIED occurs

I trigger this with the following commands
setenv ipaddr 10.0.0.2 && setenv netmask 255.255.255.0 && setenv serverip 10.0.0.1
setenv usbnet_devaddr 00:11:22:33:44:55 && setenv usbnet_hostaddr 00:aa:bb:cc:dd:ee
setenv ethprime usb_ether && setenv ethact usb_ether && setenv ncip 10.0.0.1
tftpboot 10800000 10.0.0.1:missing_file

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:39 +02:00
Troy Kisky
43880ce5be usb: gadget: ether set wMaxPacketSize
set wMaxPacketSize for full speed descriptors
fs_source_desc, fs_sink_desc to 64.

Full-speed bulk endpoint can have a maximum packet size of
8, 16, 32, or 64 bytes, so choice 64.

The hs_source_desc, hs_sink_desc, already have their wMaxPacketSize
set to 512. That is the only legal value for high speed bulk endpoints.

Strictly speaking, this patch is not needed because
usb_ep_autoconfig will call ep_matches which will
override wMaxPacketSize for BULK endpoints only with
the size associated with the endpoint setup by the udc driver.
But if you want to rely on this, you may as well combine the
full speed descriptor with the high speed descriptor to
minimize confusion.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2013-10-20 23:42:39 +02:00
Dan Murphy
2d2358ac15 OMAP5: USB: Add OMAP xHCI file and header
Add the OMAP file for the xHCI Host controller
This code will initilialize the proper components within the
OMAP5 to enable the xHCI host controller.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
2013-10-20 23:42:39 +02:00
Julius Werner
4a271cb1b4 exynos: usb: Switch USB VBUS GPIOs to be device tree configured
Some Exynos boards, such as the SMDK5250, control USB port power through
a GPIO pin. For now this had been hardcoded in the exynos5-dt board
file, but not all boards use the same pin, requiring local changes to
support different boards.

This patch moves the GPIO initialization into the USB host controller
drivers which they belong to, and uses the samsung,vbus-gpio parameter
in the device tree to configure it.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:38 +02:00
Vivek Gautam
13194f3b5f USB: XHCI: Add xHCI host controller support for Exynos5
This adds driver layer for xHCI controller in Samsung's
exynos5 soc. This interacts with xHCI host controller stack.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Julius Werner <jwerner@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:38 +02:00
Vivek Gautam
5853e1335c USB: xHCI: Add stack support for xHCI
This adds stack layer for eXtensible Host Controller Interface
which facilitates use of USB 3.0 in host mode.

Adapting xHCI host controller driver in linux-kernel
by Sarah Sharp to needs in u-boot.

Initial porting from Linux kernel version 3.4, with following
top commit history of drivers/usb/host/xhci* :
cf84055 xHCI: Cleanup isoc transfer ring when TD length mismatch found

This adds the basic xHCI host controller driver with bare minimum
features:
- Control/Bulk transfer support has been added with required
  infrastructure for necessary xHC data structures.
- Stream protocol hasn't been supported yet.
- No support for quirky devices has been added.

Signed-off-by: Vikas C Sajjan <vikas.sajjan@samsung.com>
Signed-off-by: Julius Werner <jwerner@chromium.org>
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:38 +02:00
Vivek Gautam
e3d7440c22 usb: Move 'bmRequestType' USB device request macros from EHCI header
Macros defining bmRequestType field of USB device request,
given in table 9.2 USB 2.0 spec, are rather generic macros
which can be further used by other Host controller stacks.
So moving them to usb_defs header.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Cc: Julius Werner <jwerner@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Marek Vasut <marex@denx.de>
2013-10-20 23:42:38 +02:00
Wolfgang Denk
16641d52fc Coding Style cleanup: drop some excessive empty lines
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:54 -04:00
Wolfgang Denk
d4c8aa9cb4 Coding Style cleanup: remove trailing empty lines
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:54 -04:00
Wolfgang Denk
3765b3e7bd Coding Style cleanup: remove trailing white space
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:53 -04:00
Andrew Murray
99b4eaa68e usb: Prevent using reserved registers on DM36x usb
The musb driver defines and uses MUSB_CSR0_H_DIS_PING, however this
bit is reserved on the DM36x. Thus this patch ensures that the
reserved bit is not accesssed.

It has been observed that some USB devices will fail to enumerate
with errors such as 'error in inquiry' without this patch.

See http://www.ti.com/litv/pdf/sprufh9a for details.

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>
Acked-by: Marek Vasut <marex@denx.de>
2013-10-10 07:58:00 -04:00
Tom Rini
9f3fe6da27 Merge branch 'master' of git://git.denx.de/u-boot-arm 2013-10-08 09:51:48 -04:00
Andrew Murray
ddd025bb6e usb: Fix error handling in musb_hcd.c
The wait_until_[rx|tx]ep_ready functions return a u8 to indicate success
containing the value 0, 1 or -1. This patch changes the return type to an
int to accommodate the negative return values.

These functions are used in the file using calls such as if (!wait_until...
Where a -1 is returned it is mishandled and treated as success instead of
a CRC error. This patch addresses this.

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Andrew Murray <amurray@embedded-bits.co.uk>
Acked-by: Marek Vasut <marex@denx.de>
2013-10-07 07:43:46 -04:00
Julius Werner
5077f96f10 usb: ehci: Fix test mode for connected ports
The EHCI controller has some very specific requirements for the USB 2.0
port test modes, which were not closely followed in the initial test
mode commit. It demands that the host controller is completely shut down
(all ports suspended, Run/Stop bit unset) when activating test mode, and
will not work on an already enumerated port.

This patch fixes that by introducing a new ehci_shutdown() function that
closely follows the procedure listed in EHCI 4.14. Also, when we have
such a function anyway, we might as well also use it in
usb_lowlevel_stop() to make the normal host controller shutdown cleaner.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
2013-09-27 16:20:52 +02:00
Bo Shen
4585fc5863 USB: gadget: atmel: disconnect before unbind
When unbind the gadget driver, need call disconnect first.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
2013-09-24 17:51:36 +02:00
Lukasz Majewski
a6921adcf2 usb:g_dnl:dfu: Download gadget and DFU function code clean up
The download gadget code and DFU function lacks of proper declarations
for the case when a target board wants to use only one of available usb
functions.

Moreover the relevant declarations have been moved to consistent
localization (like <dfu.h>).

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-09-24 17:51:36 +02:00
Lukasz Majewski
69d6cbe748 usb:gadget:Remove redundant #includes for USB composite gadget and its functions
Only the <linux/usb/gadget.h> requires error.h include. Hence, several
includes of error.h at USB gadget functions are not needed.

Moreover unnecessary malloc.h includes were also removed.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-09-24 17:51:36 +02:00
Lukasz Majewski
ba4e95c9f0 usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGE is defined.
Such change provides binary size reduction for boards which use USB
download gadget (like am335x_evm) with DFU, but don't use UMS.

For example at am335x_evm board reduction is more than 2KiB for
text and around 120B for data.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
2013-09-24 17:51:35 +02:00
Bo Shen
9e40493fd8 USB: gadget: add atmel usba udc driver
Add atmel usba udc driver support, porting from Linux kernel

The original code in Linux Kernel information is as following

commit e01ee9f509a927158f670408b41127d4166db1c7
Author: Jingoo Han <jg1.han@samsung.com>
Date:   Tue Jul 30 17:00:51 2013 +0900

    usb: gadget: use dev_get_platdata()

    Use the wrapper function for retrieving the platform data instead of
    accessing dev->platform_data directly.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
2013-09-24 17:51:35 +02:00
Troy Kisky
898d686eea usb: gadget: config: fix unaligned access issues
As seen with codesourcery compiler 2010q1, the buf pointer in
usb_request structure is not aligned on 4 bytes boundary causing
data aborts in eth_setup -> conf_buf -> usb_gadget_config_buf.
Make it as align access to fix this issue.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
[voice.shen@atmel.com: add commit message]
Signed-off-by: Bo Shen <voice.shen@atmel.com>
2013-09-24 17:51:35 +02:00
Joel Fernandes
5290759cc4 usb: gadget: Fix data aborts during USB ethernet boot
As seen on GCC 4.6 Linaro compiler, control_req buffer is not aligned
on 4 byte boundaray causing data aborts in eth_setup -> conf_buf
during dhcp boot over usb_ether. Fix the issue my aligning control_req
buffer using DEFINE_CACHE_ALIGN_BUFFER.

Tested on am335x_evm platform (beaglebone).
Applies on 2013.10-rc1 branch.

Cc: Tom Rini <trini@ti.com>
Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Joel Fernandes <joelf@ti.com>
2013-09-24 17:51:34 +02:00
Albert ARIBAUD
4eef93da26 Merge branch 'u-boot-atmel/master' into 'u-boot-arm/master' 2013-09-04 11:50:25 +02:00