9
0
Fork 0
Commit Graph

152 Commits

Author SHA1 Message Date
Sascha Hauer 874b8ac790 Merge branch 'for-next/net' 2014-07-04 17:27:11 +02:00
Sebastian Hesselbarth f2b9c6b6d4 drivers: of: import PCI bus specific translator
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>
2014-06-25 08:44:49 +02:00
Sebastian Hesselbarth de20089ea8 of: net: respect phy-connection-type property
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>
2014-06-25 08:31:26 +02:00
Sascha Hauer d384b5639f of: Drop devicetree merge support
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>
2014-05-22 08:09:13 +02:00
Sascha Hauer 9bb76883c1 Merge branch 'for-next/of' 2014-05-05 13:32:37 +02:00
Sascha Hauer 3781d93b06 OF: barebox-env: Use bb device on NAND
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-28 11:49:01 +02:00
Sascha Hauer 1a8800458b mtd: nand: create bb devices automatically
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>
2014-04-28 11:45:09 +02:00
Sascha Hauer 66d0f93d5c of_path: Allow to specify path with phandle only
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>
2014-04-28 11:31:39 +02:00
Sascha Hauer 12c7f5d560 of: move of_find_device_by_node_path to drivers/of/of_path.c
As it's generic helper function which should not stay in driver
specific code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-28 11:30:53 +02:00
Sascha Hauer 601dcf7644 of: partition: set device_node of the newly created partition
So that we can find the devicenode for a partition.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-04-28 10:20:10 +02:00
Sascha Hauer 80bfa0b7cb of_gpio: return error if no device found
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>
2014-04-09 22:26:26 +02:00
Sascha Hauer e2fa0cca06 of: Add support for "stdout-path" property
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>
2014-03-31 09:16:12 +02:00
Alexander Shiyan 409df4db89 drivers/of/base.c: Fix sparse warnings
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>
2014-02-17 08:21:23 +01:00
Sascha Hauer 25cee7ec17 environment: Use accessor functions for default environment path
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>
2014-01-27 09:27:02 +01:00
Jan Weitzel 1ebf5ff0c1 of: find also nodes by mixture of alias and path
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>
2014-01-10 10:39:57 +01:00
Alexander Shiyan d95f27aaa8 of: platform: Fix possible crash
"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>
2014-01-10 08:38:36 +01:00
Antony Pavlov a4dfb8d910 of: gpio: Fix Kconfig variables to depend on
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-12 09:13:20 +01:00
Sascha Hauer 6d8a85d6c3 Merge branch 'for-next/tegra' 2013-12-06 08:23:27 +01:00
Sascha Hauer 0cb6f2c19e Merge branch 'for-next/imx' 2013-12-06 08:22:48 +01:00
Lucas Stach 87b651ed89 gpio: reduce noise when parsing DT
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>
2013-12-04 14:59:39 +01:00
Sascha Hauer bb7929aaaa of: gpio: Add Kconfig variable to depend on
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-25 09:01:33 +01:00
Sebastian Hesselbarth a7d8384d12 OF: parse OF clock providers after populate
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>
2013-11-11 09:26:59 +01:00
Sascha Hauer 7c1091bd58 of: fdt: reorder fdt_header initialization
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>
2013-11-08 15:42:55 +01:00
Sascha Hauer c9a86c5c02 of: fdt: Fix fdt size_dt_struct
size_dt_struct was calculated too big, we have to substract ofs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-08 15:42:50 +01:00
Sascha Hauer 9101c2d02f of: simplify phandle lookup
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>
2013-10-22 08:55:08 +02:00
Sascha Hauer fa71e57f22 of: partition: Check for valid partition name
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-23 08:40:31 +02:00
Dmitry Smagin 3f9ee093f9 Add missing dependency ENV_HANDLING for OF_BAREBOX_DRIVER option
This patch fixes linker error:
  barebox.c:(.text.environment_probe+0x48): undefined reference to `default_environment_path`

Which appears when compiling env-less boards with enabled devicetree.

Signed-off-by: Dmitry Smagin <dmitry.s.smagin@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-09-23 08:40:31 +02:00
Sascha Hauer 1729b1798e Merge branch 'for-next/boardinfo'
Conflicts:
	arch/mips/boards/qemu-malta/init.c
	commands/bootm.c
	drivers/of/base.c
2013-09-05 10:39:22 +02:00
Sascha Hauer 10169a04ca Merge branch 'for-next/of' 2013-09-05 10:37:54 +02:00
Renaud Barbier da19582070 of: base: import of_find_node_by_type
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>
2013-09-05 10:27:51 +02:00
Sascha Hauer 775ba3c093 introduce barebox_set_model
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>
2013-08-16 08:40:37 +02:00
David Jander ba3b39d5f0 of: base.c: Use correct device-tree in of_add_initrd()
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>
2013-08-14 14:42:53 +02:00
Sascha Hauer 6c9e799a00 of: introduce some new helpers
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>
2013-08-14 10:03:28 +02:00
Sascha Hauer 55909550f8 of: default to internal tree in of_find_node_by_path_from
So that of_find_node_by_path_from can be used easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-14 10:03:28 +02:00
Sascha Hauer 7d505a9626 of: parse phandles during unflatten
With this node->phandle becomes valid after unflattening a tree
and not during of_probe later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-14 10:03:28 +02:00
Sascha Hauer a5352dfb66 of: fix merge mode in of_unflatten_dtb
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>
2013-08-14 10:03:28 +02:00
Sascha Hauer e60778e041 of: Fix endless loop in of_add_memory
of_add_memory is stuck in an endless loop when a memory bank with zero
size is passed. Fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-08-14 09:35:24 +02:00
Sascha Hauer fbf082b565 Merge branch 'for-next/of'
Conflicts:
	arch/arm/boards/freescale-mx53-loco/board.c
	drivers/of/Makefile
2013-08-05 12:50:06 +02:00
Sascha Hauer feefc3ef3b Merge branch 'for-next/mtd' 2013-08-05 12:49:58 +02:00
Sascha Hauer 07afe7d0e0 Merge branch 'for-next/marvell'
Conflicts:
	arch/arm/boards/Makefile
	arch/arm/dts/Makefile
2013-08-05 12:49:55 +02:00
Sascha Hauer b2acebc742 of: Use dts syntax when printing devicetrees
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>
2013-07-27 07:41:52 +02:00
Sascha Hauer 874f318037 Add configurability via devicetree
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>
2013-07-18 13:54:38 +02:00
Sascha Hauer 3ae902ed7f of: Add convenience functions to en/disable devicenodes
These functions allow to manipulate the "status" property of
devicenodes effectively enabling/disabling devices.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-18 13:54:23 +02:00
Sascha Hauer 9cb5f51d0a of: partition: check for valid node
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>
2013-07-18 13:54:20 +02:00
Sascha Hauer aa9e85c555 of: add mtd of helpers
Directly taken from the kernel

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-16 08:46:30 +02:00
Sascha Hauer abf95154f5 of: partitions: factor out function to parse a single partition
To make it usable for other code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:15:59 +02:00
Sebastian Hesselbarth b29eac0769 OF: base: initalize from node in of_find_node_with_property
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>
2013-07-09 08:55:02 +02:00
Sebastian Hesselbarth f457f683cb OF: base: fix iterator in of_get_next_available_child
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>
2013-07-05 08:47:57 +02:00
Sascha Hauer 73986cc87d OF: base: fix inifinite looping in node iterators
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>
2013-07-05 08:45:57 +02:00
Sebastian Hesselbarth cf31688b6a OF: base: rename of_free to of_delete_node
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>
2013-07-05 08:26:57 +02:00