summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
Commit message (Collapse)AuthorAgeFilesLines
...
| * i2c-imx: Fix memory leak in i2c_fsl_probe()Andrey Smirnov2015-08-191-4/+8
| | | | | | | | | | | | | | | | | | All points of failure in the code of i2c_fsl_probe() happen after the allocation of i2c_fsl, so all of them have to perform necessary cleanup setups in case of failure. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: gpio: add bus recovery supportJan Luebbe2015-08-201-0/+10
| | | | | | | | | | Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: algo-bit: check if the bus is busyJan Luebbe2015-08-201-0/+32
| | | | | | | | | | | | | | If we have a timeout while waiting, try to recover. Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: algo-bit: fix debug codeJan Luebbe2015-08-201-7/+5
| | | | | | | | | | | | | | | | Replace jiffies from kernel code with get_time_ns. The flags variable used in the readbytes debug output does not exist. Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c-omap: add bus recovery supportJan Luebbe2015-08-201-3/+81
| | | | | | | | | | | | | | | | This is based on commit 9dcb0e7b999db6c420c70fd32497a979a044fcdf from the kernel with some additional fixes. Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c-omap: clear ARDY twiceJan Luebbe2015-08-201-0/+4
| | | | | | | | | | | | | | | | This implements the fix from the kernel commit 4cdbf7d346e7461c3b93a26707c852e2c9db3753. Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: add bus recovery infrastructureJan Luebbe2015-08-201-0/+130
|/ | | | | | | | This is based on the code introduced to the kernel in 5f9296ba21b3c395e53dd84e7ff9578f97f24295. Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ppc'Sascha Hauer2015-08-061-2/+7
|\
| * PPC/MPC5200: re-use the IMX I2C master driver for MPC5200Juergen Borleis2015-08-031-2/+7
| | | | | | | | | | | | | | | | This IP core is shared between many FSL SoCs. The MPC5200 provides this core as well. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: only register enabled child nodesJan Luebbe2015-07-091-1/+1
|/ | | | | Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-06-091-1/+1
|\
| * i2c: Use correct format specifierSascha Hauer2015-05-151-1/+1
| | | | | | | | | | | | 'count' is of type u16, not size_t. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: omap: fix i2c bus number outputRobert Schwebel2015-06-031-3/+3
|/ | | | | | | | | | | | | | | | When probing from devicetree, the output for several i2c host controllers prints out a bus number of -1: i2c-omap 44e0b000.i2c: bus -1 rev0.11 at 400 kHz i2c-omap 4802a000.i2c: bus -1 rev0.11 at 400 kHz i2c-omap 4819c000.i2c: bus -1 rev0.11 at 400 kHz The call to i2c_add_numbered_adapter() in probe finds out the next free bus number, so we move the output to a location where the number is already determined. Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-device-id'Sascha Hauer2015-05-064-18/+18
|\
| * of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-304-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: mv64xxx: continue probe when clock-frequency is missingAntony Pavlov2015-04-171-2/+1
|/ | | | | | | | | | | | | | | | | | | | Based on this linux kernel commit: commit 0ce4bc1dbdd911ae1763e2d4ff36bd1b214a59f7 Author: Chen-Yu Tsai <wens@csie.org> Date: Mon Sep 1 22:28:13 2014 +0800 i2c: mv64xxx: continue probe when clock-frequency is missing 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. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: Call remove function only when availableSascha Hauer2015-03-171-1/+2
| | | | | | | | The bus implementations currently call the drivers remove hook unconditionally, but this hook is seldomly populated. Only call it when it's actually populated. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: omap: fix fclk_rate for ti,omap4-i2cJan Weitzel2015-01-061-6/+5
| | | | | | | | The compatible "ti,omap4-i2c" don't help to get fclk_rate. So set it acording to cpu compatible: "ti,am33xx" and "ti,omap4" Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/tegra'Sascha Hauer2014-11-051-1/+1
|\
| * i2c: tegra: move to fs initcallLucas Stach2014-10-081-1/+1
| | | | | | | | | | | | | | | | i2c is needed to enable voltage rails that are later needed by other drivers. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: at91: fix invalid length checkLucas Stach2014-10-211-2/+2
|/ | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Acked-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/resource-err-ptr'Sascha Hauer2014-10-023-2/+8
|\
| * resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-163-2/+8
| | | | | | | | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/at91'Sascha Hauer2014-10-021-27/+71
|\ \
| * | I2C: at91: fix the method for interruptBo Shen2014-09-251-15/+23
| | | | | | | | | | | | | | | | | | | | | | | | As the i2c-at91 driver won't work in the interrupt mode, so need to poll the interrupts. Signed-off-by: Bo Shen <voice.shen@atmel.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | i2c: at91: add support of device treeRaphaël Poggi2014-09-251-7/+34
| | | | | | | | | | | | | | | Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | i2c: at91: add at91sam9x5 configRaphaël Poggi2014-09-251-5/+14
| | | | | | | | | | | | | | | Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | i2c: at91: fix coding style issueRaphaël Poggi2014-09-251-2/+2
| |/ | | | | | | | | Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / i2c: omap: fix dts property "clock-frequency" usageTeresa Gámez2014-10-021-10/+10
|/ | | | | | | | | Looking at the linux kernel the clock-frequency property of the device tree is used to set the bus speed and not the fclk_rate. Adapted this to be compliant with linux kernel. Signed-off-by: Teresa Gámez <t.gamez@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-08-071-2/+2
|\ | | | | | | | | Conflicts: lib/Makefile
| * i2c: omap: fix typo in dt_idsRaphael Poggi2014-07-171-2/+2
| | | | | | | | | | | | | | Fix a typo in dt_ids name. Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: busses/Makefile: fix indentationAntony Pavlov2014-07-311-2/+2
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: add Marvell 64xxx driverAntony Pavlov2014-07-313-0/+656
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver is also used for Allwinner SoCs I2C controllers. Ported from linux-3.15. The most notable barebox driver version changes: * drop platform device stuff; * drop "allwinner,sun*" stuff; * drop message offloading support; * add reg-io-width devicetree parameter to use driver with byte-oriented controller versions. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> On Armada XP: Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: add Atmel AT91 driverRaphaël Poggi2014-07-253-0/+442
| | | | | | | | | | Signed-off-by: Raphaël Poggi <poggi.raph@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: import SMBus stuff from linuxAntony Pavlov2014-07-142-1/+372
|/ | | | | | | | | | | | | | | | | | | | This patch imports i2c_smbus_{read,write}* functions from linux-3.15. Here is a quote from linux.git/Documentation/i2c/smbus-protocol: If you write a driver for some I2C device, please try to use the SMBus commands if at all possible (if the device uses only that subset of the I2C protocol). This makes it possible to use the device driver on both SMBus adapters and I2C adapters (the SMBus command set is automatically translated to I2C on I2C adapters, but plain I2C commands can not be handled at all on most pure SMBus adapters). So having i2c_smbus_{read,write}* functions in barebox makes porting of linux i2c client drivers much easier as many drivers rely on these smbus functions. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mips'Sascha Hauer2014-07-041-3/+52
|\
| * i2c: i2c_gpio: add devicetree supportAntony Pavlov2014-06-251-3/+52
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i2c: versatile: add devicetree supportAntony Pavlov2014-06-231-0/+7
|/ | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: add Tegra driverLucas Stach2014-05-153-0/+704
| | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: implement of_find_i2c_adapter_by_nodeSascha Hauer2014-03-281-0/+11
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: i.MX: move to earlier initcallSascha Hauer2014-03-281-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/modalias'Sascha Hauer2014-03-071-1/+1
|\
| * i2c/spi: match of_modaliasesSascha Hauer2014-02-071-1/+1
| | | | | | | | | | | | | | | | i2c/spi devices in the devicetree often come with a "vendor,device" comaptible string. These do not match in barebox, so add a device_match_of_modalias function which does exactly that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers/i2c/i2c.c: Fix sparse warningsAlexander Shiyan2014-02-171-4/+3
|/ | | | | | | | drivers/i2c/i2c.c:246:19: warning: symbol 'i2c_new_device' was not declared. Should it be static? drivers/i2c/i2c.c:274:6: warning: symbol 'of_i2c_register_devices' was not declared. Should it be static? Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/omap-drivers'Sascha Hauer2013-12-061-1/+27
|\
| * i2c: omap: Add devicetree supportSascha Hauer2013-11-221-1/+27
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | treewide: Add missing includesSascha Hauer2013-11-082-0/+2
|/ | | | | | | | A lot of files rely on include/driver.h including include/of.h (and this including include/errno.h. include the files explicitly so we can eventually get rid of including of.h from driver.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c-omap: fix reported revisonJan Weitzel2013-10-141-1/+1
| | | | | | Report correct major and minor revision Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: omap: remove unncessary printfSascha Hauer2013-09-271-1/+0
| | | | | | | A printf in the driver should be dev_* and contain useful information. Both is not the case, remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c-omap: Update driverJan Weitzel2013-09-271-187/+448
| | | | | | | | | | | | | The driver didn't work well with at24 driver. NACKS are lost. Errors are lost in isr due to the local variable err. Also we didn't wait for bus free in omap_i2c_xfer_msg. Fix issues and get other improvements from linux kernel Tested on OMAP4 and AM335x Signed-off-by: Jan Weitzel <j.weitzel@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>