DT PCI address translation needs a special handling. This imports
the corresponding translator into of/address.c but makes it selectable
through Kconfig. Compared to the Linux version, we don't check for
struct device_node's type which does not exist on Barebox but directly
for device_type property set to "pci".
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ePAPR defines phy-connection-type as standard property for PHY interface
between Ethernet device and PHY device. Add corresponding property check
to of_get_phy_mode.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
I assume I am the only person knowing that barebox is able to
merge devicetrees. This feature seems broken for a while now since
trying to merge devicetress results in:
unflatten: too many end nodes
Remove this feature to save the complexity.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When a mtd device can have bad blocks we want to create a
bb device, so do this automatically. This allows us to
drop bb device creation from the environment.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of just allowing to specify an OF path with additional
partname: property allow to specify a phandle to the partition
directly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_get_named_gpio_flags used to return 'ret' when no device
is found, but 'ret' is zero here. Return an error instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ePAPR 1.1 specifies the "stdout-path" property, but barebox currently
only handles the "linux,stdout-path" property. Add parsing for the new
property name.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
drivers/of/base.c:70:20: warning: symbol 'root_node' was not declared. Should it be static?
drivers/of/base.c:72:20: warning: symbol 'of_aliases' was not declared. Should it be static?
drivers/of/base.c:1724:20: warning: symbol 'of_chosen' was not declared. Should it be static?
drivers/of/base.c:1725:12: warning: symbol 'of_model' was not declared. Should it be static?
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
default_environment_path only exists when CONFIG_ENV_HANDLING is enabled.
Boards would have to #ifdef this if they wanted to use
default_environment_path. Use accessor functions instead which can
be ifdeffed on a single place.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Let of_find_node_by_path_or_alias also find a node starting with an alias
followed by a path like "i2c0/tps@24"
Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
"dev" may uninitialized or points to incorrect device. While at
it make the message more informative.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some GPIOs are optional, so it might not be an error if we can not find
a DT property. Do the same thing as the Linux kernel and only print a
debug message not an error.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds a call to of_clk_init right after platform devices have been
populated.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
No functional change, just reorder the initialization of
the different offset/size members of fdt_header in increasing
order to make it easier to read.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of populating an extra list containing all phandles just iterate
over the whole tree. This is done as preparation for more dynamic devicetrees
where parts are loaded at runtime. Here we don't want to keep the list of
phandles in sync.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Import of_find_node_by_type from Linux drivers/of/base.c -
commit id d8dfad3.
This function retrieves a node pointer based on the "device_type"
property of the node.
This is used by device tree update functions in PPC support.
Signed-off-by: Renaud Barbier <renaud.barbier@ge.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of calling of_get_model() in barebox_get_model() add a
barebox_set_model() and use it to set the boardinfo once it's
available from the devicetree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Otherwise only the internal DT is modified, not necessarily the one passed
to the kernel.
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_get_tree_max_phandle - get the maximum phandle of a tree. Needed for
creating new phandles without conflicts.
of_node_create_phandle - create a phandle for a node which doesn't have one.
of_find_node_by_alias - find a node by alias name
of_find_node_by_path_or_alias - find a node by full path or alias name
of_find_root_node - find the root node for a given device node
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In merge mode a property may be overwritte with new values. When
this happens the length has to be adjusted.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Our devicetree printing is close to correct dts syntax, so fix
some remaining differences:
- Use an equal sign instead of a colon to separate a poperty name and
a value
- Add a semicolon at the end of properties
- Make sure we do not print a separator for empty properties
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds the possibility to configure the place for the environment
from the devicetree and to partition devices from the devicetree.
Configuration has the general form of devices with a regular compatible
property. This allows to later add additional drivers or drivers with
different behaviour (for example to add support for redundant environment).
The configuration is all in the /chosen/barebox/ hierarchy of the
devicetree. This separates the configuration from the hardware
description. Also it makes it possible to store the configuration
in a completely separate devicetree (or devicetree overlay). For
the same reason all configuration is done using nodepathes rather
than phandles.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
These functions allow to manipulate the "status" property of
devicenodes effectively enabling/disabling devices.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
So that users can call the of partition parsers without checking
if they are probed from the devicetree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds initialization of from device node with root_node if NULL
is passed. This corresponds to the behavior of all other node iterators.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_get_next_available_child does not iterate but always tries the
same node over and over again. This first prepares the entry and
then uses list_for_each_entry_continue, instead of for_each_child_of_node
before.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_find_node_by_name suffers from infinite looping, because it
does not check for root node of the tree iterated over. This
fixes this by checking for node->parent to determine whether
the last node has been reached.
Since of_tree_for_each_node does not iterate over the whole tree,
but only over the remaining nodes, rename it to
of_tree_for_each_node_from.
Reported-by: NISHIMOTO Hiroki <hiroki.nishimoto.if@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
of_free is misleading about the actual purpose of the function. There is
already a of_create_node counterpart, so rename of_free to of_create_node
and update all users accordingly.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>