usb_storage: Restore non-EHCI support

The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a
basic support of non-EHCI HCDs, like before that commit.

The fallback transfer size is certainly not optimal, but at least it should work
like before.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
usb_storage: Remove EHCI constraints

Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is
only limited by the SCSI commands it uses.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
usb_stor_BBB_transport: Do not delay when not required

There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of
data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds
up to quite a bit of delay if you're loading a large ramdisk.

The purpose of this delay should be to debounce the 5-V/100-mA USB power up.
This patch skips the delay if the device has already been queried as ready.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>

Rework following the review:
 - Rebase against the latest u-boot-usb master.
 - Replace typedef with #define.
 - Use the existing flags struct field instead of adding a new field.
 - Remove the setter function.
 - Remove the typecasts.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
Cc: Jim Shimer <mgi2475@motorola.com>
ehci: Optimize qTD allocations

Relax the qTD transfer alignment constraints in order to need less qTDs for
buffers that are aligned to 512 bytes but not to pages.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Ilya Yanok <ilya.yanok@cogentembedded.com>
Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
usb: Optimize USB storage read/write

Trim down the IO times by removing uneeded
test unit reeady calls.

Signed-off-by: Jim Shimer <mgi2475@motorola.com>
USB: Fix strict aliasing in ohci-hcd

commit 5f6aa03fda2a0a79940765865c1e4266be8a75f8
    USB: Fix complaints about strict aliasing in OHCI-HCD

tried to fix this, but gcc4.4 still complains. So, this
patch basically reverts the above and does a simpler fix.

also, the above commit incorrectly changed
	/* corresponds to data_buf[4-7] */
	datab [1] = 0;
to

	/* corresponds to databuf.u8[4-7] */
	databuf.u8[1] = 0;

This patch also fixes that.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
pxa25x: Add UDC registers definitions

Signed-off-by: Łukasz Dałek <luk0104@gmail.com>
usb: fix ulpi_set_vbus prototype

Match the name of the header prototype with the actual
implementation.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
MUSB driver: Timeout is never detected as the while loop does not end

Timeout variable is decremented once more when while condition is not met.
Following "if" does not detect correctly that timeout has occurred.
Because of this bug the "usb start" command on AM335X-EVM board did not detect correctly that USB device was not attached.

	timeout = musb_cfg.timeout;
	while (timeout--)
		if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
 			break;
	/* if musb core is not in host mode, then return */
	if (!timeout)
		return -1;

Signed-off-by: Matej Franceskin <Matej.Franceskin@comtrade.com>
CC: Marek Vasut <matex@denx.de>?
ARM : at91sam9x5 : Remove CONFIG_ARCH_CPU_INIT

Remove CONFIG_ARCH_CPU_INIT, no need it anymore

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
at91sam9263ek: fix 'update' script

The old update script uses 'load_addr' which is never set. Use 'fileaddr'
instead which is automagically set by e.g. dhcp.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
cc: Stelian Pop <stelian@popies.net>
AT91: Small fix on AT91 USART initialization code

Before reset dbgu transmitter, we just wait TXEMPTY to drain the
transmitter register(Just in case). If not doing this, we may sometimes
see several weird characters from DBGU.

A short delay is also added to make sure the new serial settings are
settled.

Signed-off-by: Hong Xu <hong.xu@atmel.com>
[cherry-picked from u-boot-atmel/old-next]
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
arm : at91sam9x5 : fix a small bug for NAND

fix a bug:
  when not boot from NAND, the NAND flash can not be detected.
  Using this to fix it

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Take over the maintainer for sam9g10 and sam9m10g45

As the maintainer for at91sam9g10ek and at91sam9m10g45ek can not reach
any more.

So I wish to take over the maintainer for sam9g10 and sam9m10g45

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
atmel: at91sam9x5: fix name error for spi

Fix the name error

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
spi: atmel: add WDRBT bit to avoid receive overrun

The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Acked-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
at91sam9263ek: remove unnecessary console_init_f

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
cc: Stelian Pop <stelian@popies.net>
arm:at91-boards: remove console_init_f where unnecessary

A lot of at91 boards have the console_init_f in board_init. This is useless
cause it was called before by generic code in lib/board.c.

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
cc: Jens Scharsig <esw@bus-elektronik.de>
cc: Stelian Pop <stelian@popies.net>
cc: Sedji Gaouaou<sedji.gaouaou@atmel.com>
cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
cc: Eric Benard <eric@eukrea.com>
Tested-by: voice.shen@atmel.com
Tested-by: voice.shen@atmel.com
Acked-by: Jens Scharsig (BuS Elektronik) <esw@bus-elektronik.de>
Tested-by: Jens Scharsig (BuS Elektronik) <esw@bus-elektronik.de>
arm: sam9g10/sam9m10g45: remove CONFIG_ARCH_CPU_INIT

Remove CONFIG_ARCH_CPU_INIT for at91sam9g10ek and at91sam9m10g45ek

Signed-off-by: Bo Shen <voice.shen@atmel.com>
[rebase on TOT]
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
atmel: at91sam9x5: add spi flash boot support

Add at91sam9x5 series spi flash boot support

Using at91sam9x5ek_spiflash to configure, then it can boot from at25df321
serial flash

SPI mater work in 30Mhz speed, while not 1Mhz speed. This will base on
atmel_spi patch, or else, it will occur receive overrun

Signed-off-by: Bo Shen <voice.shen@atmel.com>
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>