History log of /u-boot/drivers/core/util.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# d678a59d 18-May-2024 Tom Rini <trini@konsulko.com>

Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""

When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay
Ethernet"' I failed to notice that b4 noticed it was based on next and
so took that as the base commit and merged that part of next to master.

This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing
changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35.

Reported-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Tom Rini <trini@konsulko.com>

# 6ec93ba3 01-May-2024 Tom Rini <trini@konsulko.com>

core: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# f69d3d6d 26-Sep-2023 Simon Glass <sjg@chromium.org>

pci: serial: Support reading PCI-register size with base

The PCI helpers read only the base address for a PCI region. In some cases
the size is needed as well, e.g. to pass along to a driver which needs to
know the size of its register area.

Update the functions to allow the size to be returned. For serial, record
the information and provided it with the serial_info() call.

A limitation still exists in that the size is not available when OF_LIVE
is enabled, so take account of that in the tests.

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

# 95397385 07-Aug-2021 Simon Glass <sjg@chromium.org>

treewide: Use OF_REAL instead of !OF_PLATDATA

Now that we have a 'positive' Kconfig option, use this instead of the
negative one, which is harder to understand.

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

# b18b38f2 29-Jul-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: migrate the dm_warn to use the log macro

Migrate the dm_warn function to log macro with
LOGC_DM category and LOGL_WARNING level.

This macro allows filtering with log command and allows
output on all log backend.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# abb9cd30 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

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

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marex@denx.de>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <masahiroy@kernel.org>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <masahiroy@kernel.org>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <masahiroy@kernel.org>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# 6ec93ba3 01-May-2024 Tom Rini <trini@konsulko.com>

core: Remove <common.h> and add needed includes

Remove <common.h> from this driver directory and when needed
add missing include files directly.

Signed-off-by: Tom Rini <trini@konsulko.com>

# f69d3d6d 26-Sep-2023 Simon Glass <sjg@chromium.org>

pci: serial: Support reading PCI-register size with base

The PCI helpers read only the base address for a PCI region. In some cases
the size is needed as well, e.g. to pass along to a driver which needs to
know the size of its register area.

Update the functions to allow the size to be returned. For serial, record
the information and provided it with the serial_info() call.

A limitation still exists in that the size is not available when OF_LIVE
is enabled, so take account of that in the tests.

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

# 95397385 07-Aug-2021 Simon Glass <sjg@chromium.org>

treewide: Use OF_REAL instead of !OF_PLATDATA

Now that we have a 'positive' Kconfig option, use this instead of the
negative one, which is harder to understand.

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

# b18b38f2 29-Jul-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: migrate the dm_warn to use the log macro

Migrate the dm_warn function to log macro with
LOGC_DM category and LOGL_WARNING level.

This macro allows filtering with log command and allows
output on all log backend.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# abb9cd30 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

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

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marex@denx.de>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <masahiroy@kernel.org>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <masahiroy@kernel.org>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <masahiroy@kernel.org>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# f69d3d6d 26-Sep-2023 Simon Glass <sjg@chromium.org>

pci: serial: Support reading PCI-register size with base

The PCI helpers read only the base address for a PCI region. In some cases
the size is needed as well, e.g. to pass along to a driver which needs to
know the size of its register area.

Update the functions to allow the size to be returned. For serial, record
the information and provided it with the serial_info() call.

A limitation still exists in that the size is not available when OF_LIVE
is enabled, so take account of that in the tests.

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

# 95397385 07-Aug-2021 Simon Glass <sjg@chromium.org>

treewide: Use OF_REAL instead of !OF_PLATDATA

Now that we have a 'positive' Kconfig option, use this instead of the
negative one, which is harder to understand.

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

# b18b38f2 29-Jul-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: migrate the dm_warn to use the log macro

Migrate the dm_warn function to log macro with
LOGC_DM category and LOGL_WARNING level.

This macro allows filtering with log command and allows
output on all log backend.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# abb9cd30 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

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

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marex@denx.de>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <masahiroy@kernel.org>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <masahiroy@kernel.org>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <masahiroy@kernel.org>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# 95397385 07-Aug-2021 Simon Glass <sjg@chromium.org>

treewide: Use OF_REAL instead of !OF_PLATDATA

Now that we have a 'positive' Kconfig option, use this instead of the
negative one, which is harder to understand.

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

# b18b38f2 29-Jul-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: migrate the dm_warn to use the log macro

Migrate the dm_warn function to log macro with
LOGC_DM category and LOGL_WARNING level.

This macro allows filtering with log command and allows
output on all log backend.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# abb9cd30 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

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

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# b18b38f2 29-Jul-2021 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: migrate the dm_warn to use the log macro

Migrate the dm_warn function to log macro with
LOGC_DM category and LOGL_WARNING level.

This macro allows filtering with log command and allows
output on all log backend.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# abb9cd30 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

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

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@foss.st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# abb9cd30 03-Oct-2020 Simon Glass <sjg@chromium.org>

dm: core: Allow dm_warn() to be used in SPL

At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.

Add a new Kconfig option to permit this.

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

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# 5c9c9bc9 03-Apr-2020 Patrick Delaunay <patrick.delaunay@st.com>

dm: core: remove the duplicated function dm_ofnode_pre_reloc

The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only three times:
- drivers/core/lists.c:lists_bind_fdt()
- drivers/clk/at91/pmc.c::at91_clk_sub_device_bind
- drivers/clk/altera/clk-arria10.c::socfpga_a10_clk_bind

So this function dm_ofnode_pre_reloc can be removed and replaced
by these function calls by ofnode_pre_reloc().

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Simon Glass <sjg@chromium.org>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# 6dd4b014 06-Dec-2019 Simon Glass <sjg@chromium.org>

dm: pci: Move pci_get_devfn() into a common file

Early in boot it is necessary to decode the PCI device/function values for
particular peripherals in the device tree or of-platdata. This is needed
in TPL where CONFIG_PCI is not defined.

To handle this, move pci_get_devfn() into a file that is built even when
CONFIG_PCI is not defined.

Also add a function for use by of-platdata, to convert a reg property to
a pci_dev_t.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# d7677bfc 31-Aug-2019 Marek Vasut <marek.vasut+renesas@gmail.com>

dm: core: Decouple DM from DT

Some of the DM functions depend on OF_CONTROL, which is incorrect.
DM and DT are orthogonal. Add macro guards around such functions to
avoid compiling them in when DM is enabled, while OF_CONTROL is not.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>

# 69989749 21-May-2019 Patrick Delaunay <patrick.delaunay@st.com>

fdt: Allow indicating a node is for U-Boot proper only

This add missing parts for previous commit 06f94461a9f4
("fdt: Allow indicating a node is for U-Boot proper only")

At present it is not possible to specify that a node should be used before
relocation (in U-Boot proper) without it also ending up in SPL and TPL
device trees. Add a new "u-boot,dm-pre-proper" boolean property for this.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7fbee54 20-Mar-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove unused function dm_fdt_pre_reloc

The function dm_ofnode_pre_reloc should be used instead
of the function dm_fdt_pre_reloc and avoid duplicated code.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# c7a88dae 10-Feb-2019 Patrick Delaunay <patrick.delaunay@st.com>

dm: remove pre reloc properties in SPL and TPL device tree

We can remove the pre reloc property in SPL and TPL device-tree:
- u-boot,dm-pre-reloc
- u-boot,dm-spl
- u-boot,dm-tpl
As only the needed node are kept by fdtgrep (1st pass).

The associated function (XXX_pre_reloc) are simple for SPL/TPL:
return always true.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>

# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>

# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>

# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>

# e601ab1b 10-Oct-2018 Bin Meng <bmeng.cn@gmail.com>

dm: util: Add a livetree equivalent API of dm_fdt_pre_reloc()

This adds a new API dm_ofnode_pre_reloc(), a livetree equivalent
API of dm_fdt_pre_reloc().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>


# 83d290c5 06-May-2018 Tom Rini <trini@konsulko.com>

SPDX: Convert all of our single license tags to Linux Kernel style

When U-Boot started using SPDX tags we were among the early adopters and
there weren't a lot of other examples to borrow from. So we picked the
area of the file that usually had a full license text and replaced it
with an appropriate SPDX-License-Identifier: entry. Since then, the
Linux Kernel has adopted SPDX tags and they place it as the very first
line in a file (except where shebangs are used, then it's second line)
and with slightly different comment styles than us.

In part due to community overlap, in part due to better tag visibility
and in part for other minor reasons, switch over to that style.

This commit changes all instances where we have a single declared
license in the tag as both the before and after are identical in tag
contents. There's also a few places where I found we did not have a tag
and have introduced one.

Signed-off-by: Tom Rini <trini@konsulko.com>


# b08c8c48 04-Mar-2018 Masahiro Yamada <yamada.masahiro@socionext.com>

libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>

Thomas reported U-Boot failed to build host tools if libfdt-devel
package is installed because tools include libfdt headers from
/usr/include/ instead of using internal ones.

This commit moves the header code:
include/libfdt.h -> include/linux/libfdt.h
include/libfdt_env.h -> include/linux/libfdt_env.h

and replaces include directives:
#include <libfdt.h> -> #include <linux/libfdt.h>
#include <libfdt_env.h> -> #include <linux/libfdt_env.h>

Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# ceb91909 28-Sep-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: replace dm_dbg() with pr_debug()

As we discussed before in ML, dm_dbg() causes undefined reference
error if #define DEBUG is added to users, but not drivers/core/util.c

We do not need this macro because we can use pr_debug() instead, and
it is pretty easy to enable it for the DM core by using ccflags-y.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>


# 766c28a5 22-Jun-2017 Masahiro Yamada <yamada.masahiro@socionext.com>

dm: include <dm/util.h> from drivers/core/util.c

Fix sparse warnings "... was not declared. Should it be static?"

Also, fix redefinition of dm_warn/dm_dbg.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>


# d905cf73 23-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: Return actual bools in dm_fdt_pre_reloc

Documentation says that we're returning true/false, not 1/0 so adapt
the function to return actual booleans.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Simon Glass <sjg@chromium.org>


# 27326c7e 18-Feb-2017 Heiko Stübner <heiko@sntech.de>

dm: allow limiting pre-reloc markings to spl or tpl

Right now the u-boot,dm-pre-reloc flag will make each marked node
always appear in both spl and tpl. But systems needing an additional
tpl might have special constraints for each, like the spl needing to
be very tiny.

So introduce two additional flags to mark nodes for only spl or tpl
environments and introduce a function dm_fdt_pre_reloc to automate
the necessary checks in code instances checking for pre-relocation
flags.

The behaviour of the original flag stays untouched and still marks
a node for both spl and tpl.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Kever Yang <kever.yang@rock-chips.com>


# 6494d708 26-Feb-2014 Simon Glass <sjg@chromium.org>

dm: Add base driver model support

Add driver model functionality for generic board.

This includes data structures and base code for registering devices and
uclasses (groups of devices with the same purpose, e.g. all I2C ports will
be in the same uclass).

The feature is enabled with CONFIG_DM.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com>
Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>