Skip to contentSkip to conversation

gpio: tca642x: Add the tca642x gpio expander driver

PATCH New Dan Murphy 2 participants 3 messages Jul 11, 2013 – Jul 30, 2013 GPIO

lore
Share & tools
lore

Dan Murphy

author
#0 lore raw

PATCH v3 1/2 gpio: tca642x: Add the tca642x gpio expander driver

Add the tca642x gpio expander driver

Datasheet:
http://www.ti.com/product/tca6424a

---

v2 - Updated per comments - http://patchwork.ozlabs.org/patch/257602/
v3 - Fixed checkpatch issues - http://patchwork.ozlabs.org/patch/257841/

 drivers/gpio/Makefile  |    1 +
 drivers/gpio/tca642x.c |  333 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/tca642x.h      |   69 ++++++++++
 3 files changed, 403 insertions(+)
 create mode 100644 drivers/gpio/tca642x.c
 create mode 100644 include/tca642x.h
drivers/gpio/Makefile +1 -0
index f77c1ec..7e74dfe 100644
@@ -49,6 +49,7 @@ COBJS-$(CONFIG_BCM2835_GPIO)	+= bcm2835_gpio.o
 COBJS-$(CONFIG_S3C2440_GPIO)	+= s3c2440_gpio.o
 COBJS-$(CONFIG_XILINX_GPIO)	+= xilinx_gpio.o
 COBJS-$(CONFIG_ADI_GPIO2)	+= adi_gpio2.o
+COBJS-$(CONFIG_TCA642X)		+= tca642x.o
 
 COBJS	:= $(COBJS-y)
 SRCS 	:= $(COBJS:.o=.c)
drivers/gpio/tca642x.c new file +333 -0

333 lines not on this page · raw message

include/tca642x.h new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 2/2 gpio: omap5-uevm: Configure the tca6424 gpio expander

Configure the tca6424 gpio expander
This allows use of the debug and tri color LEDs.

---

v2 - Updated per comments - http://patchwork.ozlabs.org/patch/257603/
v3 - Updated documentation. No change to mux data the code is the patch is required or I2C reads fail - http://patchwork.ozlabs.org/patch/257840/

 board/ti/omap5_uevm/evm.c      |   22 ++++++++++++++++++++++
 board/ti/omap5_uevm/mux_data.h |    2 ++
 include/configs/omap5_uevm.h   |    5 +++++
 3 files changed, 29 insertions(+)
board/ti/omap5_uevm/evm.c +22 -0
index 90046e8..c3581ee 100644
@@ -26,6 +26,7 @@
 #include <palmas.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
+#include <tca642x.h>
 
 #include "mux_data.h"
 
@@ -36,6 +37,25 @@ const struct omap_sysinfo sysinfo = {
 };
 
 /**
+ * @brief tca642x_init - uEVM default values for the GPIO expander
+ * input reg, output reg, polarity reg, configuration reg
+ */
+struct tca642x_bank_info tca642x_init[] = {
+	{ .input_reg = 0x00,
+	  .output_reg = 0x04,
+	  .polarity_reg = 0x00,
+	  .configuration_reg = 0x80 },
+	{ .input_reg = 0x00,
+	  .output_reg = 0x00,
+	  .polarity_reg = 0x00,
+	  .configuration_reg = 0xff },
+	{ .input_reg = 0x00,
+	  .output_reg = 0x00,
+	  .polarity_reg = 0x00,
+	  .configuration_reg = 0x40 },
+};
+
+/**
  * @brief board_init
  *
  * @return 0
@@ -46,6 +66,8 @@ int board_init(void)
 	gd->bd->bi_arch_number = MACH_TYPE_OMAP5_SEVM;
 	gd->bd->bi_boot_params = (0x80000000 + 0x100); /* boot param addr */
 
+	tca642x_set_inital_state(CONFIG_SYS_I2C_TCA642X_ADDR, tca642x_init);
+
 	return 0;
 }
 
board/ti/omap5_uevm/mux_data.h +2 -0
index a82795d..7e6415e 100644
@@ -56,6 +56,8 @@ const struct pad_conf_entry core_padconf_array_essential[] = {
 	{USBD0_HS_DP, (IEN | M0)},	/*  USBD0_HS_DP */
 	{USBD0_HS_DM, (IEN | M0)},	/*  USBD0_HS_DM */
 	{USBD0_SS_RX, (IEN | M0)},	/*  USBD0_SS_RX */
+	{I2C5_SCL, (IEN | M0)}, /* I2C5_SCL */
+	{I2C5_SDA, (IEN | M0)}, /* I2C5_SDA */
 
 };
 
include/configs/omap5_uevm.h +5 -0
index 46dacc2..bee1278 100644
@@ -53,6 +53,11 @@
 #define CONFIG_PARTITION_UUIDS
 #define CONFIG_CMD_PART
 
+#define CONFIG_TCA642X
+#define CONFIG_CMD_TCA642X
+#define CONFIG_SYS_I2C_TCA642X_BUS_NUM 4
+#define CONFIG_SYS_I2C_TCA642X_ADDR 0x22
+
 #define CONFIG_SYS_PROMPT		"OMAP5432 uEVM # "
 
 #define CONSOLEDEV		"ttyO2"
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v3 1/2 gpio: tca642x: Add the tca642x gpio expander driver

In reply to Dan Murphy
Quoted 6 lines · Dan Murphy

Add the tca642x gpio expander driver

Datasheet:
http://www.ti.com/product/tca6424a

Applied to u-boot-ti/master along with 2/2, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130730/5a17ccda/attachment.pgp>