mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-04 02:25:58 +00:00

Some hardware need some time to switch from a bus to another. This can cause the first transfers following the selection of a bus to fail. There is no way to configure this kind of waiting time in the driver. Add support for the 'settle-time-us' device-tree property. When set, the i2c_mux_gpio_select() applies a delay before returning, leaving enough time to the hardware to switch to the new bus. Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Acked-by: Peter Rosin <peda@axentia.se> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
34 lines
956 B
C
34 lines
956 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* i2c-mux-gpio interface to platform code
|
|
*
|
|
* Peter Korsgaard <peter.korsgaard@barco.com>
|
|
*/
|
|
|
|
#ifndef _LINUX_I2C_MUX_GPIO_H
|
|
#define _LINUX_I2C_MUX_GPIO_H
|
|
|
|
/* MUX has no specific idle mode */
|
|
#define I2C_MUX_GPIO_NO_IDLE ((unsigned)-1)
|
|
|
|
/**
|
|
* struct i2c_mux_gpio_platform_data - Platform-dependent data for i2c-mux-gpio
|
|
* @parent: Parent I2C bus adapter number
|
|
* @base_nr: Base I2C bus number to number adapters from or zero for dynamic
|
|
* @values: Array of bitmasks of GPIO settings (low/high) for each
|
|
* position
|
|
* @n_values: Number of multiplexer positions (busses to instantiate)
|
|
* @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
|
|
* @settle_time: Delay to wait when a new bus is selected
|
|
*/
|
|
struct i2c_mux_gpio_platform_data {
|
|
int parent;
|
|
int base_nr;
|
|
const unsigned *values;
|
|
int n_values;
|
|
unsigned idle;
|
|
u32 settle_time;
|
|
};
|
|
|
|
#endif /* _LINUX_I2C_MUX_GPIO_H */
|