9
0
Fork 0
Commit Graph

35 Commits

Author SHA1 Message Date
Sascha Hauer a51d06d679 of: remove unused libfdt
Now that we are completely independent of libfdt remove the unused
code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 0ba9a2347a of: Add reservemap handling
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer 9d8e08353c of: fixup unflattened devicetree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:29 +01:00
Sascha Hauer cf95711e52 of: Add missing prototype for size/address counting functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer c2189e9f7e of: Add of property write functions for u32
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 64c199dd29 of: Pass barebox internal format devicetree to of_get_fixed_tree
With this every devicetree is first converted to the barebox internal
format before it's converted back to dtb again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer b6a2800537 of: make OFDEVICE a user selectable option
OFDEVICE decides whether or not we compile in support for probing
devices from the devicetree. Let the user decide this explicitly.
This makes the oftree, of_node and of_property commands independent
of devicetree device support since being able to manipulate
devicetrees has nothing to do with probing devices from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 004cce1347 of: make flatten independent of libfdt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 1d9859d5e7 of: make unflatten independent of libfdt
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 3b181a8109 of: Add initrd helper
Add a helper to set the initrd properties in the unflattened tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 43327fe374 of: Add of_write_number helper
The counterpart to of_read_number: Write a 32bit or 64bit
number to a devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer b26b7ef0f0 of: Add root node argument to of_find_node_by_path
This makes of_find_node_by_path usable with multiple trees.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:28 +01:00
Sascha Hauer 8a185a4ff2 of: let of_unflatten_dtb return the unflattened tree
In order to be able to handle multiple devicetrees, do not assume
the tree to be unflattened is the barebox internal one. Instead,
just return a pointer to it and assign the barebox internal root_node
external to the unflatten function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer 3afab2a83e of: Add missing prototype for of_device_is_compatible
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer 6be4759579 of: Add of_set_property and of_create_node
Add functions to create a new device node and to create/set
a new property based on the nodepath.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer b50c00a61d of: remove allnodes list
The allnodes list makes it hard to handle multiple devicetrees. Having
a list to iterate over all nodes of a tree is still good to have though.
This patch uses the list_head of the root node as the head of the list.
This way the root node is no longer part of the list, but when iterating
over a tree the root node is not interesting anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer a75b5c5d8e of: export of_find_child
of_find_child is a useful function. Export it and rename it to
of_find_child_by_name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-06 11:41:27 +01:00
Sascha Hauer 831d83e922 Merge branch 'for-next/highbank' 2013-03-04 09:21:37 +01:00
Jean-Christophe PLAGNIOL-VILLARD 6ae2455e80 of: add do_fixup_by_compatible with u32 and string version
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-03 14:08:44 +01:00
Jean-Christophe PLAGNIOL-VILLARD 9acb6113f0 of: make of_add_memory available for other board
so when the first stage booloader of firmware provide the dtb
we can use it to probe the memory

also allow to print what we probe

Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-14 09:27:26 +01:00
Vicente Bergas afab6ac783 DeviceTree: add support for initrd in the DT
Add the initrd start and end address to the DT, code comes from u-boot.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-12 09:04:27 +01:00
Sascha Hauer a2288e64b7 of: rename new_device_node to of_new_node and export it
of_new_node now takes the parent node and the name as argument and
creates a new node. This simplifies the caller and also makes the
function useful for others, so export it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Sascha Hauer 517fcac5f0 of: add of_delete_property
This adds a function to delete a property from the currently loaded
devicetree. Also export new_property as of_new_property.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Sascha Hauer 4979d8e9d5 of: remove unused barebox_fdt
barebox_fdt should once become the pointer to the barebox internal
devicetree. Since barebox has its own internal devicetree format
this was never used. remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Sascha Hauer 875430927d of: Add support for converting the unflattened tree back to a dtb
We already have support for unflattening the devicetree. This patch
adds support for converting it back to a dtb.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-19 11:48:17 +01:00
Sascha Hauer 86e787e845 of: rename of_parse_dtb to of_unflatten_dtb
The process of unflatten the device tree is known from the kernel,
so rename the function, because that's what it does.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-11 14:10:02 +01:00
Sascha Hauer 818dccf28b of: of_free fixes
- Add missing prototype for of_free()
- When root node is freed set root_node to NULL
- (re)scan aliases after freeing a node. This is necessary because
  the freed node may be an alias or point to an alias

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-11 14:10:01 +01:00
Sascha Hauer f30b191e36 of: make of_get_fixed_tree more universally usable
Currently the bootm code uses of_fix_tree to apply the fixups
to the devicetree given on the command line. This function assumes
that there is enough space for the fixups available. Also on ARM
we have to make sure the tree does not cross 1Mib boundaries.

This patch moves the space allocation and alignment ensurance
to of_get_fixed_tree and uses it in bootm. This is the first
step for making of_get_fixed_tree the single point of devicetree
handling in barebox.
of_get_fixed_tree now takes an argument of the input fdt. If it is
given, this one is used, otherwise an internal oftree is used which
will be created in subsequent patches.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-11 14:08:30 +01:00
Sascha Hauer 05d251f15f Merge branch 'for-next/of'
Conflicts:
	drivers/of/base.c
	include/of.h
2012-11-16 14:02:44 +01:00
Sascha Hauer 3510a4b0f5 console/of: evaluate linux,stdout-path property
When a linux,stdout-path property is given in the devicetree
activate the corresponding console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 20:58:27 +02:00
Sascha Hauer efed496001 of: Add function to get the model name
This is useful for printing it during startup.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-09 20:57:10 +02:00
Sascha Hauer ca77bd8f03 of: Add devicetree partition parsing
Helper code to probe mtd partitions from the devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 11:47:42 +02:00
Sascha Hauer 58f3457f4f of: add devicetree probing support
This adds code to probe devices from a devicetree. Most helper
functions are directly imported from Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 11:47:42 +02:00
Sascha Hauer 56442bb101 oftree: add of_fix_tree()
Currently we have of_get_fixed_tree() which assumes that
there is a global variable holding a oftree. This seems
not very flexible, so for now introduce a of_fix_tree()
which takes an fdt_header as argument and walks the
list of registered of fixup functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-12-15 10:18:14 +01:00
Sascha Hauer c0f9d1bad2 initial oftree command support
This adds basic device tree command support. So far we can
parse a flat device tree (-p), which also stores the tree
in memory, dump it (-d) and free (-f) the internally stored tree.

The chosen node can be updated with barebox bootargs, no other
device tree manipulation is implemented yet.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-19 10:09:48 +02:00