ipq4019: fdt_fixup: Delete the 'sd-ldo-gpios' property from sdhci node

power-on write protection also gets cleared during sd-ldo toggle in kernel.
This toggle is required only for SD card. So, If the boot flash type is
eMMC or NOR+eMMC sd-ldo removed from the device tree.

Change-Id: I3c7bf14a5f67df3bcef2bd6507da5146c2beffb7
Signed-off-by: Vinoth Gnanasekaran <vgnana@codeaurora.org>
diff --git a/board/qca/arm/common/fdt_fixup.c b/board/qca/arm/common/fdt_fixup.c
index 81d49c6..0504a37 100644
--- a/board/qca/arm/common/fdt_fixup.c
+++ b/board/qca/arm/common/fdt_fixup.c
@@ -481,6 +481,10 @@
 	return 0;
 }
 
+__weak void fdt_fixup_sd_ldo_gpios_toggle(void *blob)
+{
+	return;
+}
 
 /*
  * For newer kernel that boot with device tree (3.14+), all of memory is
@@ -576,6 +580,10 @@
 	ipq_fdt_fixup_usb_device_mode(blob);
 	fdt_fixup_auto_restart(blob);
 
+	if ((flash_type == SMEM_BOOT_MMC_FLASH) ||
+		(flash_type == SMEM_BOOT_NORPLUSEMMC))
+			fdt_fixup_sd_ldo_gpios_toggle(blob);
+
 #ifdef CONFIG_QCA_MMC
 	board_mmc_deinit();
 #endif
diff --git a/board/qca/arm/ipq40xx/ipq40xx.c b/board/qca/arm/ipq40xx/ipq40xx.c
index c1a6bc8..6801982 100644
--- a/board/qca/arm/ipq40xx/ipq40xx.c
+++ b/board/qca/arm/ipq40xx/ipq40xx.c
@@ -438,6 +438,28 @@
 	}
 }
 
+void fdt_fixup_sd_ldo_gpios_toggle(void *blob)
+{
+	int noff;
+	int ret;
+
+	noff = fdt_path_offset(blob, "/soc/sdhci");
+	if (noff < 0) {
+		printf("ipq: fdt fixup unable to find node /soc/sdhci\n");
+		return;
+	}
+
+	/**
+	 * In eMMC card, power-on write protection also gets cleared
+	 * during sd-ldo toggle in kernel.
+	 */
+	ret = fdt_delprop(blob, noff, "sd-ldo-gpios");
+	if (ret < 0) {
+		printf("sdhci: cann't delete sd-ldo-gpios\n");
+		return;
+	}
+}
+
 void ipq_fdt_fixup_usb_device_mode(void *blob)
 {
 	int nodeoff, ret, i;