From 2ebb44cea5706a4d8f8df00c136639e223f4d731 Mon Sep 17 00:00:00 2001 From: Vinoth Gnanasekaran Date: Mon, 16 Jul 2018 12:01:38 +0530 Subject: [PATCH] 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 --- board/qca/arm/common/fdt_fixup.c | 8 ++++++++ board/qca/arm/ipq40xx/ipq40xx.c | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/board/qca/arm/common/fdt_fixup.c b/board/qca/arm/common/fdt_fixup.c index 81d49c6f02..0504a37812 100644 --- a/board/qca/arm/common/fdt_fixup.c +++ b/board/qca/arm/common/fdt_fixup.c @@ -481,6 +481,10 @@ static int ipq40xx_patch_eth_params(void *blob, unsigned long gmac_no) 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 @@ int ft_board_setup(void *blob, bd_t *bd) 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 c1a6bc8268..6801982edc 100644 --- a/board/qca/arm/ipq40xx/ipq40xx.c +++ b/board/qca/arm/ipq40xx/ipq40xx.c @@ -438,6 +438,28 @@ void ipq_fdt_fixup_socinfo(void *blob) } } +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;