summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c.c
Commit message (Collapse)AuthorAgeFilesLines
* i2c: core: Add client I2C address to devinfoTrent Piepho2015-11-201-0/+9
| | | | | | | | | | Useful bit of information. Example: barebox:/ devinfo dummy0 Bus: i2c Address: 0x52 Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: Create for_each_i2c_adapter()Sascha Hauer2015-11-191-4/+4
| | | | | | This can be used by the i2c_probe command to iterate over i2c adapters. 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>
* 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>
* 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>
* 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: implement of_find_i2c_adapter_by_nodeSascha Hauer2014-03-281-0/+11
| | | | 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>
* treewide: Add missing includesSascha Hauer2013-11-081-0/+1
| | | | | | | | 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: Reuse "driver_match" for I2C busAlexander Shiyan2013-07-151-21/+1
| | | | | | | This will allow to use device_ids and make code a bit smaller. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* OF: base: convert and remove device_node_for_nach_childSebastian Hesselbarth2013-06-201-1/+1
| | | | | | | | Remove device_node_for_nach_child and convert users to corresponding imported OF API functions. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: Add devicetree supportSascha Hauer2013-05-311-0/+42
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: Add support for dynamic i2c bus numbersSascha Hauer2013-05-201-2/+11
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: remove dead codeSascha Hauer2013-05-201-16/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: Add missing result checkSascha Hauer2013-05-201-0/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers/base: fix corrupt device treeSascha Hauer2012-12-121-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_add_child is a very unsafe function. If called multiple times it allows setting the same device to different parents thus corrupting the siblings list. This happens regularly since: | commit c2e568d19c5c34a05a1002d25280bf113b72b752 | Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | Date: Sat Nov 3 16:11:05 2012 +0100 | | bus: add bus device | | automatically add it as parent of any bus device if none already specified | | we have now a nice output per bus If for example a FATfs is mounted this nice output per bus often ends with: > `---- fat0 > `---- 0 > `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL> > `---- sram00 > `---- 0x00000000-0xffffffffffffffff: /dev/<NULL> > `---- 0x00000000-0xffffffffffffffff: /dev/<NULL> > unable to handle NULL pointer dereference at address 0x0000000c > pc : [<87f08a20>] lr : [<87f08a04>] > sp : 86eff8c0 ip : 87f3fbde fp : ffffffff > r10: ffffffff r9 : 00000000 r8 : 00000003 > r7 : 86f075b8 r6 : 00000002 r5 : ffffffec r4 : 86f07544 > r3 : 00000000 r2 : 43f900b4 r1 : 00000020 r0 : 00000005 > Flags: Nzcv IRQs off FIQs off Mode SVC_32 > [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130) > > [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c) > [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14) > [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38) > [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60) This patch fixes this by adding a device to its parents children list in register_device so that dev_add_child is no longer needed. This function is removed from the tree. Now callers of register_device have to clearly set the parent *before* registering a device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Jan Lübbe <jlu@pengutronix.de>
* i2c: Add missing DEVICE_ID_DYNAMICSascha Hauer2012-12-031-0/+1
| | | | | | Otherwise it's not possible to register multiple identical devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: add id_table supportJean-Christophe PLAGNIOL-VILLARD2012-11-151-1/+16
| | | | | | | this will be use by at24 driver Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: introduce i2c_new_dummyJean-Christophe PLAGNIOL-VILLARD2012-11-151-0/+28
| | | | | | | | | This returns an I2C client bound to the "dummy" driver, intended for use with devices that consume multiple addresses. Examples of such chips include various EEPROMS (like 24c04 and 24c08 models). Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: adapter: register it's own deviceJean-Christophe PLAGNIOL-VILLARD2012-11-151-1/+16
| | | | | | | | so we can show the this of i2c busses set the bus device as parent of all devices. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: register busJean-Christophe PLAGNIOL-VILLARD2012-09-231-0/+7
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* I2C: Put I2C devices on their own busSascha Hauer2012-09-141-0/+23
| | | | | | | | This patch adds a I2C bus on which the I2C devices and drivers register. This makes it cleaner as I2C devices won't accidently end up probed by a platform_device driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: add platform_data for i2c_board_infoMarc Reilly2012-07-301-0/+1
| | | | | | Signed-off-by: Marc Reilly <marc@cpdesign.com.au> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: fix printf format specifierUwe Kleine-König2012-07-261-2/+2
| | | | | | | Use %u instead of %d for an u32 variable Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: fix wrong comment and symbol export for i2c_add_numbered_adapter()Wolfram Sang2010-09-161-14/+12
| | | | | Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: fix adapter_list manipulationBaruch Siach2010-06-171-1/+1
| | | | | Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: implement i2c_get_adapter()Sascha Hauer2010-05-261-1/+23
| | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Cleanup colleteral damage from renamingSascha Hauer2009-12-151-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename U-Boot-v2 project to bareboxSascha Hauer2009-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This has been done with the following script: find -path ./.git -prune -o -type f -print0 | xargs -0 -r sed -i \ -e 's/u2boot/barebox/g' \ -e 's/U2Boot/barebox/g' \ -e 's/U-boot V2/barebox/g' \ -e 's/u-boot v2/barebox/g' \ -e 's/U-Boot V2/barebox/g' \ -e 's/U-Boot-v2/barebox/g' \ -e 's/U_BOOT/BAREBOX/g' \ -e 's/UBOOT/BAREBOX/g' \ -e 's/uboot/barebox/g' \ -e 's/u-boot/barebox/g' \ -e 's/u_boot/barebox/g' \ -e 's/U-Boot/barebox/g' \ -e 's/U-boot/barebox/g' \ -e 's/U-BOOT/barebox/g' find -path ./.git -prune -o \( -name "*u-boot*" -o -name "*uboot*" -o -name "*u_boot*" \) -print0 | \ xargs -0 -r rename 's/u[-_]?boot/barebox/' It needs some manual fixup following in the next patch Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: new frameworkMarc Kleine-Budde2009-12-031-0/+353
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>