Patchwork [U-Boot,2/2] omap5: Configure the tca6424 gpio expander

login
register
mail settings
Submitter Dan Murphy
Date July 8, 2013, 8:54 p.m.
Message ID <1373316840-28436-2-git-send-email-dmurphy@ti.com>
Download mbox | patch
Permalink /patch/257603/
State Superseded
Delegated to: Tom Rini
Headers show

Comments

Dan Murphy - July 8, 2013, 8:54 p.m.
Configure the tca6424 gpio expander
This allows use of the debug and tri color LEDs.
As well as HDMI PEO signal.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 board/ti/omap5_uevm/evm.c      |   12 ++++++++++++
 board/ti/omap5_uevm/mux_data.h |    2 ++
 include/configs/omap5_uevm.h   |    5 +++++
 3 files changed, 19 insertions(+)
Nishanth Menon - July 8, 2013, 9:19 p.m.
$subject

omap5: uevm
On 07/08/2013 03:54 PM, Dan Murphy wrote:
> Configure the tca6424 gpio expander
> This allows use of the debug and tri color LEDs.
> As well as HDMI PEO signal.
we use HDMI in u-boot?
>
> Signed-off-by: Dan Murphy <dmurphy@ti.com>
> ---
>   board/ti/omap5_uevm/evm.c      |   12 ++++++++++++
>   board/ti/omap5_uevm/mux_data.h |    2 ++
>   include/configs/omap5_uevm.h   |    5 +++++
>   3 files changed, 19 insertions(+)
>
> diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
> index 90046e8..ee96ae1 100644
> --- a/board/ti/omap5_uevm/evm.c
> +++ b/board/ti/omap5_uevm/evm.c
> @@ -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"
>
> @@ -35,6 +36,15 @@ const struct omap_sysinfo sysinfo = {
>   	"Board: OMAP5430 EVM\n"
>   };
>
> +/* Initial states for the GPIO expander
Doc comment style.
> + * input reg, output reg, polarity reg, configuration reg
> + */
> +struct tca642x_bank_info tca642x_init[] = {
> +	{0x00, 0x04, 0x00, 0x80},
> +	{0x00, 0x00, 0x00, 0xff},
> +	{0x00, 0x00, 0x00, 0x40},
could you be explicit and use .input_reg =  etc?
btw, why should board know about input_reg, output_reg polarity_reg? 
is'nt that the job of the driver?
> +};
> +
>   /**
>    * @brief board_init
>    *
> @@ -46,6 +56,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;
>   }
>
> diff --git a/board/ti/omap5_uevm/mux_data.h b/board/ti/omap5_uevm/mux_data.h
> index a82795d..7e6415e 100644
> --- a/board/ti/omap5_uevm/mux_data.h
> +++ b/board/ti/omap5_uevm/mux_data.h
> @@ -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 */
>
>   };
>
> diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h
> index 46dacc2..bee1278 100644
> --- a/include/configs/omap5_uevm.h
> +++ b/include/configs/omap5_uevm.h
> @@ -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"
>
Dan Murphy - July 9, 2013, 4:20 p.m.
On 07/08/2013 04:19 PM, Nishanth Menon wrote:
> $subject
>
Don't know where it went it was in my patch set I submitted.

> omap5: uevm
> On 07/08/2013 03:54 PM, Dan Murphy wrote:
>> Configure the tca6424 gpio expander
>> This allows use of the debug and tri color LEDs.
>> As well as HDMI PEO signal.
> we use HDMI in u-boot?
Removed.
>>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>> ---
>>   board/ti/omap5_uevm/evm.c      |   12 ++++++++++++
>>   board/ti/omap5_uevm/mux_data.h |    2 ++
>>   include/configs/omap5_uevm.h   |    5 +++++
>>   3 files changed, 19 insertions(+)
>>
>> diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
>> index 90046e8..ee96ae1 100644
>> --- a/board/ti/omap5_uevm/evm.c
>> +++ b/board/ti/omap5_uevm/evm.c
>> @@ -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"
>>
>> @@ -35,6 +36,15 @@ const struct omap_sysinfo sysinfo = {
>>       "Board: OMAP5430 EVM\n"
>>   };
>>
>> +/* Initial states for the GPIO expander
> Doc comment style.
Will do.
Probably need a patch that fixes all the other interfaces as well.
>> + * input reg, output reg, polarity reg, configuration reg
>> + */
>> +struct tca642x_bank_info tca642x_init[] = {
>> +    {0x00, 0x04, 0x00, 0x80},
>> +    {0x00, 0x00, 0x00, 0xff},
>> +    {0x00, 0x00, 0x00, 0x40},
> could you be explicit and use .input_reg =  etc?
> btw, why should board know about input_reg, output_reg polarity_reg? 
> is'nt that the job of the driver?
These are the default power up values for the uEVM.
I can add .input_reg = blah.  Just thought the bank_info structure was 
good enough.
>> +};
>> +
>>   /**
>>    * @brief board_init
>>    *
>> @@ -46,6 +56,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;
>>   }
>>
>> diff --git a/board/ti/omap5_uevm/mux_data.h 
>> b/board/ti/omap5_uevm/mux_data.h
>> index a82795d..7e6415e 100644
>> --- a/board/ti/omap5_uevm/mux_data.h
>> +++ b/board/ti/omap5_uevm/mux_data.h
>> @@ -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 */
>>
>>   };
>>
>> diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h
>> index 46dacc2..bee1278 100644
>> --- a/include/configs/omap5_uevm.h
>> +++ b/include/configs/omap5_uevm.h
>> @@ -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"
>>
>
>

Patch

diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index 90046e8..ee96ae1 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -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"
 
@@ -35,6 +36,15 @@  const struct omap_sysinfo sysinfo = {
 	"Board: OMAP5430 EVM\n"
 };
 
+/* Initial states for the GPIO expander
+ * input reg, output reg, polarity reg, configuration reg
+ */
+struct tca642x_bank_info tca642x_init[] = {
+	{0x00, 0x04, 0x00, 0x80},
+	{0x00, 0x00, 0x00, 0xff},
+	{0x00, 0x00, 0x00, 0x40},
+};
+
 /**
  * @brief board_init
  *
@@ -46,6 +56,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;
 }
 
diff --git a/board/ti/omap5_uevm/mux_data.h b/board/ti/omap5_uevm/mux_data.h
index a82795d..7e6415e 100644
--- a/board/ti/omap5_uevm/mux_data.h
+++ b/board/ti/omap5_uevm/mux_data.h
@@ -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 */
 
 };
 
diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h
index 46dacc2..bee1278 100644
--- a/include/configs/omap5_uevm.h
+++ b/include/configs/omap5_uevm.h
@@ -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"