- Nov 10, 2014
-
-
Fabio Estevam authored
According to Documentation/CodingStyle - Chapter 14: "The preferred form for passing a size of a struct is the following: p = kmalloc(sizeof(*p), ...); The alternative form where struct name is spelled out hurts readability and introduces an opportunity for a bug when the pointer variable type is changed but the corresponding sizeof that is passed to a memory allocator is not." So do it as recommeded. Signed-off-by:
Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Nov 07, 2014
-
-
Wolfram Sang authored
iowait is for blkio [1]. I2C shouldn't use it. [1] https://lkml.org/lkml/2014/11/3/317 Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Acked-by:
Ludovic Desroches <ludovic.desroches@atmel.com> Cc: stable@kernel.org
-
Wolfram Sang authored
We have a central copy of the GPL for that. Some addresses were already outdated. Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com>
-
- Oct 16, 2014
-
-
james.d.ralston@intel.com authored
This patch adds the I2C/SMBus Device IDs for the Intel Sunrise Point PCH. Signed-off-by:
James Ralston <james.d.ralston@intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Wei Yan authored
I2C drivers for hix5hd2 soc series, including following chipset Hi3716CV200, Hi3719CV100, Hi3718CV100, Hi3719MV100, Hi3718MV100. Signed-off-by:
Wei Yan <sledge.yanwei@huawei.com> Signed-off-by:
Zhangfei Gao <zhangfei.gao@linaro.org> [wsa: folded dt docs into this patch] Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Oct 06, 2014
-
-
Derek Basehore authored
Since the i2c bus can get wedged on the EC sometimes, set the number of retries to 3. Since we un-wedge the bus immediately after the wedge happens, this is the correct fix since only one transfer will fail. Signed-off-by:
Derek Basehore <dbasehore@chromium.org> Reviewed-by:
Doug Anderson <dianders@chromium.org> Acked-by:
Wolfram Sang <wsa@the-dreams.de> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Andrew Bresticker authored
Instead of having users of the ChromeOS EC call the interface-specific cmd_xfer() callback directly, introduce a central cros_ec_cmd_xfer() to use instead. This will allow us to put all the locking and retry logic in one place instead of duplicating it across the different drivers. Signed-off-by:
Andrew Bresticker <abrestic@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Lee Jones <lee.jones@linaro.org>
-
Fabio Estevam authored
In the case of errors during probe, we should disable i2c_imx->clk. Signed-off-by:
Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Carl Peng authored
Add support for AMD version of the DW I2C host controller. The device is enumerated from ACPI namespace with ACPI ID AMD0010. Because the core driver needs an input source clock, and this is not an Intel LPSS device where clocks are provided through drivers/acpi/acpi_lpss.c, we register the clock ourselves if the clock rate is given in ->driver_data Signed-off-by:
Carl Peng <carlpeng008@gmail.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
In order to be able to create missing clock for AMD (and in future possibly others) we move getting clock for the device a bit later. Also make ACPI/DT configuration in the same place depending on from where the device was enumerated from. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
There is no way in ACPI to tell in which speed the host controller is supposed to run, so we default to fast mode (400KHz). Since this has been the default all the time there should be no functional changes with this change. This is the first step required to refactor the driver probe so that we can supply source clock from ACPI part of the driver to the core. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Oct 03, 2014
-
-
Anders Berg authored
Add I2C bus driver for the controller found in the LSI Axxia family SoCs. The driver implements 10-bit addressing and SMBus transfer modes via emulation (including SMBus block data read). Signed-off-by:
Anders Berg <anders.berg@avagotech.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Naveen Krishna Ch authored
The HSI2C module on Exynos7 differs in the transfer status bits. Transfer status bits were moved to INT_ENABLE and INT_STATUS registers This patch adds support for the HSI2C module on Exynos7. 1. Implementes a "hw" field in the variant struct to distinguish the hardware. 2. Updates the dt-new compatible in dt-binding documenation Signed-off-by:
Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Janusz Użycki authored
i2cdetect scanned i2c bus slow because the i2c-mxs driver ignored the NO_SLAVE_ACK bit during busy-waiting loop. Thanks to the patch, the speedup happens. Signed-off-by:
Janusz Uzycki <j.uzycki@elproma.com.pl> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Andy Gross authored
The runtime pm calls need to be done before populating the children via the i2c_add_adapter call. If this is not done, a child can run into issues trying to do i2c read/writes due to the pm_runtime_sync failing. Signed-off-by:
Andy Gross <agross@codeaurora.org> Reviewed-by:
Felipe Balbi <balbi@ti.com> Acked-by:
Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
Alexandru M Stan authored
i2cdetect -q was broken (everything was a false positive, and no transfers were actually being sent over i2c). The way it works is by sending a 0 length write request and checking for NACK. This patch fixes the 0 length writes and actually sends them. Reported-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Alexandru M Stan <amstan@chromium.org> Tested-by:
Doug Anderson <dianders@chromium.org> Tested-by:
Max Schwarz <max.schwarz@online.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- Sep 30, 2014
-
-
Doug Anderson authored
In <https://lkml.org/lkml/2014/6/10/265> pointed out that the 10-bit flag in the cros_ec_tunnel was useless. It went into a 16-bit flags field but was defined at (1 << 16). Since we have no 10-bit i2c devices on the other side of the tunnel on any known devices this was never a problem. Until we do it makes sense to remove this code. On the EC side the code to handle this flag was removed in <https://chromium-review.googlesource.com/204162 >. Reported-by:
Dave Jones <davej@redhat.com> Signed-off-by:
Doug Anderson <dianders@chromium.org> Reviewed-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Sep 29, 2014
-
-
Sjoerd Simons authored
To enable the cros-ec-tunnel driver to be auto-loaded when build as a module add an of match table (and export it) to match the modalias information passed on to userspace as the Cros EC MFD driver registers the MFD subdevices with an of_compatibility string. Signed-off-by:
Sjoerd Simons <sjoerd.simons@collabora.co.uk> Reviewed-by:
Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Wolfram Sang authored
gcc rightfully says: drivers/i2c/busses/i2c-rcar.c:198:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by:
Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by:
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Fan Du authored
Software is allowed to allocate number of descriptor size from 2 to 256, this i2c controller could process more descriptor, but for i2c core soft ware layer, only one i2c transaction is allowed each time. So here switch to minimum 2 descriptor when initialization. Signed-off-by:
Fan Du <fan.du@intel.com> Acked-by:
Neil Horman <nhorman@tuxdriver.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Haibo Chen authored
According to the i.mx spec, for multimaster mode, if I2C is enabled when the bus is busy and asserts start, hardware inhibits the transmission, clears MSTA without signaling a stop, generate an interrupt, and set I2C_I2SR[IAL] to indicate a failed attempt to engage the bus, which means arbitration lost. In this case, we should first test I2C_I2SR[IAL], and clear this bit if it is set, and then I2C controller default to slave receive mode. This patch check the IAL bit every time before an I2c transmission. if IAL is set, clear it and make I2C controller to default mode. Signed-off-by:
Haibo Chen <haibo.chen@freescale.com> Acked-by:
Fugang Duan <B38611@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Doug Anderson authored
Having a transfer more than 32 bits is not all that unlikely. Remove the annotation. The unlikely in the IRQ handler can't gain us much. It's not in a loop, so at most it would save 1 instruction per IRQ, which isn't much. In fact on the compiler I tested it produced the exact same code. Remove it too. Suggested-by:
Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Sergei Shtylyov authored
Check if the ICMSR register (masked with the ICMIER register) evaluates to 0 in the driver's interrupt handler and return IRQ_NONE in that case, like many other drivers do. Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Sergei Shtylyov authored
rcar_i2c_prepare_msg() always returns 0, so we can make this function return *void* and thus remove the result check in rcar_i2c_master_xfer(). Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Sergei Shtylyov authored
rcar_i2c_master_xfer() needlessly compares the message pointers (using indirect addressing) in order to detect the last I2C message, while it's enough to only compare the message indexes. Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Tan, Raymond authored
Use the platform data to set the clk_freq when there is no DT configuration available. The clk_freq in turn will determine the I2C speed mode. In Quark, there is currently no other configuration mechanism other than board files. Signed-off-by:
Raymond Tan <raymond.tan@intel.com> Reviewed-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by:
Hock Leong Kweh <hock.leong.kweh@intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Romain Baeriswyl authored
Some legacy devices support ony I2C standard mode at 100kHz. This patch allows to select the standard mode through the DTS with the use of the existing clock-frequency parameter. When clock-frequency parameter is not set, the fast mode is selected. Only when the parameter is set at 100000, the standard mode is selected. Signed-off-by:
Romain Baeriswyl <romainba@abilis.com> Reviewed-by:
Christian Ruppert <christian.ruppert@abilis.com> Acked-by:
Alan Tull <atull@opensource.altera.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Sep 26, 2014
-
-
Masanari Iida authored
This patch fix spelling typos found in Kconfig. Signed-off-by:
Masanari Iida <standby24x7@gmail.com> Acked-by:
Randy Dunlap <rdunlap@infradead.org> Signed-off-by:
Jiri Kosina <jkosina@suse.cz>
-
- Sep 20, 2014
-
-
addy ke authored
I2C_CLKDIV register descripted in the previous version of RK3x chip manual is incorrect. Plus 1 is required. The correct formula: - T(SCL_HIGH) = T(PCLK) * (CLKDIVH + 1) * 8 - T(SCL_LOW) = T(PCLK) * (CLKDIVL + 1) * 8 - (SCL Divsor) = 8 * ((CLKDIVL + 1) + (CLKDIVH + 1)) - SCL = PCLK / (CLK Divsor) It will be updated to the latest version of chip manual. Signed-off-by:
Addy Ke <addy.ke@rock-chips.com> Reviewed-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
Janusz Użycki authored
If I2C_M_RD flag is set SELECT command is sent and afterward READ command. The patch fixes READ command to return READ failure error message instead of SELECT failure error message. Signed-off-by:
Janusz Uzycki <j.uzycki@elproma.com.pl> Acked-by:
Marek Vasut <marex@denx.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Fan Du authored
In block write mode, when encapsulating dma_buffer, first element is 'command', the rest is data buffer, so only copy actual data buffer starting from block[1] with the size indicating by block[0]. Signed-off-by:
Fan Du <fan.du@intel.com> Acked-by:
Neil Horman <nhorman@tuxdriver.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
Sergei Shtylyov authored
Bits 8-31 of all registers reflect the value of bits 0-7 on reads and should be 0 on writes, according to the manuals. RCAR_IRQ_ACK_{RECV|SEND} macros have all 1's in bits 8-31, thus going against the manuals, so fix them. Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Cc: stable@vger.kernel.org Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mikko Perttunen authored
Currently the i2c-tegra bus driver prepares, enables and set_rates its clocks separately for each transfer. This causes locking problems when doing I2C transfers from clock notifiers; see http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/268653.html This patch moves clk_prepare/unprepare and clk_set_rate calls to the probe function, leaving only clk_enable/disable to be done on each transfer. This solves the locking issue. Signed-off-by:
Mikko Perttunen <mperttunen@nvidia.com> Reviewed-by:
Stephen Warren <swarren@nvidia.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Sep 04, 2014
-
-
Sergei Shtylyov authored
This reverts commit 150b8be3. The I2C core's per-adapter locks can't protect from IRQs, so the driver still needs a spinlock to protect the register accesses. Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Cc: stable@vger.kernel.org # 3.16+ Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Sep 02, 2014
-
-
Marek Roszko authored
The driver was not bound checking the received length byte to ensure it was within the the buffer size that is allocated for SMBus blocks. This resulted in buffer overflows whenever an invalid length byte was received. It also failed to ensure the length byte was not zero. If it received zero, it would end up in an infinite loop as the at91_twi_read_next_byte function returned immediately without allowing RHR to be read to clear the RXRDY interrupt. Tested agaisnt a SMBus compliant battery. Signed-off-by:
Marek Roszko <mark.roszko@gmail.com> Acked-by:
Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
addy ke authored
In rk3x SOC, the I2C controller can receive/transmit up to 32 bytes data in one chunk, so the size of data to be write/read to/from TXDATAx/RXDATAx must be less than or equal 32 bytes at a time. Tested on rk3288-pinky board, elan receive 158 bytes data. Signed-off-by:
Addy Ke <addy.ke@rock-chips.com> Acked-by:
Max Schwarz <max.schwarz@online.de> Reviewed-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
Simon Lindgren authored
There is a race condition in at91_do_twi_xfer when signals arrive. If a signal is recieved while waiting for a transfer to complete wait_for_completion_interruptible_timeout() will return -ERESTARTSYS. This is not handled correctly resulting in interrupts still being enabled and a transfer being in flight when we return. Symptoms include a range of oopses and bus lockups. Oopses can happen when the transfer completes because the interrupt handler will corrupt the stack. If a new transfer is started before the interrupt fires the controller will start a new transfer in the middle of the old one, resulting in confused slaves and a locked bus. To avoid this, use wait_for_completion_io_timeout instead so that we don't have to deal with gracefully shutting down the transfer and disabling the interrupts. Signed-off-by:
Simon Lindgren <simon@aqwary.com> Acked-by:
Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
Chen-Yu Tsai authored
The "clock-frequency" DT property is listed as optional, However, the current code stores the return value of of_property_read_u32 in the return code of mv64xxx_of_config, but then forgets to clear it after setting the default value of "clock-frequency". It is then passed out to the main probe function, resulting in a probe failure when "clock-frequency" is missing. This patch checks and then throws away the return value of of_property_read_u32, instead of storing it and having to clear it afterwards. This issue was discovered after the property was removed from all sunxi DTs. Fixes: 4c730a06 ("i2c: mv64xxx: Set bus frequency to 100kHz if clock-frequency is not provided") Signed-off-by:
Chen-Yu Tsai <wens@csie.org> Cc: stable@vger.kernel.org Acked-by:
Andrew Lunn <andrew@lunn.ch> Acked-by:
Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Sergei Shtylyov authored
Sometimes the MNR and MST interrupts happen simultaneously (stop automatically follows NACK, according to the manuals) and in such case the ID_NACK flag isn't set since the MST interrupt handling precedes MNR and all interrupts are cleared and disabled then, so that MNR interrupt is never noticed -- this causes NACK'ed transfers to be falsely reported as successful. Exchanging MNR and MST handlers fixes this issue, however the MNR bit somehow gets set again even after being explicitly cleared, so I decided to completely suppress handling of all disabled interrupts (which is a good thing anyway)... Signed-off-by:
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Cc: stable@vger.kernel.org Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Aug 26, 2014
-
-
Masanari Iida authored
This patch fix spelling typo in printk within vairous part of the code. Signed-off-by:
Masanari Iida <standby24x7@gmail.com> Acked-by:
Randy Dunlap <rdunlap@infradead.org> Signed-off-by:
Jiri Kosina <jkosina@suse.cz>
-