project/bcm63xx/u-boot.git
9 years agoimx: ventana: config: use MMC SPL RAW support
Tim Harvey [Fri, 15 May 2015 16:14:49 +0000 (09:14 -0700)]
imx: ventana: config: use MMC SPL RAW support

Switch to MMC RAW support for SPL. We will place the uboot.img at 69KB.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoenv_nand: use nand_spl_load_image for readenv if SPL
Tim Harvey [Thu, 14 May 2015 18:48:04 +0000 (11:48 -0700)]
env_nand: use nand_spl_load_image for readenv if SPL

The readenv() implementation of env_nand uses the mtd layer which is
unnecessary overhead in SPL when we already have a nand_spl_load_image()
function that doesn't need it. Using this instead eliminates the need
to provide a mtd_read for SPL env as well as reduces code (4KB savings in IMX6
SPL).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Scott Wood <scottwood@freescale.com>
9 years agoimx: ventana: use stack relocation
Tim Harvey [Thu, 14 May 2015 13:22:07 +0000 (06:22 -0700)]
imx: ventana: use stack relocation

Certain features we desire require a larger stack than is available by using
iRAM (most notably for us, env_mmc). Relocate the stack to DRAM so that
we can use these features.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 years agoimx: ventana: add GSC boot watchdog disable to SPL
Tim Harvey [Sat, 9 May 2015 01:28:41 +0000 (18:28 -0700)]
imx: ventana: add GSC boot watchdog disable to SPL

If the SPL is to be used for Falcon mode then we need to make sure the SPL
disable the GSC boot watchdog.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: add gpio setup to SPL
Tim Harvey [Sat, 9 May 2015 01:28:39 +0000 (18:28 -0700)]
imx: ventana: add gpio setup to SPL

If the SPL is to be used for Falcon mode then we need to make sure it
configures basic GPIO (iomux, padconf, and default output levels).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: use common uart and i2c setup functions in SPL
Tim Harvey [Sat, 9 May 2015 01:28:38 +0000 (18:28 -0700)]
imx: ventana: use common uart and i2c setup functions in SPL

Now that uart and i2c setup functions have been moved to common.c we can
use these and remove code duplication.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: detect pmic using i2c probe instead of board model
Tim Harvey [Sat, 9 May 2015 01:28:37 +0000 (18:28 -0700)]
imx: ventana: detect pmic using i2c probe instead of board model

Avoid requiring board-model and probe pmic by its i2c address.
This is in preparation for being able to call pmic_setup() from SPL
and not need board type.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: move GSC boot watchdog disable function to gsc.c
Tim Harvey [Sat, 9 May 2015 01:28:36 +0000 (18:28 -0700)]
imx: ventana: move GSC boot watchdog disable function to gsc.c

Move the code that disables the GSC boot watchdog into gsc.c

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: split out common functions between SPL and uboot
Tim Harvey [Sat, 9 May 2015 01:28:35 +0000 (18:28 -0700)]
imx: ventana: split out common functions between SPL and uboot

Move shared functions used by both SPL and U-Boot to common.c:
 - setup_iomux_uart() and uart pad config
 - gpio pad config

In the process also moved the following to common.c in preparation for
calling it from the SPL:
 - split i2c setup into a shared function
 - move pmic init to setup_pmic() function to call directly from
   power_init_board()
 - split gpio setup into early (iomux and default pin config)
   and late (output configuration based on env)

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: default msata/pci mux to pci before PCI enumeration
Tim Harvey [Sat, 9 May 2015 01:28:34 +0000 (18:28 -0700)]
imx: ventana: default msata/pci mux to pci before PCI enumeration

PCI enumeration occurs early, before we fully configure our GPIO's. Make
sure we steer the MSATA/PCI mux to PCI in board_init to ensure PCI is
selected before enumeration.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: fix pcie reset for GW522x
Tim Harvey [Sat, 9 May 2015 01:28:33 +0000 (18:28 -0700)]
imx: ventana: fix pcie reset for GW522x

The re-assignment of pcie_rst gpio for GW522x needs to occur earlier, before
the PCI subsystem calls the toggle funciton.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: config: enable Thermal support
Tim Harvey [Sat, 9 May 2015 01:28:30 +0000 (18:28 -0700)]
imx: ventana: config: enable Thermal support

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: enable DM_SERIAL
Tim Harvey [Sat, 9 May 2015 01:28:29 +0000 (18:28 -0700)]
imx: ventana: enable DM_SERIAL

mxc_serial supports DM so lets use it.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: register gpio's with gpio_request
Tim Harvey [Sat, 9 May 2015 01:28:28 +0000 (18:28 -0700)]
imx: ventana: register gpio's with gpio_request

Prior to using a gpio a call to gpio_request() should be called to register
it with the gpio subsystem.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: config: enable driver model
Tim Harvey [Sat, 9 May 2015 01:28:27 +0000 (18:28 -0700)]
imx: ventana: config: enable driver model

Enable U-Boot Driver Model (DM).

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: config: enable gpio command
Tim Harvey [Sat, 9 May 2015 01:28:26 +0000 (18:28 -0700)]
imx: ventana: config: enable gpio command

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: display SPL boot device
Tim Harvey [Sat, 9 May 2015 01:28:25 +0000 (18:28 -0700)]
imx: ventana: display SPL boot device

Display what device the SPL will fetch uboot.img from

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoimx: ventana: set dtype env var to boot media
Tim Harvey [Sat, 9 May 2015 01:28:24 +0000 (18:28 -0700)]
imx: ventana: set dtype env var to boot media

Bootscripts for some distro's such as Android can benefit from knowing
what boot media its script was loaded from.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
9 years agoarm: mx6: ddr3: Remove dead code
Nikolay Dimitrov [Fri, 8 May 2015 10:06:50 +0000 (13:06 +0300)]
arm: mx6: ddr3: Remove dead code

imx6 mmdc supports data rates up to 1066 MT/s, so remove the code handling
higher data rates.

Signed-off-by: Nikolay Dimitrov <picmaster@mail.bg>
9 years agomx6: Set shared override bit in PL310 AUX_CTRL register
Fabio Estevam [Wed, 11 Mar 2015 20:12:12 +0000 (17:12 -0300)]
mx6: Set shared override bit in PL310 AUX_CTRL register

Having bit 22 cleared in the PL310 Auxiliary Control register (shared
attribute override enable) has the side effect of transforming Normal
Shared Non-cacheable reads into Cacheable no-allocate reads.

Coherent DMA buffers in Linux always have a Cacheable alias via the
kernel linear mapping and the processor can speculatively load cache
lines into the PL310 controller. With bit 22 cleared, Non-cacheable
reads would unexpectedly hit such cache lines leading to buffer
corruption.

This was inspired by a patch from Catalin Marinas [1] and also from recent
discussions in the linux-arm-kernel list [2] where Russell King and Rob Herring
suggested that bootloaders should initialize the cache.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2010-November/031810.html
[2] https://lkml.org/lkml/2015/2/20/199

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
9 years agotbs2910: add CONFIG_SUPPORT_EMMC_BOOT
Soeren Moch [Tue, 5 May 2015 21:09:21 +0000 (23:09 +0200)]
tbs2910: add CONFIG_SUPPORT_EMMC_BOOT

Add emmc boot partition commands to be able to select the boot partition.

Signed-off-by: Soeren Moch <smoch@web.de>
9 years agotbs2910: use default CONFIG_SYS_PBSIZE
Soeren Moch [Tue, 5 May 2015 21:09:20 +0000 (23:09 +0200)]
tbs2910: use default CONFIG_SYS_PBSIZE

Since there is a default CONFIG_SYS_PBSIZE definition in config_fallbacks.h,
this setting is no longer required in board configurations.

Signed-off-by: Soeren Moch <smoch@web.de>
9 years agotbs2910: only enable vga output for stdout/stderr when hdmi detected
Soeren Moch [Tue, 5 May 2015 21:09:19 +0000 (23:09 +0200)]
tbs2910: only enable vga output for stdout/stderr when hdmi detected

Only enable graphical output for stdout/stderr (and a usb keyboard for stdin)
when a hdmi device is detected.
Serial console is always enabled for stdin/stdout/stderr.

Signed-off-by: Soeren Moch <smoch@web.de>
9 years agotbs2910: support for usb otg host mode
Soeren Moch [Tue, 5 May 2015 21:09:18 +0000 (23:09 +0200)]
tbs2910: support for usb otg host mode

Add support for USB OTG host mode. Only high speed devices supported so far
(e.g. usb 2.0 hub required to connect a keyboard).

Signed-off-by: Soeren Moch <smoch@web.de>
9 years agowarp: README: Fix typo
Fabio Estevam [Tue, 12 May 2015 16:19:06 +0000 (13:19 -0300)]
warp: README: Fix typo

Fix the spelling of 'successful'.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
9 years agomx6cuboxi: Mention Cubox-i in the README
Fabio Estevam [Mon, 27 Apr 2015 12:20:53 +0000 (09:20 -0300)]
mx6cuboxi: Mention Cubox-i in the README

Cubox-i boards are also supported, so update the README file.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
9 years agohummingboard: Remove mx6solo specific support
Fabio Estevam [Mon, 27 Apr 2015 12:20:52 +0000 (09:20 -0300)]
hummingboard: Remove mx6solo specific support

Hummingboard dual, dual-lite and solo are now supported via SPL mechanism.

Remove the previous hummingboard support, which does not use SPL and supported
only the solo variant.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 years agoimx: ventana: fix boot to SD
Tim Harvey [Wed, 6 May 2015 20:16:56 +0000 (13:16 -0700)]
imx: ventana: fix boot to SD

This fixes a regression caused by e25fbe3fe531029dc7b100ea4c79dbc802e17fc2
(gw_ventana: Move the DCD settings to spl code)

The clock gating must be setup prior to calling arch_cpu_init(). Without this
booting to SD (directly via eFuse or via bmode) will hang.

Cc: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
9 years agoimx: dek_blob: Add explicit include for mapmem
Ulises Cardenas [Mon, 4 May 2015 14:53:28 +0000 (09:53 -0500)]
imx: dek_blob: Add explicit include for mapmem

 Boards such as imx6q_sabresd might not have mapmem.h as part of
 their common library. This causes a build error if the DEK blob
 command is enabled.

 Fix: make explicit the include of mapmem.h

Signed-off-by: Ulises Cardenas <Ulises.Cardenas@freescale.com>
Reviewed-by: Ruchika Gupta <Ruchika.gupta@freescale.com>
9 years agobugfix i.mx6 pwm: prevent overflow of period_c * duty_ns
Brecht Neyrinck [Wed, 6 May 2015 07:57:48 +0000 (09:57 +0200)]
bugfix i.mx6 pwm: prevent overflow of period_c * duty_ns

Prevent overflow by casting duty_ns to ull first. This bug came up when trying to create a 200 Hz PWM

Signed-off-by: Brecht Neyrinck <bnrn@psicontrol.com>
Acked-by: Heiko Schocher<hs@denx.de>
9 years agomx6cuboxi: Skip usb initialization when booting without HDMI
Fabio Estevam [Mon, 4 May 2015 17:09:23 +0000 (14:09 -0300)]
mx6cuboxi: Skip usb initialization when booting without HDMI

Starting USB initialization is useful for those who use Cuboxi/Hummingboard
with HDMI and USB keyboard.

However, when booting without a HDMI connection we can skip the usb
initialization, which makes the boot faster.

Signed-off-by: Jon Nettleton <jon.nettleton@gmail.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-By: Vagrant Cascadian <vagrant@aikidev.net>
9 years agoarm: mx6: tqma6: Update to optionally configure an alternative SPI setup
Stefan Roese [Thu, 12 Mar 2015 12:34:30 +0000 (13:34 +0100)]
arm: mx6: tqma6: Update to optionally configure an alternative SPI setup

By making the tqma6_iomuxc_spi() weak, this patch adds the possibility to
add a different function for this SPI configuration. This can be used
by other baseboards, that might have a different SPI setup.

This patch will be used by the upcoming WRU-IV board support which also
uses the TQMa6 SoM.

Signed-off-by: Stefan Roese <sr@denx.de>
9 years agoarm: mx6: tqma6: Fix USB and add other filesystems
Stefan Roese [Thu, 12 Mar 2015 12:34:29 +0000 (13:34 +0100)]
arm: mx6: tqma6: Fix USB and add other filesystems

This patch fixes the USB EHCI support on the TQMa6 SoM. Additionally
some filesystems are added, included the generic FS commands (e.g.
ls...).

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Markus Niebel <Markus.Niebel@tq-group.com>
Cc: Stefano Babic <sbabic@denx.de>
Acked-By: Markus Niebel <Markus.Niebel@tq-group.com>
9 years agomx6cuboxi: Pull down PAD_ENET_RXD0/RXD1
Fabio Estevam [Mon, 4 May 2015 14:22:56 +0000 (11:22 -0300)]
mx6cuboxi: Pull down PAD_ENET_RXD0/RXD1

Configure PAD_ENET_RXD0/RXD1 pads as pull down because these pads are directly
connected to the Atheros 8035/8030 although they should be functional
only in the RMII mode - 8030.

Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-By: Vagrant Cascadian <vagrant@aikidev.net>
9 years agomx6cuboxi: Fix Ethernet PHY detection problem
Fabio Estevam [Mon, 4 May 2015 14:22:55 +0000 (11:22 -0300)]
mx6cuboxi: Fix Ethernet PHY detection problem

mx6cuboxi sometimes fails to recognize the Ethernet PHY:

Net:   Phy 0 not found

The explanation for this behavior comes from from Rabeeh Khoury:

"The LED_ACT pin on the carrier-one boards had a pull down that
forces the phy address to 0x0; where on CuBox-i and the production
HummingBoard that pin is connected directly to LED that depending
on the pull down strength of the LED it might be sampled as '0' or '1' thus
the phy address might appear as either address 0x0 or 0x4."

"This is AR8035 implementation; in reset stage the LED pin is configured as
input, and pull up/down does matter. In this case it configures the PHY
address.

After reset is deasserted the same LED pin becomes output and then
according to the previous pull/up it should be active high/low"

One way to properly fix this behavior is to place external pull-up/down
resistors in the LED line, but from a software standpoint we can fix it
by telling phy_find_by_mask() to scan the PHY at addresses
0x0 and 0x4.

Reported-by: Vagrant Cascadian <vagrant@aikidev.net>
Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-By: Vagrant Cascadian <vagrant@aikidev.net>
9 years agologos: Add Solidrun's logo
Fabio Estevam [Thu, 30 Apr 2015 01:28:12 +0000 (22:28 -0300)]
logos: Add Solidrun's logo

Let Solidrun's logo appear on Cuboxi and Hummingboard by default.

Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 years agomx6cuboxi: Allow HDMI and USB keyboard to be stdout/stdin
Fabio Estevam [Thu, 30 Apr 2015 01:28:11 +0000 (22:28 -0300)]
mx6cuboxi: Allow HDMI and USB keyboard to be stdout/stdin

There are users of Cuboxi and Hummingboard that use these boards without
connecting them to a USB/serial adapter.

Allow such usage by allowing the HDMI port to act as stdout and USB keyboard
as stdin.

The serial console still also works as stdin/stdout.

Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Vagrant Cascadian <vagrant@aikidev.net>
9 years agomx6cuboxi: Add USB host support
Fabio Estevam [Thu, 30 Apr 2015 01:28:10 +0000 (22:28 -0300)]
mx6cuboxi: Add USB host support

Enable USB Host1 port.

Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-By: Vagrant Cascadian <vagrant@aikidev.net>
9 years agomx6cuboxi: Add HDMI output support
Fabio Estevam [Thu, 30 Apr 2015 01:28:09 +0000 (22:28 -0300)]
mx6cuboxi: Add HDMI output support

Add HDMI output using PLL5 as the source for the IPU clocks,
and accurate VESA timings.

These settings are based on the patch from Soeren Moch <smoch@web.de>
submitted for the tbs2910 mx6 based board.

It allows the display to work properly at 1024x768@60.

This should make the hdmi output signal compatible with most if not all
modern displays.

Signed-off-by: Jon Nettleton <jon.nettleton@gmail.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Rabeeh Khoury <rabeeh@solid-run.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Vagrant Cascadian <vagrant@aikidev.net>
9 years agoFix mxc_hab documenation
Ulises Cardenas [Mon, 20 Apr 2015 18:47:58 +0000 (13:47 -0500)]
Fix mxc_hab documenation

It is necessary to modify the configuration file for the target
board. It wasn't well documented that to enable any of the secure
boot modes, it is required to add CONFIG_SECURE_BOOT to the board
configuration file.

Also, fixed a typo in the encrypted boot section.

Signed-off-by: Ulises Cardenas <Ulises.Cardenas@freescale.com>
9 years agoarm: mx6: Clamp MMDC and DDR3 clocks for timing calculations
Nikolay Dimitrov [Wed, 22 Apr 2015 15:37:31 +0000 (18:37 +0300)]
arm: mx6: Clamp MMDC and DDR3 clocks for timing calculations

This is proposal for clamping the MMDC/DDR3 clocks to the maximum supported
frequencies as per imx6 SOC models, and for dynamically calculating valid
clock value based on mem_speed.

Currently the code uses impossible values for mem_speed (1333, 1600 MT/s) for
calculating the DDR timings, and uses fixed clock (528 or 400 MHz) which
doesn't take into account DDR3 memory limitations.

Signed-off-by: Nikolay Dimitrov <picmaster@mail.bg>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tim Harvey <tharvey@gateworks.com>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
9 years agosandbox: defconfig: enable support of sandbox PMIC drivers
Przemyslaw Marczak [Wed, 13 May 2015 11:38:36 +0000 (13:38 +0200)]
sandbox: defconfig: enable support of sandbox PMIC drivers

This commit enables:
- emulated i2c PMIC driver
- sandbox PMIC I/O driver
- sandbox PMIC's regulator driver

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: dts: add sandbox_pmic.dtsi and include it to sandbox.dts and test.dts
Przemyslaw Marczak [Wed, 13 May 2015 11:38:35 +0000 (13:38 +0200)]
sandbox: dts: add sandbox_pmic.dtsi and include it to sandbox.dts and test.dts

This commit adds dtsi file for Sandbox PMIC.
It fully describes the PMIC by:
- i2c emul node - with a default settings of 16 registers
- 2x buck regulator nodes
- 2x ldo regulator nodes

The default register settings are set with preprocessor macros:
- VAL2REG(min[uV/uA], step[uV/uA], val[uV/uA])
- VAL2OMREG(mode id)
Both defined in file:
- include/dt-bindings/pmic/sandbox_pmic.h

The Voltage ranges of each regulator can be found in:
- include/power/sandbox_pmic.h

The new file is included into:
- sandbox.dts
- test.dts

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agotest: dm: test.dts - move to sandbox dts directory
Przemyslaw Marczak [Wed, 13 May 2015 11:38:34 +0000 (13:38 +0200)]
test: dm: test.dts - move to sandbox dts directory

The file test.dts from driver model test directory,
was compiled by call dtc in script: test/dm/test-dm.sh.

This doesn't allow for including of dtsi files and using
of C preprocessor routines in this dts file.

Since the mentioned script builds U-Boot before tests,
then moving the test.dts file into sandbox dts directory
is reasonable.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agotest: dm: add sandbox PMIC framework tests
Przemyslaw Marczak [Wed, 13 May 2015 11:38:33 +0000 (13:38 +0200)]
test: dm: add sandbox PMIC framework tests

This change adds new file to sandbox driver model test environment.
The file is: test/dm/power.c, and it includes tests for PMIC framework,
which includes PMIC uclass and REGULATOR uclass.

All tests are based od Sandbox PMIC emulated device. Some test constants for
this device are defined in the header: include/power/sandbox_pmic.h

PMIC tests includes:
- pmic get - tests, that pmic_get() returns the requested device
- pmic I/O - tests I/O by writing and reading some values to PMIC's registers
             and then compares, that the write/read values are equal.

The regulator tests includes:
- Regulator get by devname/platname
- Voltage set/get
- Current set/get
- Enable set/get
- Mode set/get
- Autoset
- List autoset

For the regulator 'get' test, the returned device pointers are compared,
and their names are also compared to the requested one.
Every other test, first sets the given attribute and next try to get it.
The test pass, when the set/get values are equal.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: add: sandbox PMIC device drivers: I2C emul, pmic, regulator
Przemyslaw Marczak [Wed, 13 May 2015 11:38:32 +0000 (13:38 +0200)]
sandbox: add: sandbox PMIC device drivers: I2C emul, pmic, regulator

This commit adds emulation of sandbox PMIC device, which includes:
- PMIC I2C emulation driver
- PMIC I/O driver (UCLASS_PMIC)
- PMIC regulator driver (UCLASS_REGULATOR)

The sandbox PMIC has 12 significant registers and 4 as padding to 16 bytes,
which allows using 'i2c md' command with the default count (16).

The sandbox PMIC provides regulators:
- 2x BUCK
- 2x LDO

Each, with adjustable output:
- Enable state
- Voltage
- Current limit (LDO1/BUCK1 only)
- Operation mode (different for BUCK and LDO)

Each attribute has it's own register, beside the enable state, which depends
on operation mode.

The header file: sandbox_pmic.h includes PMIC's default register values,
which are set on i2c pmic emul driver's probe() method.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: i2c: search child emul dev and check its uclass id
Przemyslaw Marczak [Wed, 13 May 2015 11:38:31 +0000 (13:38 +0200)]
sandbox: i2c: search child emul dev and check its uclass id

The function get_emul() in sandbox i2c bus driver, always returns
first child as i2c emul device. This may only work for i2c devices
with a single child, which is an only i2c emul device.

In case when i2c device has more than one child (e.g. PMIC), and
one is i2c emul, then the function should search it by check uclass
id for each child. This patch add this change to the get_emul().

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agodoc: driver-model: pmic-framework.txt - cleanup
Przemyslaw Marczak [Wed, 13 May 2015 11:38:30 +0000 (13:38 +0200)]
doc: driver-model: pmic-framework.txt - cleanup

This commit cleanups the PMIC framework documentation.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agocommon: cmd regulator: command cleanup
Przemyslaw Marczak [Wed, 13 May 2015 11:38:29 +0000 (13:38 +0200)]
common: cmd regulator: command cleanup

This commit cleanups the regulator command.
The first change, is adjusting "regulator dev" command to use
"regulator-name" constraint, for setting the operating device.
Thanks to this, the regulator_get() function is removed.

This also updates do_list() function, with loop over uclass_find_*
function calls, to prevent probe of all listed regulators.

This also cleanups the printing in command.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agocommon: cmd pmic: command cleanup
Przemyslaw Marczak [Wed, 13 May 2015 11:38:28 +0000 (13:38 +0200)]
common: cmd pmic: command cleanup

This commit cleanups the use of function: failed().
The new function name is: failure(), and it is used
for print errno and the errno-related message only.

The second change is choosing PMIC device by it's name,
instead of seq number. Thanks to this change, for set
the current device, call of pmic_get() is enough.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agodm: regulator: uclass driver code cleanup
Przemyslaw Marczak [Wed, 13 May 2015 11:38:27 +0000 (13:38 +0200)]
dm: regulator: uclass driver code cleanup

This cleanup includes:
- remove of the preprocessor macros which pointed to long name functions
- update of the names of some regulator uclass driver functions
- cleanup of the function regulator_autoset()
- reword of some comments of regulator uclass header file
- regulator_get_by_platname: check error for uclass_find_* function calls
- add function: regulator_name_is_unique
- regulator post_bind(): check regulator name uniqueness
- fix mistakes in: regulator/Kconfig
- regulator.h: update comments
- odroid u3: cleanup the regulator calls

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agodm: pmic: code cleanup of PMIC uclass driver
Przemyslaw Marczak [Wed, 13 May 2015 11:38:26 +0000 (13:38 +0200)]
dm: pmic: code cleanup of PMIC uclass driver

The cleanup includes:
- pmic.h - fix mistakes in a few comments
- pmic operations: value 'reg_count' - redefine as function call
- fix function name: pmic_bind_childs() -> pmic_bind_children()
- pmic_bind_children: change the 'while' loop with the 'for'
- add implementation of pmic_reg_count() method
- pmic_bind_children() - update function call name
- Kconfig: add new line at the end of file
- Update MAX77686 driver code

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested on sandbox:
Tested-by: Simon Glass <sjg@chromium.org>
9 years agoodroid: enable driver model pmic/regulator API and MAX77686 drivers
Przemyslaw Marczak [Wed, 13 May 2015 11:38:25 +0000 (13:38 +0200)]
odroid: enable driver model pmic/regulator API and MAX77686 drivers

This change enables the configs required to init and setup max77686
regulator driver, using the new driver model pmic and regulator API.
And also changes the old pmic framework calls to the new ones.

This commits enables:
- CONFIG_ERRNO_STR
- CONFIG_DM_PMIC
- CONFIG_DM_PMIC_CMD
- CONFIG_DM_PMIC_MAX77686
- CONFIG_DM_REGULATOR
- CONFIG_DM_REGULATOR_CMD
- CONFIG_DM_REGULATOR_MAX77686

And removes the unused:
- CONFIG_DM_I2C_COMPAT
- CONFIG_POWER
- CONFIG_POWER_I2C
- CONFIG_POWER_MAX77686

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoodroid: dts: add 'voltage-regulators' description to max77686 node
Przemyslaw Marczak [Wed, 13 May 2015 11:38:24 +0000 (13:38 +0200)]
odroid: dts: add 'voltage-regulators' description to max77686 node

Adding regulators subnode to fdt max77686 node, allows properly init
regulators by the max77686 regulator driver. This enables the complete
functionality of the regulator command.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: board:samsung: power_init_board: add requirement of CONFIG_DM_PMIC
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:50 +0000 (20:07 +0200)]
dm: board:samsung: power_init_board: add requirement of CONFIG_DM_PMIC

In the power_init_board function call, regulator driver init is called,
so before compile, make sure that any power framework is defined.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodoc: driver-model: pmic and regulator uclass documentation
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:49 +0000 (20:07 +0200)]
doc: driver-model: pmic and regulator uclass documentation

Since this framework is still under the construction, the main
documentation is kept in the header files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: regulator: add fixed voltage regulator driver
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:48 +0000 (20:07 +0200)]
dm: regulator: add fixed voltage regulator driver

This driver implements regulator operations for fixed Voltage/Current
value regulators. beside the standard regulator constraints, which are
put into the uclass platform data, a typical fixed regulator node provides
few additional properties like:
- gpio
- gpio-open-drain
- enable-active-high
- startup-delay-us
The only 'gpio' is used by this driver and is kept in structure of type
'fixed_regulator_platdata', as a device platform data (dev->platdata).

The driver implements:
- get_value
- get_current
- get_enable
- set_enable

The regulator calls and commands can be used for fixed-regulator devices,
and the proper error will be returned for prohibited.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: regulator: add max77686 regulator driver
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:47 +0000 (20:07 +0200)]
dm: regulator: add max77686 regulator driver

This commit adds support to MAX77686 regulator driver,
based on a driver model regulator's API. It implements
almost all regulator operations, beside those for setting
and geting the Current value.
For proper bind and operation it requires the MAX77686 PMIC driver.

New file: drivers/power/regulator/max77686.c
New config: CONFIG_DM_REGULATOR_MAX77686

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: pmic: add max77686 pmic driver
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:46 +0000 (20:07 +0200)]
dm: pmic: add max77686 pmic driver

This is the implementation of driver model PMIC driver.
The max77686 PMIC driver implements read/write operations and driver
bind method - to bind its childs.

This driver will try to bind the regulator devices by using it's child
info array with regulator prefixes and driver names. This should succeed
when compatible regulator driver is compiled. If no regulator driver found,
then the pmic can still provide read/write operations, and can be used with
PMIC function calls.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agopmic: max77686 set the same compatible as in the kernel
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:45 +0000 (20:07 +0200)]
pmic: max77686 set the same compatible as in the kernel

This commit also updates the proper dts files.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: regulator: add regulator command
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:44 +0000 (20:07 +0200)]
dm: regulator: add regulator command

This command is based on driver model regulator's API.
The user interface provides:
- list UCLASS regulator devices
- show or [set] operating regulator device
- print constraints info
- print operating status
- print/[set] voltage value [uV] (force)
- print/[set] current value [uA]
- print/[set] operating mode id
- enable the regulator output
- disable the regulator output

The 'force' option can be used for setting the value which exceeds
the constraints min/max limits.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: pmic: add pmic command
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:43 +0000 (20:07 +0200)]
dm: pmic: add pmic command

This is new command for the PMIC devices based on driver model PMIC API.
Command features are unchanged:
- list UCLASS pmic devices
- show or [set] operating pmic device (NEW)
- dump registers
- read byte of register at address
- write byte to register at address

The only one change for this command is 'dev' subcommand.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: regulator: add implementation of driver model regulator uclass
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:42 +0000 (20:07 +0200)]
dm: regulator: add implementation of driver model regulator uclass

This commit introduces the implementation of dm regulator API.
Device tree support allows for auto binding. And by the basic
uclass operations, it allows to driving the devices in a common
way. For detailed informations, please look into the header file.

Core files:
- drivers/power/regulator-uclass.c - provides regulator common functions api
- include/power/regulator.h - define all structures required by the regulator

Changes:
- new uclass-id: UCLASS_REGULATOR
- new config: CONFIG_DM_REGULATOR

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: pmic: add implementation of driver model pmic uclass
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:41 +0000 (20:07 +0200)]
dm: pmic: add implementation of driver model pmic uclass

This commit introduces the PMIC uclass implementation.
It allows providing the basic I/O interface for PMIC devices.
For the multi-function PMIC devices, this can be used as I/O
parent device, for each IC's interface. Then, each PMIC particular
function can be provided by the child device's operations, and the
child devices will use its parent for read/write by the common API.

Core files:
- 'include/power/pmic.h'
- 'drivers/power/pmic/pmic-uclass.c'

The old pmic framework is still kept and is independent.

For more detailed informations, please look into the header file.

Changes:
- new uclass-id: UCLASS_PMIC
- new config: CONFIG_DM_PMIC

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agolib: Kconfig: add entry for errno_str() function
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:40 +0000 (20:07 +0200)]
lib: Kconfig: add entry for errno_str() function

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoexynos4-common: remove the unsued CONFIG_CMD_PMIC
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:39 +0000 (20:07 +0200)]
exynos4-common: remove the unsued CONFIG_CMD_PMIC

This config name was never used, because the present pmic command
was precompiled for the CONFIG_POWER.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoexynos5: fix build break by adding CONFIG_POWER
Przemyslaw Marczak [Mon, 20 Apr 2015 18:07:38 +0000 (20:07 +0200)]
exynos5: fix build break by adding CONFIG_POWER

Move the configs listed below from exynos5-dt-common.h to exynos5-common.h:
- CONFIG_POWER
- CONFIG_POWER_I2C
fixes build break for Arndale and Smdk5250 boards.

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoi2c: mxc: refactor i2c driver and support dm
Peng Fan [Thu, 14 May 2015 23:29:12 +0000 (07:29 +0800)]
i2c: mxc: refactor i2c driver and support dm

1. Introduce a new structure `struct mxc_i2c_bus`, this structure will
   used for non-DM and DM.
2. Remove `struct mxc_i2c_regs` structure, but use register offset to access
   registers based on `base` entry of `struct mxc_i2c_bus`.
3. Remove most `#ifdef I2C_QUIRK_REG`. Using driver_data to contain platform
   flags. A new flag is introduced, I2C_QUIRK_FLAG.
4. Most functions use `struct mxc_i2c_bus` as one of the parameters.
   Make most functions common to DM and non-DM, try to avoid duplicated code.
5. Support DM, but pinctrl is not included. Pinmux setting is still set
   by setup_i2c, but we do not need bus_i2c_init for DM.
6. struct i2c_parms and struct sram_data are removed.
7. Remove bus_i2c_read bus_i2c_write prototype in header file. The frist
   paramter of bus_i2c_init is modified to i2c index. Add new prototype
   i2c_idle_bus and force_bus_idle. Since bus_i2c_init is not good for
   DM I2C and pinctrl is missed, we use a weak function for i2c_idle_bus.
   Board file take the responsibility to implement this function, like this:
   "
   int i2c_idle_bus(struct mxc_i2c_bus *i2c_bus)
   {
   if (i2c_bus->index == 0)
   force_bus_idle(i2c_pads_info0);
   else if (i2c_bus->index == 1)
   force_bus_idle(i2c_pads_info1);
   else
   xxxxxx
   }
   "
8. Introduce a weak function, enable_i2c_clk
9. Tested on an i.MX7 platform. Log info:
 => dm tree
 Class       Probed   Name
 ----------------------------------------
 root        [ + ]    root_driver
 simple_bus  [   ]    |-- soc
 simple_bus  [   ]    |   |-- aips-bus@30000000
 simple_bus  [   ]    |   |   |-- anatop@30360000
 simple_bus  [   ]    |   |   `-- snvs@30370000
 simple_bus  [   ]    |   |-- aips-bus@30400000
 simple_bus  [   ]    |   `-- aips-bus@30800000
 i2c         [   ]    |       |-- i2c@30a20000
 i2c         [   ]    |       `-- i2c@30a40000
 simple_bus  [   ]    `-- regulators
 => i2c dev 0
 Setting bus to 0
 => i2c probe
 Valid chip addresses: 08 50
 => i2c md 8 31
 0031: 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08 08

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agoimx: mx27 move GPIO_PORTx to gpio.h
Peng Fan [Thu, 14 May 2015 23:29:13 +0000 (07:29 +0800)]
imx: mx27 move GPIO_PORTx to gpio.h

These GPIO_PORTx macros should be in gpio.h, but not in imx-regs.h.

Also, imx-regs.h and iomux-v3.h has same macro defintion for
GPIO_PORTx, and both of them are included in mxc_i2c.c(include
mxc_i2c.h). This will incur build warnings with macro redefinition.

Since iomux-v3.h is not compatible with mx27, we can not simply
include iomux-v3.h for mx27, so move the GPIO_PORTx to gpio.h to
fix the build warning.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
9 years agosunxi: Change usb-kbd interrupt polling to use an usb interrupt queue
Hans de Goede [Wed, 13 May 2015 12:42:18 +0000 (14:42 +0200)]
sunxi: Change usb-kbd interrupt polling to use an usb interrupt queue

Now that the ohci code supports usb interrupt queues we can switch (back)
to using an usb interrupt queue for usb-kbd interrupt polling. This
greatly reduces u-boot's latency when dealing with usb keyboards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Reviewed-by: Marek Vasut <marex@denx.de>
9 years agousb: ohci: Add support for interrupt queues
Hans de Goede [Wed, 13 May 2015 12:42:17 +0000 (14:42 +0200)]
usb: ohci: Add support for interrupt queues

Add support for interrupt queues to the ohci hcd code, bringing it inline
with the ehci and musb-new(host) code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Marek Vasut <marex@denx.de>
9 years agousb: ohci: Add an ohci_alloc_urb() function
Hans de Goede [Wed, 13 May 2015 12:42:16 +0000 (14:42 +0200)]
usb: ohci: Add an ohci_alloc_urb() function

Add an ohci_alloc_urb() function, this is a preparation patch for adding
interrupt queue support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Marek Vasut <marex@denx.de>
9 years agousb: ohci: Do not reuse ed for interrupt endpoints of different devices
Hans de Goede [Wed, 13 May 2015 12:42:15 +0000 (14:42 +0200)]
usb: ohci: Do not reuse ed for interrupt endpoints of different devices

When submitting interrupt packets to an endpoint we only link in the ed
once to avoid some races surrounding unlinking of periodic endpoints,
but we share one ohci_device struct / one set of ed-s for all devices,
which means that if we have an interrupt endpoint at endpoint 1 with one
device, and a non interrupt endpoint 1 with another device we end up
with the same ed linked into both the periodic and async lists, which is
not good (tm).

This commit switches over to using separate ohci_device structs, and thus
separate ed-s for devices with interrupt endpoints, fixing this.

This fixes e.g. matching a usb storage device and keyboard on the same
usb-1 hub not working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Marek Vasut <marex@denx.de>
9 years agosandbox: Support wide-screen LCD emulation
Simon Glass [Mon, 4 May 2015 17:31:12 +0000 (11:31 -0600)]
sandbox: Support wide-screen LCD emulation

Increase the LCD size to 1366x768.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: Fix warning in display_options
Simon Glass [Mon, 4 May 2015 17:31:11 +0000 (11:31 -0600)]
sandbox: Fix warning in display_options

This fixes a warning in the print_buffer() function with some toolchains.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
9 years agosandbox: spi: Add newline to printf() in sandbox_sf_probe
Simon Glass [Mon, 4 May 2015 17:31:10 +0000 (11:31 -0600)]
sandbox: spi: Add newline to printf() in sandbox_sf_probe

This printf() should have a newline at the end. Add it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
9 years agosandbox: cros_ec: Support EC_CMD_ENTERING_MODE emulation
Simon Glass [Mon, 4 May 2015 17:31:09 +0000 (11:31 -0600)]
sandbox: cros_ec: Support EC_CMD_ENTERING_MODE emulation

Emualate this function which is used with Chrome OS verified boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: Add missing errno.h includes in a few files
Simon Glass [Mon, 4 May 2015 17:31:08 +0000 (11:31 -0600)]
sandbox: Add missing errno.h includes in a few files

These files use error numbering, so add the include.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agosandbox: Correct error handling in state_read_file()
Simon Glass [Mon, 4 May 2015 17:31:07 +0000 (11:31 -0600)]
sandbox: Correct error handling in state_read_file()

This function should return a useful error for U-Boot, rather than -1.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
9 years agoarm: Add a prototype for save_boot_params_ret()
Simon Glass [Mon, 4 May 2015 17:31:03 +0000 (11:31 -0600)]
arm: Add a prototype for save_boot_params_ret()

It is convenient for some boards to implement save_boot_params() in C rather
than assembler. Provide a way to return in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
9 years agoarm: Include the .got section in the binary
Simon Glass [Mon, 4 May 2015 17:31:02 +0000 (11:31 -0600)]
arm: Include the .got section in the binary

Commit 47ed5dd0 dropped the .got section from U-Boot binaries. This is needed
for some relocations, and causes failures if missing. Add it back.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: gpio: Fix comment typo in GPIOD_IS_IN
Simon Glass [Mon, 4 May 2015 17:31:01 +0000 (11:31 -0600)]
dm: gpio: Fix comment typo in GPIOD_IS_IN

This should say 'in', not 'out'.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agotpm: Rename Infineon TPM to slb9645tt
Simon Glass [Mon, 4 May 2015 17:31:00 +0000 (11:31 -0600)]
tpm: Rename Infineon TPM to slb9645tt

This name is used in Linux, so use it in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agotpm: Support using driver model with I2C
Simon Glass [Mon, 4 May 2015 17:30:59 +0000 (11:30 -0600)]
tpm: Support using driver model with I2C

As a first step towards converting the TPM system to driver model, allow it
to work with CONFIG_DM_I2C.

Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agodm: i2c: Add a function to find out the chip offset length
Simon Glass [Mon, 4 May 2015 17:30:58 +0000 (11:30 -0600)]
dm: i2c: Add a function to find out the chip offset length

We can currently set this but there is no API function to get it. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Heiko Schocher<hs@denx.de>
9 years agodm: i2c: Implement 'i2c bus' command for driver model
Simon Glass [Mon, 4 May 2015 17:30:57 +0000 (11:30 -0600)]
dm: i2c: Implement 'i2c bus' command for driver model

This command was missed in the conversion. Add it back for driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Heiko Schocher <hs@denx.de>
9 years agobootstage: Add IDs for SPI flash reading and decompression
Simon Glass [Mon, 4 May 2015 17:30:56 +0000 (11:30 -0600)]
bootstage: Add IDs for SPI flash reading and decompression

We maintain an accumulator for time spent reading from SPI flash, since
this can be significant on some platforms. Also add one for decompression
time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Jagan Teki <jteki@openedev.com>
9 years agousb: add device connection/disconnection detection
Vincent Palatin [Mon, 4 May 2015 17:30:54 +0000 (11:30 -0600)]
usb: add device connection/disconnection detection

Provide a function to detect USB device insertion/removal in order to
avoid having to do USB enumeration in a tight loop when trying to detect
peripheral hotplugging.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agosunxi: ohci: Add ohci usb host controller support
Hans de Goede [Sun, 10 May 2015 12:10:27 +0000 (14:10 +0200)]
sunxi: ohci: Add ohci usb host controller support

This commit adds support for the OHCI companion controller, which makes
usb-1 devices directly plugged into to usb root port work.

Note for now this switches usb-keyboard support for sunxi back from int-queue
support to the old interrupt polling method. Adding int-queue support to the
ohci code and switching back to int-queue support is in the works.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agosunxi: ehci: Convert to the driver-model
Hans de Goede [Sun, 10 May 2015 12:10:26 +0000 (14:10 +0200)]
sunxi: ehci: Convert to the driver-model

Convert sunxi-boards which use the sunxi-ehci code to the driver-model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
9 years agousb: ohci: Add dm support
Hans de Goede [Sun, 10 May 2015 12:10:25 +0000 (14:10 +0200)]
usb: ohci: Add dm support

Add driver-model support to the ohci code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Marek Vasut <marex@denx.de>
9 years agousb: ohci: Skip unnecessary mdelay(1) calls in various places
Hans de Goede [Sun, 10 May 2015 12:10:24 +0000 (14:10 +0200)]
usb: ohci: Skip unnecessary mdelay(1) calls in various places

For some reason the ohci code is full with:

 #ifdef DEBUG
pkt_print(...)
 #else
mdelay(1);
 #endif

AFAICT there is no reason for the mdelay(1) calls. This commit disables them
when building the ohci code for new driver-model using boards. It leaves
the mdelay(1) calls in place when building for older boards, so as to avoid
causing any regressions there.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agousb: ohci: Remove unnecessary delays from hc_start and power power-on paths
Hans de Goede [Sun, 10 May 2015 12:10:23 +0000 (14:10 +0200)]
usb: ohci: Remove unnecessary delays from hc_start and power power-on paths

The usb spec says that we must wait a minimum amount of time after port
power on (exact time is in the hub descriptor), this is something which
we must not only do for root ports but also for external hub ports, which
is why the common usb_hub code already waits a full second after powering
up ports. Having a separate wait for just the root hub in the ohci-hcd
code only leads to doing the waiting twice for the root ports, so drop the
wait from the ohci-hcd code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agousb: ohci: Do not resubmit and leak urbs for interrupt packets
Hans de Goede [Sun, 10 May 2015 12:10:22 +0000 (14:10 +0200)]
usb: ohci: Do not resubmit and leak urbs for interrupt packets

The u-boot usb code uses polling for all endpoints, including interrupt
endpoints, so urbs should never be automatically resubmitted.

This also fixes a leak of the urb, as submit_int_msg() did not check if
an already re-submitted urb exists before creating a new one.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Marek Vasut <marex@denx.de>
9 years agodm: usb: Do not scan companion buses if no devices where handed over
Hans de Goede [Sun, 10 May 2015 12:10:21 +0000 (14:10 +0200)]
dm: usb: Do not scan companion buses if no devices where handed over

USB scanning is slow, and there is no need to scan the companion buses
if no usb devices where handed over to the companinon controllers by any
of the main controllers.

This saves e.g. 2 seconds when booting a A10 OLinuxIno Lime with no USB-1
devices plugged into the root usb ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: usb: Add support for companion controllers
Hans de Goede [Sun, 10 May 2015 12:10:20 +0000 (14:10 +0200)]
dm: usb: Add support for companion controllers

USB companion controllers must be scanned after the main controller has
been scanned, so that any devices which the main controller which to hand
over to the companion have actually been handed over before we scan the
companion.

As there are no guarantees that this will magically happen in the right
order, split the scanning of the buses in 2 phases, first main controllers,
and then companion controllers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: usb: Move printing of usb scan status to usb_scan_bus()
Hans de Goede [Sun, 10 May 2015 12:10:19 +0000 (14:10 +0200)]
dm: usb: Move printing of usb scan status to usb_scan_bus()

Move printing of usb scan status to usb_scan_bus().

This is a preparation patch for adding companion controller support to the
usb uclass.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: usb: Add support for interrupt queues to the dm usb code
Hans de Goede [Sun, 10 May 2015 12:10:18 +0000 (14:10 +0200)]
dm: usb: Add support for interrupt queues to the dm usb code

Interrupt endpoints typically are polled for a long time by the usb
controller before they return anything, so calls to submit_int_msg() can
take a long time to complete this.

To avoid this the u-boot code has the an interrupt queue mechanism / API,
add support for this to the driver-model usb code and implement it for the
dm ehci code.

See the added doc comments for more details.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agodm: usb: Prefix ehci interrupt-queue functions with _ehci_
Hans de Goede [Mon, 11 May 2015 18:43:52 +0000 (20:43 +0200)]
dm: usb: Prefix ehci interrupt-queue functions with _ehci_

This is a preparation patch for adding interrupt-queue support to the
ehci dm code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Simon Glass <sjg@chromium.org>
9 years agousb: Stop reset procedure when a dev is handed over to a companion hcd
Hans de Goede [Sun, 10 May 2015 12:10:16 +0000 (14:10 +0200)]
usb: Stop reset procedure when a dev is handed over to a companion hcd

Short circuit the retry loop in legacy_hub_port_reset() by returning an
error from usb_control_msg() when a device was handed over to a companion
by the ehci code. This avoids trying to reset low / fullspeed devices 5
times needlessly. Also do not print an error when a device has been handed
over.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>