summaryrefslogtreecommitdiffstats
path: root/drivers/spi
Commit message (Collapse)AuthorAgeFilesLines
* treewide: remove bus probe functions that just call driver probeAhmad Fatoum2024-02-291-6/+0
| | | | | | | | | | Now that the driver core will call the driver probe function if there is no bus probe function, remove all bus probe functions that do what the core can do instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240228160518.1589193-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2024-02-212-13/+3
|\
| * treewide: use dev_err_probe instead of comparisons against EPROBE_DEFERAhmad Fatoum2024-02-201-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Drivers should not need to compare an error value against EPROBE_DEFER. We have a number of drivers doing that though to decide whether to print an error or not. This error message will be lost if the probe is deferred, so use dev_err_probe to store the error in that case. While at it, we shorten the error messages a bit. dev_err_probe will already print the string 'error' before the error code string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219172659.3796647-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * drivers: drop simple bus remove in favor of common implementationAhmad Fatoum2024-02-161-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that driver core will call dev->driver->remove if dev->bus->remove is NULL, we cann remove all bus_type::remove functions that do the same. This has the welcome side effect that devices that device_remove will return false when called on a device the neither has a bus remove or driver remove function and thus we can skip tracing these calls when CONFIG_DEBUG_PROBES is enabled. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240215103353.2799723-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | spi: atmel_spi: lower version log output from info to debugAhmad Fatoum2024-02-161-1/+1
|/ | | | | | | | | The IP version won't change from one boot to the next, so it's not useful to print this every time. Lower it to debug level instead. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240213100146.2778891-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: spi-nxp-fspi: Enable for i.MX9Sascha Hauer2023-11-171-1/+1
| | | | | | | | The i.MX9 flexspi is compatible to the one on i.MX8mm, just add the necessary Kconfig dependency. Link: https://lore.barebox.org/20231110125800.1901232-23-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: spi-nxp-fspi: Fix error checksSascha Hauer2023-11-071-6/+7
| | | | | | | We have to check dev_request_mem_resource() for errors, not the resource address it returns. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: switch regmap.h include to linux/regmap.hAhmad Fatoum2023-10-262-2/+2
| | | | | | | | | | | | | | | Now that there are no longer any users of regmap.h in headers, let's switch all users in the source files to linux/regmap.h. That way, the only users of regmap.h whether directly or indirectly will be out-of-tree code, which will fail with an error if they are dependent on the old semantics of regmap_bulk_read and regmap_bulk_write. After a transitory period, we can then drop regmap.h. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20231020071853.2826528-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: Add slices for SPI controllersSascha Hauer2023-09-121-1/+11
| | | | | | | | | Add a slice for SPI controllers so that devices using SPI in the background can check if a SPI bus is busy. Tested-by: Gerald Loacker <gerald.loacker@wolfvision.net> Link: https://lore.barebox.org/20230908131117.1769957-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* nios2: remove arch remains from driversDenis Orlov2023-07-033-241/+0
| | | | | | | | | | | The architecture was removed back in the commit efccc13513, however some drivers that were available exclusively for NIOS2 were left over. As it has been impossible to compile those since then, it seems reasonable to just get rid of them. Signed-off-by: Denis Orlov <denorl2009@gmail.com> Link: https://lore.barebox.org/20230629201446.16679-1-denorl2009@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add MODULE_DEVICE_TABLE markersAhmad Fatoum2023-06-1315-0/+15
| | | | | | | | | | | | | | | | Syncing device trees with Linux upstream can lead to breakage, when the device trees are switched to newer bindings, which are not yet supported in barebox. To make it easier to spot such issues, we want to start applying some heuristics to flag possibly problematic DT changes. One step towards being able to do that is to know what nodes barebox actually consumes. Most of the nodes have a compatible entry, which is matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE point at it for future extraction. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2023-04-191-11/+39
|\
| * spi: stm32: support per-transfer bits per word switchingPhilipp Zabel2023-04-111-11/+39
| | | | | | | | | | | | | | | | Allow dynamically switching data size between transfers. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.barebox.org/20230403115340.3416720-2-p.zabel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: fix includes missed by multiarch supportAhmad Fatoum2023-04-111-3/+3
|/ | | | | | | | | | | Found by manual inspection of the results of: rg '#include\s*<mach/[^/]+>' | rg -v 'arch/(powerpc|sandbox|mips|x86|kvx)' Fixes: 68b778c24314 ("ARM: Drop mach dir include path") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230411071436.1630752-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-overlay' into nextSascha Hauer2023-03-161-5/+24
|\
| * spi: implement rescanSascha Hauer2023-03-101-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Implement rescan to register and probe newly added devices via device tree overlays. While this is easy to do at SPI core level this is not the whole truth. Many SPI controllers do not use their native chipselects for the SPI devices, but GPIOs instead. These currently won't be rescanned when new devices are added, so the chipselects for the new devices must be be present in the base device tree already. You have been warned. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: reduce scope of 'chip'Sascha Hauer2023-03-101-2/+2
| | | | | | | | | | | | | | | | Reducde scope of struct spi_board_info chip to the loop where it is actually only used. While at it drop the memset and let the compiler do the work of initialising it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: Directly register SPI deviceSascha Hauer2023-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | SPI devices described in the device tree are not directly registered, but instead added to the SPI board_list which is normally used to register SPI devices from board code. This seems rather unnecessary, drop this detour and register SPI devices directly from spi_of_register_slaves(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: at91: Move mach header files to include/mach/at91Sascha Hauer2023-03-061-3/+3
| | | | | | | | | | | | | | | | | | | | Currently arch specific headers can be included with longer possible as there won't be a single mach anymore. Move all at91 specific header files to include/mach/at91/ to prepare for multi-arch support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: mxs: Move mach header files to include/mach/mxsSascha Hauer2023-03-061-2/+2
| | | | | | | | | | | | | | | | | | | | Currently arch specific headers can be included with longer possible as there won't be a single mach anymore. Move all mxs specific header files to include/mach/mxs/ to prepare for multi-arch support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: i.MX: Move mach header files to include/mach/imxSascha Hauer2023-03-062-4/+4
| | | | | | | | | | | | | | | | | | | | | | Currently arch specific headers can be included with #include <mach/xxx.h>. With upcoming multi-arch support this is no longer possible as there won't be a single mach anymore. Move all i.MX specific header files to include/mach/imx/ to prepare for multi-arch support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: mxs: remove unused mach/clock.hSascha Hauer2023-03-011-1/+0
|/ | | | | | | | mach/clock.h doesn't contain anything useful, remove it and drop its inclusion from files. Link: https://lore.barebox.org/20230228143031.1718565-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: atmel-quadspi: remove struct platform_device usageMarco Felsch2023-01-311-1/+0
| | | | | | | | | The pdev member is unused neither do have barebox support for 'struct platform_device' so remove the usage. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230130234501.1122060-2-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: Fix probing SPI drivers with no cs-gpiosJohn Watts2023-01-263-3/+3
| | | | | | | | | | | | | | | of_gpio_named_count returns a negative value on error but this is discarded and cast to a u16, making error handling impossible. With debug logging enabled this effectively halts booting so the board can print an error over serial 65534 times. Introduce of_gpio_count_csgpios which returns 0 in the case of an error rather than a negative value. Signed-off-by: John Watts <contact@jookia.org> Link: https://lore.barebox.org/20230124200554.1701687-1-contact@jookia.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct driver_d to driverSascha Hauer2023-01-1017-17/+17
| | | | | | | | | | | The '_d' suffix was originally meant to distinguish barebox struct names from Linux struct names. struct driver doesn't exist in Linux, so we can rename it and remove the meaningless suffix. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-1018-41/+43
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename device_d::device_node to device_d::of_nodeSascha Hauer2023-01-1014-23/+23
| | | | | | | | | | | | | | | | | | | | Linux struct device has the member of_node for the device_node pointer. Rename this in barebox accordingly to minimize the necessary changes when porting Linux code. This was done with the semantic patch: @@ struct device_d E; @@ - E.device_node + E.of_node @@ struct device_d *E; @@ - E->device_node + E->of_node Plus some manual adjustments. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: imx_spi: match fsl,imx6ul-ecspi compatibleAhmad Fatoum2022-10-271-0/+4
| | | | | | | | | | | Anticipate imx8mp.dtsi device tree change suggested upstream[1] and add the new compatible to our match list. [1]: https://lore.kernel.org/all/20221020103158.2273874-2-peng.fan@oss.nxp.com/ Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20221021052240.2125785-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: stm32: fix reads for sizes bigger than SZ_64K-1Ahmad Fatoum2022-07-121-0/+20
| | | | | | | | | | | | | | | | stm32_spi_transfer_one() can transfer no more than SPI_CR2_TSIZE (64K - 1), while e.g. imd tends to read more than (64K - 1) from SPI flash: barebox:/ imd /dev/m25p0 imd: error 90 Define spi_controller_mem_ops::exec_op for the SPI controller to fix this. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20220708055250.1175444-3-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Remove duplicate incudesAlexander Shiyan2022-06-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning fwterated by checkincludes.pl: ./net/nfs.c: libgen.h is included more than once. ./net/ifup.c: globalvar.h is included more than once. ./crypto/rsa.c: asm/types.h is included more than once. ./lib/decompress_unlz4.c: linux/decompress/mm.h is included more than once. ./scripts/stb_image.h: stdio.h is included more than once. ./scripts/kwbimage.c: unistd.h is included more than once. ./scripts/common.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/mman.h is included more than once. ./fs/pstore/ram_core.c: linux/rslib.h is included more than once. ./fs/pstore/fs.c: fs.h is included more than once. ./fs/pstore/fs.c: linux/pstore.h is included more than once. ./fs/nfs.c: fs.h is included more than once. ./fs/uimagefs.c: fs.h is included more than once. ./fs/fs.c: command.h is included more than once. ./arch/sandbox/board/hostfile.c: linux/err.h is included more than once. ./arch/sandbox/board/devices.c: mach/linux.h is included more than once. ./arch/sandbox/os/common.c: signal.h is included more than once. ./arch/arm/boards/zii-imx51-rdu1/board.c: envfs.h is included more than once. ./arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c: generated/mach-types.h is ./arch/arm/mach-stm32mp/ddrctrl.c: mach/stm32.h is included more than once. ./arch/arm/mach-imx/cpu_init.c: common.h is included more than once. ./arch/arm/mach-imx/imx8m.c: mach/imx8m-ccm-regs.h is included more than once. ./common/efi/payload/init.c: efi.h is included more than once. ./common/state/backend_format_raw.c: common.h is included more than once. ./common/state/backend_format_raw.c: crc.h is included more than once. ./common/hush.c: libbb.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/clk.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/err.h is included more than once. ./drivers/net/virtio.c: net.h is included more than once. ./drivers/net/phy/phy.c: linux/phy.h is included more than once. ./drivers/net/cpsw.c: net.h is included more than once. ./drivers/virtio/virtio_pci_common.h: linux/list.h is included more than once. ./drivers/usb/host/ohci-hcd.c: dma.h is included more than once. ./drivers/usb/gadget/fsl_udc.c: dma.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: spi/spi.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: of.h is included more than once. ./drivers/video/imx-ipu-v3/imx-ldb.c: linux/clk.h is included more than once. ./drivers/video/imx-ipu-v3/imx-hdmi.c: linux/clk.h is included more than once. ./drivers/video/omap.c: common.h is included more than once. ./drivers/mtd/nand/nand_s3c24xx.c: asm/sections.h is included more than once. ./drivers/clk/imx/clk-imx6sx.c: linux/clk.h is included more than once. ./drivers/clk/imx/clk-imx6sl.c: linux/clk.h is included more than once. ./commands/bootm.c: of.h is included more than once. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220607051957.2497-1-eagle.alexander923@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: Port SiFive SPI controller driverAhmad Fatoum2022-04-293-0/+528
| | | | | | | | | Import the U-Boot v2022.04-rc2 driver to enable access to SPI flash and SD over SPI on the HiFive Unleashed. Tested with QEMU. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20220426064604.422292-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: imx: spi: Add NXP IMX8 Flex SPI/QSPI supportJoacim Zetterling2022-03-033-0/+1072
| | | | | | | | | | | | | | | | | This driver is ported from the linux kernel and adapted to barebox for the NXP IMX8 platforms. This commit add support for the NXP IMX8 Flex SPI controller in master mode. Up to four slave devices can be connected on two buses with two chip selects each. This controller does not support generic SPI messages and only supports the high-level SPI memory interface. Tested on the NXP IMX8MN-EVK evaluation board as well as on a IMX8MN custom board supporting a Micron N25Q00 QSPI flash. Signed-off-by: Joacim Zetterling <joacim.zetterling@westermo.com> Link: https://lore.barebox.org/20220301132232.343230-1-joacim.zetterling@westermo.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0+" license identifiers to SPDX 2.0Roland Hieber2021-11-224-4/+4
| | | | | | | | | "GPL-2.0-or-later" was introduced in SPDX 2.0, and the old identifier "GPL-2.0+" is now deprecated; see <https://spdx.org/licenses>. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-3-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-225-5/+5
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2021-11-1515-117/+15
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-0115-117/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | spi: add STM32 SPI controller driverAhmad Fatoum2021-11-053-0/+598
| | | | | | | | | | | | | | | | Tested on a STM32MP1 communicating with a ksz9563. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211105074657.3914257-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | spi: zynq_qspi: don't check clk_get return value for NULLnessAhmad Fatoum2021-11-011-2/+2
|/ | | | | | | | clk_get never returns NULL, so no point in checking for it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175446.2274194-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/riscv'Sascha Hauer2021-10-073-0/+245
|\
| * spi: add litex spiflash driverAntony Pavlov2021-10-073-0/+245
| | | | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210817101104.114945-6-antonynpavlov@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | asm-generic: include bitio.h from io.hAhmad Fatoum2021-08-231-3/+3
|/ | | | | | | | | | | | | | This is currently used on ARM and sandbox, but it's relevant for other platforms like x86 as well if driver code wants to make use of the functions defined within. MIPS and PowerPC already defines the symbols, but that's ok because <bitio.h> doesn't override existing macros. This works for MIPS, but not PowerPC, where those aren't macros. Fix that up. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210812121944.4419-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-07-181-1/+1
|\
| * spi: imx: enable use for i.MX8MM and i.MX8MPAhmad Fatoum2021-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | All i.MX8M variants so far are compatible with the eCSPI peripheral of the i.MX51, which corresponds to the CONFIG_DRIVER_SPI_IMX_2_3 symbol. This symbol was so far only selected for the i.MX8MQ. Enable it for the other i.MX8M variants as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210624081558.29488-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | common: add initial barebox deep-probe supportMarco Felsch2021-06-251-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The barebox 'deep probe' or 'probe on demand' mechanism is the answer of unwanted -EPROBE_DEFER failures. The EPROBE_DEFER error code was introduced by commit ab3da15bc14c ("base: Introduce deferred probing") and since then it causes a few problems. The error is returned if either the device is not yet present or the driver is not yet registered. This makes sense on linux systems where modules and hot-plug devices are used very often but not for barebox. The module support is rarely used and devices aren't hot pluggable. The current barebox behaviour populates all devices before the drivers are registered so all devices are present during the driver registration. So the driver probe() function gets called immediately after the driver registration and causes the -EPROBE_DEFER error if this driver depends on an other not yet registered driver. To get rid of the EPROBE_DEFER error code we need to reorder the device population and the driver registration. All drivers must be registered first. In an ideal world all driver can be registered by the same initcall level. Then devices are getting populated which causes calling the driver probe() function but this time resources/devices are created on demand if not yet available. Dependencies between devices are normally expressed as references to other device nodes. With deep probe barebox provides helper functions which take a device node and probe the device behind that node if necessary. This means instead of returning -EPROBE_DEFER, we can now make the desired resources available once we need them. If the resource can't be created we are returning -ENODEV since we are not supporting hot-plugging. Dropping EPROBE_DEFER is the long-term goal, avoid initcall shifting is the short-term goal. Call it deep-probe since the on-demand device creation can create very deep stacks. This commit adds the initial support for: spi, i2c, reset, regulator, gpio and clk resource on-demand creation. The deep-probe mechanism must be enabled for each board to avoid breaking changes using deep_probe_enable(). This can be changed later after all boards are converted to the new mechanism. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.pengutronix.de/20201021115813.31645-8-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210625072540.32717-10-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: <io.h>: define (read|write)[bwlq]_relaxedAhmad Fatoum2021-06-111-3/+0
| | | | | | | | | | | | | | For Linux, It's always correct to substitute any of the read or write _relaxed functions with their non relaxed counterpart. Define functions that do this. Unlike with Linux, they doesn't per se affect performance: barebox writel doesn't imply memory barriers, instead it depends on the architecture support to map IO memory regions as non-bufferable. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20210611080155.3555976-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: core: don't ignore register_device failuresMarco Felsch2020-09-291-1/+3
| | | | | | | Add missing error handling for spi_new_device(). Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-143-7/+0
|\
| * spi: Kconfig: drop unneeded dependencyAntony Pavlov2020-05-041-1/+0
| | | | | | | | | | | | | | | | The 'config DRIVER_SPI_MXS' section is already under 'if SPI' so 'depends on SPI' is unneeded. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-273-7/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: explicitly select dependency STMP_DEVICE for i.MX23/28 driversAhmad Fatoum2020-05-081-1/+1
|/ | | | | | | | | | | | | Some of the i.MXs drivers can be build tested even if building for other platforms. Support adding a future COMPILE_TEST dependency to some of these drivers by explicitly having their Kconfig symbol select STMP_DEVICE if the driver calls stmp_reset_block. This has not been necessary for the normal build, because the ARCH symbols for the IMX23 and IMX28 already selected STMP_DEVICE. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>