9
0
Fork 0
Commit Graph

227 Commits

Author SHA1 Message Date
Sascha Hauer 30139163b7 Merge branch 'for-next/imx' 2017-02-13 09:26:04 +01:00
Sascha Hauer 32da9097e7 of: partitions: force "partitions" subnode
The binding states that a subnode containing partition subnodes
should have the name "partitions". Enforce this so that we do not
parse nodes with other names which may have partition descriptions
for other disks.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-19 15:21:29 +01:00
Ian Abbott 90abfd3fba of_path: only handle no driver for device if it is on a bus
This fixes a regression in __of_find_path() for flash devices created by
the cadence-quadspi driver, which do not have 'dev->driver' set.  Such
devices do not have 'dev->bus' set either, so we can use that to qualify
the existing test.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-13 08:35:12 +01:00
Sascha Hauer 9fe05e5ebc of: Use %pa to print resource_size_t type
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:33 +01:00
Philipp Zabel f49b415b92 of: base: add chosen node if it does not exist when adding initrd
If the chosen node does not exist, of_add_initrd fails to pass the
initrd to the kernel. Instead it should create the chosen node, just
like of_fixup_bootargs does.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-09 13:41:12 +01:00
Sascha Hauer f55e379fca Merge branch 'for-next/state' 2016-11-14 12:35:52 +01:00
Sascha Hauer f772aa92c2 Merge branch 'for-next/misc' 2016-11-14 12:35:49 +01:00
Sascha Hauer f160f8636e of: of_find_path: Add support for new partition binding
The partitions now may be in a subnode of the actual device node.
Eventually go another step up in the hierarchy if required.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-11 09:54:42 +01:00
Sascha Hauer 1f2f980373 of: partitions: Support new binding
The new binding recommends to put the partitions into a subnode
with compatible "fixed-partitions". Add support for this binding.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-11 09:54:42 +01:00
Sascha Hauer 82eb3dff10 of_path: handle no driver for device
in __of_find_path it can happen that there is a device, but there
is no driver for this device because it hasn't been probed yet.
Return -ENODEV in this case to let the caller know that it has to
try later again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-20 09:31:15 +02:00
Antony Pavlov 9c4e30e445 of: fix typos
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-18 07:39:51 +02:00
Antony Pavlov adce981d24 of: base: import of_get_cpu_node() from linux-v4.7-rc2
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:29:54 +02:00
Sascha Hauer 6bfb591cc1 Merge branch 'for-next/misc' 2016-06-14 09:13:41 +02:00
Sascha Hauer 5376121774 of: Add missing include
drivers/of/device.c has the implementation for of_match_device(), so
also include the header which has the prototype.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-24 12:51:53 +02:00
Sascha Hauer 57a648aabb of: base: Match simple-mfd devices
Some simple-buses are now considered to be simple-mfd devices. Match
them aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-23 12:21:03 +02:00
Sascha Hauer 5c83ce6091 Merge branch 'for-next/pci' 2016-05-09 08:49:50 +02:00
Sascha Hauer 4cb8e17aa3 Merge branch 'for-next/misc' 2016-05-09 08:49:43 +02:00
Boris Brezillon 08d0d519ec of: fix of_tree_for_each_node_from() macro
of_tree_for_each_node_from() is supposed to iterate over all DT nodes
after the one pointed by the from parameter, but with the current
of_next_node() implementation we cannot access the root node.

Patch of_next_node() to point to root_node when from is NULL.

Doing that also simplifies users of of_tree_for_each_node_from() which
were duplicating the logic to point to the root_node when from is NULL.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 16:43:14 +02:00
Sascha Hauer 5e94c658e4 drivers/of: Always compile of_path.c with OF support
of_find_path() is a OF specific library function, so always
compile it when OF support is enabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 16:43:14 +02:00
Andrey Smirnov bd55401e97 OF: Port of_match_device() and of_device_get_match_data()
Port of_match_device() and of_device_get_match_data() from Linux kernel
code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-28 07:44:04 +02:00
Sascha Hauer 1454a0e2cd of: preserve /memreserve/ entries
Some dts files for the Kernel specify a reserved memory area using the
/memreserve/ dtc directive. These entries get lost during
unflattening/flattening the device tree and are never passed to the
Kernel.

This patch fixes this behaviour. This is done by copying the entries
into a /memreserve node in the unflattened tree and moving them back
during flattening the tree. The entries added by barebox dynamically
are appended to the static entries from the original dtb.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-25 11:55:46 +02:00
Sascha Hauer 947fb5adf8 string: Fix (v)asprintf prototypes
Our asprintf and vasprintf have different prototypes than the glibc
functions. This causes trouble when we want to share barebox code
with userspace code. Change the prototypes for (v)asprintf to match
the glibc prototypes. Since the current (v)asprintf are convenient
to use change the existing functions to b(v)asprintf.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 12:21:45 +02:00
Sascha Hauer e2306ada3e Convert users of PRINTF_CONVERSION_RESOURCE to %pa
printf now supports printing resource_size_t directly, convert
all users of the previously used PRINTF_CONVERSION_RESOURCE over
to %pa.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-15 15:33:59 +01:00
Sascha Hauer ae172dd2d0 of_path: Drop possible further extensions of device-path property
Originally it was intended to further extend the multi string property
device-path further with more elements, like for example a filename. It
turned out though that this is too complex and instead of further
extending the property we should instead create additional properties,
so this mechanism is removed with this patch to make the code simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:31:02 +01:00
Trent Piepho 3a0e9b49e7 environment: Support env from file in a file-system via device tree
Current barebox,environment node only allows specifying a raw device or
partition to load an environment from.  Some boards, like OMAP and
SoCFPGA, instead want to use a file located in a FAT filesystem.
Extend the device tree bindings with a new property 'file-path' that
will trigger this behavior.

This allows any board using this driver to get the env from a file or
from a raw device, instead of each machine type being either raw
device only or file only.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:55 +01:00
Trent Piepho 51e97d11dc of_path: Fix bug with partitions, simply code
In commit 75b682795e using a path that
has a partition description broke.

Fix this and simpfy the code some.

There is no need to loop over each string in the path property:  it's
defined to have at most one parition description, no extant dts has
more than one, and how it would handle more than one didn't make sense
anyway.

Once not looping, __of_find_path() just needs the partition
description text, not both the original node and property name to look
it up from.

When using a partition description, don't lookup the cdev of the node
just to replace it with the partition's cdev.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:29:29 +01:00
Sascha Hauer 2ae9bbba07 Merge branch 'for-next/state' 2015-12-08 08:29:02 +01:00
Marc Kleine-Budde 21aea1d9ff of_path: add of_find_path_by_node()
This patch adds the function of_find_path_by_node(), which is similar to
of_find_path(), but it translates a device tree node into a barebox device path
directly.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:40 +01:00
Marc Kleine-Budde 75b682795e of_path: of_find_path() factor out device detection logic into separate function
This patch factors out the device detection logic into separate function, so
that it can be used from another function.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:40 +01:00
Sebastian Hesselbarth 7cde58cc9d of: mtd: Import of_get_nand_ecc_{step_size, strength} from Linux
This imports DT helpers for MTD ECC step size and strength from
Linux kernel.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 08:00:09 +01:00
Sascha Hauer 35eb06510b of_path: Allow pointing directly to the partition
We could only point to partitions in the device tree by using
&norflash, "partname:barebox-environment". Allow to point to the
partition directly without having to parse the partition labels.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-01 08:07:04 +02:00
Sascha Hauer 3f68a7698d cdev: Add function to find cdev by device_node
This adds a device_node member to struct cdev and a function
to find a cdev by device_node.
This also removes the setting of cdev->dev->device_node in
the of partition parser. We must not set the device since it
may not refer to a partition but to a whole device with partitions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-01 07:43:16 +02:00
Sascha Hauer 98b5672c4d Merge branch 'for-next/vpl' 2015-08-07 07:55:00 +02:00
Sascha Hauer 6913850321 of_graph: add of_graph_port_is_available
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:18 +02:00
Sascha Hauer cc44a37924 of: import of_graph functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:18 +02:00
Sascha Hauer d96f74f26f of: base: implement of_get_next_child
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:38:18 +02:00
Jan Luebbe 7dd0345b1a of/base: fix typo
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-09 10:20:26 +02:00
Sascha Hauer 08120e2166 of: export of_platform_device_create
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 08:23:29 +02:00
Marc Kleine-Budde 6778286639 fdt: of_unflatten_dtb(): remove left over "root" argument from inline doc
In commit

    d384b5639f of: Drop devicetree merge support

the signature of of_unflatten_dtb() was changed, but the inline documentation
was forgotten to adjust. This patch removes the left over "root" argument from
the doc.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:41 +02:00
Sascha Hauer 3975737a7d Merge branch 'for-next/misc' 2015-05-06 21:36:13 +02:00
Marc Kleine-Budde 885a1cf27e of_path: of_find_path(): add possibility to return .bb device
This patch adds a flags argument to the of_find_path() function. The only flag
defined for now is OF_FIND_PATH_FLAGS_BB. When used on NAND devices, the
function returns the bad block aware device (the ".bb" device).

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-23 08:12:28 +02:00
Marc Kleine-Budde 724d8847ed environment: remove unused code
This patch removes the LIST_HEAD of_partition_list and a struct definition from
the code. This was present but unused, since the file was added to barebox.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-17 07:31:35 +02:00
Sebastian Hesselbarth c6a9698dc1 OF: gpio: Silence error message on -EPROBE_DEFER
With deferred probing, -EPROBE_DEFER is not worth spilling an error.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-17 07:23:47 +02:00
Sascha Hauer fa20ea45e0 Merge branch 'for-next/tegra' 2015-03-09 08:32:26 +01:00
Lucas Stach 35d5ab939f of: make of_alias_get work on all types of DT paths
of_alias_get assumed that a DT path is always the full node path,
whic is not necessarily the case, as there are other valid path
descriptions. All of them are handled by of_find_node_by_path.

As there is already a preparsed list with all DT aliases that handles
this case properly we can simply reuse that one.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:34:08 +01:00
Marc Kleine-Budde f6b8bb42ca of/base: fix sparse warning, don't use integer 0 as NULL pointer
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:25:53 +01:00
Marc Kleine-Budde c681e4a45b of_path: of_find_path(): remove unused variable len
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-03 08:23:46 +01:00
Sascha Hauer 7b0f932bcd Merge branch 'for-next/mxs' 2015-02-04 19:09:15 +01:00
Wadim Egorov f0f6a7477b Fix spelling: pathes -> paths
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-28 10:02:56 +01:00
Sascha Hauer c42178d9fc of: Create platform_device when creating AMBA device failed
If creating an AMBA device failed, maybe because AMBA support is
not compiled in, register the device as regular platform device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-28 08:18:44 +01:00