From 5d45e2ab0e00cc809c11a3d0a412022f25639c58 Mon Sep 17 00:00:00 2001 From: Rabeeh Khoury Date: Mon, 23 Mar 2020 12:53:48 +0200 Subject: [PATCH 14/17] lx2160acex7: pcie fixup and boot from eMMC print Upstream-Status: Inappropriate [Solid-Run BSP] Signed-off-by: Rabeeh Khoury --- board/solidrun/lx2160a/lx2160a.c | 66 +++++++++++++++++++++++++++++++ configs/lx2160acex7_tfa_defconfig | 3 +- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/board/solidrun/lx2160a/lx2160a.c b/board/solidrun/lx2160a/lx2160a.c index 3713e91351..b7211a2d5c 100644 --- a/board/solidrun/lx2160a/lx2160a.c +++ b/board/solidrun/lx2160a/lx2160a.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include "../../freescale/common/vid.h" @@ -106,6 +108,66 @@ int board_early_init_f(void) #ifdef CONFIG_OF_BOARD_FIXUP int board_fix_fdt(void *fdt) { + char *reg_name, *old_str, *new_str; + const char *reg_names; + int names_len, old_str_len, new_str_len, remaining_str_len; + struct str_map { + char *old_str; + char *new_str; + } reg_names_map[] = { + { "ccsr", "dbi" }, + { "pf_ctrl", "ctrl" } + }; + int off = -1, i; + + if (IS_SVR_REV(get_svr(), 1, 0)) + return 0; + + off = fdt_node_offset_by_compatible(fdt, -1, "fsl,lx2160a-pcie"); + while (off != -FDT_ERR_NOTFOUND) { + fdt_setprop(fdt, off, "compatible", "fsl,ls-pcie", + strlen("fsl,ls-pcie") + 1); + + reg_names = fdt_getprop(fdt, off, "reg-names", &names_len); + if (!reg_names) + continue; + + reg_name = (char *)reg_names; + remaining_str_len = names_len - (reg_name - reg_names); + i = 0; + while ((i < ARRAY_SIZE(reg_names_map)) && remaining_str_len) { + old_str = reg_names_map[i].old_str; + new_str = reg_names_map[i].new_str; + old_str_len = strlen(old_str); + new_str_len = strlen(new_str); + if (memcmp(reg_name, old_str, old_str_len) == 0) { + /* first only leave required bytes for new_str + * and copy rest of the string after it + */ + memcpy(reg_name + new_str_len, + reg_name + old_str_len, + remaining_str_len - old_str_len); + /* Now copy new_str */ + memcpy(reg_name, new_str, new_str_len); + names_len -= old_str_len; + names_len += new_str_len; + i++; + } + + reg_name = memchr(reg_name, '\0', remaining_str_len); + if (!reg_name) + break; + + reg_name += 1; + + remaining_str_len = names_len - (reg_name - reg_names); + } + + fdt_setprop(fdt, off, "reg-names", reg_names, names_len); + off = fdt_node_offset_by_compatible(fdt, off, + "fsl,lx2160a-pcie"); + } + return 0; } #endif @@ -135,6 +197,10 @@ int checkboard(void) if (src == BOOT_SOURCE_SD_MMC) { puts("SD\n"); + } else if (src == BOOT_SOURCE_SD_MMC2) { + puts("eMMC\n"); + } else { + puts("FlexSPI DEV#0\n"); } puts("SERDES1 Reference: Clock1 = 161.13MHz Clock2 = 100MHz\n"); puts("SERDES2 Reference: Clock1 = 100MHz Clock2 = 100MHz\n"); diff --git a/configs/lx2160acex7_tfa_defconfig b/configs/lx2160acex7_tfa_defconfig index 89a47adb23..2a3441d263 100644 --- a/configs/lx2160acex7_tfa_defconfig +++ b/configs/lx2160acex7_tfa_defconfig @@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_TARGET_LX2160ACEX7=y CONFIG_SYS_TEXT_BASE=0x82000000 CONFIG_SYS_MALLOC_F_LEN=0x6000 +CONFIG_FSPI_AHB_EN_4BYTE=y CONFIG_TFABOOT=y CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y @@ -58,7 +59,7 @@ CONFIG_PCI=y CONFIG_DM_PCI=y CONFIG_DM_PCI_COMPAT=y CONFIG_PCIE_LAYERSCAPE_GEN4=y -CONFIG_PHY_ATHEROS=y +CONFIG_PCIE_LAYERSCAPE=y CONFIG_E1000=y CONFIG_DM_SCSI=y CONFIG_DM_SERIAL=y -- 2.17.1