summaryrefslogtreecommitdiff
path: root/include/linux
AgeCommit message (Collapse)Author
2020-08-24include: kernel.h: define SSIZE_MAXHeinrich Schuchardt
Define SSIZE_MAX, the largest value fitting into a variable of type ssize_t. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-08-14linux/compat.h: Add wait_event_timeout macroOleksandr Andrushchenko
Add wait_event_timeout - sleep until a condition gets true or a timeout elapses. This is a stripped version of the same from Linux kernel with the following u-boot specific modifications: - no wait queues supported - use u-boot timer to detect timeouts - check for Ctrl-C pressed during wait Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com> [trini: Drop atomic_read from gadget/ether.c as this has existed for a while and now causes problems] Signed-off-by: Tom Rini <trini@konsulko.com>
2020-08-03clk: Drop dm.h header file in clk-provider.hSimon Glass
This header file should not be included in other header files. Remove it and use a forward declaration and un-inlining of dev_get_clk_ptr() instead. Fix up the kendryte header files to avoid build errors. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
2020-07-20mtd: spinand: micron: identify SPI NAND device with Continuous Read modeShivamurthy Shastri
Add SPINAND_HAS_CR_FEAT_BIT flag to identify the SPI NAND device with the Continuous Read mode. Some of the Micron SPI NAND devices have the "Continuous Read" feature enabled by default, which does not fit the subsystem needs. In this mode, the READ CACHE command doesn't require the starting column address. The device always output the data starting from the first column of the cache register, and once the end of the cache register reached, the data output continues through the next page. With the continuous read mode, it is possible to read out the entire block using a single READ command, and once the end of the block reached, the output pins become High-Z state. However, during this mode the read command doesn't output the OOB area. Hence, we disable the feature at probe time. Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com> Acked-by: Jagan Teki <jagan@amarulasolutions.com>
2020-07-13soc: ti: k3-ringacc: Add an API to request pair of ringsVignesh Raghavendra
Add new API k3_ringacc_request_rings_pair() to request pair of rings at once, as in the most case Rings are used with DMA channels which required to request pair of rings - one to feed DMA with descriptors (TX/RX FDQ) and one to receive completions (RX/TX CQ). This will allow to simplify Ringacc API users. Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
2020-07-10Merge tag 'rpi-next-2020.10' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-raspberrypi - add support for PCI and XHCI for RPi4 (64 bit only) - optionally reset XHCI device on registration - enable USB_KEYBOARD for rpi_4_defconfig
2020-07-10linux/bitfield.h: Add primitives for manipulating bitfields both in host- ↵Nicolas Saenz Julienne
and fixed-endian Imports Al Viro's original Linux commit 00b0c9b82663a, which contains an in depth explanation and two fixes from Johannes Berg: e7d4a95da86e0 "bitfield: fix *_encode_bits()", 37a3862e12382 "bitfield: add u8 helpers". Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> [s.nawrocki: added empty lines between functions and macros] Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> [mb: squash fix including byteorder.h] Signed-off-by: Matthias Brugger <mbrugger@suse.com>
2020-07-09linux/kconfig.h: create two- and three-argument versions of CONFIG_IS_ENABLEDRasmus Villemoes
This adds a bunch of preprocessor magic to extend the capabilities of CONFIG_IS_ENABLED. The existing semantics of CONFIG_IS_ENABLED(FOO) expanding to a 1 or 0 (depending on build context and the defined-ness or not of the appropriate CONFIG_FOO/CONFIG_SPL_FOO/CONFIG_TPL_FOO) are of course preserved. With this, one is also allowed a two-argument form CONFIG_IS_ENABLED(FOO, (something)) which expands to something precisely when CONFIG_IS_ENABLED(FOO) would expand to 1, and expands to nothing otherwise. It is, in other words, completely equivalent to the three lines #if CONFIG_IS_ENABLED(FOO) something #endif The second argument must be parenthesized in order to allow any tokens, including a trailing comma, to appear - one use case for this is precisely to make it a bit more ergonomic to build an array and only include certain items depending on .config. That should increase both readability and not least "git grep"ability. A third variant is also introduced, CONFIG_IS_ENABLED(FOO, (xxx), (yyy)) which corresponds to #if CONFIG_IS_ENABLED(FOO) xxx #else yyy #endif Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-09linux/kconfig.h: remove unused helper macrosRasmus Villemoes
U-Boot does not have loadable modules, and nothing currently uses any of the (CONFIG_)?IS_(BUILTIN|MODULE) macros - only the (CONFIG_)?IS_ENABLED variants are ever used. While I understand the desire to keep this somewhat synchronized with linux, we've already departed by the introduction of the CONFIG_IS_ENABLED extra logic, and deleting these makes the next patch much simpler, since I won't have to duplicate a lot of logic for no real gain (as there are no users). Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-09linux/kconfig.h: simplify logic for choosing CONFIG_{SPL_, TPL_, }*Rasmus Villemoes
Instead of using the arg1_or_junk trick to pick between two choices, with a bit of duplication between the branches (and most of the CONFIG_TPL_BUILD case being redundant, as _IS_TPL is known to be defined to 1 in that case), simply define a prefix that we inject between CONFIG_ and the given config symbol. This only requires one level of indirection (to get the _CONFIG_PREFIX macro expanded before the token concatenation takes place), and makes it easy to, say, introduce a CONFIG_HOSTTOOL_ prefix. [I would expect most HOSTTOOL_ symbols to just be def_bool y, but it would allow us to clean up some of the ifdef HOSTCC mess in the sources shared between U-Boot and host tools.] Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-01compilers: Introduce options for forcing inlining on SPL/TPLTom Rini
There are cases where when we allow the compiler to decide about making inline decisions rather than forcing them it can save us space. For now, we keep the default values for inlining that we have had historically. Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2020-07-01compiler_types.h: Re-introduce CONFIG_OPTIMIZE_INLINING for U-BootTom Rini
In the Linux kernel, support for forcing inline functions to be made inline, rather than allowing the compiler to make its own choice has been removed. With respect to performance, modern GCC (and Clang) do a good job at deciding when to, or not to, inline code and there are no run-time requirements in Linux anymore. There is one downside to this, which is final binary size. On average in U-Boot removing this support grows SPL by almost 1 kilobyte. But there are cases where it shrinks the binary by making better inline choices than we had forced. Start by re-introducing CONFIG_OPTIMIZE_INLINING as a global which essentially reverts 889b3c1245de ("compiler: remove CONFIG_OPTIMIZE_INLINING entirely") from Linux. Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2020-07-01compiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5Tom Rini
Copy these from Linux v5.7-rc5 tag. This brings in some handy new attributes and is otherwise important to keep in sync. We drop the reference to smp_read_barrier_depends() as it is not relevant on the architectures we support at this time, based on where it's implemented in Linux today. We drop the call to kasan_check_read() as that is not relevant to U-Boot as well. Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2020-06-23psci: add 'static inline' to invoke_psci_fn() stubMasahiro Yamada
Avoid potential multiple definitions when CONFIG_ARM_PSCI_FW is disabled. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-06-02dma-mapping: Add header file for ARCH_DMA_MINALIGNSimon Glass
This is defined in the asm/cache.h header file. Update this header file to include it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Tested-by: Adam Ford <aford173@gmail.com> #da850-evm
2020-05-29usb: dwc3: amend UTMI/UTMIW phy interface setupFrank Wang
Let move 8/16-bit UTMI+ interface initialization into DWC3 core init that is convenient for both DM_USB and u-boot traditional process. Signed-off-by: Frank Wang <frank.wang@rock-chips.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2020-05-18common: Drop linux/bitops.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop linux/bug.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18arm: Don't include common.h in header filesSimon Glass
It is bad practice to include common.h in other header files since it can bring in any number of superfluous definitions. It implies that some C files don't include it and thus may be missing CONFIG options that are set up by that file. The C files should include these themselves. Update some header files in arch/arm to drop this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-11iopoll: Add readl_poll_sleep_timeoutJagan Teki
Add readl poll API with sleep and timeout support. This change is referenced from Linux from below commit: commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll: introduce read_poll_timeout macro") Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2020-05-11iopoll: Add dealy to read pollJagan Teki
Some drivers and other bsp code not only poll the register with timeout but also required to delay on each transaction. This patch add that requirement by adding sleep_us variable so-that read_poll_timeout now support delay as well. This change is referenced from Linux from below commit: commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll: introduce read_poll_timeout macro") Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2020-05-11iopoll: Add read_poll_timeout common APIJagan Teki
Add read_poll_timeout common API similar to Linux iopoll. readx_poll_timeout will trigger read_poll_timeout with proper op. This will help to extend the functionalities like sleep_us to poll timeout in future. This change is referenced from Linux from below commit: commit <5f5323a14cad19323060a8cbf9d96f2280a462dd> ("iopoll: introduce read_poll_timeout macro") Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2020-04-30mtd: spi-nor: Enable QE bit for ISSI flashJagan Teki
Enable QE bit for ISSI flash chips. QE enablement logic is similar to what Macronix has, so reuse the existing code itself. Cc: Sagar Shrikant Kadam <sagar.kadam@sifive.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2020-04-29mtd: spi-nand: Import Toshiba SPI-NAND supportRobert Marko
Linux has good support for Toshiba SPI-NAND, so lets import it. Signed-off-by: Robert Marko <robert.marko@sartura.hr> Tested-by: Luka Kovacic <luka.kovacic@sartura.hr> Cc: Luka Perkov <luka.perkov@sartura.hr> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2020-04-26libfdt: split fdt_region declarations out to <fdt_region.h>Masahiro Yamada
fdt_region APIs are not part of libfdt. They are U-Boot extension for the verified boot. Split the declarations related to fdt_region out of <fdt_region.h>. This allows <linux/libfdt.h> to become a simple wrapper file, like Linux does. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-03-31Merge branch 'next' of git://git.denx.de/u-boot-usb into nextTom Rini
2020-03-30usb: Migrate to support live DT for some driverKever Yang
Use ofnode_ instead of fdt_ APIs so that the drivers can support live DT. This patch updates usb_get_dr_mode() and usb_get_maximum_speed() to use ofnode as parameter instead of fdt offset. And all the drivers who use these APIs update to use live dt APIs at the same time. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2020-03-03firmware: tisci: Drop all deprecated messagesLokesh Vutla
SYSFW v2020.01 and later versions no longer supports the below messages: - TI_SCI_MSG_RM_RING_GET_CFG - TISCI_MSG_RM_UDMAP_TX_CH_GET_CFG 0x1206 - TISCI_MSG_RM_UDMAP_RX_CH_GET_CFG 0x1216 - TISCI_MSG_RM_UDMAP_FLOW_GET_CFG 0x1232 - TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_GET_CFG 0x1233 There are no users in U-Boot for any of the above messages, So drop the support for all the corresponding messages. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-02-19dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h>Masahiro Yamada
The implementation of dma_map_single() and dma_unmap_single() is exactly the same for all the architectures that support them. Factor them out to <linux/dma-mapping.h>, and make all drivers to include <linux/dma-mapping.h> instead of <asm/dma-mapping.h>. If we need to differentiate them for some architectures, we can move the generic definitions to <asm-generic/dma-mapping.h>. Add some comments to the helpers. The concept is quite similar to the DMA-API of Linux kernel. Drivers are agnostic about what is going on behind the scene. Just call dma_map_single() before the DMA, and dma_unmap_single() after it. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-02-05dm: core: Drop the inclusion of linux/compat.h in dm.hSimon Glass
Most files don't need this header and it pulls in quite of lots of stuff, malloc() in particular. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Create a new header file for 'compat' featuresSimon Glass
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05sandbox: Rename strdup() functionsSimon Glass
These functions include calls to a memory-allocation routine and so need to use the system routine when called from a library. To preserve access to these functions for libraries that need it, such as SDL, rename these functions within U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05string: Allow arch override of strndup() alsoSimon Glass
At present architectures can override strdup() but not strndup(). Use the same option for both. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05mtd: Rename free() to rfree()Simon Glass
This function name conflicts with our desire to #define free() to something else on sandbox. Since it deals with resources, rename it to rfree(). Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-27mtd: spi-nor-core: Add octal mode supportVignesh Raghavendra
Add support for Octal flash devices. Octal flash devices use 8 IO lines for data transfer. Currently only 1-1-8 Octal Read mode is supported. Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2020-01-26clk: Include missing headers for linux/clk-provider.hSean Anderson
This header was missing a couple of include dependencies when included on its own. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2020-01-20Merge tag '2020-01-20-ti-2020.04' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-ti K3 J721E: * DMA support. * MMC and ADMA support. * EEPROM support. * J721e High Security EVM support. * USB DT nodes K3 AM654: * Fixed boot due to pmic probe error. * USB support and DT nodes. * ADMA support DRA7xx/AM57xx: * BBAI board support * Clean up of net platform code under board/ti AM33/AM43/Davinci: * Reduce SPL size for omap3 boards. * SPL DT support for da850-lcdk * PLL divider fix for AM335x
2020-01-20lib: Import few bitmap functions from LinuxVignesh Raghavendra
Import few basic bitmap functions (bitmap_{weight,fill,set,clear,or}()) and their dependencies from Linux. These are required for upcoming DMA resource allocation support for TI's K3 SoCs. Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-01-17common: Move ROUND() into kernel.hSimon Glass
Move this macro in with all the other rounding macros. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move check_member() to kernel.hSimon Glass
The kernel.h file has a number of useful macros including a few related to structures. Move check_member() there too. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move type declarations to linux/types.hSimon Glass
This file already has lots of type declarations so it seems better to put all of them there. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-17mtd: spi: spi-nor-core: Add SST vendor specific SFDP parserTudor Ambarus
JESD216 allow vendors to define their own SFDP tables. Add SST SFDP parser. The vendor table is allocated using resource-managed kmalloc - the table will be freed on driver detach. It will be accessible by getting the UCLASS_SPI_FLASH's private data. The SST's SFDP table is particularly of interest because contains pre-programmed globally unique EUI-48 and EUI-64 identifiers. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
2019-12-09Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-netTom Rini
2019-12-09dma: ti: k3-udma: Implement dma_get_cfg() interfaceVignesh Raghavendra
Implement dma_get_cfg() interface to pass flow id information for DMA clients to use. This is needed because on K3 SoCs, CPSW (ethernet) and UDMA (DMA provider) support "flows" within a given RX DMA channel. This allows different network packets to be segregated while using same RX DMA channel. In order for basic ethernet to work, CPSW slave must be aware of the flow ID allocated for the RX channel by the DMA driver. This interface allows CPSW to query flow ID from DMA provider and configure it in CPSW HW. Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
2019-12-09linux/types.h: fix typo uncharHeinrich Schuchardt
unsigned char should be called uchar and not unchar. This fixes a build error in lib/crypto/x509_cert_parser.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-12-06lib: add oid registry utilityAKASHI Takahiro
Imported from linux kernel v5.3: build_OID_registry without changes oid_registry.h without changes oid_registry.c with changes marked as __UBOOT__ Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2019-12-06cmd: add asn1_compilerAKASHI Takahiro
Imported from linux kernel v5.3: asn1.h without changes asn1_ber_bytecode.h without changes asn1_decoder.h without changes asn1_compiler.c without changes This host command will be used to create a ASN1 parser, for example, for pkcs7 messages or x509 certificates. More specifically, it will generate *byte code* which will be interpreted by asn1 decoder library. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-12-06linux/time.h: include vsprintf.hAKASHI Takahiro
Without this commit, time.h possibly causes a build error as asctime_r() uses sprintf(). Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2019-12-06include: kernel.h: include printk.hAKASHI Takahiro
Adding "printk.h" will help improve portability from linux kernel code (in my case, lib/asn1_decoder.c and others) where printf and pr_* variant functions are used. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2019-12-06lib: add mktime64() for linux compatibilityAKASHI Takahiro
This function will be used in lib/crypto/x509_cert_parser.c, which will also be imported from linux code in a later commit. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>