summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'i2c/for-4.8' of ↵Linus Torvalds2016-07-2720-376/+976
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Here is the I2C pull request for 4.8: - the core and i801 driver gained support for SMBus Host Notify - core support for more than one address in DT - i2c_add_adapter() has now better error messages. We can remove all error messages from drivers calling it as a next step. - bigger updates to rk3x driver to support rk3399 SoC - the at24 eeprom driver got refactored and can now read special variants with unique serials or fixed MAC addresses. The rest is regular driver updates and bugfixes" * 'i2c/for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (66 commits) i2c: i801: use IS_ENABLED() instead of checking for built-in or module Documentation: i2c: slave: give proper example for pm usage Documentation: i2c: slave: describe buffer problems a bit better i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clock i2c: i2c-smbus: drop useless stubs i2c: efm32: fix a failure path in efm32_i2c_probe() Revert "i2c: core: Cleanup I2C ACPI namespace" Revert "i2c: core: Add function for finding the bus speed from ACPI" i2c: Update the description of I2C_SMBUS i2c: i2c-smbus: fix i2c_handle_smbus_host_notify documentation eeprom: at24: tweak the loop_until_timeout() macro eeprom: at24: add support for at24mac series eeprom: at24: support reading the serial number for 24csxx eeprom: at24: platform_data: use BIT() macro eeprom: at24: split at24_eeprom_write() into specialized functions eeprom: at24: split at24_eeprom_read() into specialized functions eeprom: at24: hide the read/write loop behind a macro eeprom: at24: call read/write functions via function pointers eeprom: at24: coding style fixes eeprom: at24: move at24_read() below at24_eeprom_write() ...
| * i2c: i801: use IS_ENABLED() instead of checking for built-in or moduleJavier Martinez Canillas2016-07-261-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either built-in or as a module, use that macro instead of open coding the same. Using the macro makes the code more readable by helping abstract away some of the Kconfig built-in and module enable details. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: bcm2835: Don't complain on -EPROBE_DEFER from getting our clockEric Anholt2016-07-221-1/+2
| | | | | | | | | | | | | | | | Fixes dmesg spam when we just need to wait a moment for the clock driver to probe. Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: efm32: fix a failure path in efm32_i2c_probe()Alexey Khoroshilov2016-07-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | There is the only failure path in efm32_i2c_probe(), where clk_disable_unprepare() is missed. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Fixes: 1b5b23718b84 ("i2c: efm32: new bus driver") Cc: stable@kernel.org
| * Revert "i2c: core: Cleanup I2C ACPI namespace"Wolfram Sang2016-07-191-27/+27
| | | | | | | | | | | | | | | | This reverts commit a7003b65801e17a19617a509b2dbae3442ddd709.There were too heavy merge conflicts and the driver code making use of this was not ready yet anyhow. So, we wait one cycle. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * Revert "i2c: core: Add function for finding the bus speed from ACPI"Wolfram Sang2016-07-191-59/+15
| | | | | | | | | | | | | | | | This reverts commit 55d38d060e999ca1a3ea6eb132105a0301e4cd04. There were too heavy merge conflicts and the driver code making use of this was not ready yet anyhow. So, we wait one cycle. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: Update the description of I2C_SMBUSJean Delvare2016-07-181-2/+2
| | | | | | | | | | | | | | | | We support the SMBus Host Notify protocol now. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i2c-smbus: fix i2c_handle_smbus_host_notify documentationJean Delvare2016-07-181-2/+2
| | | | | | | | | | | | | | | | | | The parameter description is from a previous implementation, update it to describe the actual implementation. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Fixed the DMA segments lengthAbhishek Sahu2016-07-151-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The current QCOM I2C driver code is failing for transfer length greater than 255. This is happening due to improper segments length as the I2C DMA segments can be maximum of 256 bytes. 2. The transfer length tlen was being initialized with 0 for 256 bytes, which is being passed for DMA mappings resulting in improper DMA mapping length. This patch fixes the above said problems by initializing the block count with the values calculated in qup_i2c_set_blk_data and calculating the remaining length for last DMA segment. Also, the block data length need to be decremented after each transfer. Additionally, this patch corrects the tlen assignment for DMA mapping. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Cleared the error bits in ISRAbhishek Sahu2016-07-151-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Current QCOM I2C driver hangs when sending data to address 0x03-0x07 in some scenarios. The QUP controller generates invalid write in this case, since these addresses are reserved for different bus formats. 2. Also, the error handling is done by I2C QUP ISR in the case of DMA mode. The state need to be RESET in case of any error for clearing the available data in FIFO, which otherwise leaves the BAM DMA controller in hang state. This patch fixes the above two issues by clearing the error bits from I2C and QUP status in ISR in case of I2C error, QUP error and resets the QUP state to clear the FIFO data. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: brcmstb: Remove superfluous size checkJaedon Shin2016-07-151-2/+1
| | | | | | | | | | | | | | | | | | | | The driver transfer to a message with NOACK always in any size. If client (eg. EDID segment point message) needs NOACK condition, it can use I2C_M_IGNORE_NAK flag. Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> Acked-by: Kamal Dasu <kdasu.kdev@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: brcmstb: Make the driver buildable on BMIPS_GENERICJaedon Shin2016-07-151-1/+1
| | | | | | | | | | | | | | | | The BCM7xxx ARM and MIPS based SoCs share a similar I2C hardware block. Signed-off-by: Jaedon Shin <jaedon.shin@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: Add function for finding the bus speed from ACPIJarkko Nikula2016-07-141-15/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ACPI 5 specification doesn't have property for the I2C bus speed but I2cSerialBus resource descriptors which define each controller-slave connection define the maximum speed supported by that connection. Thus finding the maximum safe speed for the bus is to walk all I2cSerialBus resources that are associated to I2C controller and use the speed of slowest connection. Add function i2c_acpi_find_bus_speed() to the i2c-core that adapter drivers can call prior registering itself to core. This implies two-step walk through the I2cSerialBus resources: call to i2c_acpi_find_bus_speed() does the first scan and finds the safe bus speed that adapter drivers can set up. Adapter driver registration does the second scan when i2c-core creates the I2C slaves by calling the i2c_acpi_register_devices(). In that way the bus speed is set in case slave device probe gets called during registration and does communication. Implement this by reusing the existing ACPI I2C walk routines in the i2c-core. Extend them so that slowest connection speed is saved during the walk and I2C slaves are registered only when calling through the i2c_acpi_register_devices() with the i2c_adapter pointer. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: core: Cleanup I2C ACPI namespaceJarkko Nikula2016-07-141-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I2C ACPI enumeration was originally implemented in another module under drivers/acpi/ but was later moved into i2c-core with added support for I2C ACPI operation region. Rename these acpi_i2c_ prefixed functions, structures and defines in i2c-core to i2c_acpi_ in order to have more consistent name space. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: use pr_fmt in the coreWolfram Sang2016-07-141-8/+8
| | | | | | | | | | | | | | | | Now that we revisited all error messages, we can use pr_fmt for the remaining pr_* messages to ensure consistent output. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: print more info when acpi_i2c_space_handler() failsWolfram Sang2016-07-141-1/+2
| | | | | | | | | | | | | | | | | | Use a warning loglevel instead of info and switch to dev_* for device info. Also print which client was accessed. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: print more info when of_i2c_notify failsWolfram Sang2016-07-141-2/+2
| | | | | | | | | | | | | | Use dev_err instead of pr_err for more details. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: add error message when obtaining idr failsWolfram Sang2016-07-141-5/+4
| | | | | | | | | | | | | | Fix some whitespace issues while here. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: improve error messages in i2c_register_adapter()Wolfram Sang2016-07-141-8/+8
| | | | | | | | | | | | | | | | | | Switch to WARN if no adapter name is given, otherwise we won't know who missed to do that. Add error message if device registration fails. Update error message for missing algo to match style of the others. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: cleanup i2c_register_adapter() by refactoring recovery initWolfram Sang2016-07-141-34/+42
| | | | | | | | | | | | | | | | | | Move recovery init to a seperate function to let have i2c_register_adapter() less lines and to avoid goto and a label. Refactor string handling there for consistency and to save some bytes. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: free idr when sanity checks in i2c_register_adapter() failWolfram Sang2016-07-141-3/+3
| | | | | | | | | | | | | | | | On error, we should give idr back to the pool in any case. Signed-off-by: Wolfram Sang <wsa-dev@sang-engineering.com> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: versatile: Convert to use resource managed devm_* APIsAxel Lin2016-07-141-33/+13
| | | | | | | | | | | | | | | | | | | | Use devm_* APIs to simplify the code a bit. This patch also fixes the memory leak when unload the module. Signed-off-by: Axel Lin <axel.lin@ingics.com> Tested-by: Liviu Dudau <Liviu.Dudau@arm.com> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: versatile: Allow compile test buildAxel Lin2016-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | There is no build dependency for this driver, so enable COMPILE_TEST to get better build coverage. Signed-off-by: Axel Lin <axel.lin@ingics.com> Tested-by: Liviu Dudau <Liviu.Dudau@arm.com> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: xlp9xx: add ACPI support for Broadcom VulcanTanmay Jagdale2016-07-081-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Added ACPI support for the I2C controller present on Broadcom's Vulcan ARM64 processor. ACPI ID used by the controller is BRCM9007. Changed the xlp9xx_i2c_get_frequency() function to use device_property_read_u32() API so that the "clock-frequency" value can be read from _DSD in ACPI mode. Signed-off-by: Tanmay Jagdale <tanmay.jagdale@broadcom.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: meson: allow build with COMPILE_TESTBen Dooks2016-07-081-1/+1
| | | | | | | | | | | | | | | | This driver should be buildable with COMPILE_TEST so add this to the dependency for it. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c-dev: don't get i2c adapter via i2c_devviresh kumar2016-07-081-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no code protecting i2c_dev to be freed after it is returned from i2c_dev_get_by_minor() and using it to access the value which we already have (minor) isn't safe really. Avoid using it and get the adapter directly from 'minor'. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Jean Delvare <jdelvare@suse.de> Tested-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware-pci: clarify a comment for MerrifieldAndy Shevchenko2016-07-061-4/+4
| | | | | | | | | | | | | | | | | | There are more than 7 busses, but only 7 are user visible. Update comment accordingly. Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i801: add support of Host NotifyBenjamin Tissoires2016-07-062-3/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The i801 chip can handle the Host Notify feature since ICH 3 as mentioned in http://www.intel.com/content/dam/doc/datasheet/82801ca-io-controller-hub-3-datasheet.pdf Enable the functionality unconditionally and propagate the alert on each notification. With a T440s and a Synaptics touchpad that implements Host Notify, the payload data is always 0x0000, so I am not sure if the device actually sends the payload or if there is a problem regarding the implementation. Tested-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: i801: recover from hardware PEC errorsEllen Wang2016-07-011-2/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a CRC error while using hardware-supported PEC, an additional error bit is set in the auxiliary status register. If this bit isn't cleared, all subsequent operations will fail, essentially hanging the controller. The fix is simple: check, report, and clear the bit in i801_check_post(). Also, in case the driver starts with the hardware in that state, clear it in i801_check_pre() as well. Signed-off-by: Ellen Wang <ellen@cumulusnetworks.com> Tested-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: pca-isa: Utilize the module_isa_driver macroWilliam Breathitt Gray2016-06-191-14/+1
| | | | | | | | | | | | | | | | | | | | This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> [wsa: remove two empty lines while here] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: elektor: Utilize the module_isa_driver macroWilliam Breathitt Gray2016-06-191-13/+1
| | | | | | | | | | | | | | | | | | This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware-pci: Sort header block alphabeticallyAndy Shevchenko2016-06-191-9/+10
| | | | | | | | | | | | | | | | | | | | | | Simply sort header block alphabetically. While here fix an indentation in one place and update a copyright line for Intel. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware-pci: Introduce Merrifield supportAndy Shevchenko2016-06-191-0/+39
| | | | | | | | | | | | | | | | This patch enables I2C controllers found on Intel Edison board. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware-pci: Make bus number allocation robustAndy Shevchenko2016-06-192-50/+38
| | | | | | | | | | | | | | | | | | | | On some platforms, such as Intel Medfield, the I2C slave devices are enumerated through SFI tables where bus numbering is expected to be defined in the OS. Make the bus number allocation robust for such platforms. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware: Allow build Baytrail semaphore support when IOSF_MBI=mJarkko Nikula2016-06-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | I believe i2c-designware-baytrail.c doesn't have strict dependency that Intel SoC IOSF Sideband support must be always built-in in order to be able to compile support for Intel Baytrail I2C bus sharing HW semaphore. Redefine build dependencies so that CONFIG_IOSF_MBI=y is required only when CONFIG_I2C_DESIGNWARE_PLATFORM is built-in. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: David Box <david.e.box@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: designware: Use transfer timeout from ioctl I2C_TIMEOUTWeifeng Voon2016-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | This allows applications to set the transfer timeout in 10ms increments via ioctl I2C_TIMEOUT. Signed-off-by: Weifeng Voon <weifeng.voon@intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: use address helper function in read transferNaveen Kaje2016-06-181-1/+1
| | | | | | | | | | | | | | | | | | qup_i2c_issue_read() derives the address from i2c_msg. This called in the read path when I2C_M_RD flag is set. Therefore, use the 8 bit address helper function. Signed-off-by: Naveen Kaje <nkaje@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Fix error handlingSricharan R2016-06-181-35/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Among the bus errors reported from the QUP_MASTER_STATUS register only NACK is considered and transfer gets suspended, while other errors are ignored. Correct this and suspend the transfer for other errors as well. This avoids unnecessary 'timeouts' which happens when waiting for events that would never happen when there is already an error condition on the bus. Also the error handling procedure should be the same for both NACK and other bus errors in case of dma mode. So correct that as well. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: qup: Fix broken dma when CONFIG_DEBUG_SG is enabledSricharan R2016-06-181-36/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With CONFIG_DEBUG_SG is enabled and when dma mode is used, below dump is seen, ------------[ cut here ]------------ kernel BUG at include/linux/scatterlist.h:140! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.0-00459-g9f087b9-dirty #7 Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) task: ffffffc036868000 ti: ffffffc036870000 task.ti: ffffffc036870000 PC is at qup_sg_set_buf.isra.13+0x138/0x154 LR is at qup_sg_set_buf.isra.13+0x50/0x154 pc : [<ffffffc0005a0ed8>] lr : [<ffffffc0005a0df0>] pstate: 60000145 sp : ffffffc0368735c0 x29: ffffffc0368735c0 x28: ffffffc036873752 x27: ffffffc035233018 x26: ffffffc000c4e000 x25: 0000000000000000 x24: 0000000000000004 x23: 0000000000000000 x22: ffffffc035233668 x21: ffffff80004e3000 x20: ffffffc0352e0018 x19: 0000004000000000 x18: 0000000000000028 x17: 0000000000000004 x16: ffffffc0017a39c8 x15: 0000000000001cdf x14: ffffffc0019929d8 x13: ffffffc0352e0018 x12: 0000000000000000 x11: 0000000000000001 x10: 0000000000000001 x9 : ffffffc0012b2d70 x8 : ffffff80004e3000 x7 : 0000000000000018 x6 : 0000000030000000 x5 : ffffffc00199f018 x4 : ffffffc035233018 x3 : 0000000000000004 x2 : 00000000c0000000 x1 : 0000000000000003 x0 : 0000000000000000 Process swapper/0 (pid: 1, stack limit = 0xffffffc036870020) Stack: (0xffffffc0368735c0 to 0xffffffc036874000) sg_set_bug expects that the buf parameter passed in should be from lowmem and a valid pageframe. This is not true for pages from dma_alloc_coherent which can be carveouts, hence the check fails. Change allocation of sg buffers from dma_coherent memory to kzalloc to fix the issue. Note that now dma_map/unmap is used to make the kzalloc'ed buffers coherent before passing it to the dmaengine. Signed-off-by: Sricharan R <sricharan@codeaurora.org> Reviewed-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: support fast-mode plus for rk3399David Wu2016-06-171-4/+17
| | | | | | | | | | | | | | | | | | | | | | Implement fast mode plus that allows bus speeds of up to 1MHz. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Caesar Wang <wxt@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: add i2c support for rk3399 socDavid Wu2016-06-171-20/+274
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - new method to caculate i2c timings for rk3399: There was an timing issue about "repeated start" time at the I2C controller of version0, controller appears to drop SDA at .875x (7/8) programmed clk high. On version 1 of the controller, the rule(.875x) isn't enough to meet tSU;STA requirements on 100k's Standard-mode. To resolve this issue, sda_update_config, start_setup_config and stop_setup_config for I2C timing information are added, new rules are designed to calculate the timing information at new v1. - pclk and function clk are separated at rk3399 Signed-off-by: David Wu <david.wu@rock-chips.com> Tested-by: Caesar Wang <wxt@rock-chips.com> Tested-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Douglas Anderson <dianders@chromium.org> [wsa: fixed whitespace issue] Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: Move spec timing data to "static const" structsDavid Wu2016-06-171-28/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | The i2c timing specs are really just constant data. There's no reason to write code to init them, so move them out to structures. This not only is a cleaner solution but it will reduce code duplication when we introduce a new variant of rk3x_i2c_calc_divs() in a future patch. Signed-off-by: David Wu <david.wu@rock-chips.com> Suggested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: Change SoC data to not use arrayDavid Wu2016-06-171-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifying the i2c SoC data in an array provides very little benefit and gets unwieldly / confusing as the array grows since the next bit of code needs to refer to elements in the array by their raw integral index. Let's just create a single 'static const' structure for each SoC so that we can refer to these structures by ID. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Suggested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: Remove redundant rk3x_i2c_clean_ipd()David Wu2016-06-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | rk3x_i2c_setup() gets called directly before rk3x_i2c_start(), and the last thing in setup was to clean the IPD, so no reason to do it at the beginning of start. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: use struct "rk3x_i2c_calced_timings"David Wu2016-06-171-23/+32
| | | | | | | | | | | | | | | | | | | | | | | | The "div_high" and "div_low" values are always used together. Group them into a structure to make it easier to pass them both around. This structure also provides a place for future calculated timings. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: rk3x: add documentation to fields in "struct rk3x_i2c"David Wu2016-06-171-1/+21
| | | | | | | | | | | | | | | | | | | | | | Add kernel-doc documentation for the elements of the previously undocumented struct rk3x_i2c. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: smbus: add SMBus Host Notify supportBenjamin Tissoires2016-06-171-5/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SMBus Host Notify allows a slave device to act as a master on a bus to notify the host of an interrupt. On Intel chipsets, the functionality is directly implemented in the firmware. We just need to export a function to call .alert() on the proper device driver. i2c_handle_smbus_host_notify() behaves like i2c_handle_smbus_alert(). When called, it schedules a task that will be able to sleep to go through the list of devices attached to the adapter. The current implementation allows one Host Notification to be scheduled while an other is running. Tested-by: Andrew Duggan <aduggan@synaptics.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: add a protocol parameter to the alert callbackBenjamin Tissoires2016-06-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .alert() is meant to be generic, but there is currently no way for the device driver to know which protocol generated the alert. Add a parameter in .alert() to help the device driver to understand what is given in data. This patch is required to have the support of SMBus Host Notify protocol through .alert(). Tested-by: Andrew Duggan <aduggan@synaptics.com> For hwmon: Acked-by: Guenter Roeck <linux@roeck-us.net> For IPMI: Acked-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: robotfuzz-osif: Constify osif_tableAxel Lin2016-06-131-1/+1
| | | | | | | | | | | | | | | | osif_table is never modified, so declare it as const. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
| * i2c: jz4780: drop superfluous initWolfram Sang2016-06-131-4/+0
| | | | | | | | | | | | | | | | | | | | David reported that the length for memset was incorrect (element sizes were not taken into account). Then I saw that we are clearing kzalloced memory, so we can simply drop this code. Reported-by: David Binderman <dcb314@hotmail.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>