platform/kernel/u-boot.git
4 years agowandboard: Do not print error message when PMIC is absent
Fabio Estevam [Thu, 9 Jan 2020 01:05:05 +0000 (22:05 -0300)]
wandboard: Do not print error message when PMIC is absent

Only the wandboard revD1 boards have PMIC, so when running on a wandboard
of different revision the following error is always shown on every boot:

pmic_get() ret -19

Instead of printing this error message, move it to debug level instead.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx8qxp_mek: Select CONFIG_NET_RANDOM_ETHADDR
Fabio Estevam [Thu, 9 Jan 2020 14:07:23 +0000 (11:07 -0300)]
imx8qxp_mek: Select CONFIG_NET_RANDOM_ETHADDR

Some i.MX8QXP MEK boards do not have MAC address stored
and hang during eth driver probe:

Error: ethernet@5b040000 address not set.

(Board hangs)

To fix this problem select CONFIG_NET_RANDOM_ETHADDR so that
a valid MAC address can be used in such case.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agoimx: add imx8x based deneb board
Anatolij Gustschin [Tue, 7 Jan 2020 15:37:43 +0000 (16:37 +0100)]
imx: add imx8x based deneb board

Add support for Capricorn Deneb SoM variant.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
4 years agoimx: add imx8x capricorn giedi board
Anatolij Gustschin [Tue, 7 Jan 2020 15:37:42 +0000 (16:37 +0100)]
imx: add imx8x capricorn giedi board

Add support for i.MX8X based Capricorn Giedi SoM.

Supported interfaces: GPIO, ENET, eMMC, I2C, UART.

Console output:

  U-Boot SPL 2020.01-00003-gfd1c98f (Jan 07 2020 - 15:51:25 +0100)
  Trying to boot from MMC1
  Load image from MMC/SD 0x3e400

  U-Boot 2020.01-00003-gfd1c98f (Jan 07 2020 - 15:51:25 +0100) ##v01.07

  CPU:   NXP i.MX8QXP RevB A35 at 1200 MHz at 30C

  Model: Siemens Giedi
  Board: Capricorn
  Boot:  MMC0
  DRAM:  1022 MiB
  MMC:   FSL_SDHC: 0
  Loading Environment from MMC... OK
  In:    serial@5a080000
  Out:   serial@5a080000
  Err:   serial@5a080000
  Net:   eth1: ethernet@5b050000 [PRIME]
  Autobooting in 1 seconds, press "<Esc><Esc>" to stop

Signed-off-by: Anatolij Gustschin <agust@denx.de>
4 years agotravis: Switch to QEMU v4.2.0 globally
Tom Rini [Sat, 11 Jan 2020 13:07:03 +0000 (08:07 -0500)]
travis: Switch to QEMU v4.2.0 globally

Given our tests in GitLab / Azure we can use QEMU v4.2.0 for all
platforms now.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agogitlab/azure: Update to latest container
Tom Rini [Fri, 10 Jan 2020 22:07:27 +0000 (17:07 -0500)]
gitlab/azure: Update to latest container

- Updated base snapshot
- QEMU v4.2.0

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoMerge branch '2020-01-10-master-imports'
Tom Rini [Fri, 10 Jan 2020 21:38:40 +0000 (16:38 -0500)]
Merge branch '2020-01-10-master-imports'

- Android image support enhancements
- Assorted ARM fixes and enhancements
- m68k update

4 years agocmd: adtimg: Refactor usage style
Eugeniu Rosca [Tue, 24 Dec 2019 16:51:08 +0000 (17:51 +0100)]
cmd: adtimg: Refactor usage style

Trying to extend 'adtimg' functionality [1], we've been severely hit
by a major limitation in the command's usage scheme. Specifically, the
command's user interface appears to be too centric to getting the
DTB/DTBO entry [3] based on the index of the desired DT in the image,
which makes it really difficult retrieving the DT entry based on
alternative criteria (e.g. filtering by id/rev fields), the
latter being demanded by real life customer use-cases [1].

This went to the point of receiving below feedback from Sam [2]:

 -- snip --
 As for 'dtimg' command: after giving it some thought, I think not much
 people using it yet. So in this particular case I don't have some
 strong preference, and if you think the 'dtimg' interface is ugly, and
 it overcomes "don't break interfaces" rule, maybe now is a good time
 to rework it (before it gets widely used).
 -- snip --

Given the above, rework the usage pattern from [4] to [5], in order to
allow an intuitive enablement of "by id|rev" DT search [6].

[1] https://patchwork.ozlabs.org/cover/1202575/
    ("cmd: dtimg: Enhance with --id and --rev options (take #1)")
[2] https://patchwork.ozlabs.org/patch/1182207/#2317020
[3] https://source.android.com/devices/architecture/dto/partitions
[4] Old usage
adtimg dump <addr>                    - Print image contents
adtimg start <addr> <index> <varname> - Get DT address by index
adtimg size <addr> <index> <varname>  - Get DT size by index

[5] New usage
adtimg addr <addr>                      - Set image location to <addr>
adtimg dump                             - Print out image contents
adtimg get dt --index=<i> [avar [svar]] - Get DT address and size by index

[6] Soon-to-be-provided "by id|rev" add-on functionality
adtimg get dt --id=<id> --rev=<rev> [avar [svar [ivar]]]
 - Get DT address/size/index by id|rev fields

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
4 years agocmd: adtimg: Rename internal symbols
Eugeniu Rosca [Tue, 24 Dec 2019 16:51:07 +0000 (17:51 +0100)]
cmd: adtimg: Rename internal symbols

With 'dtimg.c' renamed to 'adtimg.c', now ensure the naming
consistency in the internal implementation of 'adtimg.c'.

No functional change intended.

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodtimg/am57xx_evm_defconfig: Rename dtimg to adtimg
Eugeniu Rosca [Tue, 24 Dec 2019 16:51:06 +0000 (17:51 +0100)]
dtimg/am57xx_evm_defconfig: Rename dtimg to adtimg

Rename the existing 'dtimg' command to 'adtimg', in order to:
 - Suggest the Android origins and scope
 - Be consistent with the upcoming 'abootimg' command (naming
   suggested by Simon [*])

The change in _not_ backward compatible, but its benefits outweigh its
downsides, given that we don't expect active users of 'dtimg' today.

Perform the rename in several steps:
 1. Rename *.c file and Kconfig symbol. This should allow
    'git log --follow' to properly track the history of 'adtimg.c'
 2. 's/dtimg/adtimg/g' in the internal namespace of 'adtimg.c'

ELF comparison [**] before and after shows no functional change.

[*] https://patchwork.ozlabs.org/patch/1182212/#2291600
[**] diff -u <(objdump -d cmd/dtimg.o) <(objdump -d cmd/adtimg.o)

Cc: Tom Rini <trini@konsulko.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Reviewed-by: Simon Glass<sjg@chromium.org>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
4 years agovirtio: fix typo devicd
Heinrich Schuchardt [Tue, 24 Dec 2019 11:21:09 +0000 (12:21 +0100)]
virtio: fix typo devicd

%s/devicd/device

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoarm: cpu: armv8: add support for arm psci reset2.
Rajesh Ravi [Fri, 22 Nov 2019 22:50:01 +0000 (14:50 -0800)]
arm: cpu: armv8: add support for arm psci reset2.

Current U-Boot has only support for psci reset.
Adding support for arm psci reset2 allows passing of reset level
and other platform sepcific parameters like strap settings
to lowlevel psci implementation.

Signed-off-by: Rajesh Ravi <rajesh.ravi@broadcom.com>
Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
4 years agoarch: arm: Program GIC LPI configuration table
Bharat Kumar Reddy Gooty [Mon, 16 Dec 2019 17:09:43 +0000 (09:09 -0800)]
arch: arm: Program GIC LPI configuration table

Programs the following:
1. Redistributor PROCBASER configuration table (which
is common for all redistributors)
2. Redistributor pending table (PENDBASER), for all the
available redistributors.

Signed-off-by: Bharat Kumar Reddy Gooty <bharat.gooty@broadcom.com>
Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
4 years agomkimage: simplify fit_check_params()
Heinrich Schuchardt [Wed, 11 Dec 2019 12:51:38 +0000 (13:51 +0100)]
mkimage: simplify fit_check_params()

fit_check_params() wants at least two of dflag, fflag, and lflag set.

Simplify the logical constraint checking this.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
4 years agocmd/eeprom.c: prepend 0x to hex numbers in output message format
Klaus H. Sorensen [Wed, 11 Dec 2019 11:18:29 +0000 (11:18 +0000)]
cmd/eeprom.c: prepend 0x to hex numbers in output message format

If the numbers do not happen to contain any digits from [a-f], it's
not clear that they are base 16.

Signed-off-by: Klaus H. Sorensen <khso@prevas.dk>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
4 years agotest/cmd_ut.c: fix cmd_ut_category
Philippe Reynes [Thu, 9 Jan 2020 16:34:02 +0000 (17:34 +0100)]
test/cmd_ut.c: fix cmd_ut_category

In the function cmd_ut_category, the prefix is used with
the function strncmp to know if the prefix should be
removed from the test name, even if the prefix is NULL.

To avoid this issue, we consider that a prefix NULL
mean no prefix. So we only try to remove the prefix
from the test_name if the prefix is not NULL, then
we avoid to call the function strncmp with a NULL
prefix.

Reported-by: Coverity CID 281110
Fixes: 4ad4edfe ("cmd_ut: add a parameter prefix to the function cmd_ut_category")
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
4 years agogcc-9: silence 'address-of-packed-member' warning
Andy Shevchenko [Fri, 29 Nov 2019 17:47:59 +0000 (19:47 +0200)]
gcc-9: silence 'address-of-packed-member' warning

GCC 9.x starts complaining about potential misalignment of the pointer to
the array (in this case alignment=2) in the packed (alignment=1) structures.

Repeating Linus' Torvalds commit 6f303d60534c in the Linux kernel.

Original commit message:

  We already did this for clang, but now gcc has that warning too.
  Yes, yes, the address may be unaligned.  And that's kind of the point.

This in particular hides the warnings like

drivers/usb/gadget/composite.c:545:23: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  545 |    collect_langs(sp, s->wData);

drivers/usb/gadget/composite.c:550:24: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  550 |     collect_langs(sp, s->wData);

drivers/usb/gadget/composite.c:555:25: warning: taking address of packed member of ‘struct usb_string_descriptor’ may result in an unaligned pointer value [-Waddress-of-packed-member]
  555 |      collect_langs(sp, s->wData);

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
4 years agoboards/km_arm: enable support for Macronix SPI NOR flash
Holger Brunck [Mon, 25 Nov 2019 16:24:16 +0000 (17:24 +0100)]
boards/km_arm: enable support for Macronix SPI NOR flash

The M25P80 and M25P32 SPI flashes from Numonix/Micron
will be replaced by Marconix MX25L80 and MX25L32 flashes.

Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
CC: Stefan Roese <sr@denx.de>
CC: Valentin Longchamp <valentin.longchamp@ch.abb.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agoarm/km: remove board KMCOGE3UN
Holger Brunck [Mon, 25 Nov 2019 16:24:15 +0000 (17:24 +0100)]
arm/km: remove board KMCOGE3UN

This target is out of maintenance and can be removed.

Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
CC: Stefan Roese <sr@denx.de>
CC: Valentin Longchamp <valentin.longchamp@ch.abb.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agokm/boards: add MAC address offset as argument to ivm_populate_env
Holger Brunck [Mon, 25 Nov 2019 16:24:14 +0000 (17:24 +0100)]
km/boards: add MAC address offset as argument to ivm_populate_env

For upcoming SECU board we have different MAC address offsets depending
on which functional unit we are running. In this case we need to pass
this value to the ivm_populate_env function instead of using the hard
coded config option there.

Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
CC: Stefan Roese <sr@denx.de>
CC: Valentin Longchamp <valentin.longchamp@ch.abb.com>
CC: Marek Vasut <marex@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agokm/boards: fix typo for MAC address offset config option
Holger Brunck [Mon, 25 Nov 2019 16:24:13 +0000 (17:24 +0100)]
km/boards: fix typo for MAC address offset config option

This patch only fixes a typo.

Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
CC: Stefan Roese <sr@denx.de>
CC: Valentin Longchamp <valentin.longchamp@ch.abb.com>
Reviewed-by: Stefan Roese <sr@denx.de>
4 years agopoweroff: add poweroff for mt6323 pmic
Frank Wunderlich [Fri, 22 Nov 2019 14:32:24 +0000 (15:32 +0100)]
poweroff: add poweroff for mt6323 pmic

this adds poweroff to bananapi r2 / mt7623 / mt6323 pmic

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
4 years agortc: add support for DS3232 device
Han Nandor [Tue, 12 Nov 2019 08:39:38 +0000 (08:39 +0000)]
rtc: add support for DS3232 device

DS3232 is an i2c RTC with 236 bytes of battery-backed SRAM.

Add an RTC driver for DS3232 device, which provides time and
date support. Also read and write functions are provided,
which can be used to access the SRAM memory.

Signed-off-by: Nandor Han <nandor.han@vaisala.com>
4 years agospl: fix stack usage check if gd is not initialized
Simon Goldschmidt [Mon, 11 Nov 2019 21:30:46 +0000 (22:30 +0100)]
spl: fix stack usage check if gd is not initialized

Most platforms do not set up gd->start_addr_sp in SPL. Since this is
required for CONFIG_SPL_SYS_REPORT_SACK_F_USAGE to work correctly, set
up gd->start_addr_sp in SPL to the value passed to
board_init_f_init_reserve if it is not set yet.

Fixes: d8c0332031 ("spl: implement stack usage check")
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
4 years agom68k: Drop CONFIG_MCFPIT support
Tom Rini [Mon, 11 Nov 2019 14:39:11 +0000 (09:39 -0500)]
m68k: Drop CONFIG_MCFPIT support

All platforms currently use the "MCFTMR" DMA timer rather than the PIT
timer, so drop the MCFPIT code.

Cc: Huan Wang <alison.wang@nxp.com>
Cc: Angelo Dureghello <angelo@sysam.it>
Cc: TsiChung Liew <Tsi-Chung.Liew@nxp.com>
Cc: Wolfgang Wegner <w.wegner@astro-kom.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Angelo Dureghello <angelo@sysam.it>
4 years agobootcount: add a DM i2c eeprom backing store for bootcount
Robert Beckett [Mon, 28 Oct 2019 18:44:06 +0000 (18:44 +0000)]
bootcount: add a DM i2c eeprom backing store for bootcount

This driver allows the use of i2c eeprom device or partition as backing
store for boot counter values with DM enabled.

Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
4 years agodrivers: mcfmii: add dm support
Angelo Durgehello [Fri, 15 Nov 2019 22:54:20 +0000 (23:54 +0100)]
drivers: mcfmii: add dm support

Add specific dm code, but maintaining this driver as is, so more in the
shape of a mii library. Can be moved to dm in a further step.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agodrivers: fsl_mcdmafec: conversion to dm
Angelo Durgehello [Fri, 15 Nov 2019 22:54:19 +0000 (23:54 +0100)]
drivers: fsl_mcdmafec: conversion to dm

Full conversion to dm for all boards, legacy code removed.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agodrivers: mcffec: conversion to dm
Angelo Durgehello [Fri, 15 Nov 2019 22:54:18 +0000 (23:54 +0100)]
drivers: mcffec: conversion to dm

Full conversion to dm for all boards, legacy code removed.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agodrivers: net: add mcf fec dm Kconfig support
Angelo Durgehello [Fri, 15 Nov 2019 22:54:17 +0000 (23:54 +0100)]
drivers: net: add mcf fec dm Kconfig support

Add ColdFire fec to Kconfig.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agom68k: add dm fec support
Angelo Durgehello [Fri, 15 Nov 2019 22:54:16 +0000 (23:54 +0100)]
m68k: add dm fec support

Add architecture-related code for dm fec support.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agoconfigs: purge unneeded fec defines
Angelo Durgehello [Fri, 15 Nov 2019 22:54:15 +0000 (23:54 +0100)]
configs: purge unneeded fec defines

Remove unneeded fec-related defines after fec moved as dm.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agoconfigs: add eth dm support for all ColdFire boards
Angelo Durgehello [Fri, 15 Nov 2019 22:54:14 +0000 (23:54 +0100)]
configs: add eth dm support for all ColdFire boards

Add dm eth config options for all involved ColdFire-based boards.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agom68k: add fec fdt overrides to all boards
Angelo Durgehello [Fri, 15 Nov 2019 22:54:13 +0000 (23:54 +0100)]
m68k: add fec fdt overrides to all boards

Add ethernet controller overrides for all involved boards.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agom68k: add fec base node to devicetrees
Angelo Durgehello [Fri, 15 Nov 2019 22:54:12 +0000 (23:54 +0100)]
m68k: add fec base node to devicetrees

Add basic ethernet controller devicetree nodes for all ColdFire
families.

Signed-off-by: Angelo Durgehello <angelo.dureghello@timesys.com>
4 years agoMerge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-mpc83xx
Tom Rini [Thu, 9 Jan 2020 18:42:43 +0000 (13:42 -0500)]
Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-mpc83xx

- A small PR with MC8309 fixes from Rasmus.

4 years agoMerge tag 'dm-pull-8jan20' of git://git.denx.de/u-boot-dm
Tom Rini [Thu, 9 Jan 2020 13:52:21 +0000 (08:52 -0500)]
Merge tag 'dm-pull-8jan20' of git://git.denx.de/u-boot-dm

dm: Increased separation of ofdata_to_platdata() and probe methods

4 years agoMerge branch 'master' of git://git.denx.de/u-boot-usb
Tom Rini [Thu, 9 Jan 2020 13:51:57 +0000 (08:51 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-usb

- DFU updates

4 years agoMerge tag 'efi-2020-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Wed, 8 Jan 2020 23:57:11 +0000 (18:57 -0500)]
Merge tag 'efi-2020-04-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for UEFI sub-system for efi-2020-04-rc1

This pull request provides:

* support for FIT images for UEFI binaries
* drivers for hardware random number generators
* an implementation of the EFI_RNG_PROTOCOL
* a sub-command for efidebug to display configuration tables

4 years agoMerge tag 'uniphier-v2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot...
Tom Rini [Wed, 8 Jan 2020 20:25:13 +0000 (15:25 -0500)]
Merge tag 'uniphier-v2020.04' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier

UniPhier SoC updates for v2020.04

- add pinmux nodes for I2C ch5, ch6

- enable SPI driver and command

4 years agoMerge tag 'u-boot-imx-20200108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
Tom Rini [Wed, 8 Jan 2020 20:24:50 +0000 (15:24 -0500)]
Merge tag 'u-boot-imx-20200108' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx

---------------------------------------------------------------------
Add i.MX8MP SoC and EVK board
Update README for i.MX8MN EVK and fix mmc env
Add pca9450 driver
--------------------------------------------------------------------

Travis: https://travis-ci.org/sbabic/u-boot-imx/builds/634211885

4 years agoMerge branch 'master' of git://git.denx.de/u-boot-socfpga
Tom Rini [Wed, 8 Jan 2020 20:23:49 +0000 (15:23 -0500)]
Merge branch 'master' of git://git.denx.de/u-boot-socfpga

4 years agoMerge tag 'u-boot-amlogic-20200108' of https://gitlab.denx.de/u-boot/custodians/u...
Tom Rini [Wed, 8 Jan 2020 20:23:37 +0000 (15:23 -0500)]
Merge tag 'u-boot-amlogic-20200108' of https://gitlab.denx.de/u-boot/custodians/u-boot-amlogic

- Khadas VIM3L based on Amlogic S905D3 support
- Various fixups for amlogic boards
- Unnecessary header includes drop into video/meson

4 years agoMerge branch '2020-01-07-master-imports'
Tom Rini [Wed, 8 Jan 2020 20:08:34 +0000 (15:08 -0500)]
Merge branch '2020-01-07-master-imports'

- DT overlay support in FIT images in SPL
- remoteproc update
- Assorted SATA fixes
- Other assorted fixes

4 years agouniphier_{v7, v8}_defconfig: enable SPI driver and sspi command
Masahiro Yamada [Tue, 7 Jan 2020 09:47:26 +0000 (18:47 +0900)]
uniphier_{v7, v8}_defconfig: enable SPI driver and sspi command

Compile drivers/spi/uniphier_spi.c and cmd/spi.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoARM: dts: uniphier: add pinmux nodes for I2C ch5, ch6
Masahiro Yamada [Tue, 7 Jan 2020 09:19:23 +0000 (18:19 +0900)]
ARM: dts: uniphier: add pinmux nodes for I2C ch5, ch6

The next generation SoC can connect on-board slave devices via
I2C ch5 and ch6.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
4 years agoata: fsl_sata: Continue probing other sata port when failed current port.
Peng Ma [Wed, 4 Dec 2019 10:36:45 +0000 (10:36 +0000)]
ata: fsl_sata: Continue probing other sata port when failed current port.

In the initialization of sata driver, we want to initialize all port
 probes, Therefore, any detection failure between of them should continue
 initialization by skipping the current port instead of exit.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
4 years agoata: sata_sil: Continue probing other sata port when failed current port.
Peng Ma [Wed, 4 Dec 2019 10:36:42 +0000 (10:36 +0000)]
ata: sata_sil: Continue probing other sata port when failed current port.

In the initialization of sata driver, we want to initialize all port
 probes, Therefore, any detection failure between of them should continue
 initialization by skipping the current port instead of exit.

Signed-off-by: Peng Ma <peng.ma@nxp.com>
4 years agotreewide: Remove CONFIG_SYS_UBOOT_START from configs board files
Patrice Chotard [Fri, 6 Dec 2019 14:01:49 +0000 (15:01 +0100)]
treewide: Remove CONFIG_SYS_UBOOT_START from configs board files

As previous CONFIG_SYS_UBOOT_START is now set by default to
CONFIG_SYS_TEXT_BASE when not defined, CONFIG_SYS_UBOOT_START
can be removed from include/configs board files.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Acked-by: Lukasz Majewski <lukma@denx.de>
4 years agoMakefile: Fix CONFIG_SYS_UBOOT_START default value
Patrice Chotard [Fri, 6 Dec 2019 14:01:48 +0000 (15:01 +0100)]
Makefile: Fix CONFIG_SYS_UBOOT_START default value

This patches restores boot on boards which rely on
CONFIG_SYS_UBOOT_START equal to CONFIG_SYS_TEXT_BASE when using SPL

Fixes: d3e97b53c1f2 ("spl: fix entry_point equal to load_addr")

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agocmd/Kconfig: Add more dependencies to OSE bootm support
Tom Rini [Thu, 5 Dec 2019 23:46:11 +0000 (18:46 -0500)]
cmd/Kconfig: Add more dependencies to OSE bootm support

Per Enea OSE documentation, it supports some classes of ARM, PowerPC and
X86.  Limit the option to those platforms.

Signed-off-by: Tom Rini <trini@konsulko.com>
4 years agoimx: imx8mn: enable CONFIG_CMD_ERASEENV
Peng Fan [Mon, 6 Jan 2020 08:19:34 +0000 (16:19 +0800)]
imx: imx8mn: enable CONFIG_CMD_ERASEENV

enable CONFIG_CMD_ERASEENV to make it easy to erase env.
Use savedefconfig to generate new defconfig.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mn_evk: add board_mmc_get_env_dev
Peng Fan [Mon, 6 Jan 2020 08:16:32 +0000 (16:16 +0800)]
imx: imx8mn_evk: add board_mmc_get_env_dev

Add board_mmc_get_env_dev, otherwise,
Loading Environment from MMC...
MMC Device 0 not found
*** Warning - No MMC card found, using default environment

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx8mn: evk: add README
Peng Fan [Mon, 6 Jan 2020 07:38:17 +0000 (15:38 +0800)]
imx8mn: evk: add README

Add a README for users to build a workable image.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: add i.MX8MP EVK board
Peng Fan [Mon, 30 Dec 2019 09:46:21 +0000 (17:46 +0800)]
imx: add i.MX8MP EVK board

Add basic i.MX8MP EVK board support

U-Boot SPL 2020.01-rc4-00388-gb1bf40c0ae-dirty (Dec 30 2019 - 17:55:33 +0800)
power_pca9450b_init
DDRINFO: start DRAM init
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Failed to find clock node. Check device tree
WDT:   Not found!
Trying to boot from BOOTROM
image offset 0x8000, pagesize 0x200, ivt offset 0x0

U-Boot 2020.01-rc4-00388-gb1bf40c0ae-dirty (Dec 30 2019 - 17:55:33 +0800)

CPU:   Freescale i.MX8MP rev1.0 at 1000 MHz
Reset cause: POR
Model: NXP i.MX8MPlus EVK board
DRAM:  6 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
u-boot=> mmc list
FSL_SDHC: 1 (SD)
FSL_SDHC: 2

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: add imximage-8mp-lpddr4.cfg
Peng Fan [Mon, 30 Dec 2019 09:40:38 +0000 (17:40 +0800)]
imx: imx8m: add imximage-8mp-lpddr4.cfg

Add imximage-8mp-lpddr4.cfg for imximage usage, almost same
as i.MX8MN ddr4 cfg, but with different ddr firmware

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoclk: imx: add i.MX8MP clk driver
Peng Fan [Mon, 30 Dec 2019 09:39:18 +0000 (17:39 +0800)]
clk: imx: add i.MX8MP clk driver

Add i.MX8MP clk driver for i.MX8MP CLK driver model usage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoclk: imx: add imx_clk_mux2_flags
Peng Fan [Mon, 30 Dec 2019 08:56:25 +0000 (16:56 +0800)]
clk: imx: add imx_clk_mux2_flags

Add imx_clk_mux2_flags which will be used by i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: only support non-dm code in clock_imx8mm.c
Peng Fan [Mon, 30 Dec 2019 08:52:30 +0000 (16:52 +0800)]
imx: imx8m: only support non-dm code in clock_imx8mm.c

The drivers/clk/imx/*.c are used for CLK dm case, the
clock_imx8mm.c is used for non CLK dm case, let's split
it. Sometimes it is hard to enable CLK dm in SPL stage,
considering code size, malloc size requirement, the splittion
will make it easy to use non CLK dm in SPL stage.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: Kconfig: make SPL_IMX_ROMAPI_LOADADDR visible to i.MX8MP
Peng Fan [Mon, 30 Dec 2019 08:44:48 +0000 (16:44 +0800)]
imx: Kconfig: make SPL_IMX_ROMAPI_LOADADDR visible to i.MX8MP

i.MX8MP ROM support ROMAPI as i.MX8MN, so make
SPL_IMX_ROMAPI_LOADADDR visible to i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: add i.MX8MP PE property
Peng Fan [Mon, 30 Dec 2019 08:43:48 +0000 (16:43 +0800)]
imx: add i.MX8MP PE property

i.MX8MP does not have LVTTL, it has a PE property

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mp: add pin header file
Peng Fan [Mon, 30 Dec 2019 08:40:57 +0000 (16:40 +0800)]
imx: imx8mp: add pin header file

Add pin header file for i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agopower: Add new PMIC PCA9450 driver
Ye Li [Tue, 15 Oct 2019 09:15:18 +0000 (02:15 -0700)]
power: Add new PMIC PCA9450 driver

PCA9450 PMIC series is used to support iMX8MM (PCA9450A) and
iMX8MN (PCA9450B). Add the PMIC driver for both PCA9450A and PCA9450B.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoarm: dts: freescale: Add i.MX8MP dtsi support
Peng Fan [Mon, 30 Dec 2019 02:03:44 +0000 (10:03 +0800)]
arm: dts: freescale: Add i.MX8MP dtsi support

The i.MX8M Plus Media Applications Processor is part of the growing
mScale family targeting the consumer and industrial market. It brings
an effective Machine Learning and AI accelerator that enables a new
class of applications. It is built in Samsung 14LPP to achieve both
high performance and low power consumption and relies on a powerful
fully coherent core complex based on a quad core ARM Cortex-A53 cluster
and Cortex-M7 low-power coprocessor, audio digital signal processor,
machine learning and graphics accelerators.

Add the basic dtsi support for i.MX8MP.

Patch from Anson Huang for Kernel
https://patchwork.kernel.org/patch/11310915/

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoddr: imx8m: Add DRAM PLL to generate 1000Mhz output
Peng Fan [Mon, 30 Dec 2019 01:58:52 +0000 (09:58 +0800)]
ddr: imx8m: Add DRAM PLL to generate 1000Mhz output

We will generate DRAM 4000MT/s as default for i.MX8MP.
So need DRAM PLL to generate 1000Mhz clock to DDR PHY and controller.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agomxc_ocotp: support i.MX8MP
Peng Fan [Tue, 24 Dec 2019 03:26:41 +0000 (11:26 +0800)]
mxc_ocotp: support i.MX8MP

i.MX8MP use similar ocotp as i.MX8MN, but has changed fuse banks
and ctrl register bit definitions, so update to reflect that.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agopinctrl: imx8m: support i.MX8MP
Peng Fan [Mon, 30 Dec 2019 01:52:15 +0000 (09:52 +0800)]
pinctrl: imx8m: support i.MX8MP

Add i.MX8MP compatible to let the pinctrl driver could support
i.MX8MP.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: add 1GHz fracpll entry
Peng Fan [Fri, 27 Dec 2019 03:40:55 +0000 (11:40 +0800)]
imx: imx8m: add 1GHz fracpll entry

4000MTS DDR needs 1GHz fracpll, so add the entry

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mp: add basic clock
Peng Fan [Fri, 27 Dec 2019 03:39:15 +0000 (11:39 +0800)]
imx: imx8mp: add basic clock

i.MX8MP has similar architecture as i.MX8MN, but it has different
clk root and index, so add that to make i.MX8MP could use
the non-dm clock driver.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoarm: dts: add i.MX8MP pinfunc header
Peng Fan [Fri, 27 Dec 2019 02:38:05 +0000 (10:38 +0800)]
arm: dts: add i.MX8MP pinfunc header

Add i.MX8MP pinfunc header for dts usage

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agodt-bindings: clock: add i.MX8MP clock header
Peng Fan [Fri, 27 Dec 2019 02:37:39 +0000 (10:37 +0800)]
dt-bindings: clock: add i.MX8MP clock header

Add i.MX8MP clock header

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: spl: support i.MX8MP spl_boot_device
Peng Fan [Fri, 27 Dec 2019 02:27:49 +0000 (10:27 +0800)]
imx: spl: support i.MX8MP spl_boot_device

i.MX8MP follows i.MX8MN, so just let it use spl_board_boot_device

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8m: add Kconfig entry for i.MX8MP
Peng Fan [Fri, 27 Dec 2019 02:24:54 +0000 (10:24 +0800)]
imx: imx8m: add Kconfig entry for i.MX8MP

Add Kconfig entry for i.MX8MP

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: cpu: enlarge bit mask to 0x1FF for cpu type
Peng Fan [Mon, 30 Dec 2019 09:57:10 +0000 (17:57 +0800)]
imx: cpu: enlarge bit mask to 0x1FF for cpu type

i.MX8MP use 0x182 as dummy id, 0xFF is not able the get the highest
bit, so enlarge bit mask to 0x1FF to make it could detect
cpu type correctly

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx8mp: set BYPASS ID SWAP to avoid AXI bus errors
Peng Fan [Fri, 27 Dec 2019 02:19:42 +0000 (10:19 +0800)]
imx8mp: set BYPASS ID SWAP to avoid AXI bus errors

Set the BYPASS ID SWAP bit (GPR10 bit 1) in order for GPU not to
generated AXI bus errors with TZC380 enabled.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: get cpu id/type of i.MX8MP
Peng Fan [Fri, 27 Dec 2019 02:14:02 +0000 (10:14 +0800)]
imx: get cpu id/type of i.MX8MP

Support get i.MX8MP cpu id and cpu type

Signed-off-by: Peng Fan <peng.fan@nxp.com>
4 years agoimx: imx8mq: handle ESDHC in mxc_get_clock
Peng Fan [Wed, 11 Dec 2019 06:17:12 +0000 (06:17 +0000)]
imx: imx8mq: handle ESDHC in mxc_get_clock

fsl_esdhc_imx driver will call "mxc_get_clock(MXC_ESDHC_CLK +
dev->seq)", however mxc_get_clock wrongly handle MXC_ESDHC_CLK
as root clk and cause sd card could not be detected in U-Boot proper,
as below:
"Loading Environment from MMC... unable to select a mode"

Handle MXC_ESDHC_CLK in mxc_get_clock to fix the issue.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Tested-by: Baruch Siach <baruch@tkos.co.il>
Tested-by: Fabio Estevam <festevam@gmail.com>
4 years agowandboard: Remove repeated PMIC string
Fabio Estevam [Tue, 10 Dec 2019 09:33:00 +0000 (06:33 -0300)]
wandboard: Remove repeated PMIC string

After the conversion to DM_PMIC the following output is seen:

PMIC:  PMIC:  PFUZE100 ID=0x10

Remove the unnecessary PMIC string from the board file to
avoid the repetead string.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agowandboard: Fix the DM_PMIC conversion
Fabio Estevam [Tue, 10 Dec 2019 09:32:59 +0000 (06:32 -0300)]
wandboard: Fix the DM_PMIC conversion

Commit ec837c82d709 ("imx6: wandboard: convert to DM_PMIC")
caused the following pmic_get() error:

CPU:   Freescale i.MX6QP rev1.0 at 792 MHz
Reset cause: POR
DRAM:  2 GiB
PMIC:  pmic_get() ret -19
...

and since the PMIC presence is used to determine the board D1 revision,
the following error is seen when booting a board rev D1:

WARNING: Could not determine dtb to use

and the kernel does not boot at all.

Fix the regression by passing "pfuze100@8" as the correct parameter
to the pmic_get() function in the DM case.

Fixes: ec837c82d709 ("imx6: wandboard: convert to DM_PMIC")
Signed-off-by: Fabio Estevam <festevam@gmail.com>
4 years agompc83xx_clk: always treat MPC83XX_CLK_PCI as invalid
Rasmus Villemoes [Thu, 19 Dec 2019 09:46:08 +0000 (09:46 +0000)]
mpc83xx_clk: always treat MPC83XX_CLK_PCI as invalid

The current mpc83xx_clk driver is broken for any board for which
mpc83xx_has_pci() is true, i.e. anything not MPC8308:

When is_clk_valid() reports that MPC83XX_CLK_PCI is valid,
init_all_clks() proceeds to call init_single_clk(), but that doesn't
know about either MPC83XX_CLK_PCI or has any handling of the
TYPE_SCCR_ONOFF mode correctly returned by retrieve_mode(). Hence
init_single_clk() ends up returning -EINVAL, and the whole board hangs
in serial_init().

The quickest fix is to simply pretend that clock is invalid for
all, since nobody can have been relying on it. Adding proper support
seems to be a bit more involved than just handling TYPE_SCCR_ONOFF:

- The power-on-reset value of SCCR[PCICM] is 0, so
  mpc83xx_clk_enable() would probably need to be tought to enable the
  clock.

- The frequency of PCI_SYNC_OUT is either SYS_CLK_IN or SYS_CLK_IN/2
  depending on the CFG_CLKIN_DIV configuration input, but that can't
  be read from software, so to properly fill out
  ->speed[MPC83XX_CLK_PCI] I think one would need guidance from
  Kconfig or dtb.

Partially fixes: 07d538d281 clk: Add MPC83xx clock driver

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Mario Six <mario.six@gdsys.cc>
4 years agompc83xx: set MPC83XX_GPIO_CTRLRS to 2 for MPC8309
Rasmus Villemoes [Thu, 12 Dec 2019 09:18:52 +0000 (09:18 +0000)]
mpc83xx: set MPC83XX_GPIO_CTRLRS to 2 for MPC8309

The MPC8309 has two gpio controllers (which is already correctly
reflected in its struct immap definition).

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Mario Six <mario.six@gdsys.cc>
4 years agompc83xx: immap_83xx: add spi8xxx_t in immap for mpc8309
Rasmus Villemoes [Thu, 12 Dec 2019 08:35:49 +0000 (08:35 +0000)]
mpc83xx: immap_83xx: add spi8xxx_t in immap for mpc8309

Allow drivers/spi/mpc8xxx_spi.c to be built for an mpc8309 target.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Mario Six <mario.six@gdsys.cc>
4 years agopowerpc: mpc83xx: convert CONFIG_FSL_ELBC to Kconfig
Rasmus Villemoes [Thu, 12 Dec 2019 08:11:46 +0000 (08:11 +0000)]
powerpc: mpc83xx: convert CONFIG_FSL_ELBC to Kconfig

This complements commit 068789773d0 which did the conversion for
mpc85xx.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Mario Six <mario.six@gdsys.cc>
4 years agompc83xx: make ARCH_MPC8309 select SYS_FSL_ERRATUM_ESDHC111
Rasmus Villemoes [Wed, 11 Dec 2019 09:39:36 +0000 (09:39 +0000)]
mpc83xx: make ARCH_MPC8309 select SYS_FSL_ERRATUM_ESDHC111

The mpc8309 is also affected by the "Manual Asynchronous CMD12 abort
operation causes protocol violations" erratum, though it is enumerated
as eSDHC16 in the errata sheet for mpc8309.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Mario Six <mario.six@gdsys.cc>
4 years agolog: Include missing header for log.h
Sean Anderson [Wed, 25 Dec 2019 04:54:54 +0000 (23:54 -0500)]
log: Include missing header for log.h

log.h references cmd_tbl_t but command.h was not included

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: Add a debug message when devices are skipped pre-reloc
Sean Anderson [Wed, 25 Dec 2019 04:52:01 +0000 (23:52 -0500)]
dm: Add a debug message when devices are skipped pre-reloc

This adds a message to lists_bind_fdt when it skips initializing a device
pre-relocation. I've had a couple errors where a device didn't initialize
properly because one of its dependencies was missing.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
4 years agoInclude missing headers for fdt_support.h
Sean Anderson [Wed, 18 Dec 2019 02:21:54 +0000 (21:21 -0500)]
Include missing headers for fdt_support.h

fdt_support.h is missing declarations for bd_t. Including asm/u-boot.h
pulls in the definition.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
4 years agobinman: fix default filename of u-boot-with-ucode-ptr in documentation
Masahiro Yamada [Sat, 14 Dec 2019 04:47:26 +0000 (13:47 +0900)]
binman: fix default filename of u-boot-with-ucode-ptr in documentation

The suffix should be ".bin" instead of ".dtb" .

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
4 years agodm: devres: Add a new OFDATA phase
Simon Glass [Mon, 30 Dec 2019 04:19:28 +0000 (21:19 -0700)]
dm: devres: Add a new OFDATA phase

Since the ofdata_to_platdata() method can allocate resources, add it as a
new devres phase.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: devres: Use an enum for the allocation phase
Simon Glass [Mon, 30 Dec 2019 04:19:27 +0000 (21:19 -0700)]
dm: devres: Use an enum for the allocation phase

At present we only support two phases where devres can be used:
bind and probe. This is handled with a boolean. We want to add a new
phase (platdata), so change this to an enum.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: devres: Add tests
Simon Glass [Mon, 30 Dec 2019 04:19:26 +0000 (21:19 -0700)]
dm: devres: Add tests

The devres functionality has very few users in U-Boot, but it still should
have tests. Add a few basic tests of the main functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: test: Add a test driver for devres
Simon Glass [Mon, 30 Dec 2019 04:19:25 +0000 (21:19 -0700)]
dm: test: Add a test driver for devres

Add a driver which does devres allocations so that we can write tests for
devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: devres: Convert to use logging
Simon Glass [Mon, 30 Dec 2019 04:19:24 +0000 (21:19 -0700)]
dm: devres: Convert to use logging

At present when CONFIG_DEBUG_DEVRES is enabled, U-Boot prints log messages
to the console with every devres allocation/free event. This causes most
tests to fail since the console output is not as expected.

In particular this prevents us from adding a device to sandbox which uses
devres in its bind method.

Move devres over to use U-Boot's logging feature instead, and add a new
category for devres.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agotest: Add functions to find the amount of allocated memory
Simon Glass [Mon, 30 Dec 2019 04:19:23 +0000 (21:19 -0700)]
test: Add functions to find the amount of allocated memory

The malloc() implementations provides a way of finding out the approximate
amount of memory that is allocated. Add helper functions to make it easier
to access this and see changes over time. This is useful for tests that
want to check if memory has been allocated or freed.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: devres: Create a new devres header file
Simon Glass [Mon, 30 Dec 2019 04:19:22 +0000 (21:19 -0700)]
dm: devres: Create a new devres header file

At present these functions are lumped in with the core device functions.
They have their own #ifdef to control their availability, so it seems
better to split them out.

Move them into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a new flag to track platform data
Simon Glass [Mon, 30 Dec 2019 04:19:21 +0000 (21:19 -0700)]
dm: core: Add a new flag to track platform data

We want to avoid allocating platform data twice. This could happen if
device_probe() is called after device_ofdata_to_platdata() for the same
device.

Add a flag to track whether device_ofdata_to_platdata() has been called on
a device. Check the flag to make sure it doesn't happen twice, and clear
the flag when the data is freed.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Export a new function to read platdata
Simon Glass [Mon, 30 Dec 2019 04:19:20 +0000 (21:19 -0700)]
dm: core: Export a new function to read platdata

Add a new internal function, device_ofdata_to_platdata() to handle
allocating private space associated with each device and reading the
platform data from the device tree.

Call this new function from device_probe().

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Add a comment for DM_FLAG_OF_PLATDATA
Simon Glass [Mon, 30 Dec 2019 04:19:19 +0000 (21:19 -0700)]
dm: core: Add a comment for DM_FLAG_OF_PLATDATA

This flag is missing a comment. Add one.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Allocate parent data separate from probing parent
Simon Glass [Mon, 30 Dec 2019 04:19:18 +0000 (21:19 -0700)]
dm: core: Allocate parent data separate from probing parent

At present the parent is probed before the child's ofdata_to_platdata()
method is called. Adjust the logic slightly so that probing parents is
not done until afterwards.

Signed-off-by: Simon Glass <sjg@chromium.org>
4 years agodm: core: Move ofdata_to_platdata() call earlier
Simon Glass [Mon, 30 Dec 2019 04:19:17 +0000 (21:19 -0700)]
dm: core: Move ofdata_to_platdata() call earlier

This method is supposed to extract platform data from the device tree. It
should be done before the device itself is probed. Move it earlier in the
device_probe() function.

Signed-off-by: Simon Glass <sjg@chromium.org>