diff options
author | Vignesh Raghavendra <vigneshr@ti.com> | 2020-01-27 23:19:00 +0530 |
---|---|---|
committer | Lokesh Vutla <lokeshvutla@ti.com> | 2020-02-04 09:07:24 +0530 |
commit | dd6638a01888871306860136203e26c80d948550 (patch) | |
tree | f8197b727424debb15f6e3941a560710a3621eaa /drivers/gpio/pca953x_gpio.c | |
parent | 8e9c88e3873fce9506ba6d8418031c8ef5a6afd0 (diff) | |
download | u-boot-dd6638a01888871306860136203e26c80d948550.zip u-boot-dd6638a01888871306860136203e26c80d948550.tar.gz u-boot-dd6638a01888871306860136203e26c80d948550.tar.bz2 |
gpio: pca953x_gpio: Add support for 24 bit IO expander
J721e EVM has a TCA6424 IO expander that has 24 GPIOs. Add support for
the same
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'drivers/gpio/pca953x_gpio.c')
-rw-r--r-- | drivers/gpio/pca953x_gpio.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 07a3356..5c29440 100644 --- a/drivers/gpio/pca953x_gpio.c +++ b/drivers/gpio/pca953x_gpio.c @@ -15,8 +15,7 @@ * * TODO: * 1. Support PCA957X_TYPE - * 2. Support 24 gpio pins - * 3. Support Polarity Inversion + * 2. Support Polarity Inversion */ #include <common.h> @@ -118,6 +117,10 @@ static int pca953x_read_regs(struct udevice *dev, int reg, u8 *val) ret = dm_i2c_read(dev, reg, val, 1); } else if (info->gpio_count <= 16) { ret = dm_i2c_read(dev, reg << 1, val, info->bank_count); + } else if (info->gpio_count <= 24) { + /* Auto increment */ + ret = dm_i2c_read(dev, (reg << 2) | 0x80, val, + info->bank_count); } else if (info->gpio_count == 40) { /* Auto increment */ ret = dm_i2c_read(dev, (reg << 3) | 0x80, val, @@ -139,6 +142,10 @@ static int pca953x_write_regs(struct udevice *dev, int reg, u8 *val) ret = dm_i2c_write(dev, reg, val, 1); } else if (info->gpio_count <= 16) { ret = dm_i2c_write(dev, reg << 1, val, info->bank_count); + } else if (info->gpio_count <= 24) { + /* Auto increment */ + ret = dm_i2c_write(dev, (reg << 2) | 0x80, val, + info->bank_count); } else if (info->gpio_count == 40) { /* Auto increment */ ret = dm_i2c_write(dev, (reg << 3) | 0x80, val, info->bank_count); |