summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-meson.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: meson: implement the master_xfer_atomic callbackMartin Blumenstingl2020-01-131-32/+65
| | | | | | | | | | | | | | | | | | | Boards with some of the 32-bit SoCs (mostly Meson8 and Meson8m2) use a Ricoh RN5T618 PMU which acts as system power controller. The driver for the system power controller may need to the I2C bus just before shutting down or rebooting the system. At this stage the interrupts may be disabled already. Implement the master_xfer_atomic callback so the driver for the RN5T618 PMU can communicate properly with the PMU when shutting down or rebooting the board. The CTRL register has a status bit which can be polled to determine when processing has completed. According to the public S805 datasheet the value 0 means "idle" and 1 means "running". Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> [wsa: converted some whitespace alignment] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner2019-06-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* i2c: meson: update doc description to fix build warningsYixun Lan2018-01-261-1/+1
| | | | | | | | | | | | | | Add description for 'data' parameter and drop unused 'irq' memeber. Here is the warnings: drivers/i2c/busses/i2c-meson.c:103: warning: No description found for parameter 'data' drivers/i2c/busses/i2c-meson.c:103: warning: Excess struct member 'irq' description in 'meson_i2c' Reported-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: add configurable divider factorsJian Hu2018-01-241-4/+28
| | | | | | | | | | | This patch try to add support for I2C controller in Meson-AXG SoC, Due to the IP changes between I2C controller, we need to introduce a compatible data to make the divider factor configurable. Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Jian Hu <jian.hu@amlogic.com> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: improve and simplify interrupt handlerHeiner Kallweit2017-03-301-30/+10
| | | | | | | | The preceding changes in this patch series now allow to simplify the interrupt handler significantly. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: remove meson_i2c_write_tokensHeiner Kallweit2017-03-301-10/+4
| | | | | | | | | | meson_i2c_write_tokens is always called directly after meson_i2c_prepare_xfer (and only then). So we can simplify the code by removing meson_i2c_write_tokens and moving the two statements of meson_i2c_write_tokens to the end of meson_i2c_prepare_xfer. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: don't create separate token chain just for the stop commandHeiner Kallweit2017-03-301-18/+5
| | | | | | | | | | We can directly add the stop token to the token chain including the last transfer chunk. This is more efficient than creating a separate token chain just for the stop command. And it allows us to get rid of state STATE_STOP completely. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: improve interrupt handler and detect spurious interruptsHeiner Kallweit2017-03-301-4/+7
| | | | | | | | | | | | | | | | If state is STATE_IDLE no interrupt should occur. Return IRQ_NONE if such a spurious interrupt is detected. Not having to take care of STATE_IDLE later in the interrupt handler allows to further simplify the interrupt handler in subsequent patches of this series. In addition move resetting REG_CTRL_START bit to the start of the interrupt handler to ensure that the start bit is always reset. Currently the start bit is not reset for STATE_STOP because i2c->state is set to STATE_IDLE. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: remove variable count from meson_i2c_xferHeiner Kallweit2017-03-301-3/+2
| | | | | | | Variable count has always the same value as i, so we don't need it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: use full 12 bits for clock dividerHeiner Kallweit2017-03-301-2/+14
| | | | | | | | | | | | The clock divider has 12 bits, splitted into a 10 bit field and a 2 bit field. The extra 2 bits aren't used currently. Change this to use the full 12 bits and warn if the requested frequency is too low. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: use i2c core for DT clock-frequency parsingHeiner Kallweit2017-03-301-5/+3
| | | | | | | | | | We don't have to parse the DT manually to retrieve the bus frequency and we don't have to maintain an own default for the bus frequency. Let the i2c core do this for us. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: set clock divider in probe instead of setting it for each transferHeiner Kallweit2017-03-301-9/+8
| | | | | | | | | The bus frequency is fixed to what is set DT, therefore we can set the clock divider in probe already and we don't have to set it for each transfer. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: remove member irq from struct meson_i2cHeiner Kallweit2017-03-301-7/+5
| | | | | | | | | Member irq can be replaced with a local variable in probe because it's nowhere else accessed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: use min instead of min_t where min_t isn't neededHeiner Kallweit2017-03-301-5/+5
| | | | | | | Use min instead of min_t where min_t isn't needed. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: fix wrong variable usage in meson_i2c_put_dataHeiner Kallweit2017-03-081-1/+1
| | | | | | | | | Most likely a copy & paste error. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Fixes: 30021e3707a7 ("i2c: add support for Amlogic Meson I2C controller")
* i2c: meson: add gxbb compatible stringNeil Armstrong2016-09-151-0/+1
| | | | | | | Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Acked-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: don't print error when adding adapter failsWolfram Sang2016-08-221-1/+0
| | | | | | | | | | | | | | | | | The core will do this for us now. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Peter Korsgaard <peter@korsgaard.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Acked-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: Use complete() instead of complete_all()Daniel Wagner2016-08-151-3/+3
| | | | | | | | | | | | | | | | | | There is only one waiter for the completion, therefore there is no need to use complete_all(). Let's make that clear by using complete() instead of complete_all(). The usage pattern of the completion is: meson_i2c_xfer_msg() reinit_completion() ... /* Start the transfer */ ... wait_for_completion_timeout() Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: meson: Fix module autoload for OF platform driverLuis de Bethencourt2015-10-201-0/+1
| | | | | | | | This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: add support for Amlogic Meson I2C controllerBeniamino Galvani2014-11-181-0/+492
This is a driver for the I2C controller found in Amlogic Meson SoCs. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>