oweals/u-boot.git
5 years agodm: sound: max98095: Drop global i2c-address variable
Simon Glass [Mon, 3 Dec 2018 11:37:30 +0000 (04:37 -0700)]
dm: sound: max98095: Drop global i2c-address variable

We can put this in the private structure and avoid a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Drop global i2c-address variable
Simon Glass [Mon, 3 Dec 2018 11:37:29 +0000 (04:37 -0700)]
dm: sound: wm8994: Drop global i2c-address variable

We can put this in the private structure and avoid a global.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Split out interface setup code
Simon Glass [Mon, 3 Dec 2018 11:37:28 +0000 (04:37 -0700)]
dm: sound: max98095: Split out interface setup code

With driver model we want to do a minimal probe when the device is probed
and then set up the codec interface later when a sound is actully played.

Split this setup code out into its own function to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm899c: Split out interface setup code
Simon Glass [Mon, 3 Dec 2018 11:37:27 +0000 (04:37 -0700)]
dm: sound: wm899c: Split out interface setup code

With driver model we want to do a minimal probe when the device is probed
and then set up the codec interface later when a sound is actully played.

Split this setup code out into its own function to help with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Create a new common init function
Simon Glass [Mon, 3 Dec 2018 11:37:26 +0000 (04:37 -0700)]
dm: sound: wm8994: Create a new common init function

With driver model we cannot pass in the global struct, but instead want
to pass in the driver-private data. Split some of the code out of
wm8994_init() to handle this.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Pass private data to internal functions
Simon Glass [Mon, 3 Dec 2018 11:37:25 +0000 (04:37 -0700)]
dm: sound: max98095: Pass private data to internal functions

At present the driver-private data is global. To allow this code to be
used with driver model, change it to pass the data down to each function.
Use the name 'priv' consistently throughout.

Also rename max98095_update_bits() to max98095_bic_or() which is more
descriptive and shorter, thus breaking fewer lines with the parameter
addition.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: wm8994: Pass private data to internal functions
Simon Glass [Mon, 3 Dec 2018 11:37:24 +0000 (04:37 -0700)]
dm: sound: wm8994: Pass private data to internal functions

At present the driver-private data is global. To allow this code to be
used with driver model, change it to pass the data down to each function.
Use the name 'priv' consistently throughout.

Also rename wm8994_update_bits() to wm8994_bic_or() which is more
descriptive and shorter, thus breaking fewer lines with the parameter
addition.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Drop codec_type
Simon Glass [Mon, 3 Dec 2018 11:37:23 +0000 (04:37 -0700)]
dm: sound: Drop codec_type

This field is not really used. It is always set to a known value. Drop it
to simplify the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: samsung: Rename i2stx_info to samsung_i2s_priv
Simon Glass [Mon, 3 Dec 2018 11:37:22 +0000 (04:37 -0700)]
dm: sound: samsung: Rename i2stx_info to samsung_i2s_priv

This struct is only used by the Samsung I2C driver and should move into
that driver. For now, rename it so it is clear that is driver-private
info.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Drop unused pre-device-tree code
Simon Glass [Mon, 3 Dec 2018 11:37:21 +0000 (04:37 -0700)]
dm: sound: Drop unused pre-device-tree code

CONFIG_OF_CONTROL is enabled for all boards that use sound, so remove the
dead code.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Rename en_sound_codec to sound_codec
Simon Glass [Mon, 3 Dec 2018 11:37:20 +0000 (04:37 -0700)]
dm: sound: Rename en_sound_codec to sound_codec

The en_ prefix is confusing and not needed. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: samsung: Make local function static
Simon Glass [Mon, 3 Dec 2018 11:37:19 +0000 (04:37 -0700)]
dm: sound: samsung: Make local function static

Several functions are not exported from this file. Make them static so
this is clear.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosnow: Expand U-Boot size
Simon Glass [Mon, 3 Dec 2018 11:37:18 +0000 (04:37 -0700)]
snow: Expand U-Boot size

Now that we have EFI, etc. enabled, U-Boot is larger than it was. Expand
the region allocated for it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agosandbox: Increase the pre-relocation memory
Simon Glass [Mon, 3 Dec 2018 11:37:17 +0000 (04:37 -0700)]
sandbox: Increase the pre-relocation memory

This is close to full now, so increase it to avoid problems with adding
more devices.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-i2c
Tom Rini [Thu, 13 Dec 2018 14:36:55 +0000 (09:36 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-i2c

5 years agoMerge branch '2018-12-12-master-imports'
Tom Rini [Thu, 13 Dec 2018 00:45:07 +0000 (19:45 -0500)]
Merge branch '2018-12-12-master-imports'

- Various small TI platform updates
- Two unit test fixes
- qemu-arm updates

5 years agoam3517_evm: Use ttyS2 instead of ttyO2
Adam Ford [Mon, 10 Dec 2018 20:56:36 +0000 (14:56 -0600)]
am3517_evm: Use ttyS2 instead of ttyO2

The serial driver in the kernel moved from ttyOx to ttySx a while
ago.  This patch updates the console parameter to align with the
kernel change.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agofirmware: psci: introduce SPL_ARM_PSCI_FW
Peng Fan [Sun, 9 Dec 2018 12:45:45 +0000 (12:45 +0000)]
firmware: psci: introduce SPL_ARM_PSCI_FW

Introduce a new macro SPL_ARM_PSCI_FW

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Stefano Babic <sbabic@denx.de>
5 years agotest: overlay: NULL passed as fdt
Heinrich Schuchardt [Sat, 8 Dec 2018 08:53:05 +0000 (09:53 +0100)]
test: overlay: NULL passed as fdt

The uts created in do_ut_overlay() is not the one used in
cmd_ut_category(). Currently all tests are therefore called with
uts->priv = NULL and fail.

Using a static variable is the easiest fix here.

Fixes: e93232e15ec9 ("test: overlay: Use cmd_ut_category()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
5 years agoARM: omap3logic: Remove legacy USB code in favor of DM_USB
Adam Ford [Fri, 7 Dec 2018 23:28:03 +0000 (17:28 -0600)]
ARM: omap3logic: Remove legacy USB code in favor of DM_USB

With the defconfig options enabling DM_USB, the legacy code
can be removed.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoARM: omap3_logic/omap35_logic: Move to DM_USB
Adam Ford [Fri, 7 Dec 2018 20:38:33 +0000 (14:38 -0600)]
ARM: omap3_logic/omap35_logic: Move to DM_USB

The existing config is setup as a gadget but it doesn't use
DM_USB.  This patch converts all boards to DM_USB, but as host.

As host, it is able to mount USB drives and browse them.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agoarm: am335x-pdu001: Move from embedded to separate DTB
Felix Brack [Fri, 7 Dec 2018 14:01:55 +0000 (15:01 +0100)]
arm: am335x-pdu001: Move from embedded to separate DTB

There is no need for an embedded device tree for this board so let the
build process generate a separate u-boot.dtb file instead.

Signed-off-by: Felix Brack <fb@ltec.ch>
5 years agospl: fix build failure with !CONFIG_SPL_PCI_SUPPORT
Sekhar Nori [Thu, 6 Dec 2018 10:10:08 +0000 (15:40 +0530)]
spl: fix build failure with !CONFIG_SPL_PCI_SUPPORT

Building U-Boot with CONFIG_PCI and CONFIG_DM_PCI enabled, but
CONFIG_SPL_PCI_SUPPORT disabled, results in following linker
error:

lib/built-in.o: In function `fdtdec_get_pci_bar32':
lib/fdtdec.c:305: undefined reference to `dm_pci_read_bar32'
fdtdec.c:305:(.text.fdtdec_get_pci_bar32+0x24): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `dm_pci_read_bar32'

This is because reference to dm_pci_read_bar32() remains in lib/fdtdec.c
while SPL build does not descend into drivers/pci directory in
drivers/Makefile if CONFIG_SPL_PCI_SUPPORT is not enabled.

Fix this by applying appropriate #define guards in lib/fdtdec.c.
It looks like ns16550.c has the same problem, so fixed that too.

To simplify this, CONFIG_SPL_PCI_SUPPORT is renamed to CONFIG_SPL_PCI
(enables use of CONFIG_IS_ENABLED() macro).

Suggested-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agodefconfigs: am335x_hs_evm: Sync HS and non-HS defconfigs
Andrew F. Davis [Wed, 5 Dec 2018 18:33:33 +0000 (12:33 -0600)]
defconfigs: am335x_hs_evm: Sync HS and non-HS defconfigs

Sync new additions to non-HS defconfig with HS defconfig.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agofdt: Add warning about CONFIG_OF_EMBED
Simon Glass [Wed, 5 Dec 2018 13:57:08 +0000 (06:57 -0700)]
fdt: Add warning about CONFIG_OF_EMBED

This option has crept into use with some boards. Add a warning to try to
prevent this.

As an example:
   https://lists.denx.de/pipermail/u-boot/2017-September/304966.html

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
5 years agoblk: Rework guard around part_init call
Tom Rini [Wed, 5 Dec 2018 13:23:38 +0000 (08:23 -0500)]
blk: Rework guard around part_init call

The function part_init() will only be built when we have both
CONFIG_PARTITIONS and CONFIG_HAVE_BLOCK_DEVICE set.  Protect the call to
this function with both of these tests now.

Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: York Sun <york.sun@nxp.com>
Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Cc: Mingkai Hu <mingkai.hu@nxp.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Marek Behún <marek.behun@nic.cz>
Cc: Vanessa Maegima <vanessa.maegima@nxp.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Adam Ford <aford173@gmail.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Tom Warren <twarren@nvidia.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agotest: hexdump: fix misplaced return
Simon Goldschmidt [Tue, 4 Dec 2018 20:30:08 +0000 (21:30 +0100)]
test: hexdump: fix misplaced return

One of the hexdump tests in test/lib/hexdump.c returns right at the
start of the function without testing anything.

Fix this by moving the 'return 0;' statement to the end of the function.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agoqemu-arm: Add persistent environment support
Sumit Garg [Mon, 26 Nov 2018 11:20:17 +0000 (16:50 +0530)]
qemu-arm: Add persistent environment support

Currently on qemu-arm platforms environment is kept in RAM. Instead
use pflash device 1 to provide persistent environment support across
device reset.

Also (optionally) provide support for persistent environment across
qemu machine OFF/ON using following instructions:

- Create envstore.img using qemu-img:
    qemu-img create -f raw envstore.img 64M
- Add a pflash drive parameter to the command line:
    -drive if=pflash,format=raw,index=1,file=envstore.img

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
5 years agoqemu-arm: Enable VirtIO distro target
Sumit Garg [Tue, 13 Nov 2018 04:51:24 +0000 (10:21 +0530)]
qemu-arm: Enable VirtIO distro target

With -device virtio-blk-device,drive=hd0, it could detect distro boot
target.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Alexander Graf <agraf@suse.de>
5 years agoi2c: tegra: Fix regression by implementing a dummy probe_chip() callback
Jean-Jacques Hiblot [Tue, 11 Dec 2018 18:56:34 +0000 (19:56 +0100)]
i2c: tegra: Fix regression by implementing a dummy probe_chip() callback

Commit f32a8007ef0f ("dm: i2c: Make i2c_get_chip_for_busnum() fail if the
chip is not detected") introduced a regression for the NVIDIA Jetson TX2.

For some reason the xfer callback of the tegra i2c driver doesn't support
probing the I2C devices with a 0-length message.
Fixing the regression by providing a dummy implementation of probe_chip()
that does nothing.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
5 years agoARM: davinci: Orphan Spectrum Digital AM18xx EVM
Adam Ford [Tue, 11 Dec 2018 13:41:03 +0000 (07:41 -0600)]
ARM: davinci: Orphan Spectrum Digital AM18xx EVM

I had requested the da850 boards because their previous maintainer
had an invalid e-mail address.  I work at Logic PD who makes
the da850-evm kits, so I have access to various boards of theirs.

The Spectrum Digital AM18xx board is based on the Logic PD
da850 EVM, but it's not the same company.  Since I don't have the
hardware to test/verify changes, I would prefer to not be
responsible for this board.

Signed-off-by: Adam Ford <aford173@gmail.com>
5 years agotravis: Add check for configs without MAINTAINERS entries
Tom Rini [Thu, 6 Dec 2018 21:39:43 +0000 (16:39 -0500)]
travis: Add check for configs without MAINTAINERS entries

The genboardscfg.py script will emit a WARNING message if we have new
defconfig files that are not listed in a MAINTAINERS file.  Make new
cases of this a failure we catch in Travis-CI.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoMerge tag 'fsl-qoriq-for-v2019.01-rc2' of git://git.denx.de/u-boot-fsl-qoriq
Tom Rini [Mon, 10 Dec 2018 22:12:52 +0000 (17:12 -0500)]
Merge tag 'fsl-qoriq-for-v2019.01-rc2' of git://git.denx.de/u-boot-fsl-qoriq

Add TFA boot flow for some Layerscape platforms
Add support for lx2160a SoC

[trini: Add a bunch of missing MAINTAINERS entries]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agoMerge tag 'mips-fixes-for-2019.01' of git://git.denx.de/u-boot-mips
Tom Rini [Mon, 10 Dec 2018 22:12:28 +0000 (17:12 -0500)]
Merge tag 'mips-fixes-for-2019.01' of git://git.denx.de/u-boot-mips

- mips: bcm: disable CONFIG_SWAP_IO_SPACE to force native endianess in readl() & co.
  this fixes 09ace9161b95ad3a04b33d1d6a65a929901d28c8
- mips: bcm6838: fix device tree warning

5 years agobmips: bcm6838: fix device tree warning
Álvaro Fernández Rojas [Mon, 10 Dec 2018 16:42:58 +0000 (17:42 +0100)]
bmips: bcm6838: fix device tree warning

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
5 years agobmips: swapping IO space isn't required
Álvaro Fernández Rojas [Sun, 9 Dec 2018 09:41:27 +0000 (10:41 +0100)]
bmips: swapping IO space isn't required

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
5 years agoMerge tag 'for-master-20181210' of git://git.denx.de/u-boot-rockchip
Tom Rini [Mon, 10 Dec 2018 15:19:09 +0000 (10:19 -0500)]
Merge tag 'for-master-20181210' of git://git.denx.de/u-boot-rockchip

Improvements:
- init DRAM for RK322x in SPL
- add FAN53555 PMIC/regulator driver
- update MicroCrystal RV3029 driver to Kconfig and sync from Linux
- add bootcount uclass and first DM-driver for bootcount

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-i2c
Tom Rini [Mon, 10 Dec 2018 12:16:33 +0000 (07:16 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-i2c

- DM_I2C_COMPAT removal for all ti platforms from Jean-Jacques Hiblot
- Fix in i2c command help output from Chirstoph Muellner.

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-sh
Tom Rini [Mon, 10 Dec 2018 12:15:55 +0000 (07:15 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-sh

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Mon, 10 Dec 2018 12:15:41 +0000 (07:15 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

5 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Mon, 10 Dec 2018 12:15:12 +0000 (07:15 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

- DWC3 and UDC cleanup

5 years agoMerge git://git.denx.de/u-boot-x86
Tom Rini [Mon, 10 Dec 2018 12:14:48 +0000 (07:14 -0500)]
Merge git://git.denx.de/u-boot-x86

- Enable RTC for Intel Tangier
- Wrap the call to 8259 PIC with Kconfig options for old targets without
  8259
- Warp the call to USB init with Kconfg options for coreboot & EFI
  payload

5 years agorockchip: rk3399-puma: enable fan53555 regulators in DTS
Philipp Tomsich [Fri, 30 Nov 2018 19:00:10 +0000 (20:00 +0100)]
rockchip: rk3399-puma: enable fan53555 regulators in DTS

Now that we have FAN53555 support, we can enable the regulators in our
DTS.  To make these easier to identify on the U-Boot commandline, we
rename them to the names of the voltage rails they control.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agorockchip: rk3399-puma: defconfig: enable FAN53555 regulator driver
Philipp Tomsich [Fri, 30 Nov 2018 19:00:09 +0000 (20:00 +0100)]
rockchip: rk3399-puma: defconfig: enable FAN53555 regulator driver

With a driver for the FAN53555 regulator family available, let's
enable it for the RK3399-Q7 (which has two of these devices
on-module).

We enable this for the full U-Boot stage only, as these regulators
provide a suitable default voltage and supply non-critical (i.e.
for booting up) power rails only.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agopower: add FAN53555 family support
Philipp Tomsich [Fri, 30 Nov 2018 19:00:08 +0000 (20:00 +0100)]
power: add FAN53555 family support

This adds a driver for the FAN53555 family of regulators and wraps it
in a PMIC implementation.

While these devices support a 'normal' and 'suspend' mode (controlled
via an external pin) to switch between two programmable voltages, this
incarnation of the driver assumes that the device is always operating
in 'normal' mode.

Only setting/reading the programmed voltage is supported at this time
and the following device functionality remains unsupported:
  - switching the selected voltage (via a GPIO)
  - disabling the voltage output via software-control
This matches the functionality of the Linux driver.

Tested on a RK3399-Q7 (with 'option 5' devices): setting voltages from
the U-Boot shell and verifying output voltages on the board.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
5 years agobootcount: add a DM RTC backing store for bootcount
Philipp Tomsich [Tue, 27 Nov 2018 22:00:19 +0000 (23:00 +0100)]
bootcount: add a DM RTC backing store for bootcount

This implements a driver using a RTC-based backing store for the DM
bootcount implementation.  The node configuring this feature will be
compatible with 'u-boot,bootcount-rtc' and the underlying RTC device
shall be reference through the property 'rtc'. An offset into the RTC
device's register space can be provided through the 'offset' property.

Tested on a RK3399-Q7 on a Flamingo carrier board using the SRAM area
of the carrier board's RV3029 RTC.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agobootcount: add uclass for bootcount
Philipp Tomsich [Tue, 27 Nov 2018 22:00:18 +0000 (23:00 +0100)]
bootcount: add uclass for bootcount

The original bootcount methods do not provide an interface to DM and
rely on a static configuration for I2C devices (e.g. bus, chip-addr,
etc. are configured through defines statically).  On a modern system
that exposes multiple devices in a DTS-configurable way, this is less
than optimal and a interface to DM-based devices will be desirable.

This adds a simple driver that is DM-aware and configurable via DTS.
If ambiguous (i.e. multiple bootcount-devices are present) the
/chosen/u-boot,bootcount-device property can be used to select one
bootcount device.

Initially, this provides support for the following DM devices:
 * RTC devices

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
5 years agorockchip: rk322x: ram: enable DRAM init in SPL instead of TPL
Kever Yang [Tue, 4 Dec 2018 09:49:58 +0000 (17:49 +0800)]
rockchip: rk322x: ram: enable DRAM init in SPL instead of TPL

Patch for rk322x TPL is not merged, and only SPL is available now,
enable the sdram driver in SPL first. We should update back to TPL
after TPL is enabled for rk322x.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agocmd: i2c: Fix help output of i2c command.
Christoph Muellner [Tue, 4 Dec 2018 10:27:18 +0000 (11:27 +0100)]
cmd: i2c: Fix help output of i2c command.

In case SYS_I2C or DM_I2C are defined, then the "i2c " prefix
of the "i2c crc32" command is missing.
This patch addresses this, so that users can't get confused
by the "crc32" command.

Without the patch we get

    => i2c help
    i2c - I2C sub-system

    Usage:
    i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
    crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
    i2c dev [dev] - show or set current I2C bus
    [...]

With the patch we get

    => i2c help
    i2c - I2C sub-system

    Usage:
    i2c bus [muxtype:muxaddr:muxchannel] - show I2C bus info
    i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum
    i2c dev [dev] - show or set current I2C bus
    ...

Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agodra7: Allow selecting a new dtb after board detection.
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:55 +0000 (14:50 +0100)]
dra7: Allow selecting a new dtb after board detection.

The DRA7 platforms requires that the dtb used in the SPL really matches the
platform  to have the best MMC performances.
To detect the board type/version an I2C EEPROM is read. This requires that
DM is initialized before the detection. As a consequence we must reset the
DM after the board detection is a new dtb would better match the platform.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agodrivers: core: nullify gd->dm_root after dm_uninit()
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:54 +0000 (14:50 +0100)]
drivers: core: nullify gd->dm_root after dm_uninit()

To reset the DM after a new dtb is loaded, we need to call dm_uninit()
and then dm_init(). This fails however because gd->dm_root is not nullified
by dm_uninit().
Fixing it by setting gd->dm_root in dm_uninit().

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agodrivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:53 +0000 (14:50 +0100)]
drivers: core: Add the option SPL_DM_DEVICE_REMOVE to the Kconfig

It is currently not possible to include the support to remove devices in
the SPL. This is however needed by platforms that re-select their dtb after
DM is initialized; they need to remove all the previously bound devices
before triggering a scan of the new DT.

Add a Kconfig option to be able to include the support for device removal
in the SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Seeries-changes:3
- update commit message
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agolib: fdtdec: Add function re-setup the fdt more effeciently
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:52 +0000 (14:50 +0100)]
lib: fdtdec: Add function re-setup the fdt more effeciently

In some cases it may be useful to be able to change the fdt we have been
using and use another one instead. For example, the TI platforms uses an
EEPROM to store board information and, based on the type of board,
different dtbs are used by the SPL. When DM_I2C is used, a first dtb must
be used before the I2C is initialized and only then the final dtb can be
selected.
To speed up the process and reduce memory usage, introduce a new function
fdtdec_setup_best_match() that re-use the DTBs loaded in memory by
fdtdec_setup() to select the best match.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoconfigs: dra7xx-evm: increase the size of the malloc's pool before relocation
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:51 +0000 (14:50 +0100)]
configs: dra7xx-evm: increase the size of the malloc's pool before relocation

This is required to take advantage of MULTI_DTB_FIT before relocation.
If it is too low, DM will be initialized only after relocation has
taken place. That is too late for the DRA7 because I2C DM is used before
the relocation to setup the voltages required, among other things, to
properly initialize the DRAM.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoam57xx: remove non-DM I2C code
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:50 +0000 (14:50 +0100)]
am57xx: remove non-DM I2C code

am57xx configs uses DM_I2C both in SPL and u-boot.
Remove code for non-DM I2C support.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:49 +0000 (14:50 +0100)]
ti: remove usage of DM_I2C_COMPAT and don't disable DM_I2C in SPL

DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C
API when DM_I2C is used. The goal is to eventually remove DM_I2C_COMPAT
when all I2C "clients" have been migrated to use the DM API.
This a step in that direction for the TI based platforms.
Build tested with buildman:
buildman -dle am33xx ti omap3 omap4 omap5 davinci keystone

boot tested with:
am335x_evm, am335x_boneblack, am335x_boneblack_vboot (DM version),
am57xx_evm, dra7xx_evm, k2g_evm, am437x_evm

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoconfigs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:48 +0000 (14:50 +0100)]
configs: am335x_pdu001: remove CONFIG_DM_I2C_COMPAT

Remove the last call to the non-DM I2C API.
Also remove the #undef CONFIG_DM_I2C_COMPAT because it is not defined
in the common header file anymore.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Felix Brack <fb@ltec.ch>
Tested-by: Felix Brack <fb@ltec.ch>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT
Andreas Dannenberg [Fri, 7 Dec 2018 13:50:47 +0000 (14:50 +0100)]
ti: common: board_detect: Allow DM I2C without CONFIG_DM_I2C_COMPAT

The EEPROM reading in the board detection code is done through legacy
I2C functions which on platforms using DM_I2C this functionality is
provided via the CONFIG_DM_I2C_COMPAT layer. To allow newer platforms
to use the board detection code without relying on CONFIG_DM_I2C_COMPAT
go ahead and add an I2C handling implementation that directly uses the
I2C DM functionality.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agopower: make most tps drivers and the twl4030 driver compatible with DM_I2C
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:46 +0000 (14:50 +0100)]
power: make most tps drivers and the twl4030 driver compatible with DM_I2C

Those driver are not DM drivers per se (not using the PMIC/regulator
framework) and are using the legacy I2C API. Make them compatible with
the DM_I2C API.

This impacts the following drivers:
- palmas (used by am57xx/dra7xx evms)
- tps65218 (used by am43xx evms)
- tps65217 and tps65910 (used by am335x evms and am335x boneblack vboot)
- twl4030 (used by omap3_logicpd)
- tps65217 (used by brppt1)
- twl6030

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoomap: detect the board after DM is available
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:45 +0000 (14:50 +0100)]
omap: detect the board after DM is available

In order to use DM_I2C, we need to move the board detection after the
early SPL initialization.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agodts: am43x: omap5: Add node for I2C in SPL
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:44 +0000 (14:50 +0100)]
dts: am43x: omap5: Add node for I2C in SPL

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoam335x: Register the I2C controllers if DM_I2C is used.
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:43 +0000 (14:50 +0100)]
am335x: Register the I2C controllers if DM_I2C is used.

If DM_I2C is used , the I2C controllers must be registered as U_BOOT_DEVICE
because OF_CONTROL is not used in the SPL.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoi2c: omap24xx_i2c: Use platdata to probe the device
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:42 +0000 (14:50 +0100)]
i2c: omap24xx_i2c: Use platdata to probe the device

This allows the driver to be used without OF_CONTROL.
AM335x support DM_SPL but does not use SPL_OF_CONTROL. Enabling DM_I2C in
SPL thus requires that the omap I2C can be passed platdata.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoi2c: omap24xx_i2c: Move away from SoC specific headers for reg offset
Vignesh R [Fri, 7 Dec 2018 13:50:41 +0000 (14:50 +0100)]
i2c: omap24xx_i2c: Move away from SoC specific headers for reg offset

Move away from SoC specific headers to handle different register layout.
Instead use driver data to get appropriate register layouts like in the
kernel. While at it, perform some mostly cosmetic alignment/cleanup in
the functions being updated.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoconfigs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:40 +0000 (14:50 +0100)]
configs: am335x: am57x: dra7x: Enable CONFIG_SPL_DM_SEQ_ALIAS

Those platforms need CONFIG_SPL_DM_SEQ_ALIAS because they enable both
DM_I2C and SPL_DM. Without CONFIG_SPL_DM_SEQ_ALIAS, it is not possible to
get the I2C bus with i2c_get_chip_for_busnum().

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Felix Brack <fb@ltec.ch>
Tested-by: Felix Brack <fb@ltec.ch>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agodm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:39 +0000 (14:50 +0100)]
dm: device: Allow using uclass_find_device_by_seq() without OF_CONTROL

If OF_CONTROL is not enabled and DM_SEQ_ALIAS is enabled, we must
assign an alias (requested sequence number) to devices that belongs to a
class with the DM_UC_FLAG_SEQ_ALIAS flag. Otherwise
uclass_find_device_by_seq() cannot be used to get/probe a device. In
particular i2c_get_chip_for_busnum() cannot be used.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agodm: i2c: Make i2c_get_chip_for_busnum() fail if the chip is not detected
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:38 +0000 (14:50 +0100)]
dm: i2c: Make i2c_get_chip_for_busnum() fail if the chip is not detected

i2c_get_chip_for_busnum() really should check the presence of the chip on
the bus. Most of the users of this function assume that this is done.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agocmd: Kconfig: Do not include EEPROM if DM_I2C is used without DM_I2C_COMPAT
Jean-Jacques Hiblot [Fri, 7 Dec 2018 13:50:37 +0000 (14:50 +0100)]
cmd: Kconfig: Do not include EEPROM if DM_I2C is used without DM_I2C_COMPAT

The implementation of the EEPROM commands does not support the DM I2C API.
Prevent compilation breakage by not enabling it if the non-DM API is not
available (if DM_I2C is used without DM_I2C_COMPAT)

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
5 years agoefi: payload: only init usb if necessary
Bin Meng [Fri, 30 Nov 2018 04:07:13 +0000 (20:07 -0800)]
efi: payload: only init usb if necessary

Up until now the call to initialize the USB subsystem was hardcoded
for U-Boot running as an EFI payload. This was used to enable the
use of a USB keyboard in the U-Boot shell. However not all boards
might need this functionality. As initializing the USB subsystem can
take a considerable amount of time (several seconds on some boards),
we now initialize the USB subsystem only if U-Boot is configured to
use USB keyboards.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agocoreboot: only init usb if necessary
Thomas RIENOESSL [Fri, 30 Nov 2018 04:07:12 +0000 (20:07 -0800)]
coreboot: only init usb if necessary

Up until now the call to initialize the USB subsystem was hardcoded
for U-Boot running as a coreboot payload. This was used to enable
the use of a USB keyboard in the U-Boot shell. However not all boards
might need this functionality. As initializing the USB subsystem can
take a considerable amount of time (several seconds on some boards),
we now initialize the USB subsystem only if U-Boot is configured to
use USB keyboards.

Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agox86: kconfig: Allow board defconfig file to disable 8259 and APIC
Bin Meng [Fri, 30 Nov 2018 03:57:22 +0000 (19:57 -0800)]
x86: kconfig: Allow board defconfig file to disable 8259 and APIC

At present the Kconfig options (CONFIG_I8259_PIC and CONFIG_APIC)
do not include a prompt message, which makes it impossible to
be disabled from a board defconfig file.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
5 years agox86: Wrap calls to 8259 with CONFIG_I8259_PIC
Bin Meng [Fri, 30 Nov 2018 03:57:21 +0000 (19:57 -0800)]
x86: Wrap calls to 8259 with CONFIG_I8259_PIC

mask_irq(), unmask_irq() and specific_eoi() are provided by the
i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
5 years agox86: make the LAPIC / IOAPIC construct switchable with Kconfig
Hannes Schmelzer [Sun, 18 Nov 2018 22:19:43 +0000 (23:19 +0100)]
x86: make the LAPIC / IOAPIC construct switchable with Kconfig

There are still systems running which do not have any LAPIC or even
IOAPIC. Responsible MSRs for those do not exist and the systems are
crashing on trying to setup LAPIC.

This commit makes the APIC stuff able to switch off for those boards
which dont' have an LAPIC / IOAPIC.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: acpi: Fix indentation in Intel Tangier ASL code
Andy Shevchenko [Sat, 10 Nov 2018 15:37:02 +0000 (17:37 +0200)]
x86: acpi: Fix indentation in Intel Tangier ASL code

Make the indentation aligned with what used elsewhere in U-Boot.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agox86: acpi: Enable RTC for Intel Tangier
Andy Shevchenko [Sat, 10 Nov 2018 15:37:01 +0000 (17:37 +0200)]
x86: acpi: Enable RTC for Intel Tangier

Intel Tangier SoC has RTC inside. So, enable it in ACPI.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agoARM: mvebu: restore license information in mv_ddr_plat.{c,h}
Chris Packham [Sun, 9 Dec 2018 21:41:15 +0000 (10:41 +1300)]
ARM: mvebu: restore license information in mv_ddr_plat.{c,h}

This was unintentionally removed when syncing with upstream.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
5 years agoMerge git://git.denx.de/u-boot-marvell
Tom Rini [Sun, 9 Dec 2018 13:40:49 +0000 (08:40 -0500)]
Merge git://git.denx.de/u-boot-marvell

- Sync DDR training with Marvell code for Armada 38x by Chris
- Misc updates to Armada 38x Helios4 board by Aditya

5 years agoRoll CRC16-CCITT into the hash infrastructure
Philipp Tomsich [Sun, 25 Nov 2018 18:22:19 +0000 (19:22 +0100)]
Roll CRC16-CCITT into the hash infrastructure

The CRC16-CCITT checksum function is useful for space-constrained
applications (such as obtaining a checksum across a 2KBit or 4KBit
EEPROM) in boot applications. It has not been accessible from boot
scripts until now (due to not having a dedicated command and not being
supported by the hash infrstructure) limiting its applicability
outside of custom commands.

This adds the CRC16-CCITT (poly 0x1021, init 0x0) algorithm to the
list of available hashes and adds a new crc16_ccitt_wd_buf() to make
this possible.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
[trini: Fix building crc16.o for SPL/TPL]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agolib: merge CRC16-CCITT into u-boot/crc.h
Philipp Tomsich [Sun, 25 Nov 2018 18:22:18 +0000 (19:22 +0100)]
lib: merge CRC16-CCITT into u-boot/crc.h

This merges the CRC16-CCITT headers into u-boot/crc.h to prepare for
rolling CRC16 into the hash infrastructure.  Given that CRC8, CRC32
and CRC32-C already have their prototypes in a single header file, it
seems a good idea to also include CRC16-CCITT in the same.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
5 years agoarm: mvebu: helios4: Reset uSOM onboard phy during board init
Aditya Prayoga [Tue, 4 Dec 2018 16:57:25 +0000 (00:57 +0800)]
arm: mvebu: helios4: Reset uSOM onboard phy during board init

Similar to Clearfog rev 2.1, GPIO 19 also used to reset onboard ethernet
PHY.

This patch depend on
net: mvneta: Add GPIO configuration support
[URL: https://patchwork.ozlabs.org/patch/1007736/]

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: helios4: Enable SPI flash support
Aditya Prayoga [Tue, 4 Dec 2018 16:57:24 +0000 (00:57 +0800)]
arm: mvebu: helios4: Enable SPI flash support

Enable SPI flash support under U-Boot and SPL. The ENV size and offset,
ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16

To create U-Boot image for SPI flash, user would need to replace
* CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
* CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: helios4: Reduce U-Boot image size
Aditya Prayoga [Tue, 4 Dec 2018 16:57:23 +0000 (00:57 +0800)]
arm: mvebu: helios4: Reduce U-Boot image size

Remove unused I2C support in SPL and use simple_malloc functions to
reduce SPL image size.
Since Helios4 does not have any PCIe allocated on SerDes, remove PCI
support. MTD layer on top of SPI flash is not needed, remove it also.

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: helios4: Enable mvebu GPIO
Aditya Prayoga [Tue, 4 Dec 2018 16:57:22 +0000 (00:57 +0800)]
arm: mvebu: helios4: Enable mvebu GPIO

Make use of U-Boot's GPIO DM to control native GPIO and I2C IO expander.

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: helios4: Enable I2C and IO Expander
Aditya Prayoga [Tue, 4 Dec 2018 16:57:21 +0000 (00:57 +0800)]
arm: mvebu: helios4: Enable I2C and IO Expander

Enable Marvell I2C driver and I2C IO expander. Set default bus to
external I2C bus. Define I2C aliases in device tree so it can be
recognized by the driver.

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoarm: mvebu: helios4: mmc: move environment before 1M
Aditya Prayoga [Tue, 4 Dec 2018 16:57:20 +0000 (00:57 +0800)]
arm: mvebu: helios4: mmc: move environment before 1M

Store the environment before 1M into the block device.
This constant is easier to remember, saves a little space,
and is in line with what SolidRun's 2018.01-based fork does for the
clearfog.

Signed-off-by: Josua Mayer <josua.mayer97@gmail.com>
[ Aditya Prayoga:
* Port forward]
Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoARM: mvebu: a38x: sync ddr training code with mv_ddr-armada-18.09.02
Chris Packham [Mon, 3 Dec 2018 01:26:49 +0000 (14:26 +1300)]
ARM: mvebu: a38x: sync ddr training code with mv_ddr-armada-18.09.02

This syncs drivers/ddr/marvell/a38x/ with the mv_ddr-armada-18.09 branch
of https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git.
Specifically this syncs with commit 99d772547314 ("Bump mv_ddr to
release armada-18.09.2").

The complete log of changes is best obtained from the mv-ddr-marvell.git
repository but some relevant highlights are:

  ddr3: add missing txsdll parameter
  ddr3: fix tfaw timimg parameter
  ddr3: fix trrd timimg parameter
  merge ddr3 topology header file with mv_ddr_topology one
  mv_ddr: a38x: fix zero memory size scrubbing issue

The upstream code is incorporated omitting the portions not relevant to
Armada-38x and DDR3. After that a semi-automated step is used to drop
unused features with unifdef

    find drivers/ddr/marvell/a38x/ -name '*.[ch]' | \
        xargs unifdef -m -UMV_DDR -UMV_DDR_ATF -UCONFIG_DDR4 \
                 -UCONFIG_APN806 -UCONFIG_MC_STATIC \
                 -UCONFIG_MC_STATIC_PRINT -UCONFIG_PHY_STATIC \
                 -UCONFIG_64BIT -UCONFIG_A3700 -UA3900 -UA80X0 \
                 -UA70X0

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Stefan Roese <sr@denx.de>
5 years agoMerge branch 'master' of git://git.denx.de/u-boot-sunxi
Tom Rini [Sat, 8 Dec 2018 00:02:01 +0000 (19:02 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-sunxi

- Various axp209 fixes
- Fixes for OLinuXino-A20-Lime2 / OLinuXino-A20-Lime2-eMMC

5 years agoMerge tag 'u-boot-amlogic-20181207' of git://git.denx.de/u-boot-amlogic
Tom Rini [Sat, 8 Dec 2018 00:01:09 +0000 (19:01 -0500)]
Merge tag 'u-boot-amlogic-20181207' of git://git.denx.de/u-boot-amlogic

Two fixes for the Amlogic Pinctrl driver :
- bad usage of clrsetbits_le32
- bad pin definition for AXG Family

5 years agosunxi: update README.sunxi64
Andre Przywara [Thu, 6 Dec 2018 01:25:57 +0000 (01:25 +0000)]
sunxi: update README.sunxi64

Now that the Allwinner port in the official mainline ARM Trusted
Firmware repository has reached feature parity with the "legacy" ATF
port, let's use the opportunity to update the Allwinner 64-bit build
instructions. This changes:
- Update ATF build instructions to use the mainline repo.
- Add quick command lines for TL;DR people.
- Mention Allwinner H6 build target.
- Mention pre-built FEL binaries.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Jagan Teki <jagan@openedev.com>
5 years agoarm: sunxi: Reduce inrush current on Olimex OLinuXino-A20-Lime2-eMMC
Priit Laes [Wed, 21 Nov 2018 18:05:33 +0000 (20:05 +0200)]
arm: sunxi: Reduce inrush current on Olimex OLinuXino-A20-Lime2-eMMC

The lime2 features a too large capacitor on the LDO3 output, which
causes the PMIC to shutdown when enabling power. To be able to still
boot up however, we must gradually enable power on LDO3 for this board.

We do this by enabling both the inrush quirk and the maximum slope the
AXP209 supports.

Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoarm: sunxi: Reduce inrush current on Olimex OLinuXino-A20-Lime2
Olliver Schinagl [Wed, 21 Nov 2018 18:05:32 +0000 (20:05 +0200)]
arm: sunxi: Reduce inrush current on Olimex OLinuXino-A20-Lime2

The lime2 features a too large capacitor on the LDO3 output, which
causes the PMIC to shutdown when enabling power. To be able to still
boot up however, we must gradually enable power on LDO3 for this board.

We do this by enabling both the inrush quirk and the maximum slope the
AXP209 supports.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agopower: axp209: Limit inrush current for broken boards
Olliver Schinagl [Wed, 21 Nov 2018 18:05:31 +0000 (20:05 +0200)]
power: axp209: Limit inrush current for broken boards

Some boards feature a capacitance on LDO3's output that is too large,
causing inrush currents which as a result, shut down the AXP209. This
has been reported before, without knowing the actual cause.

A fix appeared to be done with
commit 0e6e34ac8dbb ("sunxi: Olimex A20 boards: Enable LDO3 and LDO4 regulators").

The description there is a bit misleading, the kernel does not hang
during AXP209 initialization, the PMIC shuts down, causing voltages to
drop and thus the whole system freezes.

While the AXP209 does have the ability to ramp up the voltage slowly, to
reduce these inrush currents, the voltage rate control (VRC) however is
not applicable when switching on the LDO3 output. Only when going from
an enabled lower voltage setting, to a higher voltage setting is the VRC
in effect.

To work around this problem, we set LDO3 to the lowest possible setting
of 0.7 V if it was not yet enabled, and then let the VRC (if enabled) do
its thing. It should be noted, that for some undocumented reason, there
is a short delay needed between setting the LDO3 voltage register and
enabling the power. One would expect that this delay ought to be just
after enabling the output power at 0.7 V, but this did not work.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agopower: axp209: Add support for voltage rate control on LDO3
Olliver Schinagl [Wed, 21 Nov 2018 18:05:30 +0000 (20:05 +0200)]
power: axp209: Add support for voltage rate control on LDO3

The AXP209 LDO3 regulator supports voltage rate control, or can set a
slew rate.

This allows for the power to gradually rise up to the desired voltage,
instead of spiking up as fast as possible. Reason to have this can be
to reduce the inrush currents for example.

There are 3 slopes to choose from, the default, 'none' is a voltage rise
of 0.0167 V/uS, a 1.6 mV/uS and a 0.8 mV/uS voltage rise.

In ideal world (where vendors follow the recommended design guidelines)
this setting should not be enabled by default. Unless of course AXP209
crashes instead of reporting overcurrent condition as it normally should
do in this case.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agopower: axp209: Reduce magic values by adding defines for LDO[234]
Olliver Schinagl [Wed, 21 Nov 2018 18:05:29 +0000 (20:05 +0200)]
power: axp209: Reduce magic values by adding defines for LDO[234]

The AXP209 has a few 'magisc-ish' values that are better served with
clear defines.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agopower: axp209: Define the chip version mask
Olliver Schinagl [Wed, 21 Nov 2018 18:05:28 +0000 (20:05 +0200)]
power: axp209: Define the chip version mask

Use a define for the chip version mask on the axp209.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agopower: axp209: Use BIT() macro
Olliver Schinagl [Wed, 21 Nov 2018 18:05:27 +0000 (20:05 +0200)]
power: axp209: Use BIT() macro

Use the standard BIT() macro for bitfield definitions in headers.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agosunxi: pmic_bus: Decrease boot time by not writing duplicate data
Olliver Schinagl [Wed, 21 Nov 2018 18:05:26 +0000 (20:05 +0200)]
sunxi: pmic_bus: Decrease boot time by not writing duplicate data

When we clear a pmic_bus bit, we do a read-modify-write operation.
We waste some time however, by writing back the exact samea value
that was already set in the chip. Let us thus only do the write
in case data was changed.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agosunxi: board: Print error after power initialization fails
Olliver Schinagl [Wed, 21 Nov 2018 18:05:25 +0000 (20:05 +0200)]
sunxi: board: Print error after power initialization fails

Currently during init, we enable all power, then enable the dram and
after that check whether there was an error during power-up.

This makes little sense, we should enable power and then check if power
was brought up properly before we continue to initialize other things.

This patch moves the DRAM init after the power failure check.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Priit Laes <plaes@plaes.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
5 years agoMerge branch '2018-12-06-master-imports'
Tom Rini [Fri, 7 Dec 2018 15:55:12 +0000 (10:55 -0500)]
Merge branch '2018-12-06-master-imports'

- Various FAT fixes
- Hardware spinlock uclass
- DMA uclass
- Various am335x fixes
- DT resyncs for a number of TI platforms
- stm32 updates

5 years agoarm: socfpga: imply SPL options instead of select
Simon Goldschmidt [Thu, 29 Nov 2018 20:17:08 +0000 (21:17 +0100)]
arm: socfpga: imply SPL options instead of select

For a small SPL, it should be possible to build without SPI(-flash) drivers
or wihout MMC drivers.

For this to work, we have to change from 'select'ing options to 'imply'ing
them.

With this change, I can have SPL trimmed to my hard-wired starting method
(SPI-NOR or MMC) while still including all drivers in U-Boot.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>