summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
Commit message (Collapse)AuthorAgeFilesLines
* i2c: add bcm283x i2c host controller supportDaniel Brát2022-06-173-0/+332
| | | | | | | | | Add a driver to support the i2c host controller (BSC) found in Broadcom's bcm283x family of SoCs (used by rpi boards). Signed-off-by: Daniel Brát <danek.brat@gmail.com> Link: https://lore.barebox.org/20220615203909.27363-1-danek.brat@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: rockchip: fix transfer return valueAhmad Fatoum2022-05-111-5/+8
| | | | | | | | | | | barebox (and kernel) API is for i2c_adapter::master_xfer to return the number of successfully transmitted messages and a negative value on error. This was not observed in the Rockchip driver, fix this. Reported-by: Matthias Fend <matthias.fend@emfend.at> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220510153657.2033190-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: add Cadence i2c host controller supportMatthias Fend2022-05-113-0/+462
| | | | | | | | | Add a driver to support the Cadence I2C host controller found in Zynq UltraScale+ MPSoCs. Signed-off-by: Matthias Fend <matthias.fend@emfend.at> Link: https://lore.barebox.org/20220510130414.344586-1-matthias.fend@emfend.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: stm32mp: allow driver reuse for STM32 MCUsAhmad Fatoum2022-02-011-1/+1
| | | | | | | | | | | Most peripheral driver are usable for both STM32 MPUs and MCUs, but so far we they were only used for STM32MP1. In preparation for adding MCU support, introduce a new ARCH_STM32 selected by ARCH_STM32MP and migrate common drivers to it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220131075725.1873026-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: add Rockchip i2c controller supportAhmad Fatoum2022-01-173-0/+467
| | | | | | | | | For addressing the PMIC on Rockchip platforms, add an i2c controller driver. Tested with rk3399 and rk808. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220114085425.315113-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-228-8/+8
| | | | | | | | | | "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-1511-63/+12
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-0111-63/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | I2C: i.MX: early: replace zero-valued variable use with zero directlyAhmad Fatoum2021-11-011-1/+1
|/ | | | | | | | | There is a if (ret) return -EAGAIN a few lines above, so if we reach the final return, ret must be zero. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141954.2207820-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: designware: fix error message formattingAhmad Fatoum2021-06-091-5/+3
| | | | | | | | | Some error messages lack a trailing new line. One dev_dbg uses the i2c adapter's device_d as domain, before it was allocated. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210531071304.32217-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: at91: extend for sama5d2 supportAhmad Fatoum2020-08-031-19/+116
| | | | | | | | Port over the Linux v5.8-rc4 bits to support i2c on the sama5d2. This has been tested by reading the i2c EEPROM on the sama5d27-som1-ek. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: stm32: support new st,stm32mp15-i2c compatibleAhmad Fatoum2020-08-031-0/+1
| | | | | | | | | | | | | | Linux v5.8-rc1 has gained support for the FastMode+ registers on the stm32mp15, but those are incompatible between the stm32mp15 and the stm32f7, so a new compatible was introduced. The old compatible was replaced for the MP15 SoC, breaking I2C in barebox. Add the new compatible to fix this. Unlike Linux, we just use the same setup parameters as for the stm32f7. This is ok as long we don't want to support FastMode+. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Convert files covered by ARM copyright to SPDXUwe Kleine-König2020-07-141-7/+6
| | | | | | | | | | According to Marc Zyngier, former employee at ARM, the company owns the copyright for code created by its employees. Convert accordingly to SPDX with the usual rearrangements. Also dropped Marc's email address which doesn't work any more. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: designware: use proper type for writel argumentAhmad Fatoum2020-07-141-2/+5
| | | | | | | | | We need to write DW_IC_ENABLE_ENABLE (1 << 0) to the register to enable, but instead we were writing true. This happens to work, but is quite unusual. Make the code more readable. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: stm32mp: depend on ARCH_STM32MP for SoC driversAhmad Fatoum2020-07-141-0/+1
| | | | | | | | | The i2c, MCI and reset controller peripherals are STM32-specific. There is no reason to ask uses on oldconfig about it, thus make them depend on ARCH_STM32MP || COMPILE_TEST. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: replace commas with semicolons where appropriateAhmad Fatoum2020-05-203-3/+3
| | | | | | | | | | | | Found by searching drivers/ arch/ common/ and lib/ for /^\s+[^."/\*\[\s\{\(A-Z][^\[\{\(]*=[^\{\(]+,$/ Because the comma has the lowest precedence in C, this shouldn't result in any functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* I2C: i.MX: Add early i2c support for i.MX8MSascha Hauer2020-02-191-0/+12
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: tegra: correct error messageAhmad Fatoum2020-02-121-1/+1
| | | | | | | | | | reset_control_get returns NULL when the controller reset is missing. The error pointer is used for malformed reset controller specification. Correct the message accordingly. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2019-12-101-8/+3
|\
| * i2c: stm32: use device_reset_us helper instead of open-codingAhmad Fatoum2019-11-131-8/+3
| | | | | | | | | | | | | | | | The exact sequence is already available in form of device_reset_us. Make use of it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: gpio: use of_get_named_gpio() instead of of_get_named_gpio_flags()Antony Pavlov2019-11-251-2/+2
|/ | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: add stm32f7 I2C adapter driverAhmad Fatoum2019-09-093-0/+869
| | | | | | | | This patch adds initial support for the STM32F7 I2C controller. It was tested to work with the STM32MP157C. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: scb9328: refurbish board suportSascha Hauer2019-08-151-1/+1
| | | | | | | | | - switch the i.MX1 based scb9328 board to device tree - Remove scb9328_defconfig and enable scb9328 board support in imx_defconfig - Remove old environment and switch to new default environment Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: gpio: add sda/scl-gpios property supportMarco Felsch2019-06-261-10/+17
| | | | | | | | | The gpios property is marked as deprecated since kernel 4.15 so we should support the "new" mechanism too. The new mechanism has a higher priority than the deprecated one. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Add layerscape supportSascha Hauer2019-03-132-2/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Add early driver for use in PBLSascha Hauer2019-03-042-0/+311
| | | | | | | i2c is used in SPD EEPROMs and thus needed very early before barebox is up. This patch adds a i.MX i2c driver variant for use in PBL. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Create header file for register definesSascha Hauer2019-02-272-46/+53
| | | | | | | We'll add a stripped down driver variant for use in PBL. To share the register defines add a header file for them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Read clock-frequency from device treeSascha Hauer2019-02-271-6/+6
| | | | | | | We speed up the clock frequency only if probed via platform_data. Additionally honour the "clock-frequency" property. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: remove unused defineSascha Hauer2019-02-271-3/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: stop after read only in last transfer of a messageSascha Hauer2019-02-271-3/+4
| | | | | | | | | Following the Linux driver the controller should be stopped in the read transfer path only after the last transfer of a message, but not when other transfers of the same message are following. Implement this behaviour for the barebox driver aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Consolidate status polling loopsSascha Hauer2019-02-271-42/+31
| | | | | | | | We poll for different bits in the status register in different functions. Instead of repeating the polling loops each time create a helper function for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: remove unnecessary ifdefSascha Hauer2019-02-271-8/+0
| | | | | | dev_dbg is a no-op when debugging is disabled, so no need for extra ifdefs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Fix FSL_I2C_DFSRR register offsetSascha Hauer2019-02-271-1/+1
| | | | | | | | 4ed5b77 ("i.MX: i2c: Add Vybrid support") introduced regshifts for the register offsets, but missed to adjust the register offset for the FSL_I2C_DFSRR register (which exists only on PowerPC). Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: remove unnecessary ifdefSascha Hauer2019-02-271-2/+0
| | | | | | No need to put the of_compatible field into ifdefs, remove them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: remove unnecesary defineSascha Hauer2019-02-271-4/+1
| | | | | | No need for a define which is used only once. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: fix variable nameSascha Hauer2019-02-271-14/+14
| | | | | | | i2c_fsl_write() and i2c_fsl_read() take exactly one i2c message, not multiple ones, hence rename the variable from "msgs" to "msg". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: consolidate codeSascha Hauer2019-02-271-33/+21
| | | | | | | | We have to write to FSL_I2C_I2DR and wait for completion/ack three times in the code. Instead of open coding it each time create a helper function for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Track stopped status in I2CR_MSTA bitSascha Hauer2019-02-271-28/+15
| | | | | | | | We can track the stopped status in the I2CR_MSTA bit, no need for an extra variable. Also we can call i2c_fsl_stop() instead of open coding it in i2c_fsl_read(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: move disabling of controller out of i2c_fsl_stopSascha Hauer2019-02-271-4/+4
| | | | | | | Move disabling of the controller out of i2c_fsl_stop(). This makes the function reusable in other places in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Do not call i2c_fsl_bus_busy twiceSascha Hauer2019-02-271-4/+0
| | | | | | | | In i2c_fsl_stop() we call i2c_fsl_bus_busy() a second time when it fails. If it fails once it won't succeed the second time, so drop the second call. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: i2c: Fix build error in debug output codeAndrey Smirnov2018-08-131-2/+2
| | | | | | | | | Looks like that particular chunk of the code have not been built in a while and bitrotted. Change function parameters appropriately to avoid breaking the build. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: designware: evaluate i2c-sda-hold-time propertySteffen Trumtrar2018-01-111-0/+40
| | | | | | | | | | Newer designware i2c controllers allow setting the SDA hold time. Evaluate the devicetree property "i2c-sda-hold-time" and set the value accordingly. The code is an adaption of the Linux v4.12 driver. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: mv64xxx: add timeout waiting for bus readyBastian Stender2017-11-171-5/+15
| | | | | | | | This prevents barebox hanging e.g. in case the i2c clock is accidentally connected to GND. Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: mv64xxx: fix indentationAntony Pavlov2017-05-231-1/+1
| | | | | | | | | | | | | | | | | | The patch fixes this compiler's warning: drivers/i2c/busses/i2c-mv64xxx.c: In function ‘mv64xxx_i2c_fsm’: drivers/i2c/busses/i2c-mv64xxx.c:303:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (drv_data->bytes_left == 1) ^~ drivers/i2c/busses/i2c-mv64xxx.c:305:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ udelay(2); ^~~~~~ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Cc: Bastian Stender <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mvebu'Sascha Hauer2017-03-131-23/+18
|\
| * i2c: mv64xxx: simplify mv64xxx_i2c_wait_for_completionBastian Stender2017-03-021-21/+8
| | | | | | | | | | | | | | | | | | Two nested while loops are not necessary here, so integrate the read, i2c_fsm and i2c_do_action calls into mv64xxx_i2c_wait_for_completion() and remove the obsolete interrupt remains. Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * i2c: mv64xxx: add software delaysBastian Stender2017-03-021-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | As stated in Marvell's Functional Specifications in MV-S107021-U0 Rev. A on page 420 ff. software delays are needed. "SW delay represent a delay of at least 2 internal clock cycles". These delays are hereby implemented. The original kernel driver compensates the needed software delays with the time the interrupts take. Signed-off-by: Bastian Stender <bst@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i.MX: i2c: fix i2c-fsl for non-OF boardsAlexander Kurz2017-02-141-4/+10
|/ | | | | | | | | | With commit 4ed5b778a56b ("i.MX: i2c: Add Vybrid support") i2c-fsl probe returns -EINVAL for all non-OF boards. Since newer planforms, especially vf610 are restricted OF-only it is safe to assume "fsl,imx21-i2c" if CONFIG_OFDEVICE is not set. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: Enable clockSascha Hauer2017-01-191-0/+1
| | | | | | For architectures which do not enable all clocks during initialization. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/vybrid'Sascha Hauer2017-01-121-62/+160
|\