From 00c26ae30f3b1a12a8f1c3d0256788ce53beff9e Mon Sep 17 00:00:00 2001 From: Nitheesh Sekar Date: Fri, 3 Mar 2023 11:25:23 +0530 Subject: [PATCH] ipq9574: power cycle SDX based on e911 call This patch adds a condition to power cycle the SDX based on the current status of the e911 call. Change-Id: Id3cf50cfb49a26151c98b7d52e18b9c487cfb935 Signed-off-by: Nitheesh Sekar --- arch/arm/dts/ipq9574-al02-c19.dts | 1 + arch/arm/dts/ipq9574-al02-c3.dts | 1 + board/qca/arm/ipq9574/ipq9574.c | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/dts/ipq9574-al02-c19.dts b/arch/arm/dts/ipq9574-al02-c19.dts index aaf763f1b4..b3fc46f49a 100644 --- a/arch/arm/dts/ipq9574-al02-c19.dts +++ b/arch/arm/dts/ipq9574-al02-c19.dts @@ -252,5 +252,6 @@ sdx-gpio { power_on = <40>; reset = <47>; + e911 = <43>; }; }; diff --git a/arch/arm/dts/ipq9574-al02-c3.dts b/arch/arm/dts/ipq9574-al02-c3.dts index 282abb4e6e..7cbf4b89c7 100644 --- a/arch/arm/dts/ipq9574-al02-c3.dts +++ b/arch/arm/dts/ipq9574-al02-c3.dts @@ -42,5 +42,6 @@ sdx-gpio { power_on = <40>; reset = <47>; + e911 = <43>; }; }; diff --git a/board/qca/arm/ipq9574/ipq9574.c b/board/qca/arm/ipq9574/ipq9574.c index 0f8dd9eccf..7fdc3bd11f 100644 --- a/board/qca/arm/ipq9574/ipq9574.c +++ b/board/qca/arm/ipq9574/ipq9574.c @@ -1194,6 +1194,7 @@ void reset_cpu(unsigned long a) void power_cycle_sdx(void) { int node, power_on_gpio = -1, reset_gpio = -1; + int e911_gpio = -1; unsigned int *power_on_gpio_base, *reset_gpio_base; unsigned int machid = gd->bd->bi_arch_number; @@ -1201,14 +1202,14 @@ void power_cycle_sdx(void) return; node = fdt_path_offset(gd->fdt_blob, "/sdx-gpio"); - if (node >= 0) + if (node >= 0) { power_on_gpio = fdtdec_get_uint(gd->fdt_blob, node, "power_on", -1); - - node = fdt_path_offset(gd->fdt_blob, "/sdx-gpio"); - if (node >= 0) reset_gpio = fdtdec_get_uint(gd->fdt_blob, node, "reset", -1); + e911_gpio = fdtdec_get_uint(gd->fdt_blob, node, "e911", -1); + } - if (power_on_gpio >= 0 && reset_gpio >= 0) { + if (power_on_gpio > 0 && reset_gpio > 0 && + (e911_gpio <= 0 || !gpio_get_value(e911_gpio))) { power_on_gpio_base = (unsigned int *)GPIO_CONFIG_ADDR(power_on_gpio); reset_gpio_base = (unsigned int *)GPIO_CONFIG_ADDR(reset_gpio); writel(0x2c1, power_on_gpio_base);