add driver for PCA95[357]x, PCA9698, TCA64xx, and MAX7310 SMBus I/O expanders
v2 cover add driver for PCA95[357]x, PCA9698, TCA64xx, and MAX7310 SMBus I/O expanders
changes since RFC v1 patchseries:
* gpio-pca953x.c: drop depricated devicetree parameters;
* gpio-pca953x.c: add pca953x_gpio_get_direction();
* move SMBus stuff from i2c.c to i2c-smbus.c, introduce CONFIG_I2C_SMBUS.
Antony Pavlov (2):
i2c: import SMBus stuff from linux
gpio: add driver for PCA95[357]x, PCA9698, TCA64xx, and MAX7310 SMBus
I/O expanders
drivers/gpio/Kconfig | 21 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-pca953x.c | 481 ++++++++++++++++++++++++++++++++++++++++ drivers/i2c/Kconfig | 3 + drivers/i2c/Makefile | 1 + drivers/i2c/i2c-smbus.c | 371 +++++++++++++++++++++++++++++++ include/i2c/i2c.h | 57 +++++ include/platform_data/pca953x.h | 27 +++ 8 files changed, 962 insertions(+) create mode 100644 drivers/gpio/gpio-pca953x.c create mode 100644 drivers/i2c/i2c-smbus.c create mode 100644 include/platform_data/pca953x.h
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/2 i2c: import SMBus stuff from linux
This patch imports i2c_smbus_{read,write}* functions from linux-3.15.
Here is a quote from linux.git/Documentation/i2c/smbus-protocol:
If you write a driver for some I2C device, please try to use the SMBus commands if at all possible (if the device uses only that subset of the I2C protocol). This makes it possible to use the device driver on both SMBus adapters and I2C adapters (the SMBus command set is automatically translated to I2C on I2C adapters, but plain I2C commands can not be handled at all on most pure SMBus adapters).
So having i2c_smbus_{read,write}* functions in barebox makes porting of linux i2c client drivers much easier as many drivers rely on these smbus functions.
--- drivers/i2c/Kconfig | 3 + drivers/i2c/Makefile | 1 + drivers/i2c/i2c-smbus.c | 371 ++++++++++++++++++++++++++++++++++++++++++++++++ include/i2c/i2c.h | 57 ++++++++ 4 files changed, 432 insertions(+)
drivers/i2c/Kconfig +3 -0
@@ -3,6 +3,9 @@ menuconfig I2C if I2C +config I2C_SMBUS + bool + source drivers/i2c/algos/Kconfig source drivers/i2c/busses/Kconfig
drivers/i2c/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_I2C) += i2c.o busses/ algos/ +obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
drivers/i2c/i2c-smbus.c new file +371 -0
371 lines not on this page · raw message
include/i2c/i2c.h +57 -0
63 lines not on this page · raw message
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/2 gpio: add driver for PCA95[357]x, PCA9698, TCA64xx, and MAX7310 SMBus I/O expanders
In reply to Antony Pavlov--- drivers/gpio/Kconfig | 21 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-pca953x.c | 481 ++++++++++++++++++++++++++++++++++++++++ include/platform_data/pca953x.h | 27 +++ 4 files changed, 530 insertions(+)
drivers/gpio/Kconfig +21 -0
@@ -64,6 +64,27 @@ config GPIO_ORION found on Marvell Orion and MVEBU SoCs (Armada 370/XP, Dove, Kirkwood, MV78x00, Orion5x). +config GPIO_PCA953X + bool "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports" + depends on I2C + select I2C_SMBUS + help + Say yes here to provide access to several register-oriented + SMBus I/O expanders, made mostly by NXP or TI. Compatible + models include: + + 4 bits: pca9536, pca9537 + + 8 bits: max7310, max7315, pca6107, pca9534, pca9538, pca9554, + pca9556, pca9557, pca9574, tca6408, xra1202 + + 16 bits: max7312, max7313, pca9535, pca9539, pca9555, pca9575, + tca6416 + + 24 bits: tca6424 + + 40 bits: pca9505, pca9698 + config GPIO_PL061 bool "PrimeCell PL061 GPIO support" depends on ARM_AMBA
drivers/gpio/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_GPIO_JZ4740) += gpio-jz4740.o obj-$(CONFIG_GPIO_MALTA_FPGA_I2C) += gpio-malta-fpga-i2c.o obj-$(CONFIG_GPIO_ORION) += gpio-orion.o obj-$(CONFIG_GPIO_OMAP) += gpio-omap.o +obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o obj-$(CONFIG_GPIO_TEGRA) += gpio-tegra.o
drivers/gpio/gpio-pca953x.c new file +481 -0
481 lines not on this page · raw message
include/platform_data/pca953x.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef _LINUX_PCA953X_H +#define _LINUX_PCA953X_H + +#include <linux/types.h> +#include <i2c/i2c.h> + +/* platform data for the PCA9539 16-bit I/O expander driver */ + +struct pca953x_platform_data { +/* number of the first GPIO */ +unsigned gpio_base; + +/* initial polarity inversion setting */ +u32 invert; + +void *context;/* param to setup/teardown */ + +int (*setup)(struct i2c_client *client, +unsigned gpio,unsigned ngpio, +void *context); +int (*teardown)(struct i2c_client *client, +unsigned gpio,unsigned ngpio, +void *context); +const char *const *names; +}; + +#endif /* _LINUX_PCA953X_H */
Signature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 10 lines · Antony Pavlov
changes since RFC v1 patchseries:
*
gpio-pca953x.c: drop depricated devicetree parameters;
*gpio-pca953x.c: addpca953x_gpio_get_direction();
* move SMBus stuff fromi2c.ctoi2c-smbus.c, introduceCONFIG_I2C_SMBUS.Antony Pavlov (2):
i2c: import SMBus stuff from linux
gpio: add driver for PCA95[357]x, PCA9698, TCA64xx, and MAX7310 SMBus
I/O expanders
Applied, thanks
Sascha
Quoted 23 lines
drivers/gpio/Kconfig | 21 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-pca953x.c | 481 ++++++++++++++++++++++++++++++++++++++++ drivers/i2c/Kconfig | 3 + drivers/i2c/Makefile | 1 + drivers/i2c/i2c-smbus.c | 371 +++++++++++++++++++++++++++++++ include/i2c/i2c.h | 57 +++++ include/platform_data/pca953x.h | 27 +++ 8 files changed, 962 insertions(+) create mode 100644 drivers/gpio/gpio-pca953x.c create mode 100644 drivers/i2c/i2c-smbus.c create mode 100644 include/platform_data/pca953x.hSignature · 7 lines
2.0.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox