From 5d535aa40bb73f248d307a2cfc58e6187465036d Mon Sep 17 00:00:00 2001 From: Pankaj Bansal Date: Sat, 17 Aug 2019 01:07:32 +0000 Subject: board: fsl: lx2160a: implement board_fix_fdt lx2160a rev1 and rev2 SoC has different pcie controller. The pcie controller device tree node fields "compatible" and registers names needs to be updated accordingly This change in device tree is handled as part of fdt fixups. These changes would only be applied if the soc revision is not rev1. Signed-off-by: Pankaj Bansal Signed-off-by: Priyanka Jain --- board/freescale/lx2160a/lx2160a.c | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'board/freescale') diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index 7f19a1a145..2a8dbca584 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include #include "../common/qixis.h" @@ -116,6 +118,72 @@ int board_early_init_f(void) return 0; } +#ifdef CONFIG_OF_BOARD_FIXUP +int board_fix_fdt(void *fdt) +{ + char *reg_names, *reg_name; + int names_len, old_name_len, new_name_len, remaining_names_len; + struct str_map { + char *old_str; + char *new_str; + } reg_names_map[] = { + { "ccsr", "dip" }, + { "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 = (char *)fdt_getprop(fdt, off, "reg-names", + &names_len); + if (!reg_names) + continue; + + reg_name = reg_names; + remaining_names_len = names_len - (reg_name - reg_names); + for (i = 0; (i < ARRAY_SIZE(reg_names_map)) && names_len; i++) { + old_name_len = strlen(reg_names_map[i].old_str); + new_name_len = strlen(reg_names_map[i].new_str); + if (memcmp(reg_name, reg_names_map[i].old_str, + old_name_len) == 0) { + /* first only leave required bytes for new_str + * and copy rest of the string after it + */ + memcpy(reg_name + new_name_len, + reg_name + old_name_len, + remaining_names_len - old_name_len); + /* Now copy new_str */ + memcpy(reg_name, reg_names_map[i].new_str, + new_name_len); + names_len -= old_name_len; + names_len += new_name_len; + } + + reg_name = memchr(reg_name, '\0', remaining_names_len); + if (!reg_name) + break; + + reg_name += 1; + + remaining_names_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 + #if defined(CONFIG_TARGET_LX2160AQDS) void esdhc_dspi_status_fixup(void *blob) { -- cgit From 065ccdc710c80d24fcaf2ed947143bae075f8d7f Mon Sep 17 00:00:00 2001 From: Florin Chiculita Date: Mon, 19 Aug 2019 18:56:46 +0300 Subject: board: lx2160aqds: fix ethernet-phy compatible property The code that generates the compatible property concatenates the ethernet phy id and clause-compatible information without separating them with a comma, resulting into no ethernet phy driver getting loaded by Linux kernel. Suffix phy_id_compatible_str with comma to fix this Signed-off-by: Florin Chiculita Signed-off-by: Priyanka Jain --- board/freescale/lx2160a/eth_lx2160aqds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'board/freescale') diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c index 92c06e5060..48ff495902 100644 --- a/board/freescale/lx2160a/eth_lx2160aqds.c +++ b/board/freescale/lx2160a/eth_lx2160aqds.c @@ -686,7 +686,7 @@ int fdt_create_phy_node(void *fdt, int offset, u8 phyaddr, int *subnodeoffset, struct phy_device *phy_dev, int phandle) { char phy_node_name[] = "ethernet-phy@00"; - char phy_id_compatible_str[] = "ethernet-phy-id0000.0000"; + char phy_id_compatible_str[] = "ethernet-phy-id0000.0000,"; int ret; sprintf(phy_node_name, "ethernet-phy@%x", phyaddr); @@ -700,7 +700,7 @@ int fdt_create_phy_node(void *fdt, int offset, u8 phyaddr, int *subnodeoffset, return *subnodeoffset; } - sprintf(phy_id_compatible_str, "ethernet-phy-id%04x.%04x", + sprintf(phy_id_compatible_str, "ethernet-phy-id%04x.%04x,", phy_dev->phy_id >> 16, phy_dev->phy_id & 0xFFFF); debug("phy_id_compatible_str %s\n", phy_id_compatible_str); -- cgit From b9fe1a261a0b32913384212fee33f73a5a42b406 Mon Sep 17 00:00:00 2001 From: Florin Chiculita Date: Mon, 26 Aug 2019 10:48:20 +0300 Subject: board: lx2160aqds: add support for SerDes protocol 14 Add SerDes1 protocol 14 in the list of supported protocols. This configuration enables one high-speed 100G port and PCIe x4. Signed-off-by: Florin Chiculita Reviewed-by: Priyanka Jain --- board/freescale/lx2160a/eth_lx2160aqds.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'board/freescale') diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c index 48ff495902..55e8a427e6 100644 --- a/board/freescale/lx2160a/eth_lx2160aqds.c +++ b/board/freescale/lx2160a/eth_lx2160aqds.c @@ -105,6 +105,8 @@ static const struct serdes_phy_config serdes1_phy_config[] = { EMI1, IO_SLOT_1}, {WRIOP1_DPMAC2, {INPHI_PHY_ADDR1, INPHI_PHY_ADDR2, -1}, EMI1, IO_SLOT_2} } }, + {14, {{WRIOP1_DPMAC1, {INPHI_PHY_ADDR1, INPHI_PHY_ADDR2, -1}, + EMI1, IO_SLOT_1} } }, {15, {{WRIOP1_DPMAC1, {INPHI_PHY_ADDR1, INPHI_PHY_ADDR2, -1}, EMI1, IO_SLOT_1}, {WRIOP1_DPMAC2, {INPHI_PHY_ADDR1, INPHI_PHY_ADDR2, -1}, -- cgit From 737c016d25d6c45e9c003fca9df2ca75f0b1e772 Mon Sep 17 00:00:00 2001 From: Meenakshi Aggarwal Date: Wed, 4 Sep 2019 16:39:56 +0530 Subject: lx2160: Correct serdes frequency print. Suffix serdes frequency print with MHz Signed-off-by: Meenakshi Aggarwal Reviewed-by: Priyanka Jain --- board/freescale/lx2160a/lx2160a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board/freescale') diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index 2a8dbca584..b509c0312e 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -351,7 +351,7 @@ int checkboard(void) puts("SERDES1 Reference: Clock1 = 161.13MHz Clock2 = 161.13MHz\n"); puts("SERDES2 Reference: Clock1 = 100MHz Clock2 = 100MHz\n"); - puts("SERDES3 Reference: Clock1 = 100MHz Clock2 = 100Hz\n"); + puts("SERDES3 Reference: Clock1 = 100MHz Clock2 = 100MHz\n"); #endif return 0; } -- cgit