- Jun 12, 2013
-
-
Sonic Zhang authored
TWI transfer interrupts may be lost when system is heavily handling other interrupts, while current transfer handler depends on each accurate interrupt and misses some data in this case. Because there are 2 2-byte FIFOs in blackfin TWI controller, the occurrence of the data loss can be reduced by reading till the RX FIFO is empty and writing till the TX FIFO is full. Reported-by:
Bob Maris <mail@maris-ee.eu> Signed-off-by:
Sonic Zhang <sonic.zhang@analog.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Linus Walleij authored
This tries to address an issue found when writing an MFD driver for the Nomadik STw481x PMICs: as the platform is using device tree exclusively I want to specify the driver matching like this: static const struct of_device_id stw481x_match[] = { { .compatible = "st,stw4810", }, { .compatible = "st,stw4811", }, {}, }; static struct i2c_driver stw481x_driver = { .driver = { .name = "stw481x", .of_match_table = stw481x_match, }, .probe = stw481x_probe, .remove = stw481x_remove, }; However that turns out not to be possible: the I2C probe code is written so that the probe() call is always passed a match from i2c_match_id() using non-devicetree matches. This is probably why most devices using device tree for I2C clients currently will pass no .of_match_table *at all* but instead just use .id_table from struct i2c_driver to match the device. As you realize that means that the whole idea with compatible strings is discarded, and that is why we find strange device tree I2C device compatible strings like "product" instead of "vendor,product" as you could expect. Let's figure out how to fix this before the mess spreads. This patch will allow probeing devices with only an of_match_table as per above, and will pass NULL as the second argument to the probe() function. If the driver wants to deduce secondary info from the struct of_device_id .data field, it has to call of_match_device() on its own match table in the probe function device tree probe path. If drivers define both an .of_match_table *AND* a i2c_driver .id_table, the .of_match_table will take precedence, just as is done in the i2c_device_match() function in i2c-core.c. I2C devices probed from device tree should subsequently be fixed to handle the case where of_match_table() is used (I think none of them do that today), and platforms should fix their device trees to use compatible strings for I2C devices instead of setting the name to Linux device driver names as is done in multiple cases today. Cc: Rob Herring <rob.herring@calxeda.com> Cc: Grant Likely <grant.likely@linaro.org> Signed-off-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Jingoo Han authored
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Signed-off-by:
Jingoo Han <jg1.han@samsung.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Wolfram Sang authored
devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver. Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
If a process receives signal while it is waiting for I2C transfer to complete, an error is returned to the caller and the transfer is aborted. This can cause the driver to fail subsequent transfers. Also according to commit d295a86e (i2c: mv64xxx: work around signals causing I2C transactions to be aborted) I2C drivers aren't supposed to abort transactions on signals. To prevent this switch to use wait_for_completion_timeout() instead of wait_for_completion_interruptible_timeout() in the designware I2C driver. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by:
Christian Ruppert <christian.ruppert@abilis.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Fabio Estevam authored
Since commit ab78029e (drivers/pinctrl: grab default handles from device core), we can rely on device core for handling pinctrl. So remove devm_pinctrl_get_select_default() from the driver. Signed-off-by:
Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Fabio Estevam authored
Since commit ab78029e (drivers/pinctrl: grab default handles from device core), we can rely on device core for handling pinctrl. So remove devm_pinctrl_get_select_default() from the driver. Signed-off-by:
Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jun 05, 2013
-
-
Russell King authored
Asking for a multi-part message to be handled by this driver is racy; it has been observed that the following sequence is possible with this driver: - send start - send address + write - send data - send (repeated) start - send address + write - send (repeated) start - send address + read - unrecoverable bus hang (except by system reset) The problem is that the interrupt handling sees the next event after the first repeated start is sent - the IFLG bit is set in the register even though INTEN is disabled. Let's fix this by moving all of the message processing into interrupt context, rather than having it partly in IRQ and partly in process context. This allows us to move immediately to the next message in the interrupt handler and get on with the transfer, rather than incuring a couple of scheduling switches to get the next message. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
Move mv64xxx_i2c_prepare_for_io() higher up in the driver to avoid a future forward declaration for this function. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
As this driver does not advertise protocol mangling support (I2C_FUNC_PROTOCOL_MANGLING is not set), having code to act on I2C_M_NOSTART is illogical, and in any case isn't supportable on anything but the first message - which makes no sense. Remove the I2C_M_NOSTART code. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
Propagate the error code from request_irq() rather than ignoring it entirely. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
As we're changing to using devm_* APIs to fix various problems in this driver, lets also do devm_kzalloc() while we're here too. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
This driver forgets to use clk_put(). Rather than adding clk_put(), lets instead use devm_clk_get() to obtain this clock so that it's automatically handled on cleanup. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
Eliminate reg_base_p and reg_size, mv64xxx_i2c_unmap_regs() and an unchecked ioremap() return from this driver by using the devm_* API for requesting and ioremapping resources. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
mv64xxx_i2c_map_regs() already returns an error code, so lets propagate that to mv64xxx_i2c_probe()'s caller. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Acked-by:
Mark A. Greer <mgreer@animalcreek.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Andy Shevchenko authored
Moorestown support is removed from kernel and Medfield is supported by i2c-designware-pci. But i2c-intel-mid is still in upstream and community resources are wasted to maintain it. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- May 18, 2013
-
-
Wolfram Sang authored
devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver. Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Acked-by:
Stephen Warren <swarren@nvidia.com> Acked-by:
Barry Song <Baohua.Song@csr.com>
-
- May 17, 2013
-
-
Alexander Sverdlin authored
i2c: suppress lockdep warning on delete_device Since commit 846f9974 the following lockdep warning is thrown in case i2c device is removed (via delete_device sysfs attribute) which contains subdevices (e.g. i2c multiplexer): ============================================= [ INFO: possible recursive locking detected ] 3.8.7-0-sampleversion-fct #8 Tainted: G O --------------------------------------------- bash/3743 is trying to acquire lock: (s_active#110){++++.+}, at: [<ffffffff802b3048>] sysfs_hash_and_remove+0x58/0xc8 but task is already holding lock: (s_active#110){++++.+}, at: [<ffffffff802b3cb8>] sysfs_write_file+0xc8/0x208 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(s_active#110); lock(s_active#110); *** DEADLOCK *** May be due to missing lock nesting notation 4 locks held by bash/3743: #0: (&buffer->mutex){+.+.+.}, at: [<ffffffff802b3c3c>] sysfs_write_file+0x4c/0x208 #1: (s_active#110){++++.+}, at: [<ffffffff802b3cb8>] sysfs_write_file+0xc8/0x208 #2: (&adap->userspace_clients_lock/1){+.+.+.}, at: [<ffffffff80454a18>] i2c_sysfs_delete_device+0x90/0x238 #3: (&__lockdep_no_validate__){......}, at: [<ffffffff803dcc24>] device_release_driver+0x24/0x48 stack backtrace: Call Trace: [<ffffffff80575cc8>] dump_stack+0x8/0x34 [<ffffffff801b50fc>] __lock_acquire+0x161c/0x2110 [<ffffffff801b5c3c>] lock_acquire+0x4c/0x70 [<ffffffff802b60cc>] sysfs_addrm_finish+0x19c/0x1e0 [<ffffffff802b3048>] sysfs_hash_and_remove+0x58/0xc8 [<ffffffff802b7d8c>] sysfs_remove_group+0x64/0x148 [<ffffffff803d990c>] device_remove_attrs+0x9c/0x1a8 [<ffffffff803d9b1c>] device_del+0x104/0x1d8 [<ffffffff803d9c18>] device_unregister+0x28/0x70 [<ffffffff8045505c>] i2c_del_adapter+0x1cc/0x328 [<ffffffff8045802c>] i2c_del_mux_adapter+0x14/0x38 [<ffffffffc025c108>] pca954x_remove+0x90/0xe0 [pca954x] [<ffffffff804542f8>] i2c_device_remove+0x80/0xe8 [<ffffffff803dca9c>] __device_release_driver+0x74/0xf8 [<ffffffff803dcc2c>] device_release_driver+0x2c/0x48 [<ffffffff803dbc14>] bus_remove_device+0x13c/0x1d8 [<ffffffff803d9b24>] device_del+0x10c/0x1d8 [<ffffffff803d9c18>] device_unregister+0x28/0x70 [<ffffffff80454b08>] i2c_sysfs_delete_device+0x180/0x238 [<ffffffff802b3cd4>] sysfs_write_file+0xe4/0x208 [<ffffffff8023ddc4>] vfs_write+0xbc/0x160 [<ffffffff8023df6c>] SyS_write+0x54/0xd8 [<ffffffff8013d424>] handle_sys64+0x44/0x64 The problem is already known for USB and PCI subsystems. The reason is that delete_device attribute is defined statically in i2c-core.c and used for all devices in i2c subsystem. Discussion of original USB problem: http://lkml.indiana.edu/hypermail/linux/kernel/1204.3/01160.html Commit 356c05d5 introduced new macro to suppress lockdep warnings for this special case and included workaround for USB code. LKML discussion of the workaround: http://lkml.indiana.edu/hypermail/linux/kernel/1205.1/03634.html As i2c case is in principle the same, the same workaround could be used here. Signed-off-by:
Alexander Sverdlin <alexander.sverdlin@nsn.com> Acked-by:
Alan Stern <stern@rowland.harvard.edu> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Tejun Heo <tj@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Russell King authored
Do not use interruptible waits in an I2C driver; if a process uses signals (eg, Xorg uses SIGALRM and SIGPIPE) then these signals can cause the I2C driver to abort a transaction in progress by another driver, which can cause that driver to fail. I2C drivers are not expected to abort transactions on signals. Signed-off-by:
Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Jean Delvare authored
Duplicate the feature bits documentation in modinfo, as not every user will read the driver's source code or documentation file. Signed-off-by:
Jean Delvare <khali@linux-fr.org> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
This is the same controller as on Intel Lynxpoint but the ACPI ID is different (8086F41). Add support for this. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
If the I2C bus is put to a low power state by an ACPI method it might pull the SDA line low (as its power is removed). Once the bus is put to full power state again, the SDA line is pulled back to high. This transition looks like a STOP condition from the controller point-of-view which sets STOP detected bit in its status register causing the driver to fail subsequent transfers. Fix this by always clearing all interrupts before we start a transfer. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
Josef Ahmad authored
i2c_dw_xfer_msg() pushes a number of bytes to transmit/receive to/from the bus into the TX FIFO. For master-rx transactions, the maximum amount of data that can be received is calculated depending solely on TX and RX FIFO load. This is racy - TX FIFO may contain master-rx data yet to be processed, which will eventually land into the RX FIFO. This data is not taken into account and the function may request more data than the controller is actually capable of storing. This patch ensures the driver takes into account the outstanding master-rx data in TX FIFO to prevent RX FIFO overrun. Signed-off-by:
Josef Ahmad <josef.ahmad@linux.intel.com> Acked-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
- Apr 23, 2013
-
-
Steven A. Falco authored
The TX_FIFO register is 10 bits wide. The lower 8 bits are the data to be written, while the upper two bits are flags to indicate stop/start. The driver apparently attempted to optimize write access, by only writing a byte in those cases where the stop/start bits are zero. However, we have seen cases where the lower byte is duplicated onto the upper byte by the hardware, which causes inadvertent stop/starts. This patch changes the write access to the transmit FIFO to always be 16 bits wide. Signed off by: Steven A. Falco <sfalco@harris.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
-
송은봉 authored
HZ based value is better than a magic number. Signed-off-by:
Eunbong Song <eunb.song@samsung.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Apr 19, 2013
-
-
송은봉 authored
I've been debugging the abnormal operation of i2c on octeon. If a process is terminated by signal in the middle of i2c operation, next i2c read operation which is done by another process was failed. So i changed to ignore signal in the middle of i2c operation. After that the problem was not reproduced. Signed-off-by:
Eunbong Song <eunb.song@samsung.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Wolfram Sang authored
Driver core already takes care of refcounting, no need to do this on driver level again. Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Tested-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Wolfram Sang authored
Driver core already takes care of refcounting, no need to do this on driver level again. Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Tested-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Wolfram Sang authored
Driver core already takes care of refcounting, no need to do this on driver level again. Signed-off-by:
Wolfram Sang <wsa@the-dreams.de> Tested-by:
Sekhar Nori <nsekhar@ti.com>
-
- Apr 17, 2013
-
-
Doug Anderson authored
The i2c-arb-gpio-challenge driver implements an I2C arbitration scheme where masters need to claim the bus with a GPIO before they can start a transaction. This should generally only be used when standard I2C multimaster isn't appropriate for some reason (errata/bugs). This driver is based on code that Simon Glass added to the i2c-s3c2410 driver in the Chrome OS kernel 3.4 tree. The current incarnation as a mux driver is as suggested by Grant Likely. See <https://patchwork.kernel.org/patch/1877311/ > for some history. Signed-off-by:
Doug Anderson <dianders@chromium.org> Signed-off-by:
Simon Glass <sjg@chromium.org> Signed-off-by:
Naveen Krishna Chatradhi <ch.naveen@samsung.com> Reviewed-by:
Stephen Warren <swarren@nvidia.com> Acked-by:
Olof Johansson <olof@lixom.net> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Apr 16, 2013
-
-
Alexandre Courbot authored
GENERIC_GPIO is now equivalent to GPIOLIB and features that depended on GENERIC_GPIO can now depend on GPIOLIB to allow removal of this option. Signed-off-by:
Alexandre Courbot <acourbot@nvidia.com> Acked-by:
Linus Walleij <linus.walleij@linaro.org> Acked-by:
Grant Likely <grant.likely@secretlab.ca>
-
Ludovic Desroches authored
Use generic DMA DT helper. Platforms booting with or without DT populated are both supported. Signed-off-by:
Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by:
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Apr 15, 2013
-
-
Lucas Stach authored
In PIO mode we can end up with the same errors as in DMA mode, but as IRQs are disabled there we have to check for them manually after each command. Also don't use the big controller reset hammer when receiving a NAK from a slave. It's sufficient to tell the controller to continue at a clean state. Signed-off-by:
Lucas Stach <l.stach@pengutronix.de> Tested-by:
Marek Vasut <marex@denx.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Lucas Stach authored
This commit fixes the three following races in PIO code: - The CTRL0 register is racy in itself, when programming transfer state and run bit in the same cycle the hardware sometimes ends up using the state from the last transfer. Fix this by programming state in one cycle, make sure the write is flushed down APBX bus by reading back the reg and only then trigger the run bit. - Only clear the DMAREQ bit in DEBUG0 after the read/write to the data reg happened. Otherwise we are racing with the hardware about who touches the data reg first. - When checking for completion of a transfer it's not sufficient to check if the data engine finished, but also a check for i2c bus idle is needed. In PIO mode we are really fast to program the next transfer after a finished one, so the controller possibly tries to start a new transfer while the clkgen engine is still busy writing the NAK/STOP from the last transfer to the bus. Signed-off-by:
Lucas Stach <l.stach@pengutronix.de> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
Using autosuspend helps to reduce the resume latency in situations where another I2C message is going to be started soon. For example with HID over I2C touch panels we get several messages in a short period of time while the touch panel is in use. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
This is not an atomic context so there is no need to use mdelay() but instead use usleep_range(). Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
The correct way to disable or enable the controller is to wait until the DW_IC_ENABLE_STATUS register bit matches the bit we program into DW_IC_ENABLE register. This procedure is described in the DesignWare I2C databook. By doing this we can be sure that the controller is in correct state once the function returns. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Mika Westerberg authored
It is not good idea to mix static and dynamic I2C adapter numbering. In this particular case on Lynxpoint we had graphics I2C adapter which took the first numbers preventing the designware I2C driver from using the adapter numbers it preferred. Since Lynxpoint support was just introduced and there is no hardware available outside Intel we can fix this by switching to use dynamic adapter numbering instead of static. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Andy Shevchenko authored
This makes the error handling much more simpler than open-coding everything and in addition makes the probe function smaller an tidier. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-
Andy Shevchenko authored
With dev_err() we can get the device instance printed as well and is pretty much standard to use dev_* macros in the drivers anyway. In addition correct the indentation of probe() arguments. Signed-off-by:
Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Wolfram Sang <wsa@the-dreams.de>
-