summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* usb: gadget: fsl_udc: pass controller instance to unregisterSascha Hauer2018-10-291-2/+4
| | | | | | | | | | | | | ci_udc_unregister() used to unregister "the controller". Since we may register multiple chipidea devices we called ci_udc_unregister() for each of them. This led to messages like: ERROR: imx-usb 53f80000.usb: gadget not registered. Fix this by returning the registered controller. This allows us to call ci_udc_unregister() only when we actually registered one before. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: host: ehci: do not use dev->privSascha Hauer2018-10-291-0/+6
| | | | | | | | | | | | | | An ehci can be registered with ehci_register which is passed a struct device_d *. In that case the priv pointer may already be used by the caller, so we must not use it in the ehci code. At least for the Atmel ehci driver this fixes a bug, here dev->priv is set two times to different values. Since we need dev->priv in the ehci code to get the controller in ehci_detect() we can no longer implement that without the help of the caller, hence we eport ehci_detect() and epect it to be called by the code which registers a ehci host. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: host: ehci: add ehci_unregister()Sascha Hauer2018-10-291-3/+11
| | | | | | | | | ehci_register() allocates data and registers a ehci host. Add ehci_unregister() to properly halt the controller and to free the memory again.. To do so, change ehci_register() to return the ehci host rather than an error code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* usb: Add usb_unregister_host()Sascha Hauer2018-10-261-0/+1
| | | | | | | | We have usb_register_host() which puts a new host on the list of hosts we should also have the opposite which removes the host from the list again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ubifs'Sascha Hauer2018-10-0915-471/+1066
|\
| * vsprintf: implement %pVSascha Hauer2018-10-081-0/+5
| | | | | | | | | | | | | | %pV allows to pass in a struct va_format as a pointer. UBIFS uses this for its logging functions, but it may be useful in other places aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * compiler: Update to v4.19-rc6Sascha Hauer2018-10-085-457/+535
| | | | | | | | | | | | | | | | This updates include/linux/compiler* to Linux-4.19-rc6. Among other things this gives us __printf Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: implement clear_nlink and set_nlinkSascha Hauer2018-10-081-0/+2
| | | | | | | | | | | | | | Implement clear_nlink and set_nlink and remove the private versions from UBIFS. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: implement iget_locked and iget_failedSascha Hauer2018-10-081-0/+2
| | | | | | | | | | | | Implement in fs core rather than using a private version in UBIFS. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: implement file_inodeSascha Hauer2018-10-081-0/+5
| | | | | | | | | | | | To ease code porting from Linux Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Add SB_* flagsSascha Hauer2018-10-081-0/+19
| | | | | | | | | | | | | | Newer Kernel fs code uses SB_* flags rather than the same MS_* flags. Add them to barebox to make porting code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: Add fscrypt no-op headersSascha Hauer2018-10-082-0/+378
| | | | | | | | | | | | Newer versions of UBIFS use fscrypt, so add no-op headers here. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * fs: let dir_emit_dots return intSascha Hauer2018-10-081-1/+2
| | | | | | | | | | | | | | Change to the same prototype as the kernel to make code porting easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Add more mutex no-opsSascha Hauer2018-10-081-0/+3
| | | | | | | | | | | | | | Add mutex_lock_nested, mutex_unlock_nested and mutex_is_locked to include/linux/mutex.h and remove them from UBIFS. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Add kmemdupSascha Hauer2018-10-082-1/+7
| | | | | | | | | | | | | | | | We have kmemdup as a UBIFS specific variant, put it into the correct header files. Instead of reimplementing it just use memdup we already have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * Add linux/slab.hSascha Hauer2018-10-083-12/+108
| | | | | | | | | | | | | | | | | | Move stuff we already have in include/linux/barebox-wrapper.h that really belongs to include/linux/slab.h to there. Also add kmem_cache_* functions. UBIFS uses them in there own implementation, so we have to remove it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/ratp'Sascha Hauer2018-10-091-0/+10
|\ \
| * | ratp: implement support for GPIO commandsAleksander Morgado2018-09-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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-171-0/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-092-1/+17
|\ \
| * | digest.h: Sync hash_algo values with kernelSascha Hauer2018-10-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | enum hash_algo is exported from the Kernel, so sync it with the numbers that are exported. Since we have barebox specific extensions to the hash_algo list add a big comment and put the extenstions at the end. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | environment: Do not use environment when overlapping with other partitionsSascha Hauer2018-09-261-0/+10
| |/ | | | | | | | | | | | | | | | | | | | | 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>
* | bbu: Add "handler" parameter to barebox_update()Andrey Smirnov2018-10-081-1/+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-1/+2
|/ | | | | | | | | | | | 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>
* Merge branch 'for-next/misc'Sascha Hauer2018-09-114-38/+58
|\
| * mfd: rave-sp: Add mapping for legacy EEPROM commandAndrey Smirnov2018-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is needed to make rave-sp-eeprom driver work on "legacy" firmware. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#mae2272763ae092b5b11ab128f5c22039d55557cb Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * ratp: fix sending data that won't fit in a single RATP packetAleksander Morgado2018-08-311-1/+1
| | | | | | | | | | | | | | | | We need to advance the input buffer used to create messages when the data doesn't fit in a single RATP packet. Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scsi: ilog2: create truly constant version for sparseMartin Wilck2018-08-241-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sparse emits errors about ilog2() in array indices because of the use of __ilog2_32() and __ilog2_64(), rightly so (https://www.spinics.net/lists/linux-sparse/msg03471.html). Create a const_ilog2() variant that works with sparse for this scenario. (Note: checkpatch.pl complains about missing parentheses, but that appears to be a false positive. I can get rid of the warning simply by inserting whitespace, making checkpatch "see" the whole macro). Signed-off-by: Martin Wilck <mwilck@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> [andrew.smirnov@gmail.com: Applied kernel patch to Barebox as-is] Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * linux/log2.h: fix kernel-doc notationRandy Dunlap2018-08-241-19/+23
| | | | | | | | | | | | | | | | | | | | | | | | Fix <linux/log2.h> kernel-doc: - Add kernel-doc notation to some functions. - Fix kernel-doc notation in function parameters. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> [andrew.smirnov@gmail.com: Applied kernel patch to Barebox as-is] Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * log2: Use fls_long() in __roundup_pow_of_two()Andrey Smirnov2018-08-241-1/+1
| | | | | | | | | | | | | | | | | | Convert __roundup_pow_of_two() to use fls_long() instead of fls() so the code would be identical to that found in Linux. This fix also allowed next patch(taken from Linux kernel verbatim) to apply cleanly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * give up on gcc ilog2() constant optimizationsLinus Torvalds2018-08-241-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc-7 has an "optimization" pass that completely screws up, and generates the code expansion for the (impossible) case of calling ilog2() with a zero constant, even when the code gcc compiles does not actually have a zero constant. And we try to generate a compile-time error for anybody doing ilog2() on a constant where that doesn't make sense (be it zero or negative). So now gcc7 will fail the build due to our sanity checking, because it created that constant-zero case that didn't actually exist in the source code. There's a whole long discussion on the kernel mailing about how to work around this gcc bug. The gcc people themselevs have discussed their "feature" in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785 but it's all water under the bridge, because while it looked at one point like it would be solved by the time gcc7 was released, that was not to be. So now we have to deal with this compiler braindamage. And the only simple approach seems to be to just delete the code that tries to warn about bad uses of ilog2(). So now "ilog2()" will just return 0 not just for the value 1, but for any non-positive value too. It's not like I can recall anybody having ever actually tried to use this function on any invalid value, but maybe the sanity check just meant that such code never made it out in public. Reported-by: Laura Abbott <labbott@redhat.com> Cc: John Stultz <john.stultz@linaro.org>, Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [andrew.smirnov@gmail.com: Applied kernel patch to Barebox as-is, but specifying --exclude=tools/include/linux/log2.h] Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * log2: make order_base_2() behave correctly on const input value zeroArd Biesheuvel2018-08-241-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function order_base_2() is defined (according to the comment block) as returning zero on input zero, but subsequently passes the input into roundup_pow_of_two(), which is explicitly undefined for input zero. This has gone unnoticed until now, but optimization passes in GCC 7 may produce constant folded function instances where a constant value of zero is passed into order_base_2(), resulting in link errors against the deliberately undefined '____ilog2_NaN'. So update order_base_2() to adhere to its own documented interface. [ See http://marc.info/?l=linux-kernel&m=147672952517795&w=2 and follow-up discussion for more background. The gcc "optimization pass" is really just broken, but now the GCC trunk problem seems to have escaped out of just specially built daily images, so we need to work around it in mainline. - Linus ] Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> [andrew.smirnov@gmail.com: Applied kernel patch to Barebox as-is] Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include/common: Make use of ALIGN and ALIGN_DOWNAndrey Smirnov2018-08-221-2/+2
| | | | | | | | | | 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-09-112-0/+3
|\ \
| * | libfile: Introduce pwrite_full()Andrey Smirnov2018-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Analogous to what we have with write()/write_full(), introduce a lightweight wrapper around pwrite() that guarantees the either all data is going to be written or a negative error code would be returned. 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/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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/+1
| |/ | | | | | | | | | | | | | | 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>
* | Merge branch 'for-next/dma-mask'Sascha Hauer2018-09-112-1/+13
|\ \
| * | driver: Adopt DMA mask concept from LinuxAndrey Smirnov2018-08-312-1/+13
| |/ | | | | | | | | | | | | | | | | | | In order to be able to detect cases where DMA isn't capable of reaching every memory address, port the concept of DMA mask, dma_set_mask() function and add appropriate check to dma_mapping_error(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / net: dhcp: use private extension 224 also in discover requestsOleg.Karfich@wago.com2018-09-041-0/+1
|/ | | | | Signed-off-by: Oleg Karfich <oleg.karfich@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pci'Sascha Hauer2018-08-131-0/+54
|\
| * pci: add quirk infrastructureLucas Stach2018-08-081-0/+54
| | | | | | | | | | | | | | | | | | This is a cut down version of the Linux kernel PCI quirk infrastructure, which allows to register and execute some fixups before the driver is loaded. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2018-08-133-0/+140
|\ \
| * | gpio: fix missing includes for bool and struct list_headRoland Hieber2018-08-091-0/+3
| | | | | | | | | | | | | | | Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ARM: i.MX: HAB: fix missing include for EPERMRoland Hieber2018-08-091-0/+2
| | | | | | | | | | | | | | | Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ARM: Add code to support SMCCC on AArch64Andrey Smirnov2018-08-081-0/+135
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Port SMCCC code from Linux kernel. To accomodate that: - Introduce CONFIG_ARM_SMCCC, to allow enabling the code independent of CONFIG_ARM_SECURE_MONITOR - Bring <linux/arm-smccc.h> in - Add necessary constants to arch/arm/asm-offsets.c Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/fs-dentry-cache'Sascha Hauer2018-08-137-59/+279
|\ \
| * | fs: dentry cache implementationSascha Hauer2018-07-117-59/+279
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the Linux dentry cache implementation to barebox. Until now every filesystem driver resolves the full path to a file for itself. This leads to code duplication and is error prone since resolving paths is a complicated task. Also it can narrow down the lookup performance since barebox only knows ASCII paths and has no way of caching lookups. With this patch we get the Linux dcache implementation. The path resolving code from fs/namei.c is nearly taken as-is, minus the RCU and locking code. Dcaching is made simple as of now: We simply cache everything and never release any dentries. Although we do reference counting for inodes and dentries it is effectively not used yet. We never free anything until a fs is unmounted in which case we free everything no matter if references are taken or not. This patch also contains a wrapper in fs/legacy.c to support filesystems with the old API. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / serial: lpuart: Avoid division by zero when requested baudrate isAndrey Smirnov2018-08-131-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | With serdev device support added there's now a corner case where: 1. There is a DT node for a serdev device on one of the UARTs 2. There is no driver that binds against serdev device's compatibility string with 1 and 2 being true it is possible to end up in a situation where a particualr UART has not been initalized to any baudrate when clock_notifier_call_chain() gets called. This effectively translates to set_baudrate(uart, 0); which for LPUART driver result in a division by zero. To avoid this problem, convert lpuart_serial_setbaudrate() to treat zero baudrate as a request to disable the UART. While we are at it add a BUG_ON() to lpuart_setbrg() to simplify finding any future bugs. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/riscv'Sascha Hauer2018-07-091-0/+47
|\