usb:ehci-mx6 add phy mode query function

usb_phy_enable should return status bit, but not phy mode bit, thus
add a new function usb_phy_mode to query the PHY for it's mode and
make usb_phy_enable just return 0 but not 'phy_ctrl & USBPHY_CTRL_OTG_ID'.

Include a new board weak function board_usb_phy_mode. If board code
does not reimplement this function, it just call usb_phy_mode and return
usb_phy_mode's return value. The reason to include such a weak function
is: " SOC OTG core <--connect--> board HOST port, but no pin id for
the board host port, so board can not use usb_phy_mode to return the
phy mode, but define it's own rule."

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye Li <B37916@freescale.com>
imx:mx6slevk add board level support for usb

Add pinmux settings, implement board_ehci_hcd_init, board_usb_phy_mode

There are two usb port on mx6slevk board:
1. otg port
2. host port
The following are the connection between usb controller and board usb
interface, host port has not ID pin set:
otg1 core <---> board otg port
otg2 core <---> board host port
In order to make host port work, board_usb_phy_mode return USB_INIT_HOST
to let host port work in host mode.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye Li <B37916@freescale.com>
imx:mx6sxsabresd add board level support for usb

Add pinmux settings, implement board_ehci_hcd_init, board_usb_phy_mode

There are two usb port on mx6sxsabresd board:
1. otg port
2. host port
The following are the connection between usb controller and board usb
interface, host port has not ID pin set:
otg1 core <---> board otg port
otg2 core <---> board host port
In order to make host port work, board_usb_phy_mode return USB_INIT_HOST
to make host port work in HOST mode.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Signed-off-by: Ye Li <B37916@freescale.com>
dfu: thor: fix: Modify dfu_get_alt() function to support absolute paths

Recently the ext4 file system imposed passing absolute path with its file
name parameter.
As a result dfu_alt_info env variable has been modified to provide absolute
path when ext4 file system is accessed (e.g. /uImage ext4 0 2;).

Unfortunately, lthor flashing program provides plain file name (like uImage)
and hence those two file names do not match anymore.

Presented commit also allows lthor to write files to sub directories (like
/boot/bin/uImage).

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
test: ums: Add sleep before unmount directory

This change helps to run script on machines with quite long uptime.
Without this the following error emerges:

File: ./dat_14M.img
umount: /mnt/tmp-ums-test: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))
TX: md5sum:083d3d22b542d3ecba61b12d17e03f9f
mount: /dev/sdd6 already mounted or /mnt/tmp-ums-test busy
mount: according to mtab, /dev/sdd6 is already mounted on /mnt/tmp-ums-test

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
usb: ehci: do not set the LSB of Current qTD pointer

According to EHCI specification, the LSB of DWORD 3 of Queue Head
(Current qTD Pointer) is not T-bit, but always zero.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
imx: mx53loco: Add raw initrd support

Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Jason Liu <r64343@freescale.com>
Acked-by: Jason Liu <r64343@freescale.com>
mxs_ocotp: prevent error path from returning success

The code may goto 'fail' upon error with 'ret' variable set to an error
code, but this variable was being overwritten by a final preparation
function to restore the HCLK, so success was (in general) returned even
after an error was hit previously.

With this change, the function may now return success even if the final
preparation function fails, but it's probably enough to print a message
because (if successful) the real programming of the fuses has already
completed.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
mxs_ocotp: check for errors from the OTP controller after writing

The write operation may fail when trying to write to a locked area. In
this case the ERROR bit is set in the CTRL register. Check for that
condition and return an error.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
mxs_ocotp: clear the error flag before initiating write operation

A previous operation may have set the error flag, which must be cleared
before a new write operation can be issued.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
thermal: imx_thermal: Do not display calibration data

Printing the calibration data on every boot does not provide really useful
information:

U-Boot 2015.01-rc1-18266-ge7eb277 (Nov 24 2014 - 11:29:51)

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
CPU:   Thermal calibration data: 0x5d85067d
CPU:   Temperature 33 C
Reset cause: POR
Board: MX6-SabreSD

Do not display the calibration data in order to have a cleaner boot log.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
mx6sxsabresd: Add thermal support

Add thermal support so that the temperature of the chip can be displayed on
boot:

U-Boot 2015.01-rc1-18268-g1366c05-dirty (Nov 25 2014 - 13:02:42)

CPU:   Freescale i.MX6SX rev1.0 at 792 MHz
CPU:   Temperature 50 C

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
mxc_ocotp: Do not disable the OCOTP clock after every access

Leave the OCOTP turned on, so that we subsequent access do not fail.

After enabling the thermal driver on a mx6sxsabresd board:

U-Boot 2015.01-rc1-18267-g99d4189-dirty (Nov 24 2014 - 12:59:01)

CPU:   Freescale i.MX6SX rev1.0 at 792 MHz
CPU:   Temperature 48 C
Reset cause: POR
Board: MX6SX SABRE SDB
I2C:   ready
DRAM:  1 GiB
PMIC:  PFUZE100 ID=0x10
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
  00:01.0     - 16c3:abcd - Bridge device
   01:00.0    - 8086:08b1 - Network controller
In:    serial
Out:   serial
Err:   serial
Net:
(hang)

As the thermal driver accesses the ocotp registers, its clock will be disabled
afterwards.

Then when the MAC address is read (also from ocotp registers) it will cause a
hang.

Do not disable the ocotp clock to prevent this problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
tbs2910: fix Kconfig

fix Kconfig for tbs2910 board to prevent crash on relocation

Signed-off-by: Soeren Moch <smoch@web.de>
sata: fix reset_sata for dwc_ahsata

- fix crash when sata device is not initialized
- remove disable_sata_clock() since it is not clear which clock for which
  device should be disabled here
- call disable_sata_clock() for mx6 in preboot_os instead

Signed-off-by: Soeren Moch <smoch@web.de>
Acked-by: Nikita Kiryanov <nikita@compulab.co.il>
Tested-by: Nikita Kiryanov <nikita@compulab.co.il>
arm: mx6: Change defines ENET_xxMHz to ENET_xxMHZ (no CamelCase)

As checkpatch complaines about these camel-case defines, lets change
them to only use upper-case characters.

Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Heiko Schocher <hs@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Jon Nettleton <jon.nettleton@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
tbs2910: fix lost characters on serial input

With enabled console_mux for serial input and usb keyboard sometimes
characters get lost when typing too fast at the serial input (pasting
strings in serial console window). Fix this by using INT_QUEUE for
polling the usb keyboard.

Signed-off-by: Soeren Moch <smoch@web.de>
config_fallbacks: Add a default entry for CONFIG_SYS_PBSIZE

Entering the maximum number of characters defined by CONFIG_SYS_CBSIZE into
the console and hitting enter afterwards, causes a hang in the system because
CONFIG_SYS_PBSIZE is not capable of storing the characters of the error message:
"Unknown command '' - try 'help'".

Provide a default size for CONFIG_SYS_PBSIZE so that it can store the error
message and allows the error message to be printed correctly with no hang.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
mx6sabre_common: Use the default CONFIG_SYS_PBSIZE

Entering the maximum number of characters defined by CONFIG_SYS_CBSIZE into
the console and hitting enter afterwards, causes a hang in the system because
CONFIG_SYS_PBSIZE is not capable of storing the characters of the error message:
"Unknown command '' - try 'help'".

Use the default CONFIG_SYS_PBSIZE definition from config_fallbacks.h to solve
this problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
arm: vf610: improve evaluation of reset source

Improve the evaluation of the reset source. Bit description according
to latest reference manual rev. 7.

Signed-off-by: Stefan Agner <stefan@agner.ch>