summaryrefslogtreecommitdiff
path: root/cmd/fdt.c
AgeCommit message (Collapse)Author
2023-03-09cmd: fdt: Add support for integer arrays in fdt get value with indexMarek Vasut
Currently any integer array value is set as long up-to-40 character hexadecimal string into environment variable when extracted from an FDT using 'fdt get value path prop index', because the support for handling integer arrays is not implemented, and fdt_value_env_set() code falls back into the hash handling behavior instead. Implement this support simply by checking whether user supplied any index. If index is set and the property length is multiple of four, then this is an integer array, and the code would extract value at specified index. There is a subtle change where default index is set to -1 instead of 0. This is OK, since the only place which checks for index to be less or equal zero is the string array handling code in fdt_value_env_set() and that code would work perfectly well with index -1 too. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Map address returned from fdt get addr to sysmemMarek Vasut
The address returned from 'fdt get addr' command must be mapped into sysmem, as this is a working FDT. Access to this address without mapping it would lead to crash e.g. in sandbox. The following command triggers the crash: " ./u-boot -Dc 'fdt addr $fdtcontroladdr ; fdt get addr var / compatible ; md $var' " Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Handle 64bit pointers in fdt get addrMarek Vasut
The command assumed 32bit pointers so far, with 64bit pointer the command would overwrite a piece of stack. Fix it by extending the array size to cater for 64bit pointer, and use snprintf() to avoid writing past the end of the array ever again. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Align checksign parameter names in help textMarek Vasut
The help text references 'addr' as an optional key start address, but the explanation references the same as 'start', make sure they both read as 'addr'. Also update the abbreviated 'addr' in the explanation to 'address'. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Check argc before accessing argv in fdt memoryMarek Vasut
On case 'fdt memory' is invoked without parameters, argv[2]/argv[3] is not valid and this command would SEGFAULT in sandbox environment. Add missing argc test to avoid the crash and rather print usage help message. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Check argc before accessing argv in fdt bootcpuMarek Vasut
On case 'fdt bootcpu' is invoked without parameters, argv[2] is not valid and this command would SEGFAULT in sandbox environment. Add missing argc test to avoid the crash and rather print usage help message. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Fix fdt rsvmem behavior on non-existent index and error message spaceMarek Vasut
In case 'fdt rsvmem delete index' is passed a non-existent index, one which does not exist in 'fdt rsvmem print', then the following command triggers a print of help message for 'fdt' command instead of erroring out: => fdt rsvmem delete 1234 This is because the subcommand errornously returns 'err' instead of CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past fdt_del_mem_rsv() and fdt_add_mem_rsv() in error message with the rest of the code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Fix fdt rm behavior on non-existent property and error message spaceMarek Vasut
In case an FDT contains a node '/test-node@1234' , with no property called 'noprop' in that node, the following command triggers a print of help message for 'fdt' command instead of erroring out: => fdt rm /test-node@1234 noprop This is because the subcommand errornously returns 'err' instead of CMD_RET_FAILURE, fix it. Furthermore, align the number of spaces past fdt_delprop() in error message with the rest of the code. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Fix handling of empty properties for fdt get addr and fdt get sizeMarek Vasut
It is perfectly valid to request an address or size of FDT property without value, the only special case if requesting of the value of FDT property without value. Invert the test such, that properties without value still set the variable from 'fdt get addr/size' to address of the property or size of the property, where the later is 0. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-09cmd: fdt: Import is_printable_string() from DTC to fix u32 misprintMarek Vasut
Import is_printable_string() implementation from DTC 1.7.0 as of DTC commit 039a994 ("Bump version to v1.7.0") . This fixes a print of u32 property which so far used to be printed as string by U-Boot fdt print command. We might see the case where the parsed property value, in this case it is a 32-bit integer, identified as a printable string or a null byte (concatenated strings) because of its last character happens to be: 0x00 (null character), 0xB (vertical tab character) or 0x10 (line feed character) In this situation, if the string is identified as printable string, it will be displayed as character instead of hex value When the isprint() condition is true, there are two possibilities: 1) The character is ASCII character (except the first 32) 2) The character is extended ASCII character For example, NG property in device tree: clock-frequency = <16640000>; by default, would be displayed as clock-frequency = "", "ýè"; and with this patch applied, would be displayed as clock-frequency = <0x00fde800>; Full investigation was done by Nam and Hai, patch reworked by Marek to use common code from DTC. Signed-off-by: Hai Pham <hai.pham.ud@renesas.com> Signed-off-by: Nam Nguyen <nam.nguyen.yh@renesas.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-12cmd: fdt: allow standalone "fdt move"Andre Przywara
At the moment every subcommand of "fdt", except "addr" itself, requires the DT address to be set first. We explicitly check for that before even comparing against the subcommands' string. This early bailout also affects the "move" subcommand, even though that does not require or rely on a previous call to "fdt addr". In fact it even sets the FDT address to the target of the move command, so is a perfect beginning for a sequence of fdt commands. Move the check for a previously set FDT address to after we handle the "move" command also, so we don't need a dummy call to "fdt addr" first, before being able to move the devicetree. This skips one pointless "fdt addr" call in scripts which aim to alter the control DT, but need to copy it to a safe location first (for instance to $fdt_addr_r). Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-02-12cmd: fdt: move: Use map_sysmem to convert pointersAndre Przywara
The "fdt move" subcommand was using the provided DTB addresses directly, without trying to "map" them into U-Boot's address space. This happened to work since on the vast majority of "real" platforms there is a simple 1:1 mapping of VA to PAs, so either value works fine. However this is not true on the sandbox, so the "fdt move" command fails there miserably: => fdt addr $fdtcontroladdr => cp.l $fdtcontroladdr $fdt_addr_r 40 # simple memcpy works => fdt move $fdtcontroladdr $fdt_addr_r Segmentation fault Use the proper "map_sysmem" call to convert PAs to VAs, to make this more robust in general and to enable operation in the sandbox. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-22cmd: fdt: Fix iteration over elements above index 1 in fdt getMarek Vasut
Always increment both the iterator and pointer into the string property value by length of the current element + 1 (to cater for the string delimiter), otherwise the element extracted from the string property value would be extracted from an offset that is multiple of the length of the first element, instead of sum of element lengths until select index. This fixes 'fdt get value' operation for index above 1 (counting from index 0). Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Fixes: 13982ced2cc ("cmd: fdt: Add support for reading stringlist property values") Signed-off-by: Marek Vasut <marex@denx.de>
2022-10-17fdt: Show a message when the working FDT changesSimon Glass
The working FDT is the one which comes from the OS and is fixed up by U-Boot. When the bootm command runs, it sets up the working FDT to be the one it is about to pass to the OS, so that fixups can happen. This seems like an important step, so add a message indicating that the working FDT has changed. This is shown during the running of the bootm command. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-21cmd: fdt: Add support for reading stringlist property valuesMarek Vasut
The fdt command currently handles stringlists as strings in 'fdt get value' subcommand. Since strings in FDT stringlists are separated by '\0', only the first value gets inserted into the environment variable passed to the 'fdt get value' command. Example, consider the following DT snippet: / { compatible = "foo", "bar" }; The following command only reports the first string in stringlist: => fdt get value var / compatible ; print var foo It is not possible to assign list of null-terminated strings into U-Boot environment variable. Add optional 'index' parameter to the subcommand 'fdt get value <var> <path> <prop> [<index>]' which lets user specify which string within the stringlist should be assigned into the 'var' variable. The default value of 'index' is 0 in case it is not present. This way the 'fdt' command API does not change and existing scripts are not broken. The following command now reports the Nth string in stringlist, counting from zero: => fdt get value var / compatible 1 ; print var bar Signed-off-by: Marek Vasut <marex@denx.de> Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
2022-05-05cmd: fix long text for fdt commandHeinrich Schuchardt
We don't have an option -cq but two distinct options -c and -q. Fixes: e9496ec37440 ("fdt: Add -q option to fdt addr for distro_bootcmd") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-04-22fdt: Add -q option to fdt addr for distro_bootcmdPeter Hoyes
distro_bootcmd uses this construct a few times to test $fdt_addr_r, and fall back on $fdtcontroladdr if not set/invalid: if fdt addr ${fdt_addr_r}; then ... else ... fi If the `fdt addr` test fails, it prints the following message on the console, suggesting there is an error when there is not: libfdt fdt_check_header(): FDT_ERR_BADMAGIC To remove this potentially confusing error message, this patch adds -q as a 'quiet' option for fdt addr, and uses this flag in config_distro_bootcmd.h Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
2022-04-01cmd: fdt: Use start/size for chosen instead of start/endSean Anderson
Most U-Boot command deal with start/size instead of start/end. Convert the "fdt chosen" command to use these semantics as well. The only user of this subcommand is vexpress, so convert the smhload command to use this as well. We don't bother renaming the variable in vexpress64's bootcommand, since it will be rewritten in the next commit. Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2021-09-27ti: keystone: Move away from CONFIG_SOC_KEYSTONETom Rini
We have individual SOC symbols for each keystone 2 platform. Use the existing CONFIG_ARCH_KEYSTONE rather than CONFIG_SOC_KEYSTONE to encompass all of the keystone families. Signed-off-by: Tom Rini <trini@konsulko.com>
2021-08-02global: Convert simple_strtoul() with hex to hextoul()Simon Glass
It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01fdt: Show the type of devicetree with fdt addrSimon Glass
It seems useful to show whether the address of the Control or Working devicetree is being shown. Add support for this. Drop the confusing 0x prefix since the command itself only accepts hex. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01fdt: Tidy up the code a bit with fdt addrSimon Glass
Clean up the code a little before changing it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-05-13fdt_support: move fdt_valid from cmd_fdt.c to fdt_support.cKory Maincent
Move the fdt_valid function to fdt_support. This changes allow to be able to test the validity of a devicetree in other c files. Update code syntax. Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Maxime Ripard <maxime@cerno.tech>
2020-07-09cmd: fdt: remove CMD_FDT_MAX_DUMPHeinrich Schuchardt
When printing the device tree we want to get an output that can be used as input for the device tree compiler. This requires that we do not write bogus lines like pcie@10000000 { interrupt-map = * 0x4000127c [0x00000280]; For instance the QEMU virt device has a property interrupt-map with 640 bytes which exceeds CMD_FDT_MAX_DUMP=64. So lets do away with the artificial limitation to 64 bytes. As indicated in commit f0a29d43313c ("fdt: Limit printed hex in fdt print and list commands") if a device tree contains binary blobs, it may still be desirable to limit the output length. Provide environment variable fdt_max_dump for this purpose. Fixes: 5d927b428622 ("Kconfig: Drop CONFIG_CMD_FDT_MAX_DUMP") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-18command: Remove the cmd_tbl_t typedefSimon Glass
We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop image.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-04-16fdt: Fix 'system' commandTom Warren
'fdt systemsetup' wasn't working, due to the fact that the 'set' command was being parsed in do_fdt() by only testing for the leading 's' instead of "se", which kept the "sys" test further down from executing. Changed to test for "se" instead, now 'fdt systemsetup' works (to test the ft_system_setup proc w/o having to boot a kernel). Signed-off-by: Tom Warren <twarren@nvidia.com>
2019-08-11env: Move env_set_hex() to env.hSimon Glass
Move env_set_hex() over to the new header file along with env_set_addr() which uses it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2018-11-29cmd, fdt: add subcommand "get" to fdt headerHeiko Schocher
store fdt header member with name <member> in U-Boot Environment variable with name <var>. for example to get the total length of the fdt and store it in filesize, call: fdt header get filesize totalsize For membernames look into fdt header definition at scripts/dtc/libfdt/libfdt.h Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-11-20cmd: fdt: Fix fdt address information after the movementHiroyuki Yokoyama
This patch fixes the address information of fdt. wrong case: => fdt addr 0x48000000 => fdt move 0x48000000 0x41000000 0xa000 => fdt addr The address of the fdt is 48000000 Active address in this case is 0x41000000. Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-10-10fdt: add call to ft_board_setup_ex() for ks2 boardsNicholas Faustini
When updating the board FDT, some of the operations are performed by ft_board_setup_ex() and should be executed also by the fdt command. Signed-off-by: Nicholas Faustini <nicholas.faustini@azcomtech.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-03-05libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>Masahiro Yamada
Thomas reported U-Boot failed to build host tools if libfdt-devel package is installed because tools include libfdt headers from /usr/include/ instead of using internal ones. This commit moves the header code: include/libfdt.h -> include/linux/libfdt.h include/libfdt_env.h -> include/linux/libfdt_env.h and replaces include directives: #include <libfdt.h> -> #include <linux/libfdt.h> #include <libfdt_env.h> -> #include <linux/libfdt_env.h> Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-11-16cmd/fdt.c align data buffer to avoid unaligned word accessBernhard Messerklinger
Since the compiler is free to place a char array to any address in memory (in this case the stack), also to a non word aligned address the function "fdt_prop_parse" runs into troubles upon it wants to write some (fdt32_t *) to such a variable (if it has been placed to a none word aligned address). To avoid this we tell the compiler to always align this scratchpad to a word aligned address. Signed-off-by: Bernhard Messerklinger <bernhard.messerklinger@br-automation.com> Reviewed-by: Hannes Schmelzer <oe5hpm@oevsv.at> Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fdt: Switch to using the verbose overlay application methodPantelis Antoniou
The verbose overlay application method prints out more helpful messages, so switch to it. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-09-04fdt: fix 'prop (...) not found!' error in 'fdt set' commandHannes Schmelzer
This commit brings things back to the well known working state of the command. - With commit 9620d87259572ef21f0df60988d9a932ca673779 (cmd/fdt: support single value replacement within an array) there was an error introduced modifying (inserting) a property to a device-tree node. fdt_getprop(...) returnes a len with -1 for a non-existing property, but a memcpy with len -1 isn't a good idea and things went wrong (crash). - Some times later Tom did repair this with commit 99bb38e2cce9d99238458e0f6d1880c6d2e80a4d (fdt: Check for NULL return from fdt_getprop in 'fdt set') This repairs the crash but the behaviour of the command isn't like before, it makes it impossible to insert a property. - Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Acked-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename getenv_hex(), getenv_yesno(), getenv_ulong()Simon Glass
We are now using an env_ prefix for environment functions. Rename these for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename common functions related to setenv()Simon Glass
We are now using an env_ prefix for environment functions. Rename these commonly used functions, for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename setenv() to env_set()Simon Glass
We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-11fdt: Check for NULL return from fdt_getprop in 'fdt set'Tom Rini
While the previous pass through fixed one place where we knew that fdt_getprop would be given a positive len, in the case of 'fdt set' we do not, so check that we did no get NULL from fdt_getprop(). Cc: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 163249) Fixes 72c98ed1ab48 ("fdt: Add a check to do_fdt() for coverity") Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-06-12fdt: Add a check to fdt_print() for coveritySimon Glass
We know that fdt_getprop() does not return NULL when len is > 0 but coverity does not. Add an extra check to keep it happy. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 163248)
2017-06-12fdt: Add a check to do_fdt() for coveritySimon Glass
We know that fdt_getprop() does not return NULL when len is > 0 but coverity does not. Add an extra check to keep it happy. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 163249) Fixes: bc80295b (fdt: Add get commands to fdt)
2017-06-09cmd/fdt: support single value replacement within an arrayHannes Schmelzer
With this commit we can modify single values within an array of a dts property. This is useful if we have for example a pwm-backlight where we want to modifiy the pwm frequency per u-boot script. The pwm is described in dts like this: backlight { pwms = <0x0000002b 0x00000000 0x004c4b40>; }; For changing the frequency, here the 3rd parameter, we simply type: fdt set /backlight pwms <? ? 0x1E8480>; For doing all this we: - backup the property content into our 'SCRATCHPAD' - only modify the array-cell if the new content doesn't start with '?' Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-22Kconfig: Drop CONFIG_CMD_FDT_MAX_DUMPSimon Glass
This option is not used by any board. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-01-14cmd/fdt: Make fdt get value endian-safe for single-cell propertiesAndreas Färber
On a Raspberry Pi 2 disagreements on cell endianness can be observed: U-Boot> fdt print /soc/gpio@7e200000 phandle phandle = <0x0000000d> U-Boot> fdt get value myvar /soc/gpio@7e200000 phandle; printenv myvar myvar=0x0D000000 Fix this by always treating the pointer as BE and converting it in fdt_value_setenv(), like its counterpart fdt_parse_prop() already does. Consistently use fdt32_t, fdt32_to_cpu() and cpu_to_fdt32(). Fixes: bc80295 ("fdt: Add get commands to fdt") Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Gerald Van Baren <gvb@unssw.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Simon Glass <sjg@chromium.org>
2017-01-13cmd: fdt: Print error message when fdt application failsStefan Agner
There are lots of reason why a FDT application might fail, the error code might give an indication. Let the error code translate in a error string so users can try to understand what went wrong. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-12-02cmd/fdt: fix uncallable systemsetup commandFabien Parent
The function that is processing the 'fdt' parameters is one big if-else if. In order to be able to type command faster only the first few letter are checked to know which block of code to execute. For systemsetup, the block of code that was executed was always the wrong one and ended up in a failure. } else if (argv[1][0] == 's') { process "fdt set" command } else if (strncmp(argv[1], "sys", 3) == 0) { process "fdt systemsetup" command. } When typing "fdt systemsetup", the code that was executed was the code for "fdt set". This commit fix this issue by moving the "else if" for systemsetup before the else if for "fdt set". This allow us to keep compatibility with any script that make use of "fdt s" to set node values. Signed-off-by: Fabien Parent <fparent@baylibre.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-10-13cmd/fdt: add possibilty to have 'extrasize' on fdt resizeHannes Schmelzer
Sometimes devicetree nodes and or properties are added out of the u-boot console, maybe through some script or manual interaction. The devicetree as loaded or embedded is quite small, so the devicetree has to be resized to take up those new nodes/properties. In original the devicetree was only extended by effective 4 * add_mem_rsv. With this commit we can add an argument to the "fdt resize" command, which takes the extrasize to be added. Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Acked-by: Simon Glass <sjg@chromium.org>
2016-08-20cmd: fdt: add fdt overlay application subcommandMaxime Ripard
The device tree overlays are a good way to deal with user-modifyable boards or boards with some kind of an expansion mechanism where we can easily plug new board in (like the BBB or the raspberry pi). However, so far, the usual mechanism to deal with it was to have in Linux some driver detecting the expansion boards plugged in and then request these overlays using the firmware interface. That works in most cases, but in some cases, you might want to have the overlays applied before the userspace comes in. Either because the new board requires some kind of an early initialization, or because your root filesystem is accessed through that expansion board. The easiest solution in such a case is to simply have the component before Linux applying that overlay, removing all these drawbacks. Reviewed-by: Stefan Agner <stefan@agner.ch> Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
2016-08-20cmd: fdt: Narrow the check for fdt addrMaxime Ripard
The current code only checks if the fdt subcommand is fdt addr by checking whether it starts with 'a'. Since this is a pretty widely used letter, narrow down that check a bit. Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>