Commit Graph

276 Commits

Author SHA1 Message Date
Jason Zhu 5a1674a738 drivers: core: do not use mtd node from kernel dtb
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>
2019-06-24 18:31:03 +08:00
Joseph Chen 04539b46d5 dm: core: add function dev_write_u32_array() to write u32 array values
Change-Id: I6633395c7704eefff59c2145562fe239e21f3b35
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-06-14 18:22:36 +08:00
Joseph Chen b07f31ddba core: dump: add "*" for node from U-Boot dtb
This is useful for debugging.

Change-Id: If6a6e29053c1519ec40ccbcb183e35ffd81c64e8
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-06-06 09:13:10 +08:00
Joseph Chen ea4b8016c1 core: device_bind_common: always use crypto node from U-Boot dtb
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>
2019-05-31 17:31:14 +08:00
Joseph Chen d7a244f923 core: device_bind_common: only delete U-Boot existance node
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>
2019-05-28 20:31:02 +08:00
Masahiro Yamada 0e00a84cde UPSTREAM: 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>

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>
2018-12-24 17:20:37 +08:00
Joseph Chen d24a078f3f core: device_bind_common: don't bind UCLASS_SPI_FLASH again
Change-Id: Ie4cfe40398fc1e483b558832663bc50683510ac0
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-19 18:46:07 +08:00
Joseph Chen f935b6dc55 core: of_access: delete exist aliases when adding new one
This new one is from kernel dtb if kernel dtb is enabled.

Change-Id: I6fb54812188fe8749271a7aaae565bc7fa4cb3cc
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-12-10 16:28:11 +08:00
Joseph Chen d59cf5aebb dm: of_access: add ofnode_read_u64() support
only support of-live.

Change-Id: I37c10efa30ef46369f4a4ad7f16c4c758d6ad563
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-11-28 14:09:47 +08:00
Joseph Chen 064eb49314 serial: ns16550: support using pre-loader serial
- 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>
2018-10-19 17:40:56 +08:00
Joseph Chen 2e02c4e25b dm: of_access: add of_alias_get_dev() and of_alias_dump()
- 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>
2018-10-18 10:32:18 +08:00
Philipp Tomsich e7ca7e39ee UPSTREAM: core: ofnode: add ofnode_get_parent function
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)
2018-08-23 10:26:10 +08:00
Kever Yang cadc8d74e2 clock: remove clk_set_defaults() in device core
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>
2018-07-27 15:44:58 +08:00
Joseph Chen d114ba00ec core: dump: increase info length
Change-Id: Ide57bc45fcdeb5fb158ae67d0c56a9f80ac4d8cf
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-07-20 11:23:33 +08:00
Kever Yang 527e4be7d9 rockchip: core: update kernel dtb node handle
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>
2018-07-18 10:34:38 +08:00
Yifeng Zhao 541f90ebf1 drivers: core: do not use nand node from kernel dtb
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>
2018-06-22 17:22:08 +08:00
Finley Xiao 713d964649 core: device_bind_common: remove the same clk device
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>
2018-06-13 11:07:38 +08:00
Andy Yan 45c78162f3 dm: regmap: use devfdt_get_addr_size_index get reg
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>
2018-05-24 16:43:18 +08:00
Kever Yang 33ffdd2473 debug: convert to use pr_debug for pte init and find dev
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>
2018-03-16 18:09:21 +08:00
Kever Yang 55e9fafcca core: do not fail in device_probe() when clk set default fail
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>
2018-02-27 09:00:03 +08:00
Kever Yang 5039ac47ff core: device_bind_common: do not use mmc node from kernel
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>
2018-02-26 09:17:17 +08:00
Philipp Tomsich 0b2881acbd clk: implement clk_set_defaults()
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>
2018-02-24 19:02:43 +08:00
Simon Glass 440e24d771 UPSTREAM: dm: core: Add a function to look up a uclass by name
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)
2018-02-11 19:58:01 +08:00
Mario Six 18aa8da9a4 UPSTREAM: core: Make device_is_compatible live-tree compatible
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)
2018-02-11 19:58:01 +08:00
Kever Yang 89f947ecb4 core: device: skip bind device already there
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>
2018-02-09 12:00:21 +08:00
Kever Yang df5ceb01db core: add ofnode_get_by_phandle() api
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>
2018-02-08 21:56:47 +08:00
Kever Yang 1d5894f273 core: add uclass_get_device_by_phandle_id() api
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>
2018-02-08 21:10:31 +08:00
Kever Yang d2e8ba4eb0 Revert "rockchip: add support to load and use kernel dtb"
This reverts commit af586a3812.

Change-Id: Ie1f8012b89ac810e3bc6219459127bc9ee88c674
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-07 18:12:44 +08:00
Kever Yang b96443cc1c core: break when uclass_find() get UCLASS_ROOT
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>
2018-02-07 18:12:37 +08:00
Kever Yang a49612a6a2 core: do not assert if node not valid in ofnode_get_name()
In some case with LIVE DT, some node always not valid.

Change-Id: I20ebc530f7addfef167dd5abbab46e8da0627dd8
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-07 18:12:32 +08:00
Kever Yang d5b5cd1471 core: add dev_count_phandle_with_args for of_live
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>
2018-01-26 16:40:37 +08:00
Kever Yang af586a3812 rockchip: add support to load and use kernel dtb
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>
2018-01-26 16:40:36 +08:00
Kever Yang b283d2ae7b core: read: fix some device may not have of node
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>
2018-01-26 08:37:05 +08:00
Simon Glass 1abc22cc20 UPSTREAM: dm: core: Correct address cast in dev_read_addr_ptr()
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)
2018-01-17 15:27:28 +08:00
Masahiro Yamada aea2f111e0 UPSTREAM: simple-bus: remove DECLARE_GLOBAL_DATA_PTR
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)
2018-01-17 15:27:28 +08:00
Klaus Goger 1b189a920d UPSTREAM: dm: ofnode: query correct property in livetree ofnode_get_addr_size
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)
2018-01-17 15:27:28 +08:00
Faiz Abbas 9ab2e5eb63 UPSTREAM: dm: core: Round up size when allocating so that it is cache line aligned
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)
2018-01-17 15:27:28 +08:00
Masahiro Yamada d42197e44e UPSTREAM: 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.

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)
2018-01-17 15:27:28 +08:00
Jean-Jacques Hiblot 57a9c70605 UPSTREAM: dm: core: Add functions to get strings and the string count from a stringlist
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)
2018-01-16 18:16:48 +08:00
Philipp Tomsich 18a0c4a65b UPSTREAM: dm: core: add dev_read_addr_ptr()
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)
2018-01-16 18:16:48 +08:00
Patrice Chotard 46fb92f0e8 UPSTREAM: dm: core: add clocks node scan
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)
2018-01-16 18:13:59 +08:00
Simon Glass 17c82fdc12 UPSTREAM: dm: core: Add ofnode_for_each_subnode()
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)
2018-01-16 18:13:59 +08:00
Simon Glass ae9ecb9781 UPSTREAM: dm: core: Show driver name with 'dm tree'
It is often useful to see which driver was actually selected for each
device. Add a new 'Driver' column to provide this information. Sample
output:

 Class       Probed   Driver     Name
----------------------------------------
 root        [ + ]    root_drive root_driver
 keyboard    [ + ]    i8042_kbd  |-- keyboard
 serial      [ + ]    ns16550_se |-- serial
 rtc         [   ]    rtc_mc1468 |-- rtc
 timer       [ + ]    tsc_timer  |-- tsc-timer
 syscon      [ + ]    ich6_pinct |-- pch_pinctrl
 pci         [ + ]    pci_x86    |-- pci
 northbridge [ + ]    bd82x6x_no |   |-- northbridge@0,0
 video       [ + ]    bd82x6x_vi |   |-- gma@2,0
 vidconsole0 [ + ]    vidconsole |   |   `-- gma@2,0.vidconsole0
...

Change-Id: Ib6ed67d9de2d94f9aae4d4a180a71191a0836786
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 ee3e520dad0b368df4541cd0af0d4011cf481e5b)
2018-01-16 18:13:59 +08:00
Simon Glass 58b0f0021c UPSTREAM: dm: core: Drop use of strlcpy()
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)
2018-01-16 18:13:53 +08:00
Simon Glass a28bfcc355 dtoc: Add support for 32 or 64-bit addresses
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>
2017-09-12 16:04:36 +08:00
Masahiro Yamada 7b8b47bd29 ofnode: add {ofnode, dev}_read_resource_byname()
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>
2017-08-29 23:56:17 +09:00
Simon Glass 745fb9c25e dm: core: Avoid calling dm_scan_fdt_dev() with of-platdata
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>
2017-08-17 16:44:16 +09:00
Philipp Tomsich c6ac6c1bd4 spl: dm: Kconfig: split REGMAP/SYSCON support for TPL from SPL
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>
2017-08-13 17:12:20 +02:00
Philipp Tomsich 9c447370c1 spl: dm: Kconfig: use more specific prereqs for SPL_REGMAP and SPL_SYSCON
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>
2017-08-13 17:12:20 +02:00
Tom Rini 211aaf309c Merge git://git.denx.de/u-boot-usb 2017-07-29 11:43:51 -04:00