summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/net'Sascha Hauer2018-12-071-2/+4
|\
| * net: dns: return error codesSascha Hauer2018-11-291-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The resolv() function used to return the IP address. When net_udp_new() fails we return an error code though which the callers of resolv() take as an IP address. This is wrong of course and we could return 0 in this case. Instead we return an error code and pass the resolved IP as a pointer which allows us to return proper error codes. This patch also adds error messages and error returns to the various callers of resolv() which used to just continue with a zero IP and let the user figure out what went wrong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/missing-prototypes'Sascha Hauer2018-12-072-15/+2
|\ \
| * | state: remove unused functionSascha Hauer2018-11-191-13/+0
| | | | | | | | | | | | | | | | | | state_find_type() is unused and doesn't have a prototype. Remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | imx-bbu-nand: Make locally used functions staticSascha Hauer2018-11-121-2/+2
| | | | | | | | | | | | | | | | | | To avoid missing prototypes warning. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/checkpatch'Sascha Hauer2018-12-076-55/+93
|\ \ \ | |_|/ |/| |
| * | common/parser.c: s/%d/%zu/ when printing size_tAhmad Fatoum2018-12-051-2/+2
| | | | | | | | | | | | | | | Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Add pr_memory_displaySascha Hauer2018-12-031-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | pr_memory_display is a memory_display variant that takes a MSG_* loglevel priority with which the hexdump is printed. Like the normal pr_* function this is optimized out when the priority is below the compile time priority. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memory_display: Print whole line at onceSascha Hauer2018-12-031-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | Instead of using many printf assemble a printed line first and print it at once. This has the purpose of being able to pick different output functions in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | imd: fix missing error messageThorsten K. Scherer2018-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | imd -t just returns 'imd: error 61', if there is not tag for <type> reference: common/imd.c:357 if (!imd) { ... Signed-off-by: Thorsten K. Scherer <t.scherer@eckelmann.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hush: Add extra define for hush debuggingSascha Hauer2018-11-271-25/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've seen people increasing the compile loglevel to get more debugging output from barebox. This is generally a good idea, but the tons of hush debugging printed makes barebox quite unusable. This patch puts hush debugging behind an extra HUSH_DEBUG define so increasing the compile loglevel no longer results in hush debugging. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | hush: Add pr_fmt defineSascha Hauer2018-11-271-0/+3
| | | | | | | | | | | | | | | | | | To give the hush debug output more context. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | memory_display: add padding to simplify countingRoland Hieber2018-11-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Trying to count single bytes (e.g. when adding an offset) in 'word' or 'byte' output mode is not easy in the current formatting, and (at least for me) has a high chance of miscounting or losing track of groups: barebox@boardname:/ md -b 0x149983f0+32 149983f0: 18 00 00 00 00 00 0d 86 00 00 00 00 00 00 00 00 ................ 14998400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ barebox@boardname:/ md -w 0x149983f0+32 149983f0: 0018 0000 0000 860d 0000 0000 0000 0000 ................ 14998400: 0000 0000 0000 0000 0000 0000 0000 0000 ................ With an additional space after 8 bytes, counting becomes easier: barebox@boardname:/ md -b 0x149983f0+32 149983f0: 18 00 00 00 00 00 0d 86 00 00 00 00 00 00 00 00 ................ 14998400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ barebox@boardname:/ md -w 0x149983f0+32 149983f0: 0018 0000 0000 860d 0000 0000 0000 0000 ................ 14998400: 0000 0000 0000 0000 0000 0000 0000 0000 ................ The 'quad' and 'long' output modes stay the same and are already much more easier to count because they build bigger and therefore less groups of bytes per line. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ddr_spd: remove unused arrayOleksij Rempel2018-11-191-2/+0
| | | | | | | | | | | | | | | Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ubiformat: print messages after checking a block is not badSascha Hauer2018-11-141-6/+6
| |/ | | | | | | | | | | | | | | | | ubiformat prints its "flashing eraseblock x" and "formatting eraseblock x" messages before having checked that a block is actually good. This is misleading, so first check if a block is good and only if it is print a message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | FIT: support hash-1/signature-1 nodes in signature checkMatthias Schiffer2018-11-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | The examples in the U-boot docs use "hash-N" and "signature-N" as the names for hash/signature nodes. It seems "@N" was used instead at some point during the development of the FIT format and "-N" is more correct (in fact, dtc throws warnings when using "@N" without a reg attribute). Support for the "@N" node names is preserved for backward compatibility. Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | bootm: Print which file cannot be openedSascha Hauer2018-11-151-7/+4
|/ | | | | | | | | | | When opening the OS image fails we used to print a message *which* file could not be opened. This message is no longer printed since we now fail in read_file_2 when there is an error. Move the message in the read_file_2 failure path to print it again. file_detect_type() needs no handling for ret < 0, in case of failure it returns filetype_unknown which is handled later, so we can remove the error handling there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2018-11-093-0/+152
|\
| * 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>