project/bcm63xx/u-boot.git
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>
9 years agousb: legacy_hub_port_reset() check and propagate usb_set_port_feature() errors
Hans de Goede [Sun, 10 May 2015 12:10:15 +0000 (14:10 +0200)]
usb: legacy_hub_port_reset() check and propagate usb_set_port_feature() errors

Actually check for usb_set_port_feature() errors and propagate these if they
happen.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agousb: usb_control_msg() propagate controller error code
Hans de Goede [Sun, 10 May 2015 12:10:14 +0000 (14:10 +0200)]
usb: usb_control_msg() propagate controller error code

Propagate the error returned by submit_control_msg() rather then always
returning -EIO when the hcd code indicates an error.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agousb: Fix handover of full-speed devices from ehci to companion
Hans de Goede [Sun, 10 May 2015 12:10:13 +0000 (14:10 +0200)]
usb: Fix handover of full-speed devices from ehci to companion

When after a reset the port status connection bit is still set and the enable
bit is not then we're dealing with a full-speed device and should hand it over
to the companion controller.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agoarch/arm/lib/bootm-fdt.c: Guard the include of <asm/armv7.h>
Tom Rini [Thu, 14 May 2015 15:07:03 +0000 (11:07 -0400)]
arch/arm/lib/bootm-fdt.c: Guard the include of <asm/armv7.h>

With d6b72da0 we started including this file unconditionally.  This
isn't allowed in a file that we also use on armv8.  This will get
cleaned up a bit better once we really start using these same features
(and have similar fdt updates needed) on armv8.

Signed-off-by: Tom Rini <trini@konsulko.com>
9 years agoUse map_sysmem when accessing memory in setexpr
Joe Hershberger [Mon, 11 May 2015 18:53:13 +0000 (13:53 -0500)]
Use map_sysmem when accessing memory in setexpr

The setexpr command used to segfault when accessing memory in sandbox.
The pointer accesses should be mapped.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
9 years agoMerge branch 'master' of git://git.denx.de/u-boot-tegra
Tom Rini [Thu, 14 May 2015 11:01:11 +0000 (07:01 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-tegra

9 years agoMerge branch 'master' of git://git.denx.de/u-boot-arc
Tom Rini [Thu, 14 May 2015 10:59:35 +0000 (06:59 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-arc

9 years agoMerge branch 'master' of git://git.denx.de/u-boot-atmel
Tom Rini [Thu, 14 May 2015 10:59:30 +0000 (06:59 -0400)]
Merge branch 'master' of git://git.denx.de/u-boot-atmel

9 years agospl: Correct address in spl_relocate_stack_gd()
Simon Glass [Thu, 14 May 2015 03:15:21 +0000 (21:15 -0600)]
spl: Correct address in spl_relocate_stack_gd()

During the Kconfig conversion one of the changes was missed.
CONFIG_SPL_STACK_R should be CONFIG_SPL_STACK_R_ADDR since we want the
address.

Reported-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
9 years agoARM: tegra: move NVIDIA common files to arch/arm/mach-tegra
Masahiro Yamada [Mon, 13 Apr 2015 01:51:14 +0000 (10:51 +0900)]
ARM: tegra: move NVIDIA common files to arch/arm/mach-tegra

All the Tegra boards borrow the files from board/nvidia/common/
directory, i.e., board/nvidia/common/* are not vendor-common files,
but SoC-common files.

Move NVIDIA common files to arch/arm/mach-tegra/ to clean up
Makefiles.

As arch/arm/mach-tegra/board.c already exists, this commit renames
board/nvidia/common/board.c to arch/arm/mach-tegra/board2.c,
expecting they will be consolidated as a second step.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agojetson-tk1: Add PSCI configuration options and reserve secure code
Ian Campbell [Tue, 21 Apr 2015 05:18:40 +0000 (07:18 +0200)]
jetson-tk1: Add PSCI configuration options and reserve secure code

The secure world code is relocated to the MB just below the top of 4G, we
reserve it in the FDT (by setting CONFIG_ARMV7_SECURE_RESERVE_SIZE) but it is
not protected in h/w.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra: Boot in non-secure mode by default
Jan Kiszka [Tue, 21 Apr 2015 05:18:39 +0000 (07:18 +0200)]
tegra: Boot in non-secure mode by default

Upstream Linux is broken with default configs when PSCI, thus non-secure
mode is enabled. So the user should explicitly enable this mode, e.g.
when she disabled CONFIG_CPU_IDLE in Linux (in which case it's safe to
use). We can revert this workaround once Linux got fixed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: tegra: Enable SMMU when going non-secure
Thierry Reding [Tue, 21 Apr 2015 05:18:38 +0000 (07:18 +0200)]
ARM: tegra: Enable SMMU when going non-secure

Make sure to enable the SMMU when booting the kernel in non-secure mode.
This is necessary because some of the SMMU registers are restricted to
TrustZone-secured requestors, hence the kernel wouldn't be able to turn
the SMMU on. At the same time, enable translation for all memory clients
for the same reasons. The kernel will still be able to control SMMU IOVA
translation using the per-SWGROUP enable bits.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra: Set CNTFRQ for secondary CPUs
Jan Kiszka [Tue, 21 Apr 2015 05:18:37 +0000 (07:18 +0200)]
tegra: Set CNTFRQ for secondary CPUs

We only set CNTFRQ in arch_timer_init for the boot CPU. But this has to
happen for all cores.

Fixing this resolves problems of KVM with emulating the generic
timer/counter.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra124: Reserve secure RAM using MC_SECURITY_CFG{0, 1}_0
Ian Campbell [Tue, 21 Apr 2015 05:18:36 +0000 (07:18 +0200)]
tegra124: Reserve secure RAM using MC_SECURITY_CFG{0, 1}_0

These registers can be used to prevent non-secure world from accessing a
megabyte aligned region of RAM, use them to protect the u-boot secure monitor
code.

At first I tried to do this from s_init(), however this inexplicably causes
u-boot's networking (e.g. DHCP) to fail, while networking under Linux was fine.

So instead I have added a new weak arch function protect_secure_section()
called from relocate_secure_section() and reserved the region there. This is
better overall since it defers the reservation until after the sec vs. non-sec
decision (which can be influenced by an envvar) has been made when booting the
os.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
[Jan: tiny style adjustment]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra124: Add PSCI support for Tegra124
Jan Kiszka [Tue, 21 Apr 2015 05:18:35 +0000 (07:18 +0200)]
tegra124: Add PSCI support for Tegra124

This is based on Thierry Reding's work and uses Ian Campell's
preparatory patches. It comes with full support for CPU_ON/OFF PSCI
services. The algorithm used in this version for turning CPUs on and
off was proposed by Peter De Schrijver and Thierry Reding in
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/210881. It
consists of first enabling CPU1..3 via the PMC, just to powergate them
again with the help of the Flow Controller. Once the Flow Controller is
in place, we can leave the PMC alone while processing CPU_ON and CPU_OFF
PSCI requests.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Add board-specific initialization hook for PSCI
Jan Kiszka [Tue, 21 Apr 2015 05:18:34 +0000 (07:18 +0200)]
ARM: Add board-specific initialization hook for PSCI

Tegra boards will have to initialize power management for the PSCI
support this way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra: Make tegra_powergate_power_on public
Jan Kiszka [Tue, 21 Apr 2015 05:18:33 +0000 (07:18 +0200)]
tegra: Make tegra_powergate_power_on public

Will be used for unpowergating CPUs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agovirt-dt: Allow reservation of secure region when in a RAM carveout
Jan Kiszka [Tue, 21 Apr 2015 05:18:32 +0000 (07:18 +0200)]
virt-dt: Allow reservation of secure region when in a RAM carveout

In this case the secure code lives in RAM, and hence the memory node in
the device tree needs to be adjusted. This avoids that the OS will map
and possibly access the reservation.

Add support for setting CONFIG_ARMV7_SECURE_RESERVE_SIZE to carve out
such a region. We only support cutting off memory from the beginning or
the end of a RAM bank as we do not want to increase their number (which
would happen if punching a hole) for simplicity reasons

This will be used in a subsequent patch for Jetson-TK1.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra124: Add more registers to struct mc_ctlr
Ian Campbell [Tue, 21 Apr 2015 05:18:31 +0000 (07:18 +0200)]
tegra124: Add more registers to struct mc_ctlr

I will need mc_security_cfg0/1 in a future patch and I added the rest while
debugging, so thought I might as well commit them.

Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Put target PC for PSCI CPU_ON on per-CPU stack
Jan Kiszka [Tue, 21 Apr 2015 05:18:30 +0000 (07:18 +0200)]
ARM: Put target PC for PSCI CPU_ON on per-CPU stack

Use a per-CPU variable for saving the target PC during CPU_ON
operations. This allows us to run this service independently on targets
that have more than 2 cores and also core-local power control.

CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Factor out reusable psci_get_cpu_stack_top
Jan Kiszka [Tue, 21 Apr 2015 05:18:29 +0000 (07:18 +0200)]
ARM: Factor out reusable psci_get_cpu_stack_top

This algorithm will be useful on Tegra as well, plus we will need it for
making _psci_target_pc per-CPU.

CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Factor out reusable psci_cpu_entry
Jan Kiszka [Tue, 21 Apr 2015 05:18:28 +0000 (07:18 +0200)]
ARM: Factor out reusable psci_cpu_entry

_sunxi_cpu_entry can be converted completely into a reusable
psci_cpu_entry. Tegra124 will use it as well.

As with psci_disable_smp, also the enabling is designed to be overloaded
in cased SMP is not controlled via ACTLR.

CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Factor out reusable psci_cpu_off_common
Jan Kiszka [Tue, 21 Apr 2015 05:18:27 +0000 (07:18 +0200)]
ARM: Factor out reusable psci_cpu_off_common

Move parts of sunxi's psci_cpu_off into psci_cpu_off_common, namely
cache disabling and flushing, clrex and the disabling of SMP for the
dying CPU. These steps are apparently generic for ARMv7 and will be
reused for Tegra124 support.

As the way of disabled SMP is not architectural, though commonly done
via ACLTR, the related function can be overloaded.

CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Factor out common psci_get_cpu_id
Jan Kiszka [Tue, 21 Apr 2015 05:18:26 +0000 (07:18 +0200)]
ARM: Factor out common psci_get_cpu_id

Will be required for obtaining the ID of the current CPU in shared PSCI
functions. The default implementation requires a dense ID space and only
supports a single cluster. Therefore, the functions can be overloaded in
cases where these assumptions do not hold.

CC: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Tested-by: Thierry Reding <treding@nvidia.com>
Tested-by: Ian Campbell <ijc@hellion.org.uk>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: Clean up CONFIG_ARMV7_NONSEC/VIRT/PSCI conditions
Jan Kiszka [Tue, 21 Apr 2015 05:18:24 +0000 (07:18 +0200)]
ARM: Clean up CONFIG_ARMV7_NONSEC/VIRT/PSCI conditions

CONFIG_ARMV7_VIRT depends on CONFIG_ARMV7_NONSEC, thus doesn't need to
be taken into account additionally. CONFIG_ARMV7_PSCI is only set on
boards that support CONFIG_ARMV7_NONSEC, and it only works on those.

CC: Tang Yuantian <Yuantian.Tang@freescale.com>
CC: York Sun <yorksun@freescale.com>
CC: Steve Rae <srae@broadcom.com>
CC: Andre Przywara <andre.przywara@linaro.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Alison Wang <alison.wang@freescale.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: tegra: enable STDIO deregistration
Stephen Warren [Tue, 14 Apr 2015 14:41:14 +0000 (08:41 -0600)]
ARM: tegra: enable STDIO deregistration

At the very least when USB keyboard support is enabled, we need to enable
CONFIG_SYS_STDIO_DEREGISTER, so the "usb reset" is able to re-scan USB
ports and find new devices. Enable it everywhere per request from Simon
Glass.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agoARM: tegra: CONFIG_{SYS_, }LOAD{_, }ADDR rationalization
Stephen Warren [Wed, 1 Apr 2015 21:40:53 +0000 (15:40 -0600)]
ARM: tegra: CONFIG_{SYS_, }LOAD{_, }ADDR rationalization

As best I can tell, CONFIG_SYS_LOAD_ADDR and CONFIG_LOADADDR/$loadaddr
serve essentially the same purpose. Roughly, if a command takes a load
address, then CONFIG_SYS_LOAD_ADDR or $loadaddr (or both) are the default
if the command-line does not specify the address. Different U-Boot
commands are inconsistent re: which of the two default values they use.
As such, set the two to the same value, and move the logic that does this
 into tegra-common-post.h so it's not duplicated. A number of other non-
Tegra boards do this too.

The values chosen for these macros are no longer consistent with anything
in MEM_LAYOUT_ENV_SETTINGS. Regain consistency by setting $kernel_addr_r
to CONFIG_LOADADDR. Older scripts tend to use $loadaddr for the default
kernel load address, whereas newer scripts and features tend to use
$kernel_addr_r, along with other variables for other purposes such as
DTBs and initrds. Hence, it's logical they should share the same value.

I had originally thought to make the $kernel_addr_r and CONFIG_LOADADDR
have different values. This would guarantee no interference if a script
used the two variables for different purposes. However, that scenario is
unlikely given the semantic meaning associated with the two variables.
The lowest available value is 0x90200000; see comments for
MEM_LAYOUT_ENV_SETTINGS in tegra30-common-post.h for details. However,
that value would be problematic for a script that loaded a raw zImage to
$loadaddr, since it's more than 128MB beyond the start of SDRAM, which
would interfere with the kernel's CONFIG_AUTO_ZRELADDR. So, let's not do
that.

The only potential fallout I could foresee from this patch is if someone
has a script that loads the kernel to $loadaddr, but some other file
(DTB, initrd) to a hard-coded address that the new value of $loadaddr
interferes with. This seems unlikely. A user should not do that; they
should either hard-code all load addresses, or use U-Boot-supplied
variables for all load addresses. Equally, any fallout due to this change
is trivial to fix; simply modify the load addresses in that script.

Cc: Paul Walmsley <pwalmsley@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Paul Walmsley <pwalmsley@nvidia.com>
Reviewed-by: Simon Glass
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra124: video: Add full link training for eDP
Simon Glass [Wed, 15 Apr 2015 03:03:44 +0000 (21:03 -0600)]
tegra124: video: Add full link training for eDP

Add full link training as a fallback in case the fast link training
fails.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
9 years agotegra: config: nyan-big: Enable LCD
Simon Glass [Wed, 15 Apr 2015 03:03:43 +0000 (21:03 -0600)]
tegra: config: nyan-big: Enable LCD

Add the PMIC, LCD settings, PWM and also show the board info at the top of
the LCD when starting up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>