summaryrefslogtreecommitdiffstats
path: root/common/oftree.c
Commit message (Collapse)AuthorAgeFilesLines
* oftree: expose reset_source device in device treeUwe Kleine-König2019-09-091-0/+14
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reset_source: use instance = -1 as defaultUwe Kleine-König2019-08-281-2/+3
| | | | | | | | | | | As with platform device id (does someone still remember?) 0 might be a valid id. So use -1 for "unknown" or "doesn't apply" instead of 0. Also don't pass the instance to the device tree if negative. (This ends up as 0xffffffff otherwise.) Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: oftree: Pass reset source and reset source instance to kernelAndrey Smirnov2018-05-181-0/+5
| | | | | | | | | | | | | | | | | | | Detecting reset reason is, in some cases, a destructive operation and in such cases it is impossible to obtain that information in the kernel without some help from barebox. Pass reset source and reset source instance to kernel to Linux to make it availible to Linux userspace. This info is placeed under /chosen/bootsource and it can be read under Linux in /sys/firmware/devicetree/base/chosen/reset-source. and /sys/firmware/devicetree/base/chosen/reset-source-instance. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: oftree: Pass bootsource and bootsource instance to kernelAndrey Smirnov2018-05-181-1/+27
| | | | | | | | | | | | Pass barebox-detected bootsource to Linux to make it availible to Linux userspace. That information is passed as full path to the node corresponding to the bootsource and is placed under /chosen/bootsource and it can be read under Linux in /sys/firmware/devicetree/base/chosen/bootsource Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Pass barebox version to kernelSascha Hauer2018-03-221-0/+1
| | | | | | | | Pass the barebox version to Linux in case somebody is interested in it under Linux. We use put the version under /chosen/barebox-version and it can be read under Linux in /sys/firmware/devicetree/base/chosen/barebox-version. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: oftree: Add autoenable functionalityDaniel Schultz2017-11-071-0/+89
| | | | | | | | | | This patch adds an API to automatically enable either hardware components with existing device drivers or i2c clients. All functions take a device tree path to find the hardware and will fix up the node status in the kernel device tree, if it's accessible. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Use of_property_write_string() where appropriateSascha Hauer2017-03-301-1/+1
| | | | | | | Replace users which use of_set_property() to set a property to a string with of_property_write_string(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: oftree: Add function to register set status fixupTeresa Remmet2016-03-011-0/+36
| | | | | | | | Added a function to register a fixup to enable or disable device tree nodes. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_fix_tree: do not fail when fixup failsSascha Hauer2015-09-241-4/+2
| | | | | | | When a device tree fixup fails it is worth printing a warning, but we should not fail booting. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_fix_tree: Print error messageSascha Hauer2015-09-081-1/+4
| | | | | | | | When a of_fixup handler fails add a meaningful error message so that the user gets a clue what might have gone wrong. Suggested-by: Enrico Joerns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: add a function to remove an of_fixupUwe Kleine-König2015-05-181-0/+19
| | | | | | | | | This function is needed when a device that already registered a fixup in the probe routine fails later to probe completely. Without unregistering the fixup the function might later be called with invalid data. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add a context pointer to fixup functionsSascha Hauer2013-11-061-5/+7
| | | | | | | If drivers want to fixup their specific instance they need some context to know which instance they have to fixup. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Use correct devicetree in of_print_cmdlineSascha Hauer2013-07-271-1/+1
| | | | | | | | of_print_cmdline() is passed a devicetree, so use this one instead of the internal devicetree. This fixes the cmdline printout when bootm on ARM is used with an external devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* OF: base: sync of_find_node_by_path with linux OF APISebastian Hesselbarth2013-06-201-1/+1
| | | | | | | | | | | | | Barebox of_find_node_by_path requires a node to be passed as start node to start searching. Linux OF API does not pass this node and no current user of it in barebox is passing anything else than the root node. Therefore, we rename current function to of_find_node_by_path_from and introduce a Linux OF API compatible of_find_node_by_path that always passes the current root_node. Also, all current users of that function are updated to reflect the API change. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: print Kernel commandline in verbose modeSascha Hauer2013-05-311-0/+15
| | | | | | | Without devicetree support we print the Kernel commandline in verbose mode. Do the same with devicetree boot aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: remove unused defineSascha Hauer2013-05-311-6/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: remove unused libfdtSascha Hauer2013-03-061-175/+0
| | | | | | | Now that we are completely independent of libfdt remove the unused code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM bootm: Switch initrd support to unflattened treeSascha Hauer2013-03-061-66/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: fixup unflattened devicetreeSascha Hauer2013-03-061-48/+22
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Pass barebox internal format devicetree to of_get_fixed_treeSascha Hauer2013-03-061-10/+9
| | | | | | | 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>
* of: make flatten independent of libfdtSascha Hauer2013-03-061-1/+7
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/highbank'Sascha Hauer2013-03-041-0/+27
|\
| * of: add do_fixup_by_compatible with u32 and string versionJean-Christophe PLAGNIOL-VILLARD2013-03-031-0/+27
| | | | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | DeviceTree: add support for initrd in the DTVicente Bergas2013-02-121-0/+66
|/ | | | | | | 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>
* oftree command: refactorSascha Hauer2013-01-191-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | This has several improvements for the oftree command: - loading a devicetree (-l) and actually probing (-p) it now is separated - the command now can dump the internal devicetree or a dtb given on the command line. - The -f option now actually frees the internal devicetree With this the usage pattern for this command is: oftree -l /env/oftree oftree -d -n /sound oftree -d /env/oftree oftree -f oftree -p oftree -l -p /env/oftree Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: remove unused barebox_fdtSascha Hauer2013-01-191-2/+0
| | | | | | | | 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>
* of: make of_get_fixed_tree more universally usableSascha Hauer2013-01-111-5/+45
| | | | | | | | | | | | | | | | | 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>
* of: add devicetree probing supportSascha Hauer2012-09-141-2/+2
| | | | | | | 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>
* of: Fix usage of 0 as NULL pointerSascha Hauer2012-06-301-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* booting: more flexible Linux bootargs generationSascha Hauer2012-05-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | We currently use the environment variable 'bootargs' to get the Linux bootargs. This patch allows for a more flexible bootargs generation using global variables. With it the Linux bootargs are concatenated from multiple variables. This allows to replace parts of the bootargs string without having to reconstruct it completely. With this bootargs can be constructed like: global linux.bootargs.base="console=ttyS0,115200" global linux.bootargs.ip="ip=dhcp" global linux.mtdparts="physmap-flash.0:512K(nor0.barebox),-(root)" This will then automatically be combined into a kernel bootargs string during boot. If the 'linux.bootargs.' variables are all empty the old standard 'bootargs' way will be used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* oftree: add of_fix_tree()Sascha Hauer2011-12-151-7/+15
| | | | | | | | | | 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>
* initial oftree command supportSascha Hauer2011-10-191-0/+312
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>