pandora-u-boot.git
5 years agopico-imx7d: Increase the CONFIG_ENV_OFFSET size
Fabio Estevam [Fri, 30 Nov 2018 14:52:13 +0000 (12:52 -0200)]
pico-imx7d: Increase the CONFIG_ENV_OFFSET size

U-Boot binary has grown in such a way that it goes beyond the reserved
area for the environment variables.

Running "saveenv" causes U-Boot to hang because of this overlap.

Fix this problem by increasing the CONFIG_ENV_OFFSET size.

Also, in order to prevent this same problem in the future, use
CONFIG_BOARD_SIZE_LIMIT, which will detect the overlap in build-time.

CONFIG_BOARD_SIZE_LIMIT does not accept math expressions, so declare
CONFIG_ENV_OFFSET with its direct value instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
5 years agonand: vybrid: Extend the vf610 NFC NAND driver to support device tree (and DM)
Lukasz Majewski [Mon, 3 Dec 2018 09:24:51 +0000 (10:24 +0100)]
nand: vybrid: Extend the vf610 NFC NAND driver to support device tree (and DM)

This commit adds support for device tree and enumeration via device model
for the Vybrid's NFC NAND driver.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agoKconfig: Add entry for VF610 NAND NFC device tree aware driver
Lukasz Majewski [Mon, 3 Dec 2018 09:24:50 +0000 (10:24 +0100)]
Kconfig: Add entry for VF610 NAND NFC device tree aware driver

This commit provides code to add proper entry to Kconfig to enable
support for VF610 device tree aware driver.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agonand: vybrid: Use calloc() instead of malloc() to allocate struct nfc
Lukasz Majewski [Mon, 3 Dec 2018 09:20:47 +0000 (10:20 +0100)]
nand: vybrid: Use calloc() instead of malloc() to allocate struct nfc

Without this change it is possible that Vybrid's NFC driver malloc() call
will obtain some memory used (and correctly free'd) by some previous
driver (in this case pinctrl for Vybrid).

As a result some fields of struct nfc - in out case mtd->_get_device - are
"pre initialized" with some random values.

On the latter stage of booting, when e.g. somebody calls 'mtdparts default'
the "data abort" is observed when __get_mtd_device() function is called.

The mtd->_get_device pointer is not NULL and wrong value is referenced.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Stefan Agner <stefan.agner@toradex.com>
5 years agoimx: mx53ppd: fix build error
Peng Fan [Sun, 9 Dec 2018 11:45:02 +0000 (11:45 +0000)]
imx: mx53ppd: fix build error

board/ge/mx53ppd/mx53ppd.c: In function 'board_late_init':
board/ge/mx53ppd/mx53ppd.c:359:23: error: passing argument 2 of 'read_vpd' from incompatible pointer type [-Werror=incompatible-pointer-types]
  res = read_vpd(&vpd, vpd_callback);
                       ^~~~~~~~~~~~
In file included from board/ge/mx53ppd/mx53ppd.c:37:0:
board/ge/mx53ppd/../../ge/common/vpd_reader.h:19:5: note: expected 'int (*)(struct vpd_cache *, u8,  u8,  u8,  size_t,  const u8 *) {aka int (*)(struct vpd_cache *, unsigned char,  unsigned char,  unsigned char,  unsigned int,  const unsigned char *)}' but argument is of type 'int (*)(void *, u8,  u8,  u8,  size_t,  const u8 *) {aka int (*)(void *, unsigned char,  unsigned char,  unsigned char,  unsigned int,  const unsigned char *)}'
int read_vpd(struct vpd_cache *cache,
     ^~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Stefano Babic <sbabic@denx.de>
5 years agopcm058: fix NAND flash not using badblock table
Harald Seiler [Fri, 7 Dec 2018 09:19:36 +0000 (10:19 +0100)]
pcm058: fix NAND flash not using badblock table

Currently, U-Boot ignores the BBT stored in the last 4 blocks of NAND
flash because the NAND_BBT_USE_FLASH flag is not set.  This leads to
two issues:

* U-Boot silently uses a memory-only BBT which is initialized with all
  blocks marked as good.  This means, actual bad blocks are marked good
  and U-Boot might try writing to or reading from them.
* The BBT in flash, which will be created once Linux boots up, is not
  off limits for a driver ontop, like UBI.  While it does not seem to
  consistently produce an error, sometimes UBI will fail to attach
  because the BBT blocks obviously don't contain valid UBI data.

To fix this, this patch sets the CONFIG_SYS_NAND_USE_FLASH_BBT option,
which is used in ./drivers/mtd/nand/raw/mxs_nand.c to decide whether
a BBT in flash is used.

Signed-off-by: Harald Seiler <hws@denx.de>
5 years agoimx8m: ddr: removed unused macros
Peng Fan [Mon, 3 Dec 2018 12:41:09 +0000 (12:41 +0000)]
imx8m: ddr: removed unused macros

Remove unused DDRC register macros.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: add i.MX8MQ EVK support
Peng Fan [Tue, 20 Nov 2018 10:20:00 +0000 (10:20 +0000)]
imx: add i.MX8MQ EVK support

Add i.MX8MQ EVK support. SPL will initialize ddr and load ddr phy
firmware. Then loading FIT image, ATF to OCRAM, U-Boot and DTB to
DRAM.

The boot log with Arm trusted firmware console enabled:
"
U-Boot SPL 2018.11-00142-g9ae14e7274 (Nov 20 2018 - 18:13:16 +0800)
PMIC:  PFUZE100 ID=0x10
Normal Boot
Trying to boot from MMC2
NOTICE:  Configureing TZASC380
NOTICE:  BL31: v1.5(release):p9.0.0_1.0.0-beta-20180928-8-ge09c4b62-dirty
NOTICE:  BL31: Built : 09:28:54, Nov  8 2018
lpddr4 swffc start
NOTICE:  sip svc init

U-Boot 2018.11-00142-g9ae14e7274 (Nov 20 2018 - 18:13:16 +0800)

CPU:   Freescale i.MX8MQ rev2.0 at 1000 MHz
Reset cause: POR
Model: Freescale i.MX8MQ EVK
DRAM:  3 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
In:    serial
Out:   serial
Err:   serial
Net:
Warning: ethernet@30be0000 using MAC address from ROM
eth0: ethernet@30be0000
Hit any key to stop autoboot:  0
"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
5 years agodrivers: ddr: introduce DDR driver for i.MX8M
Peng Fan [Tue, 20 Nov 2018 10:19:57 +0000 (10:19 +0000)]
drivers: ddr: introduce DDR driver for i.MX8M

Introduce DDR driver for i.MX8M. The driver will be used by SPL to
initialze DDR PHY and DDR Controller.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: imx8m: add lpddr4 header file
Peng Fan [Tue, 20 Nov 2018 10:19:53 +0000 (10:19 +0000)]
imx: imx8m: add lpddr4 header file

Introduce lpddr4 header file

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: imx8m: not build bootaux when building SPL
Peng Fan [Tue, 20 Nov 2018 10:19:50 +0000 (10:19 +0000)]
imx: imx8m: not build bootaux when building SPL

No need to build bootaux in SPL stage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: imx8mq: build flash.bin
Peng Fan [Tue, 20 Nov 2018 10:19:46 +0000 (10:19 +0000)]
imx: imx8mq: build flash.bin

Build flash.bin for i.MX8MQ, it will include signed hdmi firmware,
spl, ddr firmware, fit image(bl31.bin, u-boot-nodtb.bin, dtb).
Burn it to 33KB offset of SD card.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: imx8m: introduce imximage cfg file
Peng Fan [Tue, 20 Nov 2018 10:19:43 +0000 (10:19 +0000)]
imx: imx8m: introduce imximage cfg file

imximage.cfg will be used to generate the flash.bin

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: imx8m: introduce script to generate fit image
Peng Fan [Tue, 20 Nov 2018 10:19:39 +0000 (10:19 +0000)]
imx: imx8m: introduce script to generate fit image

Introduce script to generate fit image for i.MX8M

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: imx8m: clock refactor dram pll part
Peng Fan [Tue, 20 Nov 2018 10:19:32 +0000 (10:19 +0000)]
imx: imx8m: clock refactor dram pll part

Refactor dram_pll_init to accept args to configure different pll freq.
Introduce dram_enable_bypass and dram_disable_bypass

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: spl: add MMC BOOT Device for i.MX8M
Peng Fan [Tue, 20 Nov 2018 10:19:29 +0000 (10:19 +0000)]
imx: spl: add MMC BOOT Device for i.MX8M

Add MMC BOOT Device for i.MX8M

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: rename mx8m,MX8M to imx8m,IMX8M
Peng Fan [Tue, 20 Nov 2018 10:19:25 +0000 (10:19 +0000)]
imx: rename mx8m,MX8M to imx8m,IMX8M

Rename mx8m,MX8M to imx8m,IMX8M

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Jon Nettleton <jon@solid-run.com>
5 years agoimx: introduce is_imx8mq helper
Peng Fan [Tue, 20 Nov 2018 10:19:22 +0000 (10:19 +0000)]
imx: introduce is_imx8mq helper

Introduce is_imx8mq header macro

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: cpu: add CHIP_REV_2_1 macro
Peng Fan [Tue, 20 Nov 2018 10:19:18 +0000 (10:19 +0000)]
imx: cpu: add CHIP_REV_2_1 macro

Introduce CHIP_REV_2_1 macro.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx8m: Enable CONFIG_SPL_FIT_IMAGE_TINY for iMX8M
Ye Li [Tue, 20 Nov 2018 10:19:15 +0000 (10:19 +0000)]
imx8m: Enable CONFIG_SPL_FIT_IMAGE_TINY for iMX8M

If we don't define CONFIG_SPL_FIT_IMAGE_TINY, when loading images from FIT,
the SPL will record all loadables' info to u-boot's FDT. This causes
problem when HAB is enabled, because FDT's content is modified before
we authenticate it.

Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoIntroduce CONFIG_FIT_EXTERNAL_OFFSET
Peng Fan [Tue, 20 Nov 2018 10:19:11 +0000 (10:19 +0000)]
Introduce CONFIG_FIT_EXTERNAL_OFFSET

Introduce CONFIG_FIT_EXTERNAL_OFFSET to give user a choice to choose
where to put the external data.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoarm: imx8qxp: build u-boot-dtb.cfgout before checking files
Peng Fan [Mon, 5 Nov 2018 10:01:37 +0000 (10:01 +0000)]
arm: imx8qxp: build u-boot-dtb.cfgout before checking files

Build u-boot-dtb.cfgout before checking files, otherwise
u-boot-dtb.cfgout is generated at late stage and cause final image not
generated.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agotools: add i.MX8M image support
Peng Fan [Tue, 20 Nov 2018 10:19:36 +0000 (10:19 +0000)]
tools: add i.MX8M image support

i.MX8M bootable image type is like i.MX6/7, but there is signed HDMI
firmware image in front of A53 bootable image, which is also has an IVT
header.

Here we also include fit image to generate a bootable image.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>
5 years agoimx: hab: extend hab_auth_img to calculate ivt_offset
Parthiban Nallathambi [Wed, 21 Nov 2018 13:50:40 +0000 (14:50 +0100)]
imx: hab: extend hab_auth_img to calculate ivt_offset

Current implementation of hab_auth_img command needs ivt_offset to
authenticate the image. But ivt header is placed at the end of image
date after padding.

This leaves the usage of hab_auth_img command to fixed size or static
offset for ivt header. New function "get_image_ivt_offset" is introduced
to find the ivt offset during runtime. The case conditional check in this
function is same as boot_get_kernel in common/bootm.c

With this variable length image e.g. FIT image with any random size can
have IVT at the end and ivt_offset option can be left optional

Can be used as "hab_auth_img $loadaddr $filesize" from u-boot script

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Breno Lima <breno.lima@nxp.com>
5 years agoarm: imx7d: cl-som-imx7: migration to CONFIG_BLK
Yaniv Levinsky [Tue, 20 Nov 2018 15:49:57 +0000 (17:49 +0200)]
arm: imx7d: cl-som-imx7: migration to CONFIG_BLK

Enable driver model for USB, MMC and REGULATOR drivers.
Set run-time configuration via Device Tree.

Signed-off-by: Yaniv Levinsky <yaniv.levinsky@compulab.co.il>
5 years agoARM: DTS: Provide pinfunc definitions for vybrid vf610 from Linux kernel
Lukasz Majewski [Mon, 19 Nov 2018 23:38:08 +0000 (00:38 +0100)]
ARM: DTS: Provide pinfunc definitions for vybrid vf610 from Linux kernel

This file is in sync with v4.20-next tree:
e4dda4f5a4df "x86/kaslr, ACPI/NUMA: avoid including asm/kaslr.h on arm64"

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agoARM: DTS: Add iomux node to vf.dtsi for Vybrid devices
Lukasz Majewski [Mon, 19 Nov 2018 23:38:07 +0000 (00:38 +0100)]
ARM: DTS: Add iomux node to vf.dtsi for Vybrid devices

This node is in sync with v4.20-next tree:
e4dda4f5a4df "x86/kaslr, ACPI/NUMA: avoid including asm/kaslr.h on arm64"

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agoARM: vybrid: Provide pinctrl driver for Vybrid (vf610)
Lukasz Majewski [Mon, 19 Nov 2018 23:38:06 +0000 (00:38 +0100)]
ARM: vybrid: Provide pinctrl driver for Vybrid (vf610)

This implementation comply with other iMX devices pinctrl drivers already
available in U-boot.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
5 years agospl: introduce function prototypes
Peng Fan [Sat, 17 Nov 2018 09:10:31 +0000 (09:10 +0000)]
spl: introduce function prototypes

Introduce function prototypes for board_spl_fit_size_align and
board_spl_fit_post_load

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoSPL: Add HAB image authentication to FIT
Ye Li [Sat, 17 Nov 2018 09:10:25 +0000 (09:10 +0000)]
SPL: Add HAB image authentication to FIT

Introduce two board level callback functions to FIT image loading process, and
a SPL_FIT_FOUND flag to differentiate FIT image or RAW image.

Implement functions in imx common SPL codes to call HAB funtion
to authenticate the FIT image. Generally, we have to sign multiple regions
in FIT image:
1. Sign FIT FDT data (configuration)
2. Sign FIT external data (Sub-images)

Because the CSF supports to sign multiple memory blocks, so that we can use one
signature to cover all regions in FIT image and only authenticate once.
The authentication should be done after the entire FIT image is loaded into
memory including all sub-images.
We use "-p" option to generate FIT image to reserve a space for FIT IVT
and FIT CSF, also this help to fix the offset of the external data (u-boot-nodtb.bin,
ATF, u-boot DTB).

The signed FIT image layout is as below:
--------------------------------------------------
|     |     |     |   |           |     |        |
| FIT | FIT | FIT |   | U-BOOT    | ATF | U-BOOT |
| FDT | IVT | CSF |   | nodtb.bin |     |   DTB  |
|     |     |     |   |           |     |        |
--------------------------------------------------

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: bootaux: fix stack and pc assignment on 64-bit platforms
Gary Bisson [Wed, 14 Nov 2018 16:55:29 +0000 (17:55 +0100)]
imx: bootaux: fix stack and pc assignment on 64-bit platforms

Using ulong is wrong as its size depends on the Host CPU architecture
(32-bit vs. 64-bit) although the Cortex-M4 is always 32-bit.

Without this patch, the stack and PC are obviously wrong and it
generates an abort when used on 64-bit processors such as the i.MX8MQ.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
5 years agoimx: mx8m: add memory mapping for CAAM and TCM
Gary Bisson [Wed, 14 Nov 2018 16:55:28 +0000 (17:55 +0100)]
imx: mx8m: add memory mapping for CAAM and TCM

Otherwise can't boot the M4 core as it is impossible to load its
firmware into the TCM memory.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
5 years agotools: improve portability of imx_cntr_image.sh
Martin Husemann [Fri, 9 Nov 2018 13:30:14 +0000 (14:30 +0100)]
tools: improve portability of imx_cntr_image.sh

Replace non-portable operator == with =

The operator == in sh(1) / test(1) is non-POSIX and only implemented by
some shells (like bash). It is equivalent to the standard defined operator =.

5 years agoembestmx6boards: Add SPL support
Fabien Lahoudere [Thu, 8 Nov 2018 10:28:05 +0000 (11:28 +0100)]
embestmx6boards: Add SPL support

In order to boot faster with falcon mode, we need to add SPL
support to riotboard.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
5 years agoimx: imx8qxp_mek: imximage: remove config.h
Peng Fan [Mon, 5 Nov 2018 10:01:34 +0000 (10:01 +0000)]
imx: imx8qxp_mek: imximage: remove config.h

config.h is not needed, remove it.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
5 years agodoc: imx: fix typos in mxsimage.txt
Michael Heimpold [Fri, 2 Nov 2018 22:12:02 +0000 (23:12 +0100)]
doc: imx: fix typos in mxsimage.txt

This fixes two small typos in mxsimage.txt.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Reviewed-by: Breno Lima <breno.lima@nxp.com>
5 years agodoc: imx: fix typo in imximage.txt
Michael Heimpold [Fri, 2 Nov 2018 22:11:49 +0000 (23:11 +0100)]
doc: imx: fix typo in imximage.txt

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Reviewed-by: Breno Lima <breno.lima@nxp.com>
5 years agoconfigs: mx23_olinuxino_defconfig: disable bootefi command
Michael Heimpold [Mon, 29 Oct 2018 19:21:52 +0000 (20:21 +0100)]
configs: mx23_olinuxino_defconfig: disable bootefi command

CONFIG_CMD_BOOTEFI is enabled by Kconfig default, but rarely
used on this board/platform.
So let's disable it for the boards default config.
This also saves around 16 KiB in the final u-boot.sb.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
5 years agoconfigs: mx23_olinuxino_defconfig: fix status led definition
Michael Heimpold [Mon, 29 Oct 2018 19:21:51 +0000 (20:21 +0100)]
configs: mx23_olinuxino_defconfig: fix status led definition

While migrating individual status led usages to Kconfig stuff,
a (random) value was introduced for this board which does not
work but produces the following error message during boot:

__led_init: failed requesting GPIO59!

Since Kconfig does not seem to accept a define as this point,
but the mxs gpio driver requires not only a simple integer value,
we need to use the plain value of MX23_PAD_SSP1_DETECT__GPIO_2_1.

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Fixes: 2d8d190c8394 ("status_led: Kconfig migration")

5 years agow1: Add driver for i.MX bus master controller
Martin Fuzzey [Wed, 24 Oct 2018 08:21:18 +0000 (10:21 +0200)]
w1: Add driver for i.MX bus master controller

Two variants of controllers are supported:
V1 (bitwise only) found in
i.MX21, i.MX27, i.MX31, i.MX51
V2 (byte operations) found in
i.MX25, i.MX35, i.MX50, i.MX53

Only tested on i.MX53 hardware but in both modes
(by modifying the device tree).

Signed-off-by: Martin Fuzzey <martin.fuzzey@flowbird.group>
5 years agowatchdog: imx: add config to disable wdog reset
Xiaoliang Yang [Thu, 18 Oct 2018 10:27:46 +0000 (18:27 +0800)]
watchdog: imx: add config to disable wdog reset

Add Kconfig option WATCHDOG_RESET_DISABLE to disable watchdog reset
in imx_watchdog driver, so that the watchdog will not be fed in
u-boot if CONFIG_WATCHDOG_RESET_DISABLE is enabled.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
5 years agowatchdog: driver support for fsl-lsch2
Xiaoliang Yang [Thu, 18 Oct 2018 10:27:45 +0000 (18:27 +0800)]
watchdog: driver support for fsl-lsch2

Support watchdog driver for fsl-lsch2. It's disabled in default.
If you want to use it, please enable CONFIG_IMX_WATCHDOG.
Define CONFIG_WATCHDOG_TIMEOUT_MSECS to set watchdog timeout.

Signed-off-by: Xiaoliang Yang <xiaoliang.yang_1@nxp.com>
5 years agoboard: ge: Move VPD reading to the vpd_reader
Denis Zalevskiy [Wed, 17 Oct 2018 08:33:30 +0000 (10:33 +0200)]
board: ge: Move VPD reading to the vpd_reader

Merge functionality duplicated in bx50v3 and mx53ppd: the logic
is the same except that process_vpd is called at different phases.
Also read_vpd could end up in error, so there is no VPD data in this
case - it shouldn't be processed.

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@ge.com>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
5 years agoboard: ge: Move VPD EEPROM configuration to the defconfig
Denis Zalevskiy [Wed, 17 Oct 2018 08:33:27 +0000 (10:33 +0200)]
board: ge: Move VPD EEPROM configuration to the defconfig

Use standard configuration logic to define EEPROM constants.
Names are based on VPD_EEPROM_ prefix because EEPROM_ is already
used by i2c_eeprom driver.

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@ge.com>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
5 years agoboard: ge: Remove EEPROM bus param from read_vpd()
Denis Zalevskiy [Wed, 17 Oct 2018 08:33:26 +0000 (10:33 +0200)]
board: ge: Remove EEPROM bus param from read_vpd()

The bus is statically defined, so remove redundant parameters
from read_vpd() for PPD and Bx50v3.

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@ge.com>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
5 years agowarp7: configs: add CONFIG_FIT option
Pierre-Jean Texier [Sat, 29 Sep 2018 12:05:01 +0000 (14:05 +0200)]
warp7: configs: add CONFIG_FIT option

This enable FIT image support.

Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
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>