summaryrefslogtreecommitdiff
path: root/drivers/i2c
AgeCommit message (Collapse)Author
9 daysKconfig: Test for !COMPILE_TEST in some locationsTom Rini
We have a few options that we cannot enable in a "allyesconfig" type build because we cannot use zero as a default value. - The logic around HAS_BOARD_SIZE_LIMIT assumes that if we have set this then we compare with it. Similarly, we need to set SPL_NO_BSS_LIMIT as the default there. - Both SYS_CUSTOM_LDSCRIPT and ENV_USE_DEFAULT_ENV_TEXT_FILE then prompt for a file name to use. - The SYS_I2C_SOFT driver is a legacy driver which requires a lot of configuration within the board config. file instead, so disable it. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-06-24i2c: mux: Fix the crash when the i2c-arbitrator node is presentVenkatesh Yadav Abbarapu
Observing the crash when we add the i2c-arbitrator node in the device tree as per the DT bindings. The issue is with the child node of i2c-arbitrator@72 i.e., i2c@f1950000->i2c-arbitrator@72->i2c-arb, as the arbitrator uses the uclass of mux(UCLASS_I2C_MUX) and the mux uclass driver checks for the "reg" property using the i2c_mux_child_post_bind() function, if it won't find the "reg" property it will return -EINVAL which is leading to the crash. So, add the logic to check whether the child node has the "reg" property, if the "reg" property exists then read the "reg" and update the channel. https://www.kernel.org/doc/Documentation/devicetree/bindings/i2c/i2c-arb.txt Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-06-02i2c: designware_i2c Return -ETIMEDOUT for timeout errorsWojciech Szamocki
Change the return value for timeout errors in i2c-designware from 1 to -ETIMEDOUT. Returning errors as negative values is standard practice in the u-boot, which enhances error handling consistency across the codebase. The current behavior can lead to silent errors when functions check for negative return values to identify errors. For example, in `dm_i2c_reg_read` from i2c-uclass.c, a timeout results in an uninitialized value being returned, potentially causing unexpected behavior. Cc: Heiko Schocher <hs@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Wojciech Szamocki <wojciech.szamocki@nokia.com> Signed-off-by: Wojciech Szamocki <wojciech.szamocki@nokia.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-22i2c: mediatek: remove duplicate entry in mt_i2c_regs_v1[]Martin Schiller
This removes a duplicate entry in mt_i2c_regs_v1[]. Signed-off-by: Martin Schiller <ms@dev.tdt.de> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-22i2c: mediatek: add missing empty entry at end of mkt_i2c_ids[]Martin Schiller
This adds the missing empty entry at the end of mtk_i2c_ids[]. Signed-off-by: Martin Schiller <ms@dev.tdt.de> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-22drivers: i2c: Kconfig: Add CONFIG_SYS_I2C_OMAP24XX_REPEATED_STARTAniket Limaye
Add a Kconfig option to disable sending Stop conditions between multiple i2c_msgs within a single xfer. Enable this config by default for ARCH_K3 platforms. Signed-off-by: Aniket Limaye <a-limaye@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-22i2c: omap24xx_i2c: support CONFIG for repeated start in DM_I2C xferAniket Limaye
Repeated Start Condition (Sr) can be used to transfer multiple i2c msgs without sending a Stop condition (P). So far, the driver default was to always send a Stop condition after every i2c msg. Add support for a config option (CONFIG_SYS_I2C_OMAP24XX_REPEATED_START) to disable sending the Stop condition by default. If this config is enabled, Stop condition will be sent only if explicitly requested in the msg flags OR if it is the last msg in the transfer. Consequently, handle the Repeated Start condition (Sr) in the next msg by not calling the wait_for_bb() check since it will simply timeout in the absence of a stop condition (BB will be 1 until Stop is programmed) Signed-off-by: Aniket Limaye <a-limaye@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-22i2c: omap24xx_i2c: Use new function __omap24_i2c_xfer_msg()Aniket Limaye
Remove __omap24_i2c_read/write() usage from omap_i2c_xfer() in favour of the more flexible __omap24_i2c_xfer_msg(). Consequently, these are also no longer needed when DM_I2C is enabled. New function __omap24_i2c_xfer_msg() will take care of individual read OR write transfers with a target device. It goes through below sequence: - Program the provided Target Chip address (OMAP_I2C_SA_REG) - Program the provided Data len (OMAP_I2C_CNT_REG) - Program the provided Control register flags (OMAP_I2C_CON_REG) - Read from or Write to the provided Data buffer (OMAP_I2C_DATA_REG) For a detailed programming guide, refer to the TRM[0] (12.1.3.4 I2C Programming Guide). This patch by itself should be a transparent change. However this is needed for implementing a proper Repeated Start (Sr) functionality for i2c_msgs. Previous implementation for omap_i2c_xfer called __omap24_i2c_read/write functions, with hardcoded addr=0 and alen=0 for each i2c_msg. Each of these calls would program the registers always with a Stop bit set, not allowing for a repeated start between i2c_msgs in the same xfer(). [0]: https://www.ti.com/lit/zip/spruj28 (TRM) Signed-off-by: Aniket Limaye <a-limaye@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-22i2c: omap24xx_i2c: Remove unused CONFIG_I2C_REPEATED_STARTAniket Limaye
Remove unused piece of code under CONFIG_I2C_REPEATED_START which does not have any Kconfig entry at all. Signed-off-by: Aniket Limaye <a-limaye@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2025-04-11Kbuild: Always use $(PHASE_)Tom Rini
It is confusing to have both "$(PHASE_)" and "$(XPL_)" be used in our Makefiles as part of the macros to determine when to do something in our Makefiles based on what phase of the build we are in. For consistency, bring this down to a single macro and use "$(PHASE_)" only. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-03-12i2c: Add support for ADI SC5XX-family I2C peripheralNathan Barrett-Morrison
Co-developed-by: Greg Malysa <malysagreg@gmail.com> Signed-off-by: Greg Malysa <malysagreg@gmail.com> Co-developed-by: Ian Roberts <ian.roberts@timesys.com> Signed-off-by: Ian Roberts <ian.roberts@timesys.com> Co-developed-by: Angelo Dureghello <angelo.dureghello@timesys.com> Signed-off-by: Angelo Dureghello <angelo.dureghello@timesys.com> Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@analog.com> Signed-off-by: Utsav Agarwal <utsav.agarwal@analog.com> Signed-off-by: Arturs Artamonovs <arturs.artamonovs@analog.com> Signed-off-by: Oliver Gaskell <Oliver.Gaskell@analog.com> Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-12-11i2c: renesas: Fix R-Car spellingMarek Vasut
The correct spelling is R-Car, including the dash, update the usage. Kconfig strings and comment changes only, no functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-10-25i2c: mxc_i2c: Convert to use livetree API for fdt accessTim Harvey
Convert to using livetree API functions. Without this if livetree is enabled (OF_LIVE) the mxc-i2c driver will fail to support scl-gpios and sda-gpios for i2c bus recovery. Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2024-10-23i2c: rzg2l: include u-boot/schedule.hRasmus Villemoes
This TU currently relies on getting a declaration of schedule() through some nested include. Include the proper header directly. Signed-off-by: Rasmus Villemoes <ravi@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
2024-10-21i2c: i2c-gpio: add support for i2c-gpio,sda-output-onlyAlex Shumsky
Some I2C slave devices are read-only and don't even answer with NACK. For example FD65x segment LED controllers. Make them usable with i2c-gpio,sda-output-only that are already supported by Linux 6.3+. Signed-off-by: Alex Shumsky <alexthreed@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-10-21i2c: muxes: pca954x: Add MAX735x/MAX736x supportMaksim Kiselev
Add support for the following Maxim chips using the existing PCA954x driver: - MAX7356 - MAX7357 - MAX7358 - MAX7367 - MAX7368 - MAX7369 All added Maxim chips behave like the PCA954x, where a single SMBUS byte write selects up to 8 channels to be bridged to the primary bus. Tested using the MAX7358. Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-10-11global: Rename SPL_ to XPL_Simon Glass
Use XPL_ as the symbol to indicate an SPL build. This means that SPL_ is no-longer set. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_phase() to xpl_phase()Simon Glass
Rename this function to indicate that it refers to any xPL phase. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-19Merge tag 'v2024.10-rc3' into nextTom Rini
Prepare v2024.10-rc3
2024-08-13i2c: Remove CFG_SYS_I2C_DIRECT_BUSSimon Glass
Now that this is always 1, remove it and the associated dead code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-13i2c: Remove CFG_SYS_I2C_MAX_HOPSSimon Glass
Now that this is always 0, remove it and the associated dead code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-13i2c: Drop reference to SYS_I2C_INIT_BOARDSimon Glass
This is not now used by any boards, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-13fsl: mxc: Drop legacy I2cSimon Glass
Drop some old code from the mxc_i2c and ddr/fsl drivers. This will allow removal of very old common I2C code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-09i2c: imx_lpi2c: Support read transfers longer than 256 bytesFedor Ross
The TXFIFO register of LPI2C only has one byte length, and if the length of the data that needs to be read exceeds 256 bytes, it needs to be written to TXFIFO multiple times. Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
2024-08-09i2c: imx_lpi2c: Replace hard-coded bus speed value with bus->speed_hzFedor Ross
Instead of using the hard-coded bus speed value I2C_SPEED_STANDARD_RATE, use the actual configured bus speed. This way the bus speed doesn't change suddenly after calling the imx_lpi2c_probe_chip() function for example. Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
2024-08-09i2c: imx_lpi2c: Fix a typo in bus_i2c_receiveFedor Ross
Fix a typo in a debug message. It should be 'for' not 'fot' . Signed-off-by: Fedor Ross <fedor.ross@ifm.com>
2024-08-09i2c: samsung: Support platforms other than EXYNOS4 and EXYNOS5David Virag
Newer Samsung SoCs (including newer Exynos, ExynosAuto, Google Tensor) still use these IPs, or slightly newer versions of it. Make these drivers available on these platforms by guarding EXYNOS4/EXYNOS5 specific code behind their configs, and using CCF for clocks on other platforms. Tested S3C I2C driver on Exynos7885. This along with extended clock driver should enable S3C I2C on Exynos850. Signed-off-by: David Virag <virag.david003@gmail.com> Tested-by: Henrik Grimler <henrik@grimler.se> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-09i2c: samsung: Drop s3c24x0 specific code.David Virag
This has been dead code for many years now. Remove it. Signed-off-by: David Virag <virag.david003@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-09i2c: mux: Fix error path in i2c-arb-gpioMichal Simek
There is no reason to use goto and just call return. Better is to call return directly which is done for some if/else parts. Also make no sense to setup ret to -ETIMEDOUT and then to 0. Return timeout directly. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-08-09i2c: pca954x: Remove pointer to GDMichal Simek
There is no reason to have any pointer to GD that's why remove it. Signed-off-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-07-23arm: ti: Remove omap4 platform supportTom Rini
There are no longer any OMAP4 platforms in U-Boot, remove the related functionality. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-07-22drivers: i2c: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-07-08i2c: mediatek: add support for optional arb and pmic clockChristian Marangi
Add support for optional arb and pmic clock for i2c provided in upstream linux DTSI. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-07i2c: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Reviewed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-04-23i2c: Add support for Qualcomm Generic Interface (GENI) I2C controllerNeil Armstrong
Add Support for the Qualcomm Generic Interface (GENI) I2C interface found on newer Qualcomm SoCs. The Generic Interface (GENI) is a firmware based Qualcomm Universal Peripherals (QUP) Serial Engine (SE) Wrapper which can support multiple bus protocols depending on the firmware type loaded at early boot time based on system configuration. It also supports the "I2C Master Hub" which is a single function Wrapper that only FIFO mode I2C. It replaces the fixed-function QUP Wrapper found on older SoCs. The geni-se.h containing the generic GENI Serial Engine registers defines is imported from Linux. Only FIFO mode is implemented, neither SE DMA nor GPI DMA are implemented. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-03-02Merge patch series "ARM: renesas: Rename R-Mobile to Renesas"Tom Rini
Marek Vasut <marek.vasut+renesas@mailbox.org> says: Rename R-Mobile to Renesas all over the place because the chips are made by Renesas, while only a subset of them is from the R-Mobile line.
2024-03-02ARM: renesas: Rename ARCH_RMOBILE to ARCH_RENESASMarek Vasut
Rename ARCH_RMOBILE to ARCH_RENESAS because all the chips are made by Renesas, while only a subset of them is from the R-Mobile line. Use the following command to perform the rename: " $ git grep -l 'ARCH_RMOBILE' | xargs -I {} sed -i 's@ARCH_RMOBILE@ARCH_RENESAS@g' {} " Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
2024-02-28i2c: rzg2l: Add I2C driver for RZ/G2L familyPaul Barker
This driver supports the I2C module on the Renesas RZ/G2L (R9A07G044) SoC, also known as the RIIC module. This patch is based on both the u-boot driver in the Renesas RZ BSP 3.0.5 release [1] (commit 7fcc1fdc2534), and the Linux v6.7 driver (commit 0dd3ee311255). Support for deblocking the I2C bus is included as this may be needed after triggering a reset via the Power Management IC (PMIC) over I2C (the PMIC asserts the reset line before the SoC completes the I2C write transaction with obvious bus locking effects). If the SDA line is observed to be low during initialisation, we automatically attempt to deblock. [1]: https://github.com/renesas-rz/renesas-u-boot-cip Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-01-29treewide: Remove clk_freeSean Anderson
This function is a no-op. Remove it. Signed-off-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20231216193843.2463779-3-seanga2@gmail.com
2023-11-30Merge branch 'staging' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-tegra into next Device tree improvents for Paz00 and DM PMIC convertion of recently merged Tegra boards.
2023-11-27i2c: Bugfix in i2c_get_chip_by_phandle()Philip Oberfichtner
The "i2cbcdev" sneaked in when implementing this function for the bootcounter use case. Obviously the intention was to use prop_name instead. Fixes: b483552773 (i2c: Implement i2c_get_chip_by_phandle()) Signed-off-by: Philip Oberfichtner <pro@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
2023-11-16treewide: use linux/time.h for time conversion definesIgor Prusov
Now that we have time conversion defines from in time.h there is no need for each driver to define their own version. Signed-off-by: Igor Prusov <ivprusov@salutedevices.com> Reviewed-by: Svyatoslav Ryhel <clamor95@gmail.com> # tegra Reviewed-by: Eugen Hristev <eugen.hristev@collabora.com> #at91 Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org> #qcom geni Reviewed-by: Stefan Bosch <stefan_b@posteo.net> #nanopi2 Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2023-10-31i2c: Implement i2c_get_chip_by_phandle()Philip Richard Oberfichtner
This new function enhances the i2c_get_chip*() toolbox by implementing a variant that does not require a chip_addr. Instead, the desired device is pointed to by a phandle. Signed-off-by: Philip Richard Oberfichtner <pro@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
2023-10-30i2c: designware_i2c: adjust timing calculationHeinrich Schuchardt
In SPL probing of the designware_i2c device on the StarFive VisionFive 2 board fails with dw_i2c: mode 0, ic_clk 1000000, speed 100000, period 10 rise 1 fall 1 tlow 5 thigh 4 spk 0 dw_i2c: bad counts. hcnt = -4 lcnt = 4 device_probe: i2c@12050000 failed to probe -22 When changing the offset for the high phase from 7 to 3 the device is probed correctly. This now matches the value from the Linux driver. Without this fix the memory size of the StarFive VisionFive 2 board cannot be read from EEPROM. Fixes: e71b6f6622d6 ("i2c: designware_i2c: Rewrite timing calculation") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2023-10-30i2c: nuvoton: remove standard mode onlyJim Liu
first version is only support standard mode. remove this judgment to support standard/fast/fast plus mode. Signed-off-by: Jim Liu <JJLIU0@nuvoton.com> Changes for v2: - add commit message Reviewed-by: Heiko Schocher <hs@denx.de>
2023-10-22sunxi: introduce NCAT2 generation modelAndre Przywara
Allwinner seems to typically stick to a common MMIO memory map for several SoCs, but from time to time does some breaking changes, which also introduce new generations of some peripherals. The last time this happened with the H6, which apart from re-organising the base addresses also changed the clock controller significantly. We added a CONFIG_SUN50I_GEN_H6 symbol back then to mark SoCs sharing those traits. Now the Allwinner D1 changes the memory map again, and also extends the pincontroller, among other peripherals. To mark this generation of SoCs, add a CONFIG_SUNXI_GEN_NCAT2 symbol, this name is reportedly used in the Allwinner BSP code, and prevents us from inventing our own name. Add this new symbol to some guards that were already checking for the H6 generation, since many features are shared between the two (like the renovated clock controller). This paves the way to introduce a first user of this generation. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Samuel Holland <samuel@sholland.org>
2023-10-22pinctrl: sunxi: remove GPIO_EXTRA_HEADERAndre Przywara
U-Boot's generic GPIO_EXTRA_HEADER is a convenience symbol to allow code to more easily include platform specific GPIO headers. This should not be needed in a DM world anymore, since the generic GPIO framework handles that nicely. For Allwinner boards we still need to deal with non-DM GPIO in the SPL, but this should become the exception, not the rule. Make this more obvious by removing the definition of GPIO_EXTRA_HEADER, and just force every legacy user of platform specific GPIO to include the new sunxi_gpio.h header explicitly. Everyone doing so should feel ashamed and should find a way to avoid it from now on. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Samuel Holland <samuel@sholland.org>
2023-10-17lib: acpi: Fix linking SPL when ACPIGEN is enabledSean Anderson
lib/acpi/acpigen.o is only compiled into SPL when SPL_ACPIGEN is enabled. Update several files which reference these functions accordingly. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>