platform/kernel/u-boot.git
5 years agopoplar: fix boot failure caused by serial driver change
Shawn Guo [Wed, 12 Dec 2018 07:24:44 +0000 (15:24 +0800)]
poplar: fix boot failure caused by serial driver change

Commit 4687919684e0 ("serial: Remove DM_FLAG_PRE_RELOC flag in various
drivers") essentially drops flag DM_FLAG_PRE_RELOC from serial_pl01x
driver for Poplar platform, because the platform falls into the
following strategy category made by the commit.

  Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Before the commit lands, Poplar platform works by statically declaring
pl011 serial device via U_BOOT_DEVICE() with DM_FLAG_PRE_RELOC flag set
in the driver.  But since Poplar also supports device configuration from
device tree, the commit practically drops the flag for Poplar, and hence
breaks the platform from booting.

This patch changes platform code and device tree to initiate pl011
serial device from device tree rather than static declaration, so that
above strategy about DM_FLAG_PRE_RELOC applies to Poplar, and therefore
the reported boot failure gets fixed.

Reported-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Fixes: 4687919684e0 ("serial: Remove DM_FLAG_PRE_RELOC flag in various drivers")
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Tested-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
5 years agopoplar: add a co-maintainer for poplar board
Shawn Guo [Thu, 13 Dec 2018 09:10:43 +0000 (17:10 +0800)]
poplar: add a co-maintainer for poplar board

Add myself as co-maintainer for poplar board, as I'm actively working
on the board.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
5 years agotools: add a generic config for native tools building
Otavio Salvador [Sat, 8 Dec 2018 00:00:41 +0000 (19:00 -0500)]
tools: add a generic config for native tools building

The motivation for this is to allow distributions to distribute all
possible tools in a generic way, avoiding the need of specific tools
building for each machine.

Especially on OpenEmbedded / Yocto Project ecosystem, it is very
common each BSP to end providing their specific tools when they need
to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
case).

Using this, we can package the tools doing:

$: make tools-only_defconfig
$: make tools-only

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
[trini: Add MAINTAINERS entry for myself, add to .travis.yml, make
U-Boot itself buildable to not trip up other frameworks]
Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agotest: Only descend into test/ when CONFIG_UNIT_TEST is enabled
Tom Rini [Sat, 8 Dec 2018 00:00:40 +0000 (19:00 -0500)]
test: Only descend into test/ when CONFIG_UNIT_TEST is enabled

The contents of the test subdirectories only make sense when we have
CONFIG_UNIT_TEST set.  We will otherwise attempt to build code on for
example sandbox that needs CONFIG_UNIT_TEST otherwise and rather than
complicate the Makefiles simply leave them out when we can.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agocmd: Move the "dm" command from test/dm/ to cmd/
Tom Rini [Sat, 8 Dec 2018 00:00:39 +0000 (19:00 -0500)]
cmd: Move the "dm" command from test/dm/ to cmd/

The "dm" command under CONFIG_CMD_DM should live under cmd/ rather than
test/dm/ so move it.

Signed-off-by: Tom Rini <trini@konsulko.com>
5 years agohashtable: fix length calculation in hexport_r
AKASHI Takahiro [Fri, 14 Dec 2018 09:42:51 +0000 (18:42 +0900)]
hashtable: fix length calculation in hexport_r

The commit below incorrectly fixed hexport_r();
 > size = totlen + 1;
One extra byte is necessary to NULL-terminate a whole buffer, "resp."

Fixes: f1b20acb4a03 ("hashtable: Fix length calculation in hexport_r")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
5 years agotee: change return code for REE FS supplicant cmd
Igor Opaniuk [Tue, 4 Dec 2018 12:37:19 +0000 (14:37 +0200)]
tee: change return code for REE FS supplicant cmd

If OP-TEE core is compiled with support of REE FS and RPMB
at the same time (CFG_RPMB_FS ?= y; CFG_RPMB_FS ?= y), and persistent
storage API is used with TEE_STORAGE_PRIVATE storage id, it will
lead to TA panic.

E/TC:? 0 TA panicked with code 0xffff0009
.....
E/TC:? 0 Call stack:
E/TC:? 0  0x000000004002f2f8 TEE_OpenPersistentObject at
lib/libutee/tee_api_objects.c:422

In this particular case TEE_ERROR_STORAGE_NOT_AVAILABLE is more suitable
than TEE_ERROR_NOT_IMPLEMENTED, as it provides to a TA a possibility
to handle this error code [1].

>From GPD TEE Internal Core specification [2]:
TEE_ERROR_STORAGE_NOT_AVAILABLE - if the persistent object is stored in a
storage area which is currently inaccessible. It may be associated with
the device but unplugged, busy, or inaccessible for some other reason.

[1]: https://github.com/OP-TEE/optee_os/blob/94db01ef448d1e552161c2d861d57a5f8bda0cc0/lib/libutee/tee_api_objects.c#L419
[2]: https://globalplatform.org/wp-content/uploads/2018/06/GPD_TEE_Internal_Core_API_Specification_v1.1.2.50_PublicReview.pdf

Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
5 years agoMerge tag 'dm-pull-14dec18' of git://git.denx.de/u-boot-dm
Tom Rini [Fri, 14 Dec 2018 19:18:47 +0000 (14:18 -0500)]
Merge tag 'dm-pull-14dec18' of git://git.denx.de/u-boot-dm

Complete conversion of sound to driver model

5 years agodm: sound: Use the correct number of channels for sound
Simon Glass [Mon, 10 Dec 2018 17:37:51 +0000 (10:37 -0700)]
dm: sound: Use the correct number of channels for sound

At present the 'beep' sound generates a waveform for only one channel even
if two are being used. This means that the beep is twice the frequency it
should be. Correct this by making it a parameter.

The fix in a previous commit was correct for sandbox but not for other
boards.

Fixes: 03f11e87a8 ("sound: Correct data output in sound_create_square_wave()")
Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sandbox: Allow selection of sample rate and channels
Simon Glass [Mon, 10 Dec 2018 17:37:50 +0000 (10:37 -0700)]
dm: sandbox: Allow selection of sample rate and channels

At present these parameters are hard-coded in the sdl interface code.
Allow them to be specified by the driver instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: max98095: Tidy up error codes
Simon Glass [Mon, 10 Dec 2018 17:37:49 +0000 (10:37 -0700)]
dm: sound: max98095: Tidy up error codes

Return a valid error code instead of -1.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Fix license headers
Simon Glass [Mon, 10 Dec 2018 17:37:48 +0000 (10:37 -0700)]
dm: sound: Fix license headers

Fix a few files whos license headers were not converted to SPDX.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Complete migration to driver model
Simon Glass [Mon, 10 Dec 2018 17:37:47 +0000 (10:37 -0700)]
dm: sound: Complete migration to driver model

All users of sound are converted to use driver model. Drop the old code
and the CONFIG_DM_SOUND option.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: exynos: Drop CONFIG_DM_I2C_COMPAT
Simon Glass [Mon, 10 Dec 2018 17:37:46 +0000 (10:37 -0700)]
dm: exynos: Drop CONFIG_DM_I2C_COMPAT

This option is not needed anymore for all exynos boards except arndale.
Update the config.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sandbox: sound: Convert to use driver model
Simon Glass [Mon, 10 Dec 2018 17:37:45 +0000 (10:37 -0700)]
dm: sandbox: sound: Convert to use driver model

Update sandbox's device tree and config to use driver model for sound. Use
the double buffer for sound output so that we don't need to wait for the
sound to complete before returning.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: exynos: sound: Convert to use driver model
Simon Glass [Mon, 10 Dec 2018 17:37:44 +0000 (10:37 -0700)]
dm: exynos: sound: Convert to use driver model

Update snow's device tree and config to use driver model for sound. Also
update the others as best we can.

Spring does not appear to have audio support in the kernel. The smdk5250
and smdk5420 boards use a wolfson codec which I cannot test with. So the
only boards that is tested and known to work are snow, pit and pi.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: exynos: Add support for max98090
Simon Glass [Mon, 10 Dec 2018 17:37:43 +0000 (10:37 -0700)]
dm: sound: exynos: Add support for max98090

Add support for this new codec which is used by pit.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Move common code out of maxim98095
Simon Glass [Mon, 10 Dec 2018 17:37:42 +0000 (10:37 -0700)]
dm: sound: Move common code out of maxim98095

The register-access code is useful for any maxim codec. Move it out into
its own file.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoexynos: Add support for exynos5420 i2s pinmux
Simon Glass [Mon, 10 Dec 2018 17:37:41 +0000 (10:37 -0700)]
exynos: Add support for exynos5420 i2s pinmux

Allow setting the i2s pinmux correctly on exyno5420 so that i2c can be
used on that SoC. Also rename EXYNOS_AUDSS to something consistent with
other naming.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agoexynos: Add proid_is_exynos542x() for common 542x
Simon Glass [Mon, 10 Dec 2018 17:37:40 +0000 (10:37 -0700)]
exynos: Add proid_is_exynos542x() for common 542x

Add a convenience function for any Exynos 542x chip.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Add conversion to driver model
Simon Glass [Mon, 10 Dec 2018 17:37:39 +0000 (10:37 -0700)]
dm: sound: Add conversion to driver model

Move the existing hardware drivers over to use driver model.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Start i2c IDs from 0
Simon Glass [Mon, 10 Dec 2018 17:37:38 +0000 (10:37 -0700)]
dm: sound: Start i2c IDs from 0

The current ID enums start from 1 but there does not seem to be any reason
that they cannot start with 0. Adjust the code to avoid the +1 in
codec_init().

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: core: Add a function to read into a unsigned int
Simon Glass [Mon, 10 Dec 2018 17:37:37 +0000 (10:37 -0700)]
dm: core: Add a function to read into a unsigned int

The current dev_read...() functions use s32 and u32 which are convenient
for device tree but not so useful for normal code, which often wants to
use normal integers for values.

Add a helper which supports returning an unsigned int. Also add signed
versions of the unsigned readers.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create a uclass for sound
Simon Glass [Mon, 10 Dec 2018 17:37:36 +0000 (10:37 -0700)]
dm: sound: Create a uclass for sound

The sound driver pulls together the audio codec and i2s drivers in order
to actually make sounds. It supports setup() and play() methods. The
sound_find_codec_i2s() function allows locating the linked codec and i2s
devices. They can be referred to from uclass-private data.

Add a uclass and a test for sound.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sandbox: Update sound to use two buffers
Simon Glass [Mon, 10 Dec 2018 17:37:35 +0000 (10:37 -0700)]
dm: sandbox: Update sound to use two buffers

At present we use a single buffer for sound which means we cannot be
playing one sound while queueing up the next. This wouldn't matter except
that a long sound (more than a second) has to be created as a single
buffer, thus using a lot of memory. To better mimic what real sound
drivers do, add support for double buffering in sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create a uclass for i2s
Simon Glass [Mon, 10 Dec 2018 17:37:34 +0000 (10:37 -0700)]
dm: sound: Create a uclass for i2s

The i2s bus is commonly used with audio codecs. It provides a way to
stream digital data sychronously in both directions. U-Boot only supports
audio output, so this uclass is very simple, with a single tx_data()
method.

Add a uclass and a test for i2s.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create a uclass for audio codecs
Simon Glass [Mon, 10 Dec 2018 17:37:33 +0000 (10:37 -0700)]
dm: sound: Create a uclass for audio codecs

An audio codec provides a way to convert digital data to sound and vice
versa. Add a simple uclass which just supports setting the parameters for
the codec.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Rename samsung_i2s_priv to i2s_uc_priv
Simon Glass [Mon, 10 Dec 2018 17:37:32 +0000 (10:37 -0700)]
dm: sound: Rename samsung_i2s_priv to i2s_uc_priv

This structure contains information that is likely needed by any i2s
driver so it seems useful to attach it to the (forthcoming) i2c uclass.
For now, just rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: Create an option to use driver model for sound
Simon Glass [Mon, 10 Dec 2018 17:37:31 +0000 (10:37 -0700)]
dm: sound: Create an option to use driver model for sound

The U-Boot sound system provides basic support for beeping. At present it
does not use driver model, but it needs to be converted. Add an option to
enable driver model for sound. For now it is not connected to anything.
Future work will add drivers which use this option. It will then be
removed once everything is converted.

Signed-off-by: Simon Glass <sjg@chromium.org>
5 years agodm: sound: exynos: Correct codec bus addresses
Simon Glass [Mon, 10 Dec 2018 17:37:30 +0000 (10:37 -0700)]
dm: sound: exynos: Correct codec bus addresses

For snow the codec is at address 0x11 on the i2c bus, in 7-bit format.
The device tree and code are in 8-bit format (i.e. shifted left one bit).
Fix both. Fix pit in a similar way.

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

Tidy up the ordering of header files in the sounds files.

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

This function has only one line in it. Drop it.

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

These are only used in two functions so can be made local.

Also change the first argument of max98095_do_init() to suit.

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

These are only used in two functions so can be made local.

Signed-off-by: Simon Glass <sjg@chromium.org>
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>