summaryrefslogtreecommitdiffstats
path: root/commands
Commit message (Collapse)AuthorAgeFilesLines
...
* commands: test: simplify argv handlingMarco Felsch2023-07-281-2/+2
| | | | | | | | | Decrement argc first before check the closing ']' to avoid the *argv[argc - 1]. No functional change. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230704121626.835344-1-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: hab: check for error in imx_hab_device_locked_downAhmad Fatoum2023-07-281-1/+7
| | | | | | | | | | | imx_hab_device_locked_down() reads efuses and that operation can fail. Instead of assuming a failure means the efuses are non-zero, have the hab command explicitly check for negative error codes. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230726192718.911735-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: go: support passing integer arguments instead of argc/argvAhmad Fatoum2023-07-262-8/+56
| | | | | | | | | | | | | | | | | The go command accepts extra arguments, which are passed through to the application using two parameters: argc to hold the number of arguments and argv as a NULL pointer terminated array of pointers to nul-terminated strings. As the go command is meant to invoke bare metal applications, it is useful to be able to pass arguments parsed to integers using the default calling convention, so add a new -i argument. The old behavior remains the default and a new -s arguments makes it explicit for symmetry. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230726125222.3706933-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Print device nodes with %pOFSascha Hauer2023-07-033-4/+4
| | | | | | | We have the %pOF format specifier for printing device nodes. Use it where appropriate. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pwm'Sascha Hauer2023-06-223-0/+221
|\
| * fixup! commands: add pwm manipulation commandSascha Hauer2023-06-061-12/+21
| |
| * commands: add pwm manipulation commandMarc Reilly2023-06-063-0/+212
| | | | | | | | | | | | | | | | This introduces a command to set parameters for a pwm device. Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Link: https://lore.barebox.org/20230602045306.31258-2-marc@cpdesign.com.au Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/of-compat'Sascha Hauer2023-06-226-72/+179
|\ \
| * | commands: of_diff: support applying fixups on arbitrary device treesAhmad Fatoum2023-06-091-8/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_diff - + is quite useful to find what fixups barebox would apply to its own device tree. But for some cases, like barebox-state or OP-TEE reservations, the nodes that would be fixed up into the kernel device tree already exist within the barebox device tree and wouldn't be shown by of_diff - +. To make them visible, let's redefine +: - Previously, it always meant the fixed up barebox DT - Now, it means the other DT with fixups applied That way, of_diff - + continues to work, but kernel DTs can now be diffed against their fixed up version by doing: of_diff /mnt/tftp/afa-oftree-myboard + Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230608134040.2123869-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: of_diff: simplify error handlingAhmad Fatoum2023-06-091-36/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The error check and message is duplicated for each argument and could be unified if we move it to get_tree instead. While at it, we limit argc to exactly 3 in case we want to add options in the future. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230608134040.2123869-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: change superfluous of_fix_tree int return type to voidAhmad Fatoum2023-06-092-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_fix_tree always returns 0, so propagating its return code and checking it serves no purpose. Let's just change it to void *. I considered having it return the first argument, but that could mislead users to think that the argument is not modified. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230608134040.2123869-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: implement of_compatible commandAhmad Fatoum2023-05-253-0/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the usual way within scripts to differentiate between machines is to compare global.model or global.hostname. Both are suboptimal, because they may change between releases or overridden by the user. In C code, the machine compatible is used for this purpose. Add a new of_compatible command that makes of_machine_is_compatible/ of_device_is_compatible available to scripts. Example use: /env/init/fixups: #!/bin/sh if of_compatible -k radxa,rock3a ; then of_property -df mmc0 sd-uhs-sdr104 fi Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: of_dump: use of_dup instead of flattening/unflatteningAhmad Fatoum2023-05-251-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Flattening and unflattening is needlessly laborious. We have of_dup for that, so let's make use of it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: of_dump: remove duplicate error messageAhmad Fatoum2023-05-251-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | of_read_file will already print to log on failures, so we need not print a second message in of_dump on error. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | commands: of_property: use new of_read_fileAhmad Fatoum2023-05-251-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent addition of of_read_file also involved switching over nearly all open coded instances to use it. of_property seems the only remaining instance where of_read_file can be used, but isn't. Switch it over. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | treewide: drop null pointer checks around of_delete_nodeAhmad Fatoum2023-05-252-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | of_delete_node is a no-op when called on a null pointer, so remove the useless null checks around it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc-fixes-sandbox'Sascha Hauer2023-06-221-0/+2
|\ \ \
| * | | commands: ubsan: hide pointer provenance used to trigger UBAhmad Fatoum2023-06-131-0/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | The ubsan command invokes various sort of undefined behavior to verify that the Undefined Behavior Sanitizer works as expected. Compiler warns about some of this, which is not helpful, so work around the warning. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612130239.1087599-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/dmesg'Sascha Hauer2023-06-221-21/+70
|\ \ \
| * | | dmesg: udpate helpSascha Hauer2023-06-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that there are two options which take a loglevel as argument describe the available loglevels in the command description and not in the argument description. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | dmesg: implement dmesg -nSascha Hauer2023-06-131-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Under Linux dmesg -n can be used to set the console loglevel. Implement the same for barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | dmesg: allow loglevels specified as numbersSascha Hauer2023-06-131-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Linux dmesg loglevels can be specified as strings or as numbers. Do likewise in barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | dmesg: error out on unknown loglevelsSascha Hauer2023-06-131-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The user deserves an error when an unknown loglevel is given, so print an error instead of silently ignoring unknown loglevels. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | dmesg: factor out str_to_loglevel()Sascha Hauer2023-06-121-18/+29
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | dmesg open codes functionality to convert a string to a loglevel. Make a separate function from it which will be useful in the next patch. While at it remove the BAREBOX_LOG_PRINT_* defines and use MSG_* defines directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / / crypto: digest: match driver name if no algo name matchesAhmad Fatoum2023-05-261-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | The digest command lists all registered digest implementations, but there's no way to select a specific implementation when another higher priority one exists for the same algorithm. Let's support this, by having digest_algo_get_by_name fallback to look up by driver name if an exact match couldn't be found by algo name. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230526063746.1155297-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / commands: ethlog: wire up help textRoland Hieber2023-05-261-0/+1
|/ | | | | | | | | | | The help text for ethlog currently contains only the short synopsis, but no explanation what all the options actually do, although that info is available a few lines further up. It was probably just forgotten to be included in the command definition. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20230525152934.4127575-1-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-05-248-70/+123
|\
| * commands: add new of_fixup command to list and disable DT fixupsAhmad Fatoum2023-05-223-0/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | barebox can already dry run fixups with of_diff - +, but there's no way to selectively disable a fixup to rule out it causing issues. For platforms supporting kallsyms, we can readily allow enabling and disabling fixups by name, so let's add a command that does just that to aid in debugging. Suggested-by: Daniel Brát <danek.brat@gmail.com> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230420203219.2255564-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: add function to read a file as unflattened device treeSascha Hauer2023-05-225-70/+15
| | | | | | | | | | | | | | | | There are several places in the tree that read in a dtb file and unflatten it. Add a of_read_file() helper function for that and use it where appropriately. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: drop trailing spaceAhmad Fatoum2023-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by manual inspection of the output of: rg '\s+$' | rg -v dts/ Patch can be verified by observing that no diff results from: git show --ignore-space-at-eol Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20230424121805.150434-4-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: memtest: prepare for reuse in self testAhmad Fatoum2023-05-232-2/+4
| | | | | | | | | | | | | | | | | | | | memtest is quite talkative: it narrates status and advances a progress bar. For non-interactive use, e.g. for selftest, this is a bit much, so hide that behidnd a new MEMTEST_VERBOSE flag. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230522052835.1039143-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM64: mmu: implement ARMv8 mmuinfo commandAhmad Fatoum2023-05-231-3/+3
| | | | | | | | | | | | | | | | | | To aid with debugging of MMU code, let's implement mmuinfo for ARMv8, like we already support for ARMv7. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230522052835.1039143-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: prepare extending mmuinfo beyond ARMv7Ahmad Fatoum2023-05-231-0/+1
|/ | | | | | | | | | | | | There's no reason to restrict mmuinfo to ARMv7 or ARM at all for that matter. Prepare extending it for ARMv8 support by splitting off the 32-bit parts. While at it, make the output available for debuggin by exporting a mmuinfo() function. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230522052835.1039143-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2023-04-194-7/+7
|\
| * usb: move include files to place where Linux has themSascha Hauer2023-03-204-7/+7
| | | | | | | | | | | | | | | | | | For easier patch merging and comparison with Linux move the usb gadget files to where Linux has them. For now do a plain git mv include/usb include/linux/usb, eventhough there might be some files which are purely barebox specific. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2023-04-192-54/+55
|\ \
| * | commands: menu: enable help text parsing for sphinx docsAhmad Fatoum2023-04-171-53/+54
| | | | | | | | | | | | | | | | | | | | | | | | Use of the macros is required, so Documentation/gen_commands.py may format it into ReST for the documentation. Reported-by: Leonard Göhrs <l.goehrs@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
| * | mmc: fix calculation of Max Enhanced AreaSchoyswohl, Roland2023-04-051-1/+1
| |/ | | | | | | | | | | | | | | | | According extcsd documentation, the HC_ERASE_GRP_SIZE must be multiplied by HC_ERASE_GRP_SIZE and not added. Signed-off-by: Roland Schoyswohl roland.schoyswohl@ife-doors.com Link: https://lore.barebox.org/AM6PR04MB472829B69D627CA15218927EA2879@AM6PR04MB4728.eurprd04.prod.outlook.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: of_overlay: Allow to register clocks from overlaySascha Hauer2023-03-231-2/+6
| | | | | | | | | | | | | | | | | | When clocks are added from an overlay calling of_probe() is enough for devices handled by regular drivers, but not for clocks declared with CLK_OF_DECLARE(). Additionally call of_clk_init() to support these as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: nand: add missing parameters to helpWolfram Sang2023-03-212-2/+4
| | | | | | | | | | | | Signed-off-by: Wolfram Sang <wsa@kernel.org> Link: https://lore.barebox.org/20230319153931.23867-1-wsa@kernel.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | commands: edit: fix typo in Kconfig help textWolfram Sang2023-03-211-1/+1
|/ | | | | | Signed-off-by: Wolfram Sang <wsa@kernel.org> Link: https://lore.barebox.org/20230319153911.23811-1-wsa@kernel.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_overlay: Add option to apply overlay to live treeSascha Hauer2023-03-151-4/+39
| | | | | | | | | The of_overlay command currently only supports applying overlays to the Linux device tree. Add an option to apply an overlay to the live tree. Using this option will apply the overlay and also triggers rescanning the device tree in case new devices have been added. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct fs_driver_d to fs_driverSascha Hauer2023-01-101-1/+1
| | | | | | | | | Remove the meaningless '_d' suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct fs_device_d to fs_deviceSascha Hauer2023-01-101-1/+1
| | | | | | | | | Remove the meaningless '_d' suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-102-2/+2
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-106-8/+8
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-101-3/+3
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-12-121-1/+0
|\
| * Remove unused struct partitionSascha Hauer2022-11-231-1/+0
| | | | | | | | | | | | | | | | struct partition from include/partition.h is entirely unused. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20221117120604.3840211-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx7-nand-xload'Sascha Hauer2022-12-121-0/+9
|\ \