app: aboot: Toggle PMIC gpio 4 for early ethernet feature

Add PMIC gpio 4 toggle to bring Neutrino out of reset for
early ethernet feature.

Change-Id: I9a4ff9386c3823848b50f065cc6fc8b4cb484eaf
CRs-fixed: 2087773
Signed-off-by: Sachin Prakash Gejji <sgejji@codeaurora.org>
diff --git a/makefile b/makefile
index cc0f10f..0b3237c 100644
--- a/makefile
+++ b/makefile
@@ -70,6 +70,11 @@
 ifeq ($(ENABLE_HARD_FPU),1)
   CFLAGS += -mfloat-abi=hard -mfpu=neon
 endif
+
+ifeq ($(ENABLE_EARLY_ETHERNET),1)
+  CFLAGS += -DENABLE_EARLY_ETHERNET=1
+endif
+
 # setup toolchain prefix
 TOOLCHAIN_PREFIX ?= arm-eabi-
 CFLAGS += -fstack-protector-all
diff --git a/target/mdm9640/init.c b/target/mdm9640/init.c
index 21e43c9..97e55ec 100644
--- a/target/mdm9640/init.c
+++ b/target/mdm9640/init.c
@@ -143,6 +143,24 @@
 	return platform_boot_dev_isemmc();
 }
 
+#if ENABLE_EARLY_ETHERNET
+void toggle_neutrino(void)
+{
+	struct pm8x41_gpio gpio = {
+	.direction = PM_GPIO_DIR_OUT,
+	.function = PM_GPIO_FUNC_HIGH,
+	.vin_sel = 1,   /* VIN_1 */
+	.output_buffer = PM_GPIO_OUT_CMOS,
+	.out_strength = PM_GPIO_OUT_DRIVE_LOW,
+	};
+
+	pm8x41_gpio_config(4, &gpio);
+	pm8x41_gpio_set(4, 1);
+	mdelay(10);
+	pm8x41_gpio_set(4, 0);
+}
+#endif
+
 /* init */
 void target_init(void)
 {
@@ -161,6 +179,10 @@
 		rpm_glink_init();
 	}
 
+#if ENABLE_EARLY_ETHERNET
+	/*enable pmic gpio 4*/
+	toggle_neutrino();
+#endif
 	if (platform_boot_dev_isemmc()) {
 		target_sdc_init();
 		if (partition_read_table()) {