summaryrefslogtreecommitdiffstats
path: root/include/linux
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge branch 'for-next/net'Sascha Hauer2024-01-241-4/+51
|\
| * net/phy: sync phy_interface_t types with LinuxSascha Hauer2024-01-051-4/+51
| | | | | | | | | | | | | | | | This syncs the phy interface modes with Linux as of linux-6.7-rc7. Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240104112241.989839-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/pci'Sascha Hauer2024-01-242-5/+51
|\ \
| * | pci: implement function level resetSascha Hauer2024-01-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This will be needed for upcoming LS1028a support. The code is taken from U-Boot which suffices for our usecase. The kernel code is much more elaborated here. Link: https://lore.barebox.org/20231219125630.3684-7-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pci: implement Enhanced Allocation supportSascha Hauer2024-01-021-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some PCI devices have their base addresses not defined in the BARs, but instead have them defined in Enhanced Allocation structures. Add support for these Enhanced Allocation structures, taken directly from the Linux Kernel. Motivation for adding this is the LS1028a SoC which uses Enhanced Allocation for the Ethernet Subsystem which comes as an integrated Endpoint Root Complex. Link: https://lore.barebox.org/20231219125630.3684-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pci: fix __pci_bus_find_cap_startSascha Hauer2024-01-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | BIT(7) of dev->hdr_type has unrelated information. Mask out the upper bit so that the capabilities can properly be found. Link: https://lore.barebox.org/20231219125630.3684-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pci: remove duplicate definition of pci_resource_startSascha Hauer2024-01-021-4/+0
| | | | | | | | | | | | | | | | | | | | | pci_resource_start is defined twice. Remove the duplicate. Link: https://lore.barebox.org/20231219125630.3684-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2024-01-236-19/+41
|\ \ \
| * | | lib: add optional linked list debuggingAhmad Fatoum2024-01-111-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enabled, this outputs messages like: list_del corruption, 000000005fe4a9d0->next is LIST_POISON1 (0000000000000100) which can be useful when debugging. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101948.2630473-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | list: rename debugging hooksAhmad Fatoum2024-01-111-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux recently renamed the name of these helpers, so have barebox follow suit before implementing them out of line when optional list debugging is enabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101948.2630473-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | treewide: mark linker list elements with __ll_elemAhmad Fatoum2024-01-113-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To fix build with clang while using ASAN, define all linker list elements with __ll_elem. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101748.2629927-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | compiler: define __ll_elem for linker list elementsAhmad Fatoum2024-01-111-0/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When built with clang + AddressSanitizer, global variables end up with a redzone that breaks linker list elements. The __no_sanitize_address attribute prevents these redzones, but GCC isn't happy about applying it to anything but functions. Therefore define a __ll_elem macro for defining linker list elements that takes care to avoid these redzones when building with clang. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240103101748.2629927-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | clk: define aliases for clk_bulk_prepare_enable/disable_unprepareAhmad Fatoum2024-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't have a separate atomic prepare/unprepare step for clocks in barebox and instead combine it with enable/disable. We have macros to alias prepare_enable/disable_unprepare for non-bulk API, so add the same for the bulk API too. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-17-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | regmap: include missing header from linux/regmap.hAhmad Fatoum2024-01-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The header defines regmap_read_poll_timeout, which requires <linux/iopoll.h>, thus include the header. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-16-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | include: linux/device.h: implement dev_platform_ioremap_resourceAhmad Fatoum2024-01-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are more than a thousand instances of devm_platform_ioremap_resource across Linux drivers and porting it to barebox is cumbersome, because unlike Linux we don't remap, so the MMIO region may be at address zero. Now that dev_request_mem_region_err_null() prints a warning in that case, let's just use it to implement dev_platform_ioremap_resource(). Platforms with relevant MMIO at address 0 are scarce anyway and when we run on such a platform, we can always switch to use normal dev_request_mem_resource(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240119162610.1014870-15-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | clk: fix of_clk_hw_simple_get stub definitionAhmad Fatoum2024-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When !CONFIG_COMMON_CLK_OF_PROVIDER, we end up with a stub definition that defers from the out-of-line version. Fix that. Fixes: 054ccac22bd1 ("clk: implement of_clk_hw_{onecell,simple}_get") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240118084514.1294791-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | regmap: clarify struct regmap::max_register value some moreAhmad Fatoum2024-01-111-0/+3
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | We already have documentation for the member that was taken from Linux, but still managed to use it wrongly at multiple places that were recently fixed. To prevent such issues from reoccurring in the future, expand the documentation a bit. Suggested-by: Robin van der Gracht <robin@protonic.nl> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Acked-by: Robin van der Gracht <robin@protonic.nl> Link: https://lore.barebox.org/20240111073412.1318725-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: kasan: reserve shadow memory regionAhmad Fatoum2024-01-041-2/+2
|/ | | | | | | | | | We did not have any protection in place to ensure that KASAN shadow memory isn't overwritten during boot. Add that now to avoid strange effects during debugging. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240104085736.541171-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add STM32MP13 clock and reset driversAhmad Fatoum2023-12-052-0/+31
| | | | | | | | | | | The reset and clock control peripheral of the STM32MP13 is with publicly available firmware exclusively handled by the secure world and normal world needs to employ SCMI to interact with OP-TEE to toggle clocks for it. Import the Linux driver to facilitate this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: implement clk_hw_reparentAhmad Fatoum2023-12-051-0/+5
| | | | | | | | | | clk_hw_reparent does a bit of work in Linux to update the cached clock tree, but we have no cached clock tree in barebox, so just implement it as empty stub. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: add struct clk_init_data::parent_hwsAhmad Fatoum2023-12-051-0/+3
| | | | | | | | | | | For cases where all clock parents are internal to the clock controller, parent_hws allows specifying direct pointers to the clk_hw structures instead of globally unique names. Add support for this to barebox to be used by the incoming STM32MP13 clock driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: implement clk clk_hw_get_parent_by_indexAhmad Fatoum2023-12-051-0/+1
| | | | | | | | | | This is the inverse operation to clk_get_parent_index and is already implemented inline in clk_get_parent. Factor that code out for use by the incoming STM32MP13 clock driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: divider: implement divider_[ro_]round_rate_parentAhmad Fatoum2023-12-051-0/+21
| | | | | | | | | These functions will be used in the incoming STM32MP13 clock driver support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: divider: implement CLK_DIVIDER_ALLOW_ZEROAhmad Fatoum2023-12-051-0/+1
| | | | | | | | | | We already support CLK_DIVIDER_ONE_BASED and incoming STM32MP13 clock support can have clock dividers evaluate to zero. Add support for CLK_DIVIDER_ALLOW_ZERO analogously to Linux. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: add initial <linux/clk-provider.h>Ahmad Fatoum2023-12-051-0/+138
| | | | | | | | | | | | Linux now differentiates bween <linux/clk.h> for consumers and <linux/clk-provider.h> for providers. We have been putting everything into <linux/clk.h>, but for new API imported from Linux that's only applicable to clock provider drivers, let's add a <linux/clk-provider.h> header and add them there. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: factor out clk_hw_get_parent_indexAhmad Fatoum2023-12-051-0/+6
| | | | | | | | | | | clk_ops::set_parent passes the parent as an index, so clk_set_parent needs to determine the index. Linux provides this information via clk_hw_get_parent_index and some drivers depend on this, so factor out the code in question in barebox as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064947.2207726-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* firmware: arm_scmi: sync with Linux v6.6Ahmad Fatoum2023-12-051-30/+64
| | | | | | | | | | | | | | Since our initial import of the ARM SCMI infrastructure in Linux, the upstream driver has been extended to support SCMI via OP-TEE and arm_ffa as well and also gained support for more function, including sensors and power domains, which may be useful in barebox going forward. Let's sync with Linux again and add the OP-TEE transport alongside the existing SMC-based transport. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127064034.2206788-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* optee: add experimental support for /dev/tee0Marc Kleine-Budde2023-12-051-0/+33
| | | | | | | | | | | Userspace accesses OP-TEE via ioctls and mmaps of the /dev/tee0 device. Replicating this in barebox is useful for verifying proper operation of CONFIG_OPTEE by hacking libteeclient + optee_tests to run under barebox. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127063559.2205776-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* optee: add bidirectional communication supportMarc Kleine-Budde2023-12-052-0/+395
| | | | | | | | | | | | | | | | | | | | | | | So far, barebox support for OP-TEE was restricted to loading it either early in PBL or via bootm and to not step over it when allocating memory. This was guarded behind CONFIG_HAVE_OPTEE. This commit imports from Linux the driver behind CONFIG_OPTEE, which brings actual bidirectional communication with OP-TEE in barebox. This is useful as trusted applications running in OP-TEE can provide various services to the normal world, like filtered OTP access, RNG seeded from normally inaccessible entropy sources, firmware TPM and management of resources like clocks, resets, power domains and voltage regulators in the form of SCMI. We already have SCMI support, but only via the SMC calling convention for communication with TF-A. For integration with publicly available STM32MP13 firmware, we need to do SCMI over OP-TEE and this is likewise interesting for STM32MP1 trusted boot setups. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127063559.2205776-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: uaccess.h: import from linuxMarc Kleine-Budde2023-12-051-0/+38
| | | | | | | | | | | | | | Linux code imported in a follow-up commit will include user-facing ioctl API that makes heavy use of the user accessors define in uaccess.h. Instead of rewriting all this, let's just import the Linux header with the default CONFIG_UACCESS_MEMCPY implementation meant for nommu systems that don't do any privilege separation. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231127063559.2205776-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/prepare-optee'Sascha Hauer2023-11-2717-59/+872
|\
| * include: add linux/device.h wrapper around driver.hAhmad Fatoum2023-11-231-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't have device-scoped resource control and in practice memory allocated in device functions is only freed when barebox terminates, so let's accept the fact that most code is leaky and implement devm_ as literal leaky abstractions. While at it provide some macros to translate Linux API into equivalent barebox API. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-21-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: add Linux ktime APIAhmad Fatoum2023-11-231-0/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With get_time_ns(), we already have a monotonically increasing nanosecond counter, so let's define ktime_get() as an alias for it and import the Linux helpers for doing arithmetic with this ktime_t type. There is a slight mismatch here as get_time_ns() returns a u64, while ktime_t is signed, but U64_MAX is > 580 years and half of that is still a fair bit longer than the expected life time of a device idling with 100% CPU in the barebox shell after an aborted boot. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-18-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: add blocking notifier aliasesAhmad Fatoum2023-11-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | All notifiers are blocking in barebox, but to avoid needless mechanical fixups during porting, just provide the stubs in a new <linux/notifier.h> header. While at it, also provide NOTIFY_DONE and NOTIFY_OK for use in the notifier callbacks. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-17-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: implement dev_warn_once and friendsAhmad Fatoum2023-11-231-1/+28
| | | | | | | | | | | | | | | | | | We already have pr_*_once, so duplicate it for dev_warn and friends as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-16-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: linux/idr.h: implement more Linux APIAhmad Fatoum2023-11-231-34/+25
| | | | | | | | | | | | | | | | | | Upcoming sync of SCMI with the kernel will start using IDR API, which we lack in barebox, so let's retrofit it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-14-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * string: implement strscpyAhmad Fatoum2023-11-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | strscpy is meant to be a safer alternative to strscpy, which always terminates the destination string and returns an error code if truncation happens. To enable porting kernel code using it, import the definition. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-10-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: import Linux word-at-a-time.hAhmad Fatoum2023-11-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux <linux/word-at-a-time.h> interface is used to optimize searching for bytes in strings by doing word-size comparisons. This will be used in the implementation of strscpy in a follow-up commit, so import the generic version here. A good overview on the interface is available at LWN[1]. Note that it discuss Linux v3.5. The asm-generic version imported here works also on little-endian and not only big-endian[2]. [1]: https://lwn.net/Articles/501492/ [2]: Linux kernel commit a6e2f029ae34 ("Make asm/word-at-a-time.h available on all architectures"). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: add linux/io.h with strict prototypesAhmad Fatoum2023-11-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel code uses <linux/io.h> instead of <io.h>, which defines readl and friends as functions with type checks instead of macros that just cast everything to pointers. Let's provide <linux/io.h> to ease porting as well and have it have the same semantics. Eventually, we should be able to get switch <io.h> to include <linux/io.h> once all in-tree users are migrated. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: import <linux/instruction_pointer.h>Ahmad Fatoum2023-11-232-2/+12
| | | | | | | | | | | | | | | | | | | | This header provides definitions for getting the instruction pointer and the return address in a portable manner, which can be useful for trace outputs where dump_stack would be overkill. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * bitops: split off linux/bits.hAhmad Fatoum2023-11-232-20/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | The bit definitions are split off in Linux into <linux/bits.h>, which is included by <linux/bitops.h> and extended with bit operations. Follow through in barebox to simplify porting kernel code and in future to speed up the build a bit by avoiding pulling in the whole bitops.h, when only needing macros like BIT(). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: add linux/refcount.hAhmad Fatoum2023-11-233-0/+424
| | | | | | | | | | | | | | | | | | | | | | | | For complex interactions, especially in communication protocols, it can be beneficial to keep the reference counts used in the Linux drivers as is to avoid resource leaks or use-after-frees. Provide a simplified kref and refcount API to facilitate this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * include: provide linux/errno.hAhmad Fatoum2023-11-233-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't have the historic baggage of having to support different errno definitions depending on architecture. We thus have only asm-generic/errno.h and include that from errno.h and elsewhere directly. Kernel code however includes <linux/errno.h>, so let's provide that file as well and define there the Linux-specific errno's and include <asm-generic/errno.h> for all other errnos. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122172951.376531-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2023-11-276-1/+128
|\ \
| * | clk: document struct clk_opsAhmad Fatoum2023-11-231-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | We already import the API from Linux, so let's import the documentation for reference as well and add a note about clk_unprepare/clk_prepare. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122181535.846936-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | console: provide best-effort clk_get_for_console helperAhmad Fatoum2023-11-231-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clk_get will return -EPROBE_DEFER if clock provider hasn't yet been probed. In a system with deep probe enabled, dependencies are probed on demand, so a -EPROBE_DEFER return is final and the console probe will never succeed. CONFIG_DEBUG_LL is often used to debug this, but because the low-level console is not interactive, it's a bit cumbersome. Improve upon this a bit, by providing a clk_get_for_console helper that returns NULL if and only if we are sure that a clock provider will not be probed. In that case, the driver can skip code paths initialization code and baud rate setting dependent on having access to the clock and still register a console that reuses what was set up by CONFIG_DEBUG_LL. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20231122171320.1714868-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | common: machine_id: support deriving app specific UUIDsAhmad Fatoum2023-11-221-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libsystemd provides a sd_id128_get_machine_app_specific() function that allows deriving an application specific UUID without directly leaking the machine ID. Let's provide an equivalent for barebox that will be used in a following commit to generate a stable MAC instead of randomizing it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231122094747.340825-2-uwe@kleine-koenig.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | include: spinlock.h: mark DEFINE_SPINLOCK with __always_unusedAhmad Fatoum2023-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The spinlock stubs don't actually do anything with the spinlock_t. To avoid the compiler warning about it add an __always_unused annotation to the spinlock. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231109122945.1487078-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | barebox-wrapper: define stub for MODULE_VERSIONAhmad Fatoum2023-11-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We already stub out a number of MODULE_* macros to save porters the hassle of deleting them. Let's add MODULE_VERSION to the list as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231109120045.1427680-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | malloc: use __attribute((alloc_size)) for dynamic memory allocationAhmad Fatoum2023-11-212-0/+32
| |/ | | | | | | | | | | | | | | | | | | | | | | Adorning functions allocating dynamic memory with __alloc_size allows GCC to warn about heap overflows it notices during normal compilation. Import the definitions from Linux and switch over barebox <malloc.h> to make use of it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231109113807.1193935-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>