- Jan 15, 2019
-
-
Oleksij Rempel authored
Improve the error handling in i2c_imx_dma_request() and let it return an error indication that the caller then can handle accordingly. Signed-off-by:
Oleksij Rempel <o.rempel@pengutronix.de> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Oleksij Rempel authored
At least on i.MX5x, the DMA events for I2C and SDHC use the same channel and there can only be a single user. So in this case there should be no message emitted that looks like an error if the I2C device doesn't have an assigned DMA channel. In contrast real problems that were only emitted at debug level before should be described at a higher level to be better visible and so understandable. Signed-off-by:
Oleksij Rempel <o.rempel@pengutronix.de> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Nov 27, 2018
-
-
Lucas Stach authored
Probe deferral is a normal operating condition in the probe function, so don't spam the log with an error in this case. Signed-off-by:
Lucas Stach <l.stach@pengutronix.de> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Aug 20, 2018
-
-
Esben Haabendal authored
Always update the stopped state when busy status have been checked. This is identical to what was done before, with the exception of error handling. Without this change, some errors cause the stopped state to be left in incorrect state in i2c_imx_stop(), i2c_imx_dma_read(), i2c_imx_read() and i2c_imx_xfer(). Signed-off-by:
Esben Haabendal <eha@deif.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Esben Haabendal authored
This fixes a race condition, where the DMAEN bit ends up being set after I2C slave has transmitted a byte following the dummy read. When that happens, an interrupt is generated instead, and no DMA request is generated to kickstart the DMA read, and a timeout happens after DMA_TIMEOUT (1 sec). Fixed by setting the DMAEN bit before the dummy read. Signed-off-by:
Esben Haabendal <eha@deif.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- Jul 24, 2018
-
-
Wolfram Sang authored
I2C is open drain, so request the GPIO accordingly, even if pinmux did set it up correctly for in-kernel users in this case. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by:
Lucas Stach <l.stach@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jul 23, 2018
-
-
Esben Haabendal authored
Make sure to call reinit_completion() before dma is started to avoid race condition where reinit_completion() is called after complete() and before wait_for_completion_timeout(). Signed-off-by:
Esben Haabendal <eha@deif.com> Fixes: ce1a7884 ("i2c: imx: add DMA support for freescale i2c driver") Reviewed-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- May 29, 2018
-
-
Peter Rosin authored
Because it looks neater. For diolan, this allows factoring out some code that is now common between if and else. For eg20t, pch_i2c_writebytes is always called with a write in msgs->flags, and pch_i2c_readbytes with a read. For imx, i2c_imx_dma_write and i2c_imx_write are always called with a write in msgs->flags, and i2c_imx_read with a read. For qup, qup_i2c_write_tx_fifo_v1 is always called with a write in qup->msg->flags. For stu300, also restructure debug output for resends, since that code as a result is only handling debug output. Reviewed-by: Guenter Roeck <linux@roeck-us.net> [diolan] Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [efm32 and imx] Acked-by: Linus Walleij <linus.walleij@linaro.org> [stu300] Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- May 24, 2018
-
-
Fabio Estevam authored
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by:
Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Apr 03, 2018
-
-
Lucas Stach authored
This is unsafe, as the runtime PM callbacks are called from the PM workqueue, so this may deadlock when handling an i2c attached clock, which may already hold the clk_prepare mutex from another context. Signed-off-by:
Lucas Stach <l.stach@pengutronix.de> Reviewed-by:
Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Lucas Stach authored
Instead of repeatedly calling clk_get_rate for each transfer, register a clock notifier to update the cached divider value each time the clock rate actually changes. Signed-off-by:
Lucas Stach <l.stach@pengutronix.de> Reviewed-by:
Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Dec 12, 2017
-
-
Linus Walleij authored
<linux/of_gpio.h> is not used in this file, by <linux/gpio/consumer.h> is. Someone is just lucky with their implicit includes. Signed-off-by:
Linus Walleij <linus.walleij@linaro.org> Reviewed-by:
Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Dec 07, 2017
-
-
Wolfram Sang authored
When converting to GPIOD, the GPIO directions of SCL/SDA have been swapped. Fix it! Fixes: ad36a279 ("i2c: imx: switch to using gpiod for bus recovery gpios") Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by:
Phil Reid <preid@electromag.com.au> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Nov 27, 2017
-
-
Phil Reid authored
Change the driver to use the gpio descriptors for the bus recovery information instead of the deprecated integer interface. Reviewed-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Phil Reid <preid@electromag.com.au> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Oct 13, 2017
-
-
Clemens Gruber authored
The arguments for SDA and SCL were swapped. Fix it. Signed-off-by:
Clemens Gruber <clemens.gruber@pqgruber.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Wei Jinhua authored
Some SoC share one irq number between I2C controllers. For example, on the LS2088 board, I2C 1 and I2C 2 share one irq number. In this case, only one I2C controller can register successfully, and others will fail. Signed-off-by:
Wei Jinhua <wei.jinhua1@zte.com.cn> Reviewed-by:
Jiang Biao <jiang.biao2@zte.com.cn> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jun 22, 2017
-
-
Michail Georgios Etairidis authored
The i2c-imx driver incorrectly uses readb()/writeb() to read and write to the appropriate registers when performing a repeated start. The appropriate imx_i2c_read_reg()/imx_i2c_write_reg() functions should be used instead. Performing a repeated start results in a kernel panic. The platform is imx. Signed-off-by:
Michail G Etairidis <m.etairidis@beck-ipc.com> Fixes: ce1a7884 ("i2c: imx: add DMA support for freescale i2c driver") Fixes: 054b62d9 ("i2c: imx: fix the i2c bus hang issue when do repeat restart") Acked-by:
Fugang Duan <fugang.duan@nxp.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Feb 09, 2017
-
-
Bhumika Goyal authored
Declare i2c_algorithm structures as const as they are only stored in the algo field of an i2c_adapter structure. This field is of type const, so i2c_algorithm structures having this property can be made const too. Signed-off-by:
Bhumika Goyal <bhumirks@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> for Acked-by:
Patrice Chotard <patrice.chotard@st.com> Acked-by:
Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by:
Jean Delvare <jdelvare@suse.de> Acked-by:
Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Oct 25, 2016
-
-
Stefan Agner authored
Some SoC might load the GPIO driver after the I2C driver and using the I2C bus recovery mechanism via GPIOs. In this case it is crucial to defer probing if the GPIO request functions do so, otherwise the I2C driver gets loaded without recovery mechanisms enabled. Signed-off-by:
Stefan Agner <stefan@agner.ch> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by:
Li Yang <leoyang.li@nxp.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- Sep 15, 2016
-
-
Yang Li authored
Since commit 1c4b6c3b ("i2c: imx: implement bus recovery") the driver starts to use gpio/pinctrl to support optional bus recovery feature. But pinctrl is not always usable. There are platforms such as ls1021a and ls1043a that don't support pinctrl, and it could just be broken due to old/broken device tree. The patch makes it really optional that the probe function won't bailout on pinctrl problems instead it just disables bus recovery and prints out notification when there is problem with pinctrl. Since pinctrl is only used by bus recovery in this driver, move pinctrl initialization into bus recovery init function to prevent confusion. Signed-off-by:
Li Yang <leoyang.li@nxp.com> Acked-by:
Linus Walleij <linus.walleij@linaro.org> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Aug 22, 2016
-
-
Wolfram Sang authored
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>
-
- Apr 26, 2016
-
-
Oleksij Rempel authored
Documentation/timers/timers-howto.txt recommends to use usleep_range on delays > 10usec. According to my test results with Neonode zForce touchscreen driver, usleep_range indeed reduces CPU load. Stats collected with "./perf record -a -g -F 1000 sleep 10" i2c-imx with udelay(50): 34.19% 0.00% irq/220-Neonode [kernel.kallsyms] [k] irq_thread ---irq_thread |--33.75%--irq_thread_fn | |--19.27%--0x7f08a878 | | i2c_master_recv | | i2c_transfer | | __i2c_transfer | | i2c_imx_xfer | | |--11.71%--i2c_imx_trx_complete | | |--5.70%--i2c_imx_start <<<<---------------- | | | |--5.38%--__timer_const_udelay | | | | __timer_delay | | | | --5.07%--read_current_timer i2c-imx with usleep_range(50,100) 29.08% 0.00% irq/220-Neonode [kernel.kallsyms] [k] irq_thread ---irq_thread |--28.89%--irq_thread_fn | |--17.21%--0x7f08a878 | | i2c_master_recv | | |--17.14%--i2c_transfer | | | __i2c_transfer | | | i2c_imx_xfer | | | |--14.29%--i2c_imx_trx_complete | | | |--1.42%--i2c_imx_start <<<<---------- | | | | |--0.71%--usleep_range | | | | |--0.53%--i2c_imx_bus_busy Signed-off-by:
Oleksij Rempel <linux@rempel-privat.de> Signed-off-by:
Dirk Behme <dirk.behme@de.bosch.com> Reviewed-by:
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Mar 03, 2016
-
-
Dmitriy Baranov authored
Signed-off-by:
Dmitriy Baranov <dbaranov@dev.rtsoft.ru> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jan 10, 2016
-
-
Gao Pan authored
In i2c_imx_dma_xfer(), when dmaengine_submit() returns error, the context goto label err_submit and then return. However, the memory allocated for txdesc has not been freed yet, which leads to resource leak. Signed-off-by:
Gao Pan <b54642@freescale.com> Signed-off-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jan 04, 2016
-
-
Fabio Estevam authored
These multi-lines comments do not follow the standard kernel coding style. In fact, they are not useful comments, so get rid of them. Signed-off-by:
Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jan 03, 2016
-
-
Gao Pan authored
Replace of_get_named_gpio_flags with of_get_named_gpio because the latter has less parameters, which improves code readability. Signed-off-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Gao Pan <b54642@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Fabio Estevam authored
When DMA cannot be used, it is better to state that the I2C controller will operate in PIO mode. Signed-off-by:
Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Gao Pan authored
In our former i2c driver, i2c clk is enabled and disabled in xfer function, which contributes to power saving. However, the clk enable process brings a busy wait delay until the core is stable. As a result, the performance is sacrificed. To weigh the power consumption and i2c bus performance, runtime pm is the good solution for it. The clk is enabled when a i2c transfer starts, and disabled after a specifically defined delay. If CONFIG_PM is disabled the net result of this patch is that the clock is never disabled. Without the patch the test case (many eeprom reads) executes with approx: real 1m7.735s user 0m0.488s sys 0m20.040s With the patch the same test case (many eeprom reads) executes with approx: real 0m54.241s user 0m0.440s sys 0m5.920s Signed-off-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Gao Pan <b54642@freescale.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [wsa: sorted includes] Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Gao Pan authored
During driver probe, i2c_imx_init_recovery_info() must come before i2c_add_numbered_adapter(), because the get/set_scl() functions are assigned in i2c_register_adapter() under the conditon that bus recover_info are initialized. Otherwise, get/set_scl() function pointers never get assigned. In such case, when i2c_generic_gpio_recovery() is used for bus recovery, there will be kernel crash because bri->set_scl is NULL. The solution to this bug is moving i2c_imx_init_recovery_info() before i2c_register_adapter(). Signed-off-by:
Gao Pan <b54642@freescale.com> Signed-off-by:
Fugang Duan <B38611@freescale.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- Dec 09, 2015
-
-
Gao Pan authored
During driver probe, i2c_imx_init_recovery_info() must come before i2c_add_numbered_adapter(), because the get/set_scl() functions are assigned in i2c_register_adapter() under the conditon that bus recover_info are initialized. Otherwise, get/set_scl() function pointers never get assigned. In such case, when i2c_generic_gpio_recovery() is used for bus recovery, there will be kernel crash because bri->set_scl is NULL. The solution to this bug is moving i2c_imx_init_recovery_info() before i2c_register_adapter(). Signed-off-by:
Gao Pan <b54642@freescale.com> Signed-off-by:
Fugang Duan <B38611@freescale.com> Acked-by:
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- Nov 20, 2015
-
-
Hou Zhiqiang authored
drivers/i2c/busses/i2c-imx.c:978:2: error: implicit declaration of function ‘pinctrl_select_state’ [-Werror=implicit-function-declaration] pinctrl_select_state(i2c_imx->pinctrl, i2c_imx->pinctrl_pins_gpio); ^ Signed-off-by:
Hou Zhiqiang <Zhiqiang.Hou@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Oct 23, 2015
-
-
Fabio Estevam authored
According to Documentation/i2c/fault-codes the response to a bus NACK should be -ENXIO, so fix the error code. Signed-off-by:
Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Gao Pan authored
Implement bus recovery methods for i2c-imx so we can recover from situations where SCL/SDA are stuck low. Once i2c bus SCL/SDA are stuck low during transfer, config the i2c pinctrl to gpio mode by calling pinctrl sleep set function, and then use GPIO to emulate the i2c protocol to send nine dummy clock to recover i2c device. After recovery, set i2c pinctrl to default group setting. Signed-off-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Gao Pan <b54642@freescale.com> Signed-off-by:
Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- May 12, 2015
-
-
Krzysztof Kozlowski authored
The platform_device_id is not modified by these drivers and core uses it as const. Signed-off-by:
Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Mar 15, 2015
-
-
Nicholas Mc Guire authored
return type of wait_for_completion_timeout is unsigned long not int. An appropriate variable of type unsigned long is introduced and the assignments fixed up. Signed-off-by:
Nicholas Mc Guire <hofrat@osadl.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jan 22, 2015
-
-
Philipp Zabel authored
This patch fixes up some whitespace issues and addresses a few checkpatch warnings. Signed-off-by:
Philipp Zabel <p.zabel@pengutronix.de> Acked-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jan 14, 2015
-
-
Philipp Zabel authored
The ret variable is set and never used in the error path of i2c_imx_dma_request. Signed-off-by:
Philipp Zabel <p.zabel@pengutronix.de> Acked-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jan 13, 2015
-
-
Nicholas Mc Guire authored
wait_for_completion_timeout does not return negative values so "result" handling here should be simplified to cover the actually possible cases only. Signed-off-by:
Nicholas Mc Guire <der.herr@hofr.at> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Nov 19, 2014
-
-
Wolfram Sang authored
Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Acked-by:
Yao Yuan <yao.yuan@freescale.com>
-
- Nov 18, 2014
-
-
Yao Yuan authored
Add dma support for i2c. This function depend on DMA driver. You can turn on it by write both the dmas and dma-name properties in dts node. DMA is optional, even DMA request unsuccessfully, i2c can also work well. Signed-off-by:
Yuan Yao <yao.yuan@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-