GPIO functionallity related query

Hello team,

We are working on apq8016e based customer board on Linaro-18.01 subsystem.

We need to change GPIO4/5 functionality to GPIO from UART.

Please guide us how can we change these GPIO settings in kernel.

Regards,
Parth Y Shah

You need to modify and rebuilt the devicetree for that. If you look at msm8916-pins.dtsi [1], you’ll find that gpio4/5 can be used for the blsp1_uart2, so you can simply and selected in apq8016--sbc.dtsi [2] under serial@78b0000 node. Simply disabling this node (status = "disabled") should release theses pins and make them controllable as gpio.

[1] msm8916-pins.dtsi « qcom « dts « boot « arm64 « arch - working/qualcomm/kernel.git - Qualcomm Landing Team kernel
[2] apq8016-sbc.dtsi « qcom « dts « boot « arm64 « arch - working/qualcomm/kernel.git - Qualcomm Landing Team kernel

Hi Loic,

We have done this changes in the dtsi files as mentioned by you but our board is not fully up after these changes. Board got stucked in between.

diff --git a/arch/arm64/boot/dts/qcom/apq8016-tytocare-g2.dtsi b/arch/arm64/boot/dts/qcom/apq8016-tytocare-g2.dtsi
index 976255c..567f332 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-tytocare-g2.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-tytocare-g2.dtsi
@@ -57,10 +57,8 @@
 
 		serial@78b0000 {
 			label = "LS-UART1";
-			status = "okay";
+			status = "disabled";
 			pinctrl-names = "default", "sleep";
-			pinctrl-0 = <&blsp1_uart2_default>;
-			pinctrl-1 = <&blsp1_uart2_sleep>;
 		};
 
 		i2c@78b6000 {
diff --git a/arch/arm64/boot/dts/qcom/msm8916-mtp.dtsi b/arch/arm64/boot/dts/qcom/msm8916-mtp.dtsi
index ceeb8a6..8904283 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-mtp.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-mtp.dtsi
@@ -26,10 +26,8 @@
 
 	soc {
 		serial@78b0000 {
-			status = "okay";
+			status = "disabled";
 			pinctrl-names = "default", "sleep";
-			pinctrl-0 = <&blsp1_uart2_default>;
-			pinctrl-1 = <&blsp1_uart2_sleep>;
 		};
 	};
 };
diff --git a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
index a0ea94b..db58867 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916-pins.dtsi
@@ -38,30 +38,6 @@
 		};
 	};
 
-	blsp1_uart2_default: blsp1_uart2_default {
-		pinmux {
-			function = "blsp_uart2";
-			pins = "gpio4", "gpio5";
-		};
-		pinconf {
-			pins = "gpio4", "gpio5";
-			drive-strength = <16>;
-			bias-disable;
-		};
-	};
-
-	blsp1_uart2_sleep: blsp1_uart2_sleep {
-		pinmux {
-			function = "gpio";
-			pins = "gpio4", "gpio5";
-		};
-		pinconf {
-			pins = "gpio4", "gpio5";
-			drive-strength = <2>;
-			bias-pull-down;
-		};
-	};
-
 	spi1_default: spi1_default {
 		pinmux {
 			function = "blsp_spi1";

Please suggest if something is missed here. We also want to set GPIO as low after its functionallity changes to GPIO.

Regards,
Parth Y Shah

As this kernel change did not work for us, we have done further changes in LK as below,

diff --git a/project/msm8916.mk b/project/msm8916.mk
index feb8b98..9810919 100644
--- a/project/msm8916.mk
+++ b/project/msm8916.mk
@@ -32,7 +32,7 @@ endif

 #DEFINES += WITH_DEBUG_DCC=1
 DEFINES += WITH_DEBUG_LOG_BUF=1
-DEFINES += WITH_DEBUG_UART=1
+#DEFINES += WITH_DEBUG_UART=1
 #DEFINES += WITH_DEBUG_FBCON=1
 DEFINES += ENABLE_FBCON_LOGGING=1
 DEFINES += DEVICE_TREE=1
diff --git a/target/msm8916/init.c b/target/msm8916/init.c
index 2364c17..bc25e12 100644
--- a/target/msm8916/init.c
+++ b/target/msm8916/init.c
@@ -365,6 +365,13 @@ void target_init(void)
                ASSERT(0);
        }

+        /* configure gpio-5 */
+        gpio_tlmm_config(5, 0, GPIO_OUTPUT, GPIO_NO_PULL,
+                                GPIO_8MA, GPIO_DISABLE);
+        /* configure gpio-4 */
+        gpio_tlmm_config(4, 0, GPIO_OUTPUT, GPIO_NO_PULL,
+                                GPIO_8MA, GPIO_DISABLE);
+

After this change we are able to disable the UART from the LK.
But still we are at the same stage and not able to run the board fully with these changes also. Can you please suggest here what can we do further?

Regards,
Parth Y Shah

What do you mean, is there a boot issue? UART_1 is normally used for console, maybe check that you fixed the kernel boot params accordingly.

Yes Loic, there is a boot issue. Board is not booting up fully after these changes.

Please suggest here.