summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-at91.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: at91: add support for the HOLD fieldLudovic Desroches2015-12-031-3/+50
| | | | | | | | | | | The hold field allows to configure the data hold time which can be set with the help of the generic binding 'i2c-sda-hold-time-ns'. This feature has been introduced with SAMA5D4 SoC family. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: manage unexpected RXRDY flag when starting a transferLudovic Desroches2015-10-261-10/+26
| | | | | | | | | | | | | | | In some cases, we could start a new i2c transfer with the RXRDY flag set. It is not a clean state and it leads to print annoying error messages even if there no real issue. The cause is only having garbage data in the Receive Holding Register because of a weird behavior of the RXRDY flag. Reported-by: Peter Rosin <peda@lysator.liu.se> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Peter Rosin <peda@lysator.liu.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Fixes: 93563a6a71bb ("i2c: at91: fix a race condition when using the DMA controller") Cc: stable@vger.kernel.org #4.1
* i2c: at91: fix write transfers by clearing pending interrupt firstCyrille Pitchen2015-10-221-8/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases a NACK interrupt may be pending in the Status Register (SR) as a result of a previous transfer. However at91_do_twi_transfer() did not read the SR to clear pending interruptions before starting a new transfer. Hence a NACK interrupt rose as soon as it was enabled again at the I2C controller level, resulting in a wrong sequence of operations and strange patterns of behaviour on the I2C bus, such as a clock stretch followed by a restart of the transfer. This first issue occurred with both DMA and PIO write transfers. Also when a NACK error was detected during a PIO write transfer, the interrupt handler used to wrongly start a new transfer by writing into the Transmit Holding Register (THR). Then the I2C slave was likely to reply with a second NACK. This second issue is fixed in atmel_twi_interrupt() by handling the TXRDY status bit only if both the TXCOMP and NACK status bits are cleared. Tested with a at24 eeprom on sama5d36ek board running a linux-4.1-at91 kernel image. Adapted to linux-next. Reported-by: Peter Rosin <peda@lysator.liu.se> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Peter Rosin <peda@lysator.liu.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Fixes: 93563a6a71bb ("i2c: at91: fix a race condition when using the DMA controller") Cc: stable@vger.kernel.org #4.1
* i2c: at91: fix code checker warningsCyrille Pitchen2015-06-111-3/+3
| | | | | | | | | buf_len is a size_t, so unsigned, but was tested with '<= 0'. Reported-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: add support to FIFOsCyrille Pitchen2015-06-101-17/+130
| | | | | | | | | | | | | | When FIFOs are available and enabled, the driver now configures the Atmel eXtended DMA Controller to perform word accesses instead of byte accesses when possible. The actual access width depends on the size of the buffer to transmit. To enable FIFO support the "atmel,fifo-size" property must be set properly in the I2C controller node of the device tree. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: print hardware versionCyrille Pitchen2015-06-101-1/+4
| | | | | | | | | | The probe() function now prints the hardware version of the I2C controller. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> [wsa: s/version/hw version/] for clarity] Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: add support for new alternative command modeCyrille Pitchen2015-06-101-20/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The alternative command mode was introduced to simplify the transmission of STOP conditions and to solve timing and latency issues around them. This mode relies on a new register, the Alternative Command Register, which must be set at the same time as the Master Mode Register. This new register was designed to allow simple setup of basic combined transactions built from up to two unitary transactions. Indeed, the ACR is split into two areas, which describe one unitary transaction each. Each area is filled with Data Length 8bit counter, a Direction and a PEC Request bit. The PEC bit is only used in SMBus mode and is not supported by this driver yet. Also when using alternative command mode, the MREAD bit from the Master Mode Register is ignored. Instead the Direction bits from ACR are used to setup the direction, read or write, of each unitary transaction. Finally the 8bit counters must filled with the data length of their respective transaction. Then if only one transaction is to be used, the data length of the second one must be set to zero. At the moment, this driver uses only the first transaction. In addition to MMR and ACR, the Control Register also need to be written to enable the alternative command mode. That's the purpose of its ACMEN bit, which stands for Alternative Command Mode Enable. Note that the alternative command mode is compatible with the use of the Internal Address Register. So combined transactions for eeprom read are actually implemented with the Internal Address Register. This register is written with up to 3 bytes, which are the internal address sent to the slave through the first write transaction. Then the first area of the ACR describe the write transaction to follow, which carries the data to be read from the eeprom. The second area of the ACR is not used so its Data Length 8bit counter is cleared. For each byte sent or received by the device, the Data Length 8bit counter is decremented. When it reaches 0, a STOP condition is automatically sent. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: use BIT() macro to define register bitsCyrille Pitchen2015-06-101-14/+15
| | | | | | | | | This patch just fixes typo before applying later patches which will use register bits with index above 16. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: fix a race condition when using the DMA controllerCyrille Pitchen2015-06-101-17/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For TX transactions, the TXCOMP bit in the Status Register is cleared when the first data is written into the Transmit Holding Register. In the lines from at91_do_twi_transfer(): at91_twi_write_data_dma(dev); at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); the TXCOMP interrupt may be enabled before the DMA controller has actually started to write into the THR. In such a case, the TXCOMP bit is still set into the Status Register so the interrupt is triggered immediately. The driver understands that a transaction completion has occurred but this transaction hasn't started yet. Hence the TXCOMP interrupt is no longer enabled by at91_do_twi_transfer() but instead by at91_twi_write_data_dma_callback(). Also, the TXCOMP bit in the Status Register in not a clear on read flag but a snapshot of the transmission state at the time the Status Register is read. When a NACK error is dectected by the I2C controller, the TXCOMP, NACK and TXRDY bits are set together to 1 in the SR. If enabled, the TXCOMP interrupt is triggered at the same time. Also setting the TXRDY to 1 triggers the DMA controller to write the next data into the THR. Such a write resets the TXCOMP bit to 0 in the SR. So depending on when the interrupt handler reads the SR, it may fail to detect the NACK error if it relies on the TXCOMP bit. The NACK bit and its interrupt should be used instead. For RX transactions, the TXCOMP bit in the Status Register is cleared when the START bit is set into the Control Register. However to unify the management of the TXCOMP bit when the DMA controller is used, the TXCOMP interrupt is now enabled by the DMA callbacks for both TX and RX transfers. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com> Cc: stable@vger.kernel.org #3.10 and later Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: fixup return type of wait_for_completion_timeoutNicholas Mc Guire2015-03-151-3/+4
| | | | | | | | | Return type of wait_for_completion_timeout is unsigned long not int. This patch adds a timeout variable of appropriate type and fixes up the assignment. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: make use of the new infrastructure for quirksWolfram Sang2015-03-131-21/+11
| | | | | Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Tested-By: Ludovic Desroches <ludovic.desroches@atmel.com>
* Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds2014-12-141-1/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
| * i2c: busses: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0
| | | | | | | | | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: at91: enable probe deferring on dma channel requestLudovic Desroches2014-11-231-11/+14
| | | | | | | | | | | | | | | | If dma controller is not probed, defer i2c probe. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: at91: remove legacy DMA supportArnd Bergmann2014-11-211-34/+3
| | | | | | | | | | | | | | | | | | Since at91sam9g45 is now DT-only, all DMA capable users of this driver are using the DT case, and the legacy support can be removed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: at91: adopt pinctrl supportWenyou Yang2014-11-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Amend the at91 i2c pin controller to set the state of the pins to: - "default" on resume. - "sleep" on suspend(). This should make it possible to optimize energy usage for the pins both for the suspend/resume cycle Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: at91: add support for system PMWenyou Yang2014-11-101-0/+26
| | | | | | | | | | | | Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: at91: add support for runtime PMWenyou Yang2014-11-101-6/+32
| | | | | | | | | | | | | | | | | | | | | | Drivers should put the device into low power states proactively whenever the device is not in use. Thus implement support for runtime PM and use the autosuspend feature to make sure that we can still perform well in case we see lots of i2c traffic within short period of time. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* | i2c: at91: don't account as iowaitWolfram Sang2014-11-071-1/+1
|/ | | | | | | | | | 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
* i2c: at91: add bound checking on SMBus block length bytesMarek Roszko2014-09-021-4/+24
| | | | | | | | | | | | | | | | 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
* i2c: at91: Fix a race condition during signal handling in at91_do_twi_xfer.Simon Lindgren2014-09-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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
* drivers/i2c/busses: use correct type for dma_map/unmapWolfram Sang2014-08-011-2/+2
| | | | | | | | dma_{un}map_* uses 'enum dma_data_direction' not 'enum dma_transfer_direction'. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Cc: stable@kernel.org
* i2c: i2c-at91: Drop class based scanning to improve bootup timeWolfram Sang2014-07-161-1/+1
| | | | | | | | | | This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: Add device tree property to set clock-frequencyMarek Roszko2014-03-121-2/+8
| | | | | | | | | | This adds the ability to set "clock-frequency" in the device tree for the at91 i2cbus following the naming of other i2c bus implementations. If the property is not set,the clock frequency will default to the previously used define of 100KHz. Signed-off-by: Marek Roszko <mark.roszko@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: i2c-at91: deprecate class based instantiationWolfram Sang2014-03-051-1/+1
| | | | | | | | Warn users that class based instantiation is going away soon in favour of more robust probing and faster bootup times. Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
* i2c: at91: add a new compatibility string for the at91sam9261jean-jacques hiblot2014-01-161-0/+3
| | | | | | Signed-off-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* tree-wide: use reinit_completion instead of INIT_COMPLETIONWolfram Sang2013-11-151-1/+1
| | | | | | | | | | | | Use this new function to make code more comprehensible, since we are reinitialzing the completion, not initializing. [akpm@linux-foundation.org: linux-next resyncs] Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13) Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* i2c: move OF helpers into the coreWolfram Sang2013-08-231-3/+0
| | | | | | | | | | I2C of helpers used to live in of_i2c.c but experience (from SPI) shows that it is much cleaner to have this in the core. This also removes a circular dependency between the helpers and the core, and so we can finally register child nodes in the core instead of doing this manually in each driver. So, fix the drivers and documentation, too. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: convert to dma_request_slave_channel_compat()Ludovic Desroches2013-04-161-24/+25
| | | | | | | | | 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>
* i2c: Ignore return value of i2c_del_adapter()Lars-Peter Clausen2013-04-021-3/+2
| | | | | | | | | | | | | | i2c_del_adapter() always returns 0. So all checks testing whether it will be non zero will always evaluate to false and the conditional code is dead code. This patch updates all callers of i2c_del_mux_adapter() to ignore the return value and assume that it will always succeed (which it will). In a subsequent patch the return type of i2c_del_adapter() will be made void. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Ben Hutchings <bhutchings@solarflare.com> Reviewed-by: Jean Delvare <khali@linux-fr.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* i2c: at91: Use of_match_ptr() macroSachin Kamat2013-03-291-3/+1
| | | | | | | | | This eliminates having an #ifdef returning NULL for the case when OF is disabled. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* Merge branch 'i2c/for-next' of ↵Linus Torvalds2013-02-261-7/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Highlights: - new drivers for Intel ismt & Broadcom bcm2835 - a number of drivers got support for more variants and mostly got cleaned up on the way (sis630, i801, at91, tegra, designware) - i2c got rid of all *_set_drvdata(..., NULL) on remove/probe failure - removed the i2c_smbus_process_call from the core since there are no users - mxs can now switch between PIO and DMA depending on the message size and the bus speed can now be arbitrary In addition, there is the usual bunch of fixes, cleanups, devm_* conversions, etc" Fixed conflict (and buggy devm_* conversion) in i2c-s3c2410.c * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (39 commits) i2c: Remove unneeded xxx_set_drvdata(..., NULL) calls i2c: pxa: remove incorrect __exit annotations i2c: ocores: Fix pointer to integer cast warning i2c: tegra: remove warning dump if timeout happen in transfer i2c: fix i2c-ismt.c printk format warning i2c: i801: Add Device IDs for Intel Wellsburg PCH i2c: add bcm2835 driver i2c: ismt: Add Seth and Myself as maintainers i2c: sis630: checkpatch cleanup i2c: sis630: display unsigned hex i2c: sis630: use hex to constants for SMBus commands i2c: sis630: fix behavior after collision i2c: sis630: clear sticky bits i2c: sis630: Add SIS964 support i2c: isch: Add module parameter for backbone clock rate if divider is unset i2c: at91: fix unsed variable warning when building with !CONFIG_OF i2c: Adding support for Intel iSMT SMBus 2.0 host controller i2c: sh_mobile: don't send a stop condition by default inside transfers i2c: sh_mobile: eliminate an open-coded "goto" loop i2c: sh_mobile: fix timeout error handling ...
| * i2c: at91: fix unsed variable warning when building with !CONFIG_OFJoachim Eastwood2013-02-101-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 70d46a2 "i2c: at91: add dt support to i2c-at91" added DT only support for at91sam9x5. Building i2c-at91 without CONFIG_OF now warns about at91sam9x5_config as being unused. drivers/i2c/busses/i2c-at91.c:556:30: warning: 'at91sam9x5_config' defined but not used [-Wunused-variable] Move at91sam9x5_config under the defined(CONFIG_OF) guard as new AT91 SoCs will be DT only. Signed-off-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: Wolfram Sang <wolfram@the-dreams.de>
| * i2c: at91: add of_device_id entry for at91rm9200Joachim Eastwood2013-01-281-0/+3
| | | | | | | | | | | | Signed-off-by: Joachim Eastwood <manabian@gmail.com> Acked-by: Ludovic Ddesroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* | i2c: Convert to devm_ioremap_resource()Thierry Reding2013-01-241-3/+3
|/ | | | | | | | | | | | | Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* i2c: remove __dev* attributes from subsystemBill Pemberton2012-12-221-7/+7
| | | | | | | | | | | | | | | | | CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Acked-by: Peter Korsgaard <peter.korsgaard@barco.com> (for ocores and mux-gpio) Acked-by: Havard Skinnemoen <hskinnemoen@gmail.com> (for i2c-gpio) Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> (for puf3) Acked-by: Barry Song <baohua.song@csr.com> (for sirf) Reviewed-by: Jean Delvare <khali@linux-fr.org> [wsa: Fixed "foo* bar" flaws while we are here] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: add dma supportLudovic Desroches2012-11-241-8/+298
| | | | | | | | | | | | Add dma support for Atmel TWI which is available on sam9x5 and later. When using dma for reception, you have to read only n-2 bytes. The last two bytes are read manually. Don't doing this should cause to send the STOP command too late and then to get extra data in the receive register. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: change struct members indentationLudovic Desroches2012-11-241-15/+15
| | | | | | | | Replace tabs for struct members indentation by space to minimise line changes when adding new members which would require extra tabs to keep alignment. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: fix compilation warningLudovic Desroches2012-11-241-1/+1
| | | | | | | | | This patch fixes the following warning: drivers/i2c/busses/i2c-at91.c: In function ‘at91_twi_get_driver_data’: drivers/i2c/busses/i2c-at91.c:411:3: warning: return discards ‘const’ qualifier from pointer target type [enabled by default] Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: fix SMBus quick commandLudovic Desroches2012-11-141-1/+6
| | | | | | | | | | | | | | The driver claims to support SMBus quick command but it was not the case. This patch fixes this issue. Without it, i2cdetect finds imaginary devices. And with some IP versions, trying to send 0 byte can cause issue when writing data to an EEPROM. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> [wsa: improved the commit message] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: add dt support to i2c-at91Ludovic Desroches2012-09-121-0/+49
| | | | | | | Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Nikolaus Voss <n.voss@weinmann.de> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: add new driverNikolaus Voss2012-09-121-0/+505
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver has the following properties compared to the old driver: 1. Support for multiple interfaces. 2. Interrupt driven I/O as opposed to polling/busy waiting. 3. Support for _one_ repeated start (Sr) condition, which is enough for most real-world applications including all SMBus transfer types. (The hardware does not support issuing arbitrary Sr conditions on the bus.) testing: SoC: at91sam9g45 - BQ20Z80 battery SMBus client. - on a 2.6.38 kernel with several i2c clients (temp-sensor, audio-codec, touchscreen-controller, w1-bridge, io-expanders) Signed-off-by: Nikolaus Voss <n.voss@weinmann.de> Reviewed-by: Felipe Balbi <balbi@ti.com> Tested-by: Hubert Feurstein <h.feurstein@gmail.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com> [wsa: squashed with the following patches from Ludovic to have some flaws fixed: i2c: at91: use managed resources i2c: at91: add warning about transmission issues for some devices i2c: at91: use an id table for SoC dependent parameters ] Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c: at91: remove old polling driverNikolaus Voss2012-09-121-315/+0
| | | | | | | | | | | | | It will get replaced by a superior one. Safe to remove since this one depends on BROKEN anyhow. Signed-off-by: Nikolaus Voss <n.voss@weinmann.de> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com> Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com> [wsa: added commit message] Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c-at91: Use struct dev_pm_ops for power managementRafael J. Wysocki2012-07-121-6/+7
| | | | | | | | | Make the AT91 Two-Wire Interface driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
* i2c/busses: Use module_platform_driver()Axel Lin2012-01-121-15/+2
| | | | | | | | | | | | | | | | | | | | Convert the drivers in drivers/i2c/busses/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Cc: Ben Dooks <ben-linux@fluff.org> Acked-by: Jochen Friedrich <jochen@scram.de> Acked-by: Peter Korsgaard <jacmet@sunsite.dk> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Manuel Lauss <manuel.lauss@googlemail.com> Cc: Barry Song <21cnbao@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Yong Zhang <yong.zhang0@gmail.com> Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Use <linux/io.h> instead of <asm/io.h>H Hartley Sweeten2010-05-211-2/+1
| | | | | | | | As warned by checkpatch.pl, <linux/io.h> should be used instead of <asm/io.h>. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
* i2c: Use resource_size macroLinus Walleij2009-06-161-4/+4
| | | | | | | | | | | | | | | | | This replace all instances in the i2c busses tree of res->end - res->start + 1 with the handy macro resource_size(res) from ioport.h (coming in from platform_device.h). This was created with a simple sed -i -e 's/\([a-z]*\)->end *- *[a-z]*->start *+ *1/resource_size(\1)/g' Then manually replacing the PXA redefiniton of the same kind of macro manually. Recompiled some ARM defconfigs I could find to make a rough test so it shouldn't break anything, though I couldn't see exactly which configs you need for all the drivers. Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
* i2c: Use snprintf to set adapter namesJean Delvare2009-01-071-1/+1
| | | | | | Use snprintf instead of sprintf to set adapter names, it's safer. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* removed unused #include <linux/version.h>'sAdrian Bunk2008-08-231-1/+0
| | | | | | | | This patch lets the files using linux/version.h match the files that #include it. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/machRussell King2008-08-071-3/+3
| | | | | | This just leaves include/asm-arm/plat-* to deal with. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
OpenPOWER on IntegriCloud