9
0
Fork 0
Commit Graph

26 Commits

Author SHA1 Message Date
Sascha Hauer 57eb30b265 i2c: implement of_find_i2c_adapter_by_node
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-03-28 08:45:11 +01:00
Sascha Hauer 98615784a6 Merge branch 'for-next/modalias' 2014-03-07 09:25:12 +01:00
Alexander Shiyan 132b10bc4a drivers/i2c/i2c.c: Fix sparse warnings
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>
2014-02-17 08:21:23 +01:00
Sascha Hauer 394edf6377 i2c/spi: match of_modaliases
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>
2014-02-07 09:28:02 +01:00
Sascha Hauer b67b2671c2 treewide: Add missing includes
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>
2013-11-08 15:42:04 +01:00
Alexander Shiyan 82022ecce6 i2c: Reuse "driver_match" for I2C bus
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>
2013-07-15 10:08:11 +02:00
Sebastian Hesselbarth 2e2265bfd4 OF: base: convert and remove device_node_for_nach_child
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>
2013-06-20 21:22:19 +02:00
Sascha Hauer b1a4a659c6 i2c: Add devicetree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 15:53:11 +02:00
Sascha Hauer 5b79ceee57 i2c: Add support for dynamic i2c bus numbers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-20 22:08:18 +02:00
Sascha Hauer 5cee215f3e i2c: remove dead code
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-20 22:08:08 +02:00
Sascha Hauer 05753b98c0 i2c: Add missing result check
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-20 22:07:36 +02:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
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 c2e568d19c
| 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>
2012-12-12 15:04:27 +01:00
Sascha Hauer 619dc48632 i2c: Add missing DEVICE_ID_DYNAMIC
Otherwise it's not possible to register multiple identical devices.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 09:58:41 +01:00
Jean-Christophe PLAGNIOL-VILLARD bcf272af8b i2c: add id_table support
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>
2012-11-15 08:34:54 +01:00
Jean-Christophe PLAGNIOL-VILLARD 47e176461f i2c: introduce i2c_new_dummy
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>
2012-11-15 08:34:53 +01:00
Jean-Christophe PLAGNIOL-VILLARD 0e9a078d20 i2c: adapter: register it's own device
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>
2012-11-15 08:34:53 +01:00
Jean-Christophe PLAGNIOL-VILLARD 72b0a6503f driver: register bus
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:13 +02:00
Sascha Hauer 75265ae527 I2C: Put I2C devices on their own bus
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>
2012-09-14 11:47:41 +02:00
Marc Reilly d136e780f4 i2c: add platform_data for i2c_board_info
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>
2012-07-30 11:41:03 +02:00
Uwe Kleine-König e8bbacab05 i2c: fix printf format specifier
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>
2012-07-26 12:41:55 +02:00
Wolfram Sang cf6d0d0e19 i2c: fix wrong comment and symbol export for i2c_add_numbered_adapter()
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-16 08:29:40 +02:00
Baruch Siach ea5230ce75 i2c: fix adapter_list manipulation
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-06-17 14:00:03 +02:00
Sascha Hauer 624f936032 i2c: implement i2c_get_adapter()
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>
2010-05-26 10:34:58 +02:00
Sascha Hauer 9491ec7800 Cleanup colleteral damage from renaming
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-12-15 10:19:08 +01:00
Sascha Hauer a3ffa97f40 rename U-Boot-v2 project to barebox
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>
2009-12-15 10:18:30 +01:00
Marc Kleine-Budde 0d870824a4 i2c: new framework
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2009-12-03 10:44:42 +01:00