summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
...
| * usbgadget: autostart: add DFU supportLadislav Michl2018-10-293-0/+152
| | | | | | | | | | | | | | | | | | | | | | Use global variable dfu_function to autostart DFU. As similar code is used to start multifunction gadget using command, move common code to common/usbgadget.c and consolidate it. It turned out that '-s' option of usbgadget command does nothing, so remove its help text and make it function as '-a'. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/state'Sascha Hauer2018-11-093-25/+62
|\ \
| * | bootchooser: Add reference countingSascha Hauer2018-10-181-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds reference counting to the bootchooser. Instead of creating a new bootchooser instance with each bootchooser_get() we return a reference to the existing bootchooser. This makes the behaviour consistent when bootchooser_get() is called multiple times. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootchooser: put bootchooser after creating a boot entrySascha Hauer2018-10-181-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Between creating a boot entry for bootchooser and actually using it the underlying state may have been modified, so make sure to get a current bootchooser when booting it, thus do a bootchooser_put after having created the entry and a bootchooser_get again when booting it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_bucket_circular: remove unused variablesUlrich Ölmann2018-10-121-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | This has been forgotten in commit 9d6d91931afb ("state: Remove -EUCLEAN check from userspace tool"). Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: state: fix typoUlrich Ölmann2018-10-101-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | state: backend_bucket_circular: fix memory leakUlrich Ölmann2018-10-101-4/+7
| | | | | | | | | | | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-092-3/+3
|\ \ \
| * | | drivers: Introduce dev_set_name()Andrey Smirnov2018-10-182-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ratp: fix compile warningsOleksij Rempel2018-10-181-1/+1
| | |/ | |/| | | | | | | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-11-091-1/+1
|\ \ \
| * | | ratp: fix compile warningsOleksij Rempel2018-10-231-1/+1
| |/ / | | | | | | | | | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2018-11-094-7/+5
|\ \ \
| * | | partitions: efi: Constify force_gptAndrey Smirnov2018-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No one is modifying 'force_gpt', so constify it to reflect that fact. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | state: fix indentationUlrich Ölmann2018-10-191-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | state: fix documentation of state_new_from_node()Ulrich Ölmann2018-10-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit a66a8d79871c ("state: remove unused arguments from state_new_from_node()") removed a little bit too much. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | common: state: use of_property_write_string() where appropriateUlrich Ölmann2018-10-121-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See commit b6089182316d ("treewide: Use of_property_write_string() where appropriate"). Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | blspec: do not depend on BLOCKLadislav Michl2018-10-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | blspec can be read also from jffs2 or ubifs, so remove BLOCK dependency Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | tlsf_malloc: Set errno to ENOMEM on failureAndrey Smirnov2018-10-161-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set errno to ENOMEM on failure so that correct error message can be displayed by users who rely on errno. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | dummy_malloc: Check if sbrk() failsAndrey Smirnov2018-10-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add code to check if sbrk() fails as well as setting appropriate 'errno' for users that may rely on it for error reporting. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | dummy_malloc: Make use of PTR_ALIGNAndrey Smirnov2018-10-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop explicit type cast and alignement code in favor of PTR_ALIGN Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | tlsf_malloc: dummy_malloc: Share code for calloc()Andrey Smirnov2018-10-164-31/+21
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calloc() implementation for TLSF does not correctly check for malloc() failure which can result in a NULL pointer exception when trying to calloc() extra large buffers. Since both TLSF and dummy malloc implementations of calloc() are exactly the same, pick implementation for the latter (which does aforementioned check) and share it between the two. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | environment: bypass overlap check for mtd devicesSascha Hauer2018-10-121-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For mtd devices the overlap check does not work as expected for two reasons. First is that cdev->offset is 0 for mtd partitions, instead cdev->mtd->master_offset has to be used. That could be fixed easily. Second on NAND devices the environment is on the bb devices and not on the raw nand devices which means we would need something to get the mtd device from the bb device before doing the check. Both issues are fixable, but the check was mainly done to catch cases when an environment partition is created in the free space before the first MBR/GPT partition on SD/MMC devices, so leave out the mtd case for now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / environment: Fix overlapping partitions error messageLadislav Michl2018-10-121-2/+2
|/ | | | | | | Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Fixes: b234a6da331f ("environment: Do not use environment when overlapping with other partitions") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2018-10-098-32/+483
|\
| * ratp: fix incorrect whitespaces in method callsAleksander Morgado2018-09-174-15/+15
| | | | | | | | | | | | | | | | This is a simple coding style fix to avoid the whitespace before the open-parenthesis in method calls. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: use pr_ macros to print messagesAleksander Morgado2018-09-173-13/+19
| | | | | | | | | | | | | | | | | | Following suggestions in other patch reviews, the RAPT commands are updated to use pr_err() instead of plain printf() to report errors to the user. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: use __packed instead of the full formAleksander Morgado2018-09-173-5/+5
| | | | | | | | | | | | | | | | Just a minor coding style change to follow the suggestions given in patch reviews for other RATP commands. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: implement support for GPIO commandsAleksander Morgado2018-09-173-1/+154
| | | | | | | | | | | | | | | | Introduce three new RATP commands that allow getting and setting GPIO values as well as configuring the direction of the GPIO pins. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: implement i2c read/write supportAleksander Morgado2018-09-173-0/+292
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce two new RATP commands that allow running i2c read/write operations, very similar in format to the already existing md/mw RATP commands. The messages are defined with a fixed 16-bit long register field, but it will only be treated as a 16-bit address if I2C_FLAG_WIDE_ADDRESS is set in the message flags field. If this flag is unset, the start register address is assumed 8-bit long. If the message includes the I2C_FLAG_MASTER_MODE flag, the start register field is ignored and a i2c master send/receive operation is performed. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2018-10-093-20/+80
|\ \
| * | environment: Do not use environment when overlapping with other partitionsSascha Hauer2018-09-261-1/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Environment partitions are usually specified with their hardcoded offset and size, either in the device tree or the board file. These partitions potentially overlap with other partitions read from the partition table. Overlapping partitions for sure have bad effects. Be more friendly to our users and warn them when such a situation occurs and stop using that partition for storing the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | environment: Allow default env path to be NULLSascha Hauer2018-09-211-2/+7
| | | | | | | | | | | | | | | | | | | | | Several places assume that the default environment path cannot be NULL. Allow NULL here without crashing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: Make use of resource_size()Andrey Smirnov2018-09-191-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memtest: Adjust code for 64-bit architecturesAndrey Smirnov2018-09-191-15/+20
| |/ | | | | | | | | | | | | | | | | Make use of %pa specifier to avoid warnings when building against 64-bit CPU (specifically AArch64) as well as adjust a number of patterns to be 64-bits wide. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2018-10-091-8/+50
|\ \
| * | imx-bbu-nand-fcb: Workaround ROM checking fingerprint before correcting bitflipsSascha Hauer2018-09-251-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FCB block is protected with a ECC code which can correct 1bit errors and detect 2bit errors. This works fine for all fields except the fingerprint marker (Containing "FCB") and the version field. Here the ROM chooses to check the correct value of the fields *before* running the ECC correction. Thus a FCB is not used by the ROM anymore when it has a bitflip in the fingerprint or version. For us this means we have to rewrite the FCB in this case, so reject the faulty FCB in read_fcb_hamming_13_8() which triggers a rewrite during the check operation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | imx-bbu-nand-fcb: Workaround ROM not being able to handle bad blocks properlySascha Hauer2018-09-251-7/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | When reading a firmware image the ROM only checks for a bad block when advancing the read position, but not if the initial block is good. Hence we cannot directly point to the first firmware block, but must instead point to the first *good* firmware block. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | imx-bbu-nand-fcb: Improve error messageSascha Hauer2018-09-251-1/+1
| |/ | | | | | | | | | | | | When printing that a FCB is not readable it's interesting to know which one is not readable. Print the block number in the message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: Simplify bbu_find_handler_by_device()Andrey Smirnov2018-10-081-9/+5
| | | | | | | | | | | | | | | | | | Simplify bbu_find_handler_by_device() by making use of devpath_to_name() as well as some basic recursion to avoid coding the same loop twice. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: Add "handler" parameter to barebox_update()Andrey Smirnov2018-10-081-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | Add "handler" parameter to barebox_update() and remove the code that was respondible for header lookup before. With this change finding appropriate handler is caller's responsibility, which makes it possible to implement custom handler lookup/existence check, chache it, and then re-use it without calling handler_find_by_* functions for the second time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bbu: Expose bbu_find_handler_by_*() functionsAndrey Smirnov2018-10-081-19/+5
| | | | | | | | | | | | | | | | | | | | | | | | Expose bbu_find_handler_by_device() and bbu_find_handler_by_name() as public functions and convert the only user of barebox_update_handler_exists() to use the former function instead. With this done, barebox_update_handler_exists() is no longer used anywhere in the code and can be removed. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | state: backend_bucket_circular: fix for non power of 2 writesizeLadislav Michl2018-09-261-2/+2
| | | | | | | | | | | | | | | | | | backend_bucket_circular currently assumes writesize is power of 2, which makes it fail on dataflash devices, where this assumption is false. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ratp: select CMDLINE_EDITINGClément Leger2018-09-261-0/+1
|/ | | | | | | | ratp seems to send special characters which are not handle correctly without CDMLINE_EDITING. Without this config, commands run via ratp will have an erratic behavior and/or incorrect output. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootsource: handle SPI-NOR in the same way as SPI-EEPROMLucas Stach2018-09-041-0/+1
| | | | | | | | | The NOR flash device itself does not have an alias in the kernel DT, so we want to have the bootsource pointing at the SPI controller the flash chip is attached to. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Report update failures explicitlyAndrey Smirnov2018-08-311-6/+6
| | | | | | | | | Change the code of barebox_update() to explicitly log that update failed instead of failing silently (unless update was interrupted) and relying on user checking the return code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* block: Do not ignore error in blk->ops->write()Andrey Smirnov2018-08-311-3/+14
| | | | | | | | | | | Getting a error from blk->ops->write() is not a very unlikely event (happens quite often during new board bringup), so we need to catch and propagate them to upper layers so they can be at least reported properly. Change the code of all of the callers to bail out as soon as blk->ops->write() fails. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bbu: Remove logical negation in barebox_update_handler_exists()Andrey Smirnov2018-08-311-1/+1
| | | | | | | | | Returning !bbu_find_handler() from barebox_update_handler_exists() would return the opposite result from what the name of that funciton implies. Drop the "!" to make it behave as expected. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add code to detect i.MX image v2Andrey Smirnov2018-08-311-0/+4
| | | | | | | | Modify file_detect_type() and add code needed to be able to detect i.MX boot images with v2 header. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* filetype: Add code to detect i.MX image v1Andrey Smirnov2018-08-311-0/+7
| | | | | | | | Modify file_detect_type() and add code needed to be able to detect i.MX boot images with v1 header. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>