From 9b49d9c097f2d090baac595e2d5f293a05ce9be2 Mon Sep 17 00:00:00 2001 From: Ram Kumar D Date: Mon, 16 May 2022 11:59:34 +0530 Subject: [PATCH 1/3] fdt_fixup: Add devsoc nand compatible to fdt fixup Change-Id: I2d3f0ad48528554ed93c5aa89c25dd8e69a073a3 Signed-off-by: Ram Kumar D --- board/qca/arm/common/fdt_fixup.c | 1 + include/configs/devsoc.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/board/qca/arm/common/fdt_fixup.c b/board/qca/arm/common/fdt_fixup.c index 2566f242ff..269d0f31f7 100644 --- a/board/qca/arm/common/fdt_fixup.c +++ b/board/qca/arm/common/fdt_fixup.c @@ -965,6 +965,7 @@ int ft_board_setup(void *blob, bd_t *bd) { "qcom,ebi2-nandc-bam-v2.1.1", MTD_DEV_TYPE_NAND, 0 }, { "qcom,ipq9574-nand", MTD_DEV_TYPE_NAND, 0 }, { "qcom,ipq8074-nand", MTD_DEV_TYPE_NAND, 0 }, + { "qcom,devsoc-nand", MTD_DEV_TYPE_NAND, 0 }, { "spinand,mt29f", MTD_DEV_TYPE_NAND, 1 }, { "n25q128a11", MTD_DEV_TYPE_NAND, CONFIG_IPQ_SPI_NOR_INFO_IDX }, diff --git a/include/configs/devsoc.h b/include/configs/devsoc.h index f1f9c958f9..8f9b0d5044 100644 --- a/include/configs/devsoc.h +++ b/include/configs/devsoc.h @@ -299,6 +299,10 @@ extern loff_t board_env_size; #define CONFIG_MMC_FORCE_CAP_4BIT_BUSWIDTH #endif +#define CONFIG_IPQ_FDT_FIXUP +#define CONFIG_FDT_FIXUP_PARTITIONS +#define CONFIG_OF_BOARD_SETUP + #undef CONFIG_BOOTM_NETBSD #undef CONFIG_BOOTM_PLAN9 #undef CONFIG_BOOTM_RTEMS From 4ffb97c3947393194d3ff0f06763164b886402c9 Mon Sep 17 00:00:00 2001 From: Ram Kumar D Date: Mon, 16 May 2022 12:00:19 +0530 Subject: [PATCH 2/3] fdt_fixup: Add support to patch up cpu_type and soc version Change-Id: Iaf24075cf532997993c0bf6a8d6add90b812db77 Signed-off-by: Ram Kumar D --- board/qca/arm/common/fdt_fixup.c | 52 +++++++++++++++++++++++++++++ board/qca/arm/ipq40xx/ipq40xx.c | 5 --- board/qca/arm/ipq5018/ipq5018.c | 47 --------------------------- board/qca/arm/ipq6018/ipq6018.c | 47 --------------------------- board/qca/arm/ipq806x/ipq806x.c | 56 -------------------------------- board/qca/arm/ipq807x/ipq807x.c | 46 -------------------------- board/qca/arm/ipq9574/ipq9574.c | 52 ----------------------------- 7 files changed, 52 insertions(+), 253 deletions(-) diff --git a/board/qca/arm/common/fdt_fixup.c b/board/qca/arm/common/fdt_fixup.c index 269d0f31f7..b1e5a6795e 100644 --- a/board/qca/arm/common/fdt_fixup.c +++ b/board/qca/arm/common/fdt_fixup.c @@ -896,6 +896,58 @@ __weak void fdt_fixup_runtime_failsafe(void *blob) return; } +__weak void ipq_fdt_fixup_socinfo(void *blob) +{ + uint32_t cpu_type; + uint32_t soc_version, soc_version_major, soc_version_minor; + int nodeoff, ret; + + nodeoff = fdt_path_offset(blob, "/"); + + if (nodeoff < 0) { + printf("ipq: fdt fixup cannot find root node\n"); + return; + } + + ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); + if (!ret) { + ret = fdt_setprop(blob, nodeoff, "cpu_type", + &cpu_type, sizeof(cpu_type)); + if (ret) + printf("%s: cannot set cpu type %d\n", __func__, ret); + } else { + printf("%s: cannot get socinfo\n", __func__); + } + + ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); + if (!ret) { + soc_version_major = SOCINFO_VERSION_MAJOR(soc_version); + soc_version_minor = SOCINFO_VERSION_MINOR(soc_version); + + ret = fdt_setprop(blob, nodeoff, "soc_version_major", + &soc_version_major, + sizeof(soc_version_major)); + if (ret) + printf("%s: cannot set soc_version_major %d\n", + __func__, soc_version_major); + + ret = fdt_setprop(blob, nodeoff, "soc_version_minor", + &soc_version_minor, + sizeof(soc_version_minor)); + if (ret) + printf("%s: cannot set soc_version_minor %d\n", + __func__, soc_version_minor); + } else { + printf("%s: cannot get soc version\n", __func__); + } + return; +} + +__weak void fdt_fixup_auto_restart(void *blob) +{ + return; +} + void set_mtdids(void) { char mtdids[256]; diff --git a/board/qca/arm/ipq40xx/ipq40xx.c b/board/qca/arm/ipq40xx/ipq40xx.c index 61bd3ee3e1..93f6b56728 100644 --- a/board/qca/arm/ipq40xx/ipq40xx.c +++ b/board/qca/arm/ipq40xx/ipq40xx.c @@ -540,11 +540,6 @@ void ipq_fdt_fixup_usb_device_mode(void *blob) return; } -void fdt_fixup_auto_restart(void *blob) -{ - return; -} - void set_flash_secondary_type(qca_smem_flash_info_t * smem) { return; diff --git a/board/qca/arm/ipq5018/ipq5018.c b/board/qca/arm/ipq5018/ipq5018.c index e84ea1161e..41cca87104 100644 --- a/board/qca/arm/ipq5018/ipq5018.c +++ b/board/qca/arm/ipq5018/ipq5018.c @@ -468,53 +468,6 @@ void ipq_fdt_fixup_usb_device_mode(void *blob) printf("%s: invalid param for usb_mode\n", __func__); } -void ipq_fdt_fixup_socinfo(void *blob) -{ - uint32_t cpu_type; - uint32_t soc_version, soc_version_major, soc_version_minor; - int nodeoff, ret; - - nodeoff = fdt_path_offset(blob, "/"); - - if (nodeoff < 0) { - printf("ipq: fdt fixup cannot find root node\n"); - return; - } - - ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); - if (!ret) { - ret = fdt_setprop(blob, nodeoff, "cpu_type", - &cpu_type, sizeof(cpu_type)); - if (ret) - printf("%s: cannot set cpu type %d\n", __func__, ret); - } else { - printf("%s: cannot get socinfo\n", __func__); - } - - ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); - if (!ret) { - soc_version_major = SOCINFO_VERSION_MAJOR(soc_version); - soc_version_minor = SOCINFO_VERSION_MINOR(soc_version); - - ret = fdt_setprop(blob, nodeoff, "soc_version_major", - &soc_version_major, - sizeof(soc_version_major)); - if (ret) - printf("%s: cannot set soc_version_major %d\n", - __func__, soc_version_major); - - ret = fdt_setprop(blob, nodeoff, "soc_version_minor", - &soc_version_minor, - sizeof(soc_version_minor)); - if (ret) - printf("%s: cannot set soc_version_minor %d\n", - __func__, soc_version_minor); - } else { - printf("%s: cannot get soc version\n", __func__); - } - return; -} - void fdt_fixup_auto_restart(void *blob) { const char *paniconwcssfatal; diff --git a/board/qca/arm/ipq6018/ipq6018.c b/board/qca/arm/ipq6018/ipq6018.c index 7982f0c086..3be6255a24 100644 --- a/board/qca/arm/ipq6018/ipq6018.c +++ b/board/qca/arm/ipq6018/ipq6018.c @@ -1292,53 +1292,6 @@ void reset_board(void) while(1); } -void ipq_fdt_fixup_socinfo(void *blob) -{ - uint32_t cpu_type; - uint32_t soc_version, soc_version_major, soc_version_minor; - int nodeoff, ret; - - nodeoff = fdt_path_offset(blob, "/"); - - if (nodeoff < 0) { - printf("ipq: fdt fixup cannot find root node\n"); - return; - } - - ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); - if (!ret) { - ret = fdt_setprop(blob, nodeoff, "cpu_type", - &cpu_type, sizeof(cpu_type)); - if (ret) - printf("%s: cannot set cpu type %d\n", __func__, ret); - } else { - printf("%s: cannot get socinfo\n", __func__); - } - - ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); - if (!ret) { - soc_version_major = SOCINFO_VERSION_MAJOR(soc_version); - soc_version_minor = SOCINFO_VERSION_MINOR(soc_version); - - ret = fdt_setprop(blob, nodeoff, "soc_version_major", - &soc_version_major, - sizeof(soc_version_major)); - if (ret) - printf("%s: cannot set soc_version_major %d\n", - __func__, soc_version_major); - - ret = fdt_setprop(blob, nodeoff, "soc_version_minor", - &soc_version_minor, - sizeof(soc_version_minor)); - if (ret) - printf("%s: cannot set soc_version_minor %d\n", - __func__, soc_version_minor); - } else { - printf("%s: cannot get soc version\n", __func__); - } - return; -} - void fdt_fixup_auto_restart(void *blob) { const char *paniconwcssfatal; diff --git a/board/qca/arm/ipq806x/ipq806x.c b/board/qca/arm/ipq806x/ipq806x.c index cc865c8374..9f72ce4978 100644 --- a/board/qca/arm/ipq806x/ipq806x.c +++ b/board/qca/arm/ipq806x/ipq806x.c @@ -567,68 +567,12 @@ void board_pci_deinit() return ; } -void ipq_fdt_fixup_socinfo(void *blob) -{ - uint32_t cpu_type; - uint32_t soc_version, soc_version_major, soc_version_minor; - int nodeoff, ret; - - nodeoff = fdt_path_offset(blob, "/"); - - if (nodeoff < 0) { - printf("ipq: fdt fixup cannot find root node\n"); - return; - } - - ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); - if (ret) { - return; - } - - /* Add "cpu_type" to root node of the devicetree*/ - ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); - if (!ret) { - ret = fdt_setprop(blob, nodeoff, "cpu_type", - &cpu_type, sizeof(cpu_type)); - if (ret) - printf("%s: cannot set cpu type %d\n", __func__, ret); - } else { - printf("ipq: fdt fixup cannot get socinfo\n"); - } - - ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); - if (!ret) { - soc_version_major = SOCINFO_VERSION_MAJOR(soc_version); - soc_version_minor = SOCINFO_VERSION_MINOR(soc_version); - - ret = fdt_setprop(blob, nodeoff, "soc_version_major", - &soc_version_major, - sizeof(soc_version_major)); - if (ret) - printf("%s: cannot set soc_version_major %d\n", - __func__, soc_version_major); - - ret = fdt_setprop(blob, nodeoff, "soc_version_minor", - &soc_version_minor, - sizeof(soc_version_minor)); - if (ret) - printf("%s: cannot set soc_version_minor %d\n", - __func__, soc_version_minor); - } else { - printf("%s: cannot get soc version\n", __func__); - } -} void ipq_fdt_fixup_usb_device_mode(void *blob) { return; } -void fdt_fixup_auto_restart(void *blob) -{ - return; -} - void board_mmc_deinit(void) { emmc_clock_reset(); diff --git a/board/qca/arm/ipq807x/ipq807x.c b/board/qca/arm/ipq807x/ipq807x.c index 9c89d2dc04..939adc072f 100644 --- a/board/qca/arm/ipq807x/ipq807x.c +++ b/board/qca/arm/ipq807x/ipq807x.c @@ -1430,52 +1430,6 @@ void ipq_uboot_fdt_fixup(void) return; } -void ipq_fdt_fixup_socinfo(void *blob) -{ - uint32_t cpu_type; - uint32_t soc_version, soc_version_major, soc_version_minor; - int nodeoff, ret; - - nodeoff = fdt_path_offset(blob, "/"); - - if (nodeoff < 0) { - printf("ipq: fdt fixup cannot find root node\n"); - return; - } - - ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); - if (!ret) { - ret = fdt_setprop(blob, nodeoff, "cpu_type", - &cpu_type, sizeof(cpu_type)); - if (ret) - printf("%s: cannot set cpu type %d\n", __func__, ret); - } else { - printf("%s: cannot get socinfo\n", __func__); - } - - ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); - if (!ret) { - soc_version_major = SOCINFO_VERSION_MAJOR(soc_version); - soc_version_minor = SOCINFO_VERSION_MINOR(soc_version); - - ret = fdt_setprop(blob, nodeoff, "soc_version_major", - &soc_version_major, - sizeof(soc_version_major)); - if (ret) - printf("%s: cannot set soc_version_major %d\n", - __func__, soc_version_major); - - ret = fdt_setprop(blob, nodeoff, "soc_version_minor", - &soc_version_minor, - sizeof(soc_version_minor)); - if (ret) - printf("%s: cannot set soc_version_minor %d\n", - __func__, soc_version_minor); - } else { - printf("%s: cannot get soc version\n", __func__); - } -} - void ipq_fdt_fixup_usb_device_mode(void *blob) { int nodeoff, ret, node; diff --git a/board/qca/arm/ipq9574/ipq9574.c b/board/qca/arm/ipq9574/ipq9574.c index 952c7e597c..19e2f4fca9 100644 --- a/board/qca/arm/ipq9574/ipq9574.c +++ b/board/qca/arm/ipq9574/ipq9574.c @@ -1413,58 +1413,6 @@ __weak int ipq_get_tz_version(char *version_name, int buf_size) return 1; } -void ipq_fdt_fixup_socinfo(void *blob) -{ - uint32_t cpu_type; - uint32_t soc_version, soc_version_major, soc_version_minor; - int nodeoff, ret; - - nodeoff = fdt_path_offset(blob, "/"); - - if (nodeoff < 0) { - printf("ipq: fdt fixup cannot find root node\n"); - return; - } - - ret = ipq_smem_get_socinfo_cpu_type(&cpu_type); - if (!ret) { - ret = fdt_setprop(blob, nodeoff, "cpu_type", - &cpu_type, sizeof(cpu_type)); - if (ret) - printf("%s: cannot set cpu type %d\n", __func__, ret); - } else { - printf("%s: cannot get socinfo\n", __func__); - } - - ret = ipq_smem_get_socinfo_version((uint32_t *)&soc_version); - if (!ret) { - soc_version_major = SOCINFO_VERSION_MAJOR(soc_version); - soc_version_minor = SOCINFO_VERSION_MINOR(soc_version); - - ret = fdt_setprop(blob, nodeoff, "soc_version_major", - &soc_version_major, - sizeof(soc_version_major)); - if (ret) - printf("%s: cannot set soc_version_major %d\n", - __func__, soc_version_major); - - ret = fdt_setprop(blob, nodeoff, "soc_version_minor", - &soc_version_minor, - sizeof(soc_version_minor)); - if (ret) - printf("%s: cannot set soc_version_minor %d\n", - __func__, soc_version_minor); - } else { - printf("%s: cannot get soc version\n", __func__); - } - return; -} - -void fdt_fixup_auto_restart(void *blob) -{ - return; -} - int is_secondary_core_off(unsigned int cpuid) { int err; From b900c8242b3259adcd02465036d75f7929f661d2 Mon Sep 17 00:00:00 2001 From: Ram Kumar D Date: Mon, 16 May 2022 12:01:21 +0530 Subject: [PATCH 3/3] devsoc: Add dummy handler to fixup the USB device mode Change-Id: Id68da6161eaabb867de0cd00e5a8c455e24df2c3 Signed-off-by: Ram Kumar D --- board/qca/arm/devsoc/devsoc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/board/qca/arm/devsoc/devsoc.c b/board/qca/arm/devsoc/devsoc.c index 9f60eff0e1..52bd2210b6 100644 --- a/board/qca/arm/devsoc/devsoc.c +++ b/board/qca/arm/devsoc/devsoc.c @@ -295,3 +295,8 @@ void set_flash_secondary_type(qca_smem_flash_info_t *smem) { return; }; + +void ipq_fdt_fixup_usb_device_mode(void *blob) +{ + return; +}