summaryrefslogtreecommitdiff
path: root/drivers/net/pfe_eth/pfe_firmware.c
diff options
context:
space:
mode:
authorChaitanya Sakinam <chaitanya.sakinam@nxp.com>2021-05-07 12:22:05 +0800
committerPriyanka Jain <priyanka.jain@nxp.com>2021-06-17 11:46:11 +0530
commitff64e9a9f0f48107a46536c251951885df63d63f (patch)
treedb4eb577fbfcb50985e1565a52758ada70daa5af /drivers/net/pfe_eth/pfe_firmware.c
parentaddec3511f7c389353884026435488d3d552e6a9 (diff)
downloadu-boot-ff64e9a9f0f48107a46536c251951885df63d63f.tar.gz
armv8: ls1012a: Pass PPFE firmware to Linux through FDT
Read Linux PPFE firmware from flash partition and pass it to Linux through FDT entry. So that we can avoid placing PPFE firmware in Linux rootfs. (FDT may increase at max by 64KB) Signed-off-by: Chaitanya Sakinam <chaitanya.sakinam@nxp.com> Signed-off-by: Anji J <anji.jagarlmudi@nxp.com> Signed-off-by: Biwen Li <biwen.li@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'drivers/net/pfe_eth/pfe_firmware.c')
-rw-r--r--drivers/net/pfe_eth/pfe_firmware.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c
index eee70a2e73..ac86e33c55 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2015-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017,2021 NXP
*/
/*
@@ -262,7 +262,8 @@ int pfe_firmware_init(void)
uintptr_t pfe_img_addr = 0;
#endif
int ret = 0;
- int fw_count;
+ int fw_count, max_fw_count;
+ const char *p;
ret = pfe_spi_flash_init();
if (ret)
@@ -293,6 +294,61 @@ int pfe_firmware_init(void)
}
#endif
+ p = env_get("load_util");
+ if (!p) {
+ max_fw_count = 2;
+ } else {
+ max_fw_count = simple_strtoul(p, NULL, 10);
+ if (max_fw_count)
+ max_fw_count = 3;
+ else
+ max_fw_count = 2;
+ }
+
+ for (fw_count = 0; fw_count < max_fw_count; fw_count++) {
+ switch (fw_count) {
+ case 0:
+ pfe_firmware_name = "class_slowpath";
+ break;
+ case 1:
+ pfe_firmware_name = "tmu_slowpath";
+ break;
+ case 2:
+ pfe_firmware_name = "util_slowpath";
+ break;
+ }
+
+ if (pfe_get_fw(&raw_image_addr, &raw_image_size,
+ pfe_firmware_name)) {
+ printf("%s firmware couldn't be found in FIT image\n",
+ pfe_firmware_name);
+ break;
+ }
+ pfe_firmware = malloc(raw_image_size);
+ if (!pfe_firmware)
+ return -ENOMEM;
+ memcpy((void *)pfe_firmware, (void *)raw_image_addr,
+ raw_image_size);
+
+ switch (fw_count) {
+ case 0:
+ env_set_addr("class_elf_firmware", pfe_firmware);
+ env_set_addr("class_elf_size", (void *)raw_image_size);
+ break;
+ case 1:
+ env_set_addr("tmu_elf_firmware", pfe_firmware);
+ env_set_addr("tmu_elf_size", (void *)raw_image_size);
+ break;
+ case 2:
+ env_set_addr("util_elf_firmware", pfe_firmware);
+ env_set_addr("util_elf_size", (void *)raw_image_size);
+ break;
+ }
+ }
+
+ raw_image_addr = NULL;
+ pfe_firmware = NULL;
+ raw_image_size = 0;
for (fw_count = 0; fw_count < 2; fw_count++) {
if (fw_count == 0)
pfe_firmware_name = "class";