summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: exynos5: Preserve high speed master codeMårten Lindahl2021-02-261-1/+7
| | | | | | | | | | | | | | | When the driver starts to send a message with the MASTER_ID field set (high speed), the whole I2C_ADDR register is overwritten including MASTER_ID as the SLV_ADDR_MAS field is set. This patch preserves already written fields in I2C_ADDR when writing SLV_ADDR_MAS. Fixes: 8a73cd4cfa15 ("i2c: exynos5: add High Speed I2C controller driver") Signed-off-by: Mårten Lindahl <martenli@axis.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Tested-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* Revert "i2c: i2c-qcom-geni: Add shutdown callback for i2c"Wolfram Sang2021-02-261-34/+0
| | | | | | | | This reverts commit e0371298ddc51761be257698554ea507ac8bf831. It was accidently applied despite discussion still going on. Signed-off-by: Wolfram Sang <wsa@kernel.org> Acked-by: Stephen Boyd <swboyd@chromium.org>
* i2c: designware: Get right data lengthLiguang Zhang2021-02-262-1/+3
| | | | | | | | | | | | IC_DATA_CMD[11] indicates the first data byte received after the address phase for receive transfer in Master receiver or Slave receiver mode, this bit was set in some transfer flow. IC_DATA_CMD[7:0] contains the data to be transmitted or received on the I2C bus, so we should use the lower 8 bits to get the real data length. Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* i2c: brcmstb: Fix brcmstd_send_i2c_cmd conditionMaxime Ripard2021-02-261-1/+1
| | | | | | | | | | | | | The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD || CMD_WR) which always evaluates to true, while the obvious fix is to test whether the cmd variable passed as parameter holds one of these two values. Fixes: dd1aa2524bc5 ("i2c: brcmstb: Add Broadcom settop SoC i2c controller driver") Reported-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
* Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-armLinus Torvalds2021-02-221-3/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull ARM updates from Russell King: - Generalise byte swapping assembly - Update debug addresses for STI - Validate start of physical memory with DTB - Do not clear SCTLR.nTLSMD in decompressor - amba/locomo/sa1111 devices remove method return type is void - address markers for KASAN in page table dump * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: ARM: 9065/1: OABI compat: fix build when EPOLL is not enabled ARM: 9055/1: mailbox: arm_mhuv2: make remove callback return void amba: Make use of bus_type functions amba: Make the remove callback return void vfio: platform: simplify device removal amba: reorder functions amba: Fix resource leak for drivers without .remove ARM: 9054/1: arch/arm/mm/mmu.c: Remove duplicate header ARM: 9053/1: arm/mm/ptdump:Add address markers for KASAN regions ARM: 9051/1: vdso: remove unneded extra-y addition ARM: 9050/1: Kconfig: Select ARCH_HAVE_NMI_SAFE_CMPXCHG where possible ARM: 9049/1: locomo: make locomo bus's remove callback return void ARM: 9048/1: sa1111: make sa1111 bus's remove callback return void ARM: 9047/1: smp: remove unused variable ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores ARM: 9045/1: uncompress: Validate start of physical memory against passed DTB ARM: 9042/1: debug: no uncompress debugging while semihosting ARM: 9041/1: sti LL_UART: add STiH418 SBC UART0 support ARM: 9040/1: use DEBUG_UART_PHYS and DEBUG_UART_VIRT for sti LL_UART ARM: 9039/1: assembler: generalize byte swapping macro into rev_l
| * amba: Make the remove callback return voidUwe Kleine-König2021-02-021-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All amba drivers return 0 in their remove callback. Together with the driver core ignoring the return value anyhow, it doesn't make sense to return a value here. Change the remove prototype to return void, which makes it explicit that returning an error value doesn't work as expected. This simplifies changing the core remove callback to return void, too. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> # for drivers/memory Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com> # for hwtracing/coresight Acked-By: Vinod Koul <vkoul@kernel.org> # for dmaengine Acked-by: Guenter Roeck <linux@roeck-us.net> # for watchdog Acked-by: Wolfram Sang <wsa@kernel.org> # for I2C Acked-by: Takashi Iwai <tiwai@suse.de> # for sound Acked-by: Vladimir Zapolskiy <vz@mleia.com> # for memory/pl172 Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Link: https://lore.kernel.org/r/20210126165835.687514-5-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* | Merge branch 'i2c/for-5.12' of ↵Linus Torvalds2021-02-2232-2993/+764
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: - mostly driver updates. Bigger ones for mlxcpld and iproc. But most of them are all over the place. - removal of the efm32, sirf, u300, and zte zx bus drivers because of platform removal. So, we have a pleasant diffstat this time. - first set of cleanups in the I2C core as preparation to increase maximum length of SMBus transfers to 255 (as specified in the new standard). Better documentation of struct i2c_msg and its flags stand out here. - the testunit can now respond to SMBus block process calls which is the testcase when implementing the above new maximum length. * 'i2c/for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (62 commits) i2c: remove redundant error print in stm32f7_i2c_probe i2c: testunit: add support for block process calls i2c: busses: Replace spin_lock_irqsave with spin_lock in hard IRQ dt-bindings: eeprom: at24: Document ROHM BR24G01 i2c: i801: Add support for Intel Alder Lake PCH-P i2c: mv64xxx: Fix check for missing clock after adding RPM i2c: mux: mlxcpld: Add callback to notify mux creation completion i2c: mux: mlxcpld: Extend supported mux number i2c: mux: mlxcpld: Extend driver to support word address space devices i2c: mux: mlxcpld: Get rid of adapter numbers enforcement i2c: mux: mlxcpld: Prepare mux selection infrastructure for two-byte support i2c: mux: mlxcpld: Convert driver to platform driver i2c: imx: Synthesize end of transaction events without idle interrupts i2c: i2c-qcom-geni: Add shutdown callback for i2c i2c: mv64xxx: Add runtime PM support i2c: amd-mp2: Remove unused macro i2c: amd-mp2: convert to PCI logging functions i2c: mux: mlxcpld: Move header file out of x86 realm platform/x86: mlxcpld: Update module license i2c: mux: mlxcpld: Update module license ...
| * | i2c: remove redundant error print in stm32f7_i2c_probeMenglong Dong2021-02-121-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Coccinelle reports a redundant error print in stm32f7_i2c_probe. As 'platform_get_irq' already prints the error message, error print here is redundant and can be removed. Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: testunit: add support for block process callsWolfram Sang2021-02-121-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Devices offering SMBus block process calls are rare, so add it to the testunit. This is also a good test case for testing proper I2C_M_RECV_LEN flag handling of I2C bus masters emulating SMBus. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: busses: Replace spin_lock_irqsave with spin_lock in hard IRQWeihang Li2021-02-122-6/+4
| | | | | | | | | | | | | | | | | | | | | There is no need to do irqsave and irqrestore in context of hard IRQ. Signed-off-by: Weihang Li <liweihang@huawei.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: i801: Add support for Intel Alder Lake PCH-PJarkko Nikula2021-02-091-0/+4
| | | | | | | | | | | | | | | | | | | | | Add PCI ID of SMBus controller on Intel Alder Lake PCH-P. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mv64xxx: Fix check for missing clock after adding RPMSamuel Holland2021-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support"), error pointers to optional clocks were replaced by NULL to simplify the resume callback implementation. However, that commit missed that the IS_ERR check in mv64xxx_of_config should be replaced with a NULL check. As a result, the check always passes, even for an invalid device tree. Fixes: e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Add callback to notify mux creation completionVadim Pasternak2021-02-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add notification to inform caller that mux objects array has been created. It allows to user, invoked platform device registration for "i2c-mux-mlxcpld" driver, to be notified that mux infrastructure is available, and thus some devices could be connected to this infrastructure. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Extend supported mux numberVadim Pasternak2021-02-091-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to extend mux number supported by driver. Currently it is limited by eight, which is not enough for new coming Mellanox modular system with line cards, which require up to 64 mux support. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Reviewed-by: Michael Shych <michaelsh@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Extend driver to support word address space devicesVadim Pasternak2021-02-091-8/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend driver to allow I2C routing control through CPLD devices with word address space. Till now only CPLD devices with byte address space have been supported. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Reviewed-by: Michael Shych <michaelsh@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Get rid of adapter numbers enforcementVadim Pasternak2021-02-091-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not set the argument 'force_nr' of i2c_mux_add_adapter() routine, instead provide argument 'chan_id'. Rename mux ids array from 'adap_ids' to 'chan_ids'. The motivation is to prepare infrastructure to be able to: - Create only the child adapters which are actually needed - for which channel ids are specified. - To assign 'nrs' to these child adapters dynamically, with no 'nr' enforcement. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Prepare mux selection infrastructure for two-byte supportVadim Pasternak2021-02-091-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to program register value zero to the mux register, which is required for word address mux register space support. Change key selector type from 'unsigned short' to 'integer' in order to allow to set it to -1 on deselection. Rename key selector field from 'last_chan' to 'last_val', since this fields keeps actually selector value and not channel number. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Convert driver to platform driverVadim Pasternak2021-02-091-34/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert driver from 'i2c' to 'platform'. The motivation is to avoid I2C addressing conflict between ‘i2c-mux-cpld’ driver, providing mux selection and deselection through CPLD ‘mux control’ register, and CPLD host driver. The CPLD is I2C device and is multi-functional device performing logic for different components, like LED, ‘hwmon’, interrupt control, watchdog etcetera. For such configuration CPLD should be host I2C device, connected to the relevant I2C bus with the relevant I2C address and all others component drivers are supposed to be its children. The hierarchy in such case will be like in the below example: ls /sys/bus/i2c/devices/44-0032 i2c-mux-mlxcpld.44 leds-mlxreg.44 mlxreg-io.44 ls /sys/bus/i2c/devices/44-0032/i2c-mux-mlxcpld.44 channel-0, …, channel-X Currently this driver is not activated by any kernel driver, so this conversion doesn’t affect any user. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Reviewed-by: Michael Shych <michaelsh@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: imx: Synthesize end of transaction events without idle interruptsKevin Paul Herbert2021-02-011-7/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only the Layerscape SoCs have interrupts on bus idle, which facilitate sending events which complete slave bus transactions. Add support for synthesizing missing events. If we see a master request, or a newly addressed slave request, if the last event sent to the backend was I2C_SLAVE_READ_REQUESTED, send the backend a I2C_SLAVE_READ_PROCESSED followed by I2C_SLAVE_STOP. For all other events, send an I2C_SLAVE_STOP. Signed-off-by: Kevin Paul Herbert <kph@platinasystems.com> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: i2c-qcom-geni: Add shutdown callback for i2cRoja Rani Yarubandi2021-02-011-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the hardware is still accessing memory after SMMU translation is disabled (as part of smmu shutdown callback), then the IOVAs (I/O virtual address) which it was using will go on the bus as the physical addresses which will result in unknown crashes like NoC/interconnect errors. So, implement shutdown callback to i2c driver to stop on-going transfer and unmap DMA mappings during system "reboot" or "shutdown". Fixes: 37692de5d523 ("i2c: i2c-qcom-geni: Add bus driver for the Qualcomm GENI I2C controller") Signed-off-by: Roja Rani Yarubandi <rojay@codeaurora.org> Reviewed-by: Akash Asthana <akashast@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mv64xxx: Add runtime PM supportSamuel Holland2021-02-011-42/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To save power, gate the clock when the bus is inactive, during system sleep, and during shutdown. On some platforms, specifically Allwinner A13/A20, gating the clock implicitly resets the module as well. Since the module already needs to be reset after some suspend/resume cycles, it is simple enough to reset it during every runtime suspend/resume. Because the bus may be used by wakeup source IRQ threads, it needs to be functional as soon as IRQs are enabled. Thus, its system PM hooks need to run in the noirq phase. Signed-off-by: Samuel Holland <samuel@sholland.org> Tested-by: Ondrej Jirman <megous@megous.com> Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: amd-mp2: Remove unused macroRichard Neumann2021-02-011-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Remove unused work_amd_i2c_common() macro. Signed-off-by: Richard Neumann <mail@richard-neumann.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: amd-mp2: convert to PCI logging functionsRichard Neumann2021-02-013-37/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use pci_{info,warn,err,dbg} functions of the kernel's PCI API. Remove unnecessary ndev_pdev(), ndev_name() and ndev_dev() macros. While at it, remove useless __func__ from logging. Signed-off-by: Richard Neumann <mail@richard-neumann.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Move header file out of x86 realmVadim Pasternak2021-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move out header file from include/linux/platform_data/x86/ to include/linux/platform_data/, since it does not depend on x86 architecture. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Reviewed-by: Michael Shych <michaelsh@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: mux: mlxcpld: Update module licenseVadim Pasternak2021-02-011-30/+3
| | | | | | | | | | | | | | | | | | | | | | | | Update license to SPDX-License. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: smbus: improve naming in i2c_smbus_xfer_emulated()Wolfram Sang2021-01-281-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | This may be just taste, but I think 'nmsgs' is way more readable than a generic 'num' variable. Also, fix spaces around operators while here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: smbus: don't abuse loop variableWolfram Sang2021-01-281-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | Don't use 'i' to carry data, make a specific variable for it. After the move to memcpy recently, we can even remove 'i'. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | i2c: tegra: Use threaded interruptDmitry Osipenko2021-01-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to use threaded interrupt context in order to avoid checking of "are we in interrupt?" for the code that may sleep in the IRQ handler. I2C doesn't require a very low interrupt-handling latency, hence this change doesn't introduce any noticeable effects. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | Merge tag 'v5.11-rc5' into i2c/for-5.12Wolfram Sang2021-01-288-12/+74
| |\ \ | | | | | | | | | | | | Linux 5.11-rc5
| * | | i2c: remove zte zx bus driverArnd Bergmann2021-01-283-612/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The zte zx platform is getting removed, so this driver is no longer needed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: s3c2410: advertise SMBus transfers using RECV_LENWolfram Sang2021-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver implements I2C_M_RECV_LEN, so it can advertise the SMBus transfers needing it. This also enables client devices to check for the RECV_LEN capability. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: qup: advertise SMBus transfers using RECV_LENWolfram Sang2021-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver implements I2C_M_RECV_LEN, so it can advertise the SMBus transfers needing it. This also enables client devices to check for the RECV_LEN capability. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: algo: bit: use new macro to specifiy capabilitiesWolfram Sang2021-01-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's use the new macro for emulating SMBus with RECV_LEN support. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: remove u300 bus driverArnd Bergmann2021-01-223-1022/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ST-Ericsson U300 platform is getting removed, so this driver is no longer needed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: remove sirf bus driverArnd Bergmann2021-01-223-486/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CSR SiRF prima2/atlas platforms are getting removed, so this driver is no longer needed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Barry Song <baohua@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: stub: remove definition of DEBUGTom Rix2021-01-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Defining DEBUG should only be done in development. So remove DEBUG. Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: i2c-mux-gpio: Enable this driver in ACPI landEvan Green2021-01-171-28/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable i2c-mux-gpio devices to be defined via ACPI. The idle-state property translates directly to a fwnode_property_*() call. The child reg property translates naturally into _ADR in ACPI. The i2c-parent binding is a relic from the days when the bindings dictated that all direct children of an I2C controller had to be I2C devices. These days that's no longer required. The i2c-mux can sit as a direct child of its parent controller, which is where it makes the most sense from a hardware description perspective. For the ACPI implementation we'll assume that's always how the i2c-mux-gpio is instantiated. Signed-off-by: Evan Green <evgreen@chromium.org> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: i2c-mux-gpio: Factor out pdev->dev in _probe_dt()Evan Green2021-01-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out &pdev->dev into a local variable in preparation for the ACPI enablement of this function, which will utilize the variable more. Signed-off-by: Evan Green <evgreen@chromium.org> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: Drop unused efm32 bus driverUwe Kleine-König2021-01-173-477/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support for this machine was just removed, so drop the now unused i2c bus driver, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: smbus: switch from loops to memcpyDmitry Torokhov2021-01-111-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When copying memory from one buffer to another, instead of open-coding loops with byte-by-byte copies let's use memcpy() which might be a bit faster and makes intent more clear. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: mlxcpld: Add support for I2C bus frequency settingVadim Pasternak2021-01-061-1/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for I2C bus frequency setting according to the specific system capability. This capability is obtained from CPLD frequency setting register, which could be provided through the platform data. If such register is provided, it specifies minimal I2C bus frequency to be used for the devices attached to the I2C bus. Supported freqeuncies are 100KHz, 400KHz, 1MHz, while 100KHz is the default. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: busses: Use DEFINE_SPINLOCK() for spinlockZheng Yongjun2021-01-051-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: use DIV_ROUND_UP macro to do calculationZheng Yongjun2021-01-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't open-code DIV_ROUND_UP() kernel macro. Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Reviewed-by: Fabio Estevam <festevam@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: fix platform_get_irq.cocci warningsTian Tao2021-01-051-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove dev_err() messages after platform_get_irq*() failures. drivers/i2c/busses/i2c-hix5hd2.c:417:2-9: line 417 is redundant because platform_get_irq() already prints an error Signed-off-by: Tian Tao <tiantao6@hisilicon.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: gpio: fix MODULE_LICENCEWolfram Sang2021-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let MODULE_LICENCE match the SPDX header which is correctly based on the previous textual description. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: iproc: handle rx fifo full interruptRayagonda Kokatanur2021-01-051-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add code to handle IS_S_RX_FIFO_FULL_SHIFT interrupt to support master write request with >= 64 bytes. Iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes full. This can happen if master issues write request of more than 64 bytes. Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: iproc: handle master read requestRayagonda Kokatanur2021-01-051-45/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle single or multi byte master read request with or without repeated start. Fixes: c245d94ed106 ("i2c: iproc: Add multi byte read-write support for slave mode") Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: iproc: fix typo in slave_isr functionRayagonda Kokatanur2021-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix typo in bcm_iproc_i2c_slave_isr(). Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: iproc: update slave isr mask (ISR_MASK_SLAVE)Rayagonda Kokatanur2021-01-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update slave isr mask (ISR_MASK_SLAVE) to include remaining two slave interrupts. Fixes: c245d94ed106 ("i2c: iproc: Add multi byte read-write support for slave mode") Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
| * | | i2c: iproc: handle only slave interrupts which are enabledRayagonda Kokatanur2021-01-051-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handle only slave interrupts which are enabled. The IS_OFFSET register contains the interrupt status bits which will be set regardless of the enabling of the corresponding interrupt condition. One must therefore look at both IS_OFFSET and IE_OFFSET to determine whether an interrupt condition is set and enabled. Fixes: c245d94ed106 ("i2c: iproc: Add multi byte read-write support for slave mode") Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>