diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 21:10:45 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-14 21:10:45 -0400 |
| commit | c3a416a669eb83cfa9ccb52db030e72d654bd105 (patch) | |
| tree | 518d00dc803fbb7d3772fc26a78b6bf3b797baf3 /include/linux | |
| parent | 8c194f3bd322a8bd44d079092d870549b8ae62d1 (diff) | |
| parent | 2bbd681ba2bfa0f3805fb541b0840b96893c5727 (diff) | |
Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang:
"Most notable:
- introducing the i2c_quirk infrastructure. Now, flaws of I2C
controllers can be described and the core will check if the flaws
collide with the messages to be sent
- wait_for_completion return type cleanup series
- new drivers for Digicolor, Netlogic XLP, Ingenic JZ4780
- updates to the I2C slave framework which include API changes. Its
only user was updated, too. Documentation was finally added
- changed dynamic bus numbering for the DT case. This could change
bus numbers for users. However, it fixes a collision where dynamic
and static busses request the same id.
- driver bugfixes, cleanups"
* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (52 commits)
i2c: xlp9xx: Driver for Netlogic XLP9XX/5XX I2C controller
of: Add vendor prefix 'netlogic'
i2c: davinci: use ICPFUNC to toggle I2C as gpio for bus recovery
i2c: davinci: use bus recovery infrastructure
i2c: change input parameter to i2c_adapter for prepare/unprepare_recovery
i2c: i2c-mux-gpio: remove error messages for probe deferrals
i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780
i2c: dln2: set the device tree node of the adapter
i2c: davinci: fixup wait_for_completion_timeout handling
i2c: mpc: Fix ISR return value
i2c: slave-eeprom: add more info when to increase the pointer
i2c: slave: add documentation for i2c-slave-eeprom
Documentation: i2c: describe the new slave mode
i2c: slave: rework the slave API
i2c: add support for the Digicolor I2C controller
i2c: busses with dynamic ids should start after fixed ids for DT
of: base: add function to get highest id of an alias stem
i2c: designware: Suppress error message if platform_get_irq() < 0
i2c: mpc: assign the correct prescaler from SVR
i2c: img-scb: fixup of wait_for_completion_timeout return handling
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/i2c.h | 55 | ||||
| -rw-r--r-- | include/linux/of.h | 6 | ||||
| -rw-r--r-- | include/linux/platform_data/i2c-davinci.h | 1 |
3 files changed, 56 insertions, 6 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index f17da50402a4..898033f41d76 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -253,10 +253,10 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) | |||
| 253 | 253 | ||
| 254 | #if IS_ENABLED(CONFIG_I2C_SLAVE) | 254 | #if IS_ENABLED(CONFIG_I2C_SLAVE) |
| 255 | enum i2c_slave_event { | 255 | enum i2c_slave_event { |
| 256 | I2C_SLAVE_REQ_READ_START, | 256 | I2C_SLAVE_READ_REQUESTED, |
| 257 | I2C_SLAVE_REQ_READ_END, | 257 | I2C_SLAVE_WRITE_REQUESTED, |
| 258 | I2C_SLAVE_REQ_WRITE_START, | 258 | I2C_SLAVE_READ_PROCESSED, |
| 259 | I2C_SLAVE_REQ_WRITE_END, | 259 | I2C_SLAVE_WRITE_RECEIVED, |
| 260 | I2C_SLAVE_STOP, | 260 | I2C_SLAVE_STOP, |
| 261 | }; | 261 | }; |
| 262 | 262 | ||
| @@ -435,8 +435,8 @@ struct i2c_bus_recovery_info { | |||
| 435 | void (*set_scl)(struct i2c_adapter *, int val); | 435 | void (*set_scl)(struct i2c_adapter *, int val); |
| 436 | int (*get_sda)(struct i2c_adapter *); | 436 | int (*get_sda)(struct i2c_adapter *); |
| 437 | 437 | ||
| 438 | void (*prepare_recovery)(struct i2c_bus_recovery_info *bri); | 438 | void (*prepare_recovery)(struct i2c_adapter *); |
| 439 | void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri); | 439 | void (*unprepare_recovery)(struct i2c_adapter *); |
| 440 | 440 | ||
| 441 | /* gpio recovery */ | 441 | /* gpio recovery */ |
| 442 | int scl_gpio; | 442 | int scl_gpio; |
| @@ -449,6 +449,48 @@ int i2c_recover_bus(struct i2c_adapter *adap); | |||
| 449 | int i2c_generic_gpio_recovery(struct i2c_adapter *adap); | 449 | int i2c_generic_gpio_recovery(struct i2c_adapter *adap); |
| 450 | int i2c_generic_scl_recovery(struct i2c_adapter *adap); | 450 | int i2c_generic_scl_recovery(struct i2c_adapter *adap); |
| 451 | 451 | ||
| 452 | /** | ||
| 453 | * struct i2c_adapter_quirks - describe flaws of an i2c adapter | ||
| 454 | * @flags: see I2C_AQ_* for possible flags and read below | ||
| 455 | * @max_num_msgs: maximum number of messages per transfer | ||
| 456 | * @max_write_len: maximum length of a write message | ||
| 457 | * @max_read_len: maximum length of a read message | ||
| 458 | * @max_comb_1st_msg_len: maximum length of the first msg in a combined message | ||
| 459 | * @max_comb_2nd_msg_len: maximum length of the second msg in a combined message | ||
| 460 | * | ||
| 461 | * Note about combined messages: Some I2C controllers can only send one message | ||
| 462 | * per transfer, plus something called combined message or write-then-read. | ||
| 463 | * This is (usually) a small write message followed by a read message and | ||
| 464 | * barely enough to access register based devices like EEPROMs. There is a flag | ||
| 465 | * to support this mode. It implies max_num_msg = 2 and does the length checks | ||
| 466 | * with max_comb_*_len because combined message mode usually has its own | ||
| 467 | * limitations. Because of HW implementations, some controllers can actually do | ||
| 468 | * write-then-anything or other variants. To support that, write-then-read has | ||
| 469 | * been broken out into smaller bits like write-first and read-second which can | ||
| 470 | * be combined as needed. | ||
| 471 | */ | ||
| 472 | |||
| 473 | struct i2c_adapter_quirks { | ||
| 474 | u64 flags; | ||
| 475 | int max_num_msgs; | ||
| 476 | u16 max_write_len; | ||
| 477 | u16 max_read_len; | ||
| 478 | u16 max_comb_1st_msg_len; | ||
| 479 | u16 max_comb_2nd_msg_len; | ||
| 480 | }; | ||
| 481 | |||
| 482 | /* enforce max_num_msgs = 2 and use max_comb_*_len for length checks */ | ||
| 483 | #define I2C_AQ_COMB BIT(0) | ||
| 484 | /* first combined message must be write */ | ||
| 485 | #define I2C_AQ_COMB_WRITE_FIRST BIT(1) | ||
| 486 | /* second combined message must be read */ | ||
| 487 | #define I2C_AQ_COMB_READ_SECOND BIT(2) | ||
| 488 | /* both combined messages must have the same target address */ | ||
| 489 | #define I2C_AQ_COMB_SAME_ADDR BIT(3) | ||
| 490 | /* convenience macro for typical write-then read case */ | ||
| 491 | #define I2C_AQ_COMB_WRITE_THEN_READ (I2C_AQ_COMB | I2C_AQ_COMB_WRITE_FIRST | \ | ||
| 492 | I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR) | ||
| 493 | |||
| 452 | /* | 494 | /* |
| 453 | * i2c_adapter is the structure used to identify a physical i2c bus along | 495 | * i2c_adapter is the structure used to identify a physical i2c bus along |
| 454 | * with the access algorithms necessary to access it. | 496 | * with the access algorithms necessary to access it. |
| @@ -474,6 +516,7 @@ struct i2c_adapter { | |||
| 474 | struct list_head userspace_clients; | 516 | struct list_head userspace_clients; |
| 475 | 517 | ||
| 476 | struct i2c_bus_recovery_info *bus_recovery_info; | 518 | struct i2c_bus_recovery_info *bus_recovery_info; |
| 519 | const struct i2c_adapter_quirks *quirks; | ||
| 477 | }; | 520 | }; |
| 478 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) | 521 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
| 479 | 522 | ||
diff --git a/include/linux/of.h b/include/linux/of.h index dfde07e77a63..9bfcc18ceab3 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
| @@ -332,6 +332,7 @@ extern int of_count_phandle_with_args(const struct device_node *np, | |||
| 332 | 332 | ||
| 333 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); | 333 | extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)); |
| 334 | extern int of_alias_get_id(struct device_node *np, const char *stem); | 334 | extern int of_alias_get_id(struct device_node *np, const char *stem); |
| 335 | extern int of_alias_get_highest_id(const char *stem); | ||
| 335 | 336 | ||
| 336 | extern int of_machine_is_compatible(const char *compat); | 337 | extern int of_machine_is_compatible(const char *compat); |
| 337 | 338 | ||
| @@ -594,6 +595,11 @@ static inline int of_alias_get_id(struct device_node *np, const char *stem) | |||
| 594 | return -ENOSYS; | 595 | return -ENOSYS; |
| 595 | } | 596 | } |
| 596 | 597 | ||
| 598 | static inline int of_alias_get_highest_id(const char *stem) | ||
| 599 | { | ||
| 600 | return -ENOSYS; | ||
| 601 | } | ||
| 602 | |||
| 597 | static inline int of_machine_is_compatible(const char *compat) | 603 | static inline int of_machine_is_compatible(const char *compat) |
| 598 | { | 604 | { |
| 599 | return 0; | 605 | return 0; |
diff --git a/include/linux/platform_data/i2c-davinci.h b/include/linux/platform_data/i2c-davinci.h index 2312d197dfb7..89fd34727a24 100644 --- a/include/linux/platform_data/i2c-davinci.h +++ b/include/linux/platform_data/i2c-davinci.h | |||
| @@ -18,6 +18,7 @@ struct davinci_i2c_platform_data { | |||
| 18 | unsigned int bus_delay; /* post-transaction delay (usec) */ | 18 | unsigned int bus_delay; /* post-transaction delay (usec) */ |
| 19 | unsigned int sda_pin; /* GPIO pin ID to use for SDA */ | 19 | unsigned int sda_pin; /* GPIO pin ID to use for SDA */ |
| 20 | unsigned int scl_pin; /* GPIO pin ID to use for SCL */ | 20 | unsigned int scl_pin; /* GPIO pin ID to use for SCL */ |
| 21 | bool has_pfunc; /*chip has a ICPFUNC register */ | ||
| 21 | }; | 22 | }; |
| 22 | 23 | ||
| 23 | /* for board setup code */ | 24 | /* for board setup code */ |
