Skip to contentSkip to conversation

dm: gpio: pca953x: introduce driver model support for pca953x

PATCH New Peng Fan 3 participants 3 messages Apr 14, 2016 – Apr 23, 2016 GPIO

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH v4 1/1 dm: gpio: pca953x: introduce driver model support for pca953x

Introduce a new driver that supports driver model for pca953x. The pca953x chips are used as I2C I/O expanders. This driver is designed to support the following chips:
"
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
"
But for now this driver only supports max 24 bits and pca953x compatible chips. pca957x compatible chips are not supported now.
These can be addressed when we need to add such support for the different chips.
This driver has been tested on i.MX6 SoloX Sabreauto board with max7310 i2c expander using gpio command as following:

=>gpio status -a
Bank gpio at 30_:
gpio at 30_0: input: 1 [ ]

=> dm tree:

 i2c         [   ]    |   |   `-- i2c at 021a8000
 gpio        [   ]    |   |       |-- gpio at 30
 gpio        [   ]    |   |       `-- gpio at 32
Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Wenyou Yang <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Purna Chandra Mandal <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Bhuvanchandra DV <[email protected]>
Cc Andrea Scian <[email protected]>
Cc Michal Simek <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

---

V4:
Follow Michal's comments, use fdtdec_get_int, but not dev_get_addr.

V3:
Add Michal's tested by
Take Michal's suggestion, use hex vaule for gpio@[x].

V2:
change bank name according to Simon's comments.

 drivers/gpio/Kconfig        |  22 +++
 drivers/gpio/Makefile       |   2 +
 drivers/gpio/pca953x_gpio.c | 351 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 375 insertions(+)
 create mode 100644 drivers/gpio/pca953x_gpio.c
drivers/gpio/Kconfig +22 -0
index 2311309..8ff657c 100644
@@ -112,4 +112,26 @@ config MVEBU_GPIO
 	help
 	  Say yes here to support Marvell MVEBU (Armada XP/38x) GPIOs.
 
+config DM_PCA953X
+	bool "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports"
+	depends on DM_GPIO
+	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
+
+	  Now, max 24 bits chips and PCA953X compatible chips are
+	  supported
 endmenu
drivers/gpio/Makefile +2 -0
index ea6e2ed..a7a466c 100644
@@ -11,6 +11,8 @@ obj-$(CONFIG_AXP_GPIO)		+= axp_gpio.o
 endif
 obj-$(CONFIG_DM_GPIO)		+= gpio-uclass.o
 
+obj-$(CONFIG_DM_PCA953X)	+= pca953x_gpio.o
+
 obj-$(CONFIG_AT91_GPIO)	+= at91_gpio.o
 obj-$(CONFIG_ATMEL_PIO4)	+= atmel_pio4.o
 obj-$(CONFIG_INTEL_ICH6_GPIO)	+= intel_ich6_gpio.o
drivers/gpio/pca953x_gpio.c new file +351 -0

351 lines not on this page · raw message

Signature · 1 line
2.6.2
#1 lore raw

PATCH v4 1/1 dm: gpio: pca953x: introduce driver model support for pca953x

Quoted 42 lines · Peng Fan

Introduce a new driver that supports driver model for pca953x. The pca953x chips are used as I2C I/O expanders. This driver is designed to support the following chips:
"
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
"
But for now this driver only supports max 24 bits and pca953x compatible chips. pca957x compatible chips are not supported now.
These can be addressed when we need to add such support for the different chips.
This driver has been tested on i.MX6 SoloX Sabreauto board with max7310 i2c expander using gpio command as following:

=>gpio status -a
Bank gpio at 30_:
gpio at 30_0: input: 1 [ ]

=> dm tree:

 i2c         [   ]    |   |   `-- i2c at 021a8000
 gpio        [   ]    |   |       |-- gpio at 30
 gpio        [   ]    |   |       `-- gpio at 32
Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Wenyou Yang <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Purna Chandra Mandal <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Bhuvanchandra DV <[email protected]>
Cc Andrea Scian <[email protected]>
Cc Michal Simek <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Quoted 1 line

---

When someone takes this there is a conflict in Kconfig but it is easy to resolved. All looks good.

Thanks,
Michal

#2 lore raw

PATCH v4 1/1 dm: gpio: pca953x: introduce driver model support for pca953x

Quoted 45 lines · Michal Simek
Quoted 42 lines · Peng Fan

Introduce a new driver that supports driver model for pca953x. The pca953x chips are used as I2C I/O expanders. This driver is designed to support the following chips:
"
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
"
But for now this driver only supports max 24 bits and pca953x compatible chips. pca957x compatible chips are not supported now.
These can be addressed when we need to add such support for the different chips.
This driver has been tested on i.MX6 SoloX Sabreauto board with max7310 i2c expander using gpio command as following:

=>gpio status -a
Bank gpio at 30_:
gpio at 30_0: input: 1 [ ]

=> dm tree:

 i2c         [   ]    |   |   `-- i2c at 021a8000
 gpio        [   ]    |   |       |-- gpio at 30
 gpio        [   ]    |   |       `-- gpio at 32
Cc Simon Glass <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Wenyou Yang <[email protected]>
Cc Daniel Schwierzeck <[email protected]>
Cc Purna Chandra Mandal <[email protected]>
Cc Thomas Chou <[email protected]>
Cc Bhuvanchandra DV <[email protected]>
Cc Andrea Scian <[email protected]>
Cc Michal Simek <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
Quoted 1 line

---

Quoted 5 lines

When someone takes this there is a conflict in Kconfig but it is easy to resolved. All looks good.

Thanks,
Michal

Applied to u-boot-dm, thanks!