Do not use mtd node from kernel dtb, otherwise the driver will
be initialized twice.
Change-Id: I6f3dca8fd8c3e05475f4359fe6c3c5312c0984cd
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
There is not crypto node in kernel dtb for early platform(such as
rk322x/rk3288/rk3368/rk3399, etc), so we decide to add crypto node
always in U-Boot dtb and ignore crypto node from kernel dtb.
This is a way to compatible with early platforms. Actually, we
need crypto during secure boot sequence, the crypto had better
not depends on kernel dtb.
Change-Id: Ibab4fca0741b45042b8d0868240449fb6b52aa14
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Use "u-boot,dm-pre-reloc" to identify whether the existance
node is from U-Boot or not. This avoids deleting the same name
nodes from kernel dtb.
Change-Id: I6503965c0013053feefad7e93f98b01b5af71f44
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
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>
Change-Id: I6c0f7e50e8b571106627f25ddac008a62bd2994e
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This new one is from kernel dtb if kernel dtb is enabled.
Change-Id: I6fb54812188fe8749271a7aaae565bc7fa4cb3cc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
- pass pre-loader serial configure by rk atags;
- it depends on serial aliases to find uart port;
- enabled by CONFIG_ROCKCHIP_USING_PRELOADER_SERIAL;
Change-Id: I6723cccc5e1f3dac77203b4cc19cdac631f5133b
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
- support get device_node by given stem and alias id;
- dump of alias nodes added in aliases_lookup.
Change-Id: I3ed8bd4692dd3fbbeebe9978a797a5a2dcf7eb23
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
The Rockchip video drivers need to walk the ofnode-parrents to find
an enclosing device that has a UCLASS_DISPLAY driver bound. This
adds a ofnode_get_parent()-function that returns the parent-node.
Change-Id: I312236c966348aaa36ffc30e3f7dbc83d706fb36
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
(cherry picked from commit e2d5997ffdf5cbf4f7d53584dab2ffc673f50987)
We do not need to assign-clock for every driver in Rockchip platform,
only below module need this feature, remove it for boot time optimize:
- GMAC (need set parent from dts)
- CRU ARM clock (rockchip board will call set_armclk_rate() instead)
- VOP (need set parent)
Change-Id: Ie8facfb7499323f4649e0e1d908f850de1338e12
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Don't duplicate bind EMMC and NAND device after load kernel dtb.
Always use serial node from u-boot and use all other nodes from kernel.
Change-Id: Iaef9258f66f4f1060f057a9f7b194694e0e1df21
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Do not use nand node from kernel dtb, or the driver will
be initialized twice.
Change-Id: Iae3e76094d074549e6f52c20261ceefa9b98be1b
Signed-off-by: Yifeng Zhao <zyf@rock-chips.com>
With kernel dtb support, there are two dtbs and some devices may have
the same driver and nanme, the api uclass_get_device_by_driver() and
uclass_get_device_by_name() may get wrong value. In order to use cru
node in kernel dtb, remove the same device whose node is in u-boot dtb.
Change-Id: Id19eedb276731fa18b07bca51bbc203636f20c31
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
fdtdec_get_addr_size() hard-codes the number of cells used to represent
an address or size in DT. This is incorrect in many cases depending on
the DT binding for a particular node or property (e.g. it is incorrect
for the "reg" property). In most cases, DT parsing code must use the
properties #address-cells and #size-cells to parse addres properties.
Change-Id: I736cf41f48eaac5d6b82510a037f447ff874a9e4
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
These two op have too much print, convert to pr_debug and not print
by default.
Change-Id: I5b3c738db783419717441e24ee0b04ab6f02d61e
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Assigned clocks are widely used in kernel, but not in U-Boot yet,
many U-Boot clock driver do not have the API while dts port from kernel
have "assigned-clocks" node.
Just give a warning now instead of a device probe fail.
Change-Id: Icc1da8bdd1a21d6d118e37d305bd7909758c40b2
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
The driver for U-Boot and kernel are different, we can not re-use
mmc node from kernel now.
BTW: U-Boot need alias for mmc to make sure emmc at mmc0(not support
in kernel dtb).
Change-Id: I1b8fd3ab8a28e3abb5964dc113d0028abe2beaa2
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Linux uses the properties 'assigned-clocks', 'assigned-clock-parents'
and 'assigned-clock-rates' to configure the clock subsystem for use
with various peripheral nodes.
This implements clk_set_defaults() and hooks it up with the general
device probibin in drivers/core/device.c: when a new device is probed,
clk_set_defaults() will be called for it and will process the
properties mentioned above.
Note that this functionality is designed to fail gracefully (i.e. if a
clock-driver does not implement set_parent(), we simply accept this
and ignore the error) as not to break existing board-support.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: David Wu <david.wu@rock-chips.com>
Series-changes: 2
- Fixed David's email address.
Series-version: 2
Cover-letter:
clk: support assigned-clock, assigned-clock-parents, assigned-clock-rates
For various peripherals on Rockchip SoCs (e.g. for the Ethernet GMAC),
the parent-clock needs to be set via the DTS. This adds the required
plumbing and implements the GMAC case for the RK3399.
END
(cherry picked from commit f4fcba5c5baaaa9d477d753f97124efdb8e45893)
Change-Id: I549891987c5a3e8546b96f1f54ad575950f92b12
Signed-off-by: David Wu <david.wu@rock-chips.com>
Each uclass has a driver name which we can use to look up the uclass. This
is useful for logging, where the uclass ID is used as the category.
Add a function to handle this, as well as a test.
Change-Id: Id221809d6f9f818b52a5bf88f4e12d409a070f05
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 6e43d1b19982b1756b7c607569d1778e556d6577)
Judging from its name and parameters, device_is_compatible looks like it
is compatible with a live device tree, but it actually isn't.
Make it compatible with a live device tree.
Reviewed-by: Simon Glass <sjg@chromium.org>
Change-Id: I892142d611ab5068d4ec6bdb51666a673b679794
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 29d11b8838bb2aa324b8873159cbd7088870a75b)
With kernel dtb support, there have two dtb and some device may the same,
skip it if already in the list, node in u-boot dtb will be used.
Change-Id: Ic9f8b73e3708a03416a9dc4ab6c72fa0184a6fdb
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
We need to get ofnode from a phandle, add interface to support
both live dt and fdt.
Change-Id: I01a5241e2eced37b68ab6556cc1b16001eecbe0f
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Add to api for who can not get phandle from a device property.
Change-Id: I8395f02d1731a4bbb00af1e4fa9d151830fc54b0
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
After reloc and before dm_scan_init again, the dm_root is broken.
Change-Id: Ia5b1f762a396daa78d2498b160f89a951a4ec544
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
In some case with LIVE DT, some node always not valid.
Change-Id: I20ebc530f7addfef167dd5abbab46e8da0627dd8
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This is a fix to:
642346a dm: core: add ofnode_count_phandle_with_args()
Change-Id: I25befa448e44884440060d43be905744cd4cd319
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
We are going to use a tiny dtb(with 'u-boot,dm-pre-reloc') in pre-relocate,
and then read kernel dtb and use it after relocate.
This feature only works with CONFIG_OF_LIVE enabled now.
Change-Id: I429ccd90ef562a96f2f7916255e7e427ce8f451d
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Some device like syscon, blk do not have of node, return directly.
Change-Id: Icc4629632522f4a3af6532c6a9f2152b0e45de8b
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This currently causes a warning in sandbox and will not do the right
thing:
drivers/core/read.c: In function ‘dev_read_addr_ptr’:
drivers/core/read.c:64:44: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
Use map_sysmem() which is the correct way to convert an address to a
pointer.
Fixes: c131c8bca8 (dm: core: add dev_read_addr_ptr())
Change-Id: Ic8ef1cb185d98d84dc6cf35a7001dcdcb4caa849
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 8ccc2db6e84244e5cb57885dc9dfd7e752071b98)
No global pointer is used in this file.
Change-Id: I0c2dcde65300f815348d6f44922577225dd0ddf4
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 3d569a807e17b146731c37db0cf21125134dee23)
The livetree codepath of ofnode_get_addr_size always used the "reg"
property for of_get_property. Use the property parameter of the function
call instead and check the return value if the property exists.
Otherwise return FDT_ADDR_T_NONE.
This was discoverd while using SPI NOR with livetree.
spi_flash_decode_fdt checks for memory-map and will not fail with
livetree even if the property does not exist.
Change-Id: Icc63d2edbccea6a9f17cdcb5818993d317736ede
Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 68a345294ac74505f17d65b003a7de836b3d9cba)
The size variable may not be always be a mulitple of
ARCH_DMA_MINALIGN and using it to flush cache leads to cache
misaligned warnings.
Therefore, round up the size to a multiple of ARCH_DMA_MINLAIGN
when allocating private data.
Change-Id: I29c4fb89f4be628518c2f5350d3efbccd28acd36
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 5924da1dfe56d32a45b8adf29bdc8caf788bd4c8)
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.
Change-Id: I0732d1fec827d434b1163093920a3c5bd682803e
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit ceb9190969e458dcd1427566f762dbb9cfdfdc94)
dev_read_string_count() is used to get the number of strings in a
stringlist.
dev_read_string_index() is used to get a string in the stringlist based on
its position in the list.
Change-Id: I0e144e7c2048030a9b43ca6153225f6267d58c89
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit b5a144a5014be5e3b065e2061a7d17e653d739ae)
The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(),
retrieving the first address of the node's reg-property and returning
it as a pointer (or NULL on failure).
Change-Id: Iaac920b89296fd53504b071e7617f24ac6dd2fc8
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit c131c8bca86b428daef7a25c26a96af42658be21)
Currently, all fixed-clock declared in "clocks" node in device tree
can be binded by clk_fixed_rate.c driver only if each of them have
the "simple-bus" compatible string.
This constraint has been invoked here [1].
This patch offers a solution to avoid adding "simple-bus" compatible
string to nodes that are not busses.
[1] https://patchwork.ozlabs.org/patch/558837/
Change-Id: Ia267df49d4f1b84115d5e600c0f0cd5e74105f53
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit e81c98649b7a67d43c5baae407430a242d3b26b9)
Add a convenience macro to iterate over subnodes of a node. Make use of
this where appropriate in the code.
Change-Id: Iae0fb554472d0b5819d26becbbcf8909ff891514
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit 3991f42ed2e38aff28ba3c24369bfbd90620bea7)
We can use printf() to limit the string width. Adjust the code to do this
instead of using strlcpy() which is a bit clumbsy.
Change-Id: I69e67116ac1e955498ff886c7daa7461e1fa17ab
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
(cherry picked from commit a0f9acb08bd6f3b4a6f3adcb02c8170e522c074a)
When using 32-bit addresses dtoc works correctly. For 64-bit addresses it
does not since it ignores the #address-cells and #size-cells properties.
Update the tool to use fdt64_t as the element type for reg properties when
either the address or size is larger than one cell. Use the correct value
so that C code can obtain the information from the device tree easily.
Alos create a new type, fdt_val_t, which is defined to either fdt32_t or
fdt64_t depending on the word size of the machine. This type corresponds
to fdt_addr_t and fdt_size_t. Unfortunately we cannot just use those types
since they are defined to phys_addr_t and phys_size_t which use
'unsigned long' in the 32-bit case, rather than 'unsigned int'.
Add tests for the four combinations of address and size values (32/32,
64/64, 32/64, 64/32). Also update existing uses for rk3399 and rk3368
which now need to use the new fdt_val_t type.
Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Heiko Stuebner <heiko@sntech.de>
Reported-by: Kever Yang <kever.yang@rock-chips.com>
Linux supports platform_get_resource_byname() to look up a resource
by name.
We want a similar helper. It is useful when a device node has named
register regions.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
We cannot call dm_scan_fdt_dev() with of-platdata since there is no device
tree. Fix this with an #if check.
Fixes: 3be9a37 (dm: syscon: scan sub-nodes of the syscon node)
Signed-off-by: Simon Glass <sjg@chromium.org>
This change introduces TPL variants of the REGMAP and SYSCON config
options (i.e. TPL_REGMAP and TPL_SYSCON in analogy to SPL_REGMAP and
SPL_SYSCON) in preparation of a finer-grained feature selection for
building feature-rich TPL variants.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
SPL_REGMAP and SPL_SYSCON were marked as depending on DM, when a
stricter dependency of SPL_DM was possible. This commit makes the
prereq more specific.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>