summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/ratp'Sascha Hauer2018-03-052-0/+54
|\
| * ratp: new reset commandAleksander Morgado2018-03-011-0/+1
| | | | | | | | | | | | | | | | E.g.: $ ./bbremote -v --port /dev/ttyUSB2 reset Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: new md and mw commandsAleksander Morgado2018-03-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces support for running the md and mw commands using the binary interface provided by RATP. This allows clients to read and write memory files without needing to do custom string parsing on the data returned by the console 'md' and 'mw' operations. The request and response messages used for these new operations are structured in the same way: * An initial fixed-sized section includes the fixed-sized variables (e.g. integers), as well as the size and offset of the variable-length variables. * After the initial fixed-sized section, the buffer is given, which contains the variable-length variables in the offsets previously defined and with the size previously defined. The message also defines separately the offset of the buffer w.r.t. the start of the message. The endpoint reading the message will use this information to decide where the buffer starts. This allows to extend the message format in the future without needing to break the message API, as new fields can be appended to the fixed-sized section as long as the buffer offset is also updated to report the new position of the buffer. E.g.: $ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5 0000000000 $ ./bbremote --port /dev/ttyUSB2 mw /dev/pic_eeprom_rdu 0x107 0102030405 5 bytes written $ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5 0102030405 $ ./bbremote --port /dev/ttyUSB2 mw /dev/pic_eeprom_rdu 0x107 0000000000 5 bytes written $ ./bbremote --port /dev/ttyUSB2 md /dev/pic_eeprom_rdu 0x107 5 0000000000 Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: implement generic command supportAleksander Morgado2018-03-012-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The RATP implementation now allows executing generic commands with a binary interface: binary requests are received and binary responses are returned. Each command can define its own RATP request contents (e.g. to specify command-specific options) as well as its own RATP response contents (if any data is to be returned). Each command is associated with a pair of numeric unique request and response IDs, and for easy reference these IDs are maintained in the common ratp_bb header. Modules may override generic implemented commands or include their own new ones (as long as the numeric IDs introduced are unique). Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2018-03-051-0/+2
|\ \
| * | console: move global.allow_color handling to C codeSascha Hauer2018-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We have global.allow_color, but this is limited to the environment only. Move creation and handling of this variable to C code so that we can add support for colored output to commands/console controlled by the same variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/fastboot'Sascha Hauer2018-03-052-0/+24
|\ \ \ | |_|/ |/| |
| * | usb: gadget: fastboot: Add external command execution supportSascha Hauer2018-02-091-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Custom projects may need vendor specific expansions to the fastboot command execution. Allow these to be implemented without messing in the fastboot code directly. We have a hook for all commands and also one for the "flash" command. Each hook can decide if the generic command parser is executed afterwards (return value FASTBOOT_CMD_FALLTHROUGH) or if the generic parser shall be skipped (return value 0 or negative error code). This allows board code to implement vendor specific "oem" commands or to handle the downloaded image in a special way (i.e. do signature checks on them) Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ubiformat: Allow to ubiformat with a buffer givenSascha Hauer2018-02-091-0/+7
| |/ | | | | | | | | | | | | So far ubiformat can only handle files. Make it possible to pass a buffer into ubiformat. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / state: remove unused arguments from state_new_from_node()Sascha Hauer2018-02-221-2/+1
|/ | | | | | | | state_new_from_node() has arguments describing the backend path. These are never used in barebox, the backend path is always derived from the device nodes backend description. Remove these arguments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zstd'Sascha Hauer2018-02-083-0/+1395
|\
| * lib: Add zstd decompression modulePhilipp Zabel2018-02-051-0/+1157
| | | | | | | | | | | | | | Based on kernel commit 73f3d1b48f50 ("lib: Add zstd modules"). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: Add xxhash modulePhilipp Zabel2018-02-051-0/+236
| | | | | | | | | | | | | | Based on kernel commit 5d2405227a9e ("lib: Add xxhash module"). Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include linux/compiler.h in linux/unaligned/generic.hPhilipp Zabel2018-02-051-0/+2
| | | | | | | | | | | | | | | | Without this include, the __force macro used in this header may be undefined. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/tftp-workaround'Sascha Hauer2018-02-084-17/+12
|\ \
| * | fs: remove now unused function can_lseek_backward()Sascha Hauer2018-01-251-20/+0
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs/uimagefs: Use is_tftp_fs() and cache_file() to ease TFTP workaroundSascha Hauer2018-01-251-1/+1
| | | | | | | | | | | | | | | | | | | | | We have helper functions now to ease file caching when a file is on TFTP. Use them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | uimage: Use is_tftp_fs() and cache_file() to ease TFTP workaroundSascha Hauer2018-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | We have helper functions now to ease file caching when a file is on TFTP. Use them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | libfile: implement a function to cache a fileSascha Hauer2018-01-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the nature of TFTP which can't lseek and due to the silliness of our filesystem implementation which can't cache accesses we have to manually cache files on TFTP filesystems sometimes. Make it easier for them by providing a cache_file() function which copies the file from TFTP to RAM. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | libfile: implement make_tempSascha Hauer2018-01-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a make_temp() function which creates a name for a temporary file. Since we do not have any concurrency in barebox we do not need to create the file right away and can leave that to the caller. Unlike unix mktemp the resulting filename is dynamically allocated and must be freed by the caller. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fs: implement is_tftp_fs()Sascha Hauer2018-01-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some commands need files in which they can lseek backwards which is particularly not possible on TFTP. Instead of hiding this behind can_lseek_backward() create a function for it which tests if the file is on TFTP directly rather than using different lseek operations. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/ratp'Sascha Hauer2018-02-082-7/+4
|\ \ \
| * | | ratp: remove unused list pointer from ratp_bb_pktAleksander Morgado2018-01-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This struct type is used in the RATP FS implementation, but was never used as a list element anywhere. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | ratp: move barebox-specific command to ratp_bb.hAleksander Morgado2018-01-302-5/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | The ratp_run_command() is really an implementation detail of the barebox ratp 'command' operation support. Move it to the barebox specific header and rename it with the correct prefix. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/of'Sascha Hauer2018-02-081-0/+5
|\ \ \
| * | | of: fdt: add of_unflatten_dtb_constSascha Hauer2018-01-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a variant of of_unflatten_dtb() which uses the property data directly from the input tree rather than copying it. This is mainly useful for a single user: FIT images. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | of: Allow for const propertiesSascha Hauer2018-01-311-0/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for const properties. We add a const void *value_const to struct property which will not be modified. The value of a property should no longer be used directly, but with the of_property_get_value() accessor which picks the right value. With this we can unflatten dtbs and use the property values directly from the dtb instead of copying them. This is useful for device trees which (ab)use properties to store huge data files, aka FIT images. To create a property whose value is not copied but used from the original input data we introduce of_new_property_const(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2018-02-083-1/+4
|\ \ \
| * | | fs: add support loop mount offsetPhilipp Zabel2018-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When loop mounting, allow to specify an offset into the file, similarly to the losetup offset option. Multiplicative suffixes are supported. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | filetype: Add type detection at an offsetPhilipp Zabel2018-02-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add file_name_detect_type_offset to allow file system detection for loop mounts at an offset. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | fs/parseopt: Add parseopt_llu_suffixPhilipp Zabel2018-02-051-0/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | Add an option parser using strtoull_suffix that can be used to parse a loop mount offset option. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/constify'Sascha Hauer2018-02-083-13/+14
|\ \ \
| * | | libfile: Make write_file buffer constSascha Hauer2018-01-311-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | bbu: Make pointer to image constSascha Hauer2018-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make pointer to image in bbu data const so that we can put const pointers into that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | imd: Make all pointers into image constSascha Hauer2018-01-302-11/+12
| |/ / | | | | | | | | | | | | | | | | | | The IMD code should be readonly and never modify any pointers. Make all pointers const so that const pointers can be passed in to IMD. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/FIT'Sascha Hauer2018-02-082-13/+16
|\ \ \
| * | | FIT: Allow to open buffer as FIT imageSascha Hauer2018-02-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | This adds fit_open_buf() which can open a buffer as FIT image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | FIT: store device_nodes in fit_handleSascha Hauer2018-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need the /images and /configurations nodes more than once, so store them in the fit_handle rather than searching for them each time again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | FIT: Let user specify the configuration to useSascha Hauer2018-02-082-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The images in FIT images can be opened in two different ways. They can be either opened directly based on their names in the images/ node or as part of a configuration based on their names in the corresponding /configuration/ node. So far we only supported the latter. To prepare supporting the former we return a cookie belonging to the configuration from fit_open_configuration() which we use in fit_open_image() to refer to the desired configuration. While at it document fit_open_configuration(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | FIT: Do not pre-open imagesSascha Hauer2018-02-081-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Only do what fit_open_configuration() suggests: open the configuration, but not the images in it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | bootm: FIT: do not depend on FIT pre-opened imagesSascha Hauer2018-02-081-0/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | When calling fit_open_configuration the FIT code already opens the images "kernel", "ramdisk" and "dtb". This does not fit well into the FIT code, so make the bootm code independent of these pre-opened images so that we can drop the opening from the FIT code in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | / of: Add function to find the same node in another treeSascha Hauer2018-02-061-1/+4
| |/ |/| | | | | | | | | | | | | | | | | | | | | For our device tree fixups we have to find a node corresponding to another node in another device tree. We used to use the full name to match the nodes, but this falls apart when nodes get renamed or for example a new bus hierarchy is introduced. To make this more robust we create reproducible names from device nodes which mostly depend on the address in MMIO space, the reg property and as a last resort the name of the device node. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | reset: add missing stub for reset_control_getLucas Stach2018-02-051-0/+7
|/ | | | | | Fixes: 45b95b50cd0b (reset: add reset controller framework) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-01-227-5/+23
|\
| * mci: drop unused parameter from mci_switch()Uwe Kleine-König2018-01-221-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SWITCH command has two purposes: a) switch the command set b) Write to the EXT_CSD register If the access field (bits [25:24]) in the argument are b00, we're in case a), otherwise in b). As mci_switch() always passes MMC_SWITCH_MODE_WRITE_BYTE (0b3) in the access field, only case b) is relevant here. According to the eMMC specification[1] the command set field is ignored in case b) and so the respective parameter (that is unused already now) can be dropped. [1] Embedded Multi-Media Card (e•MMC) Electrical Standard (5.1), February 2015; paragraph 6.6.1 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * FIT: export fit_open_configuration() and fit_open_image()Sascha Hauer2018-01-181-1/+7
| | | | | | | | | | | | | | | | | | Currently only fit_open() is exported which only opens the predefined images "kernel", "dtb" and "ramdisk". To make the FIT code more usable for other code which may want to open other images export fit_open_configuration() and fit_open_image(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * parseopt: introduce parseopt_u16() and parseopt_str()Antony Pavlov2018-01-171-0/+2
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include/parseopt.h: add guard macroAntony Pavlov2018-01-171-0/+5
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * move parseopt to lib/Antony Pavlov2018-01-171-0/+2
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: base: use root_node compatible as suggestion for a hostnameOleksij Rempel2018-01-172-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on some SoCs we can use generic PLL and RAM initialization. In this cases we create board file only to provide a host name. With this patch host name will be created from device tree compatible. For example: compatible = "board_vendor,board", "chip_vendor,soc" the host name will be: "board" This function will not overwrite a host name which is already set by board or machine code. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>