summaryrefslogtreecommitdiff
path: root/board/freescale
diff options
context:
space:
mode:
authorHaibo Chen <haibo.chen@freescale.com>2015-04-28 12:37:53 +0800
committerPeng Fan <Peng.Fan@freescale.com>2015-04-29 14:58:50 +0800
commitb6ba68516b681a38025252bd0ef6a6ed3e8adfa0 (patch)
tree053f4c6d10fd311943004f3bcdaa4d36eb3290a2 /board/freescale
parentcb2eed524f43ba74572799374ce0425798f67940 (diff)
downloadu-boot-imx-b6ba68516b681a38025252bd0ef6a6ed3e8adfa0.zip
u-boot-imx-b6ba68516b681a38025252bd0ef6a6ed3e8adfa0.tar.gz
u-boot-imx-b6ba68516b681a38025252bd0ef6a6ed3e8adfa0.tar.bz2
MLK-10215 Add elan init in i.MX6SL-EVK board
EPDC board contain a elan touch screen, this screen is a i2c slave. If this EPDC board connect to i.MX6SL-EVK board, after uboot boot up, if we do i2c operation, like i2c probe, then the i2c bus block. This is due to the elan touch screen i2c slave. This device needs to do some initialization opearation before its i2c operation, otherwise this i2c device pull down the i2c clk line, and make the i2c bus hang. This means elan needs a special flow on i2c before its address is acked, otherwise the i2c bus will be hang. This patch is a workaround, it add a void function which is defined as a weak symbol in i2c driver, and it is called before every i2c operation. In mx6slevk, this function was overwrite to execute elan initialization. So that, for mx6slevk board, it will initialize elan before every i2c operation, but for other boards, it just work as before. Signed-off-by: Haibo Chen <haibo.chen@freescale.com> (cherry picked from commit 4c587b29c423ce61b2471ed20f31ff533d9d8a39) Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Conflicts: arch/arm/include/asm/arch-mx6/mx6sl_pins.h board/freescale/mx6slevk/mx6slevk.c
Diffstat (limited to 'board/freescale')
-rw-r--r--board/freescale/mx6slevk/mx6slevk.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 7c72216..db4b9f8 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -58,6 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW |\
PAD_CTL_DSE_80ohm | PAD_CTL_HYS | \
PAD_CTL_SRE_FAST)
+#define ELAN_INTR_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_HYS)
+
#define EPDC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
@@ -130,6 +132,12 @@ static iomux_v3_cfg_t const fec_pads[] = {
MX6_PAD_FEC_TX_CLK__GPIO_4_21 | MUX_PAD_CTRL(NO_PAD_CTRL),
};
+static iomux_v3_cfg_t const elan_pads[] = {
+ MX6_PAD_EPDC_PWRCTRL2__GPIO_2_9 | MUX_PAD_CTRL(NO_PAD_CTRL),
+ MX6_PAD_EPDC_PWRCTRL3__GPIO_2_10 | MUX_PAD_CTRL(ELAN_INTR_PAD_CTRL),
+ MX6_PAD_KEY_COL6__GPIO_4_4 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+};
+
#ifdef CONFIG_MXC_SPI
static iomux_v3_cfg_t ecspi1_pads[] = {
MX6_PAD_ECSPI1_MISO__ECSPI_MISO | MUX_PAD_CTRL(SPI_PAD_CTRL),
@@ -784,8 +792,42 @@ int board_init(void)
return 0;
}
+void setup_elan_pads(void)
+{
+#define TOUCH_CS IMX_GPIO_NR(2, 9)
+#define TOUCH_INT IMX_GPIO_NR(2, 10)
+#define TOUCH_RST IMX_GPIO_NR(4, 4)
+ imx_iomux_v3_setup_multiple_pads(elan_pads, ARRAY_SIZE(elan_pads));
+}
+
+void elan_init(void)
+{
+ gpio_direction_input(TOUCH_INT);
+ gpio_direction_output(TOUCH_CS , 1);
+ gpio_set_value(TOUCH_CS, 0);
+ gpio_direction_output(TOUCH_RST , 1);
+ gpio_set_value(TOUCH_RST, 0);
+ mdelay(10);
+ gpio_set_value(TOUCH_RST, 1);
+ gpio_set_value(TOUCH_CS, 1);
+ mdelay(100);
+}
+
+/*
+ * This function overwrite the function defined in
+ * drivers/i2c/mxc_i2c.c, which is a weak symbol
+ */
+void i2c_force_reset_slave(void)
+{
+ elan_init();
+}
+
int board_late_init(void)
{
+#ifdef CONFIG_SYS_I2C_MXC
+ setup_elan_pads();
+#endif
+
#ifdef CONFIG_ENV_IS_IN_MMC
board_late_mmc_env_init();
#endif