From patchwork Wed Apr 22 12:29:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 238297 List-Id: U-Boot discussion From: patrick.delaunay at st.com (Patrick Delaunay) Date: Wed, 22 Apr 2020 14:29:13 +0200 Subject: [PATCH v2 05/12] board: stm32mp1: gt9147 IRQ before reset on EV1 In-Reply-To: <20200422122920.19340-1-patrick.delaunay@st.com> References: <20200422122920.19340-1-patrick.delaunay@st.com> Message-ID: <20200422142834.v2.5.I5d296f8fd82b60a592b51029e7e420672d0e855b@changeid> Software workaround for I2C issue on EV1 board, configure the IRQ line for touchscreen before LCD reset to fix the used I2C address. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- Changes in v2: - remove debug message and unused return of board_ev1_init board/st/stm32mp1/stm32mp1.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 6a3e2e64bf..8e247bbc87 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -621,6 +621,38 @@ static bool board_is_dk2(void) } #endif +static bool board_is_ev1(void) +{ + if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) && + (of_machine_is_compatible("st,stm32mp157a-ev1") || + of_machine_is_compatible("st,stm32mp157c-ev1") || + of_machine_is_compatible("st,stm32mp157d-ev1") || + of_machine_is_compatible("st,stm32mp157f-ev1"))) + return true; + + return false; +} + +/* touchscreen driver: only used for pincontrol configuration */ +static const struct udevice_id goodix_ids[] = { + { .compatible = "goodix,gt9147", }, + { } +}; + +U_BOOT_DRIVER(goodix) = { + .name = "goodix", + .id = UCLASS_NOP, + .of_match = goodix_ids, +}; + +static void board_ev1_init(void) +{ + struct udevice *dev; + + /* configure IRQ line on EV1 for touchscreen before LCD reset */ + uclass_get_device_by_driver(UCLASS_NOP, DM_GET_DRIVER(goodix), &dev); +} + /* board dependent setup after realloc */ int board_init(void) { @@ -638,6 +670,9 @@ int board_init(void) board_key_check(); + if (board_is_ev1()) + board_ev1_init(); + #ifdef CONFIG_DM_REGULATOR if (board_is_dk2()) dk2_i2c1_fix();