2 * Copyright 2015 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <asm/arch/fsl_serdes.h>
9 #include <asm/arch/immap_lsch2.h>
11 struct serdes_config {
13 u8 lanes[SRDS_MAX_LANES];
16 static struct serdes_config serdes1_cfg_tbl[] = {
18 {0x1555, {XFI_FM1_MAC9, PCIE1, PCIE2, PCIE3} },
19 {0x2555, {SGMII_2500_FM1_DTSEC9, PCIE1, PCIE2, PCIE3} },
20 {0x4555, {QSGMII_FM1_A, PCIE1, PCIE2, PCIE3} },
21 {0x4558, {QSGMII_FM1_A, PCIE1, PCIE2, SATA1} },
22 {0x1355, {XFI_FM1_MAC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3} },
23 {0x2355, {SGMII_2500_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3} },
24 {0x3335, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5,
26 {0x3355, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3} },
27 {0x3358, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, SATA1} },
28 {0x3555, {SGMII_FM1_DTSEC9, PCIE1, PCIE2, PCIE3} },
29 {0x3558, {SGMII_FM1_DTSEC9, PCIE1, PCIE2, SATA1} },
30 {0x7000, {PCIE1, PCIE1, PCIE1, PCIE1} },
31 {0x9998, {PCIE1, PCIE2, PCIE3, SATA1} },
32 {0x6058, {PCIE1, PCIE1, PCIE2, SATA1} },
33 {0x1455, {XFI_FM1_MAC9, QSGMII_FM1_A, PCIE2, PCIE3} },
34 {0x2455, {SGMII_2500_FM1_DTSEC9, QSGMII_FM1_A, PCIE2, PCIE3} },
35 {0x2255, {SGMII_2500_FM1_DTSEC9, SGMII_2500_FM1_DTSEC2, PCIE2, PCIE3} },
36 {0x3333, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5,
41 static struct serdes_config *serdes_cfg_tbl[] = {
45 enum srds_prtcl serdes_get_prtcl(int serdes, int cfg, int lane)
47 struct serdes_config *ptr;
49 if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
52 ptr = serdes_cfg_tbl[serdes];
53 while (ptr->protocol) {
54 if (ptr->protocol == cfg)
55 return ptr->lanes[lane];
62 int is_serdes_prtcl_valid(int serdes, u32 prtcl)
65 struct serdes_config *ptr;
67 if (serdes >= ARRAY_SIZE(serdes_cfg_tbl))
70 ptr = serdes_cfg_tbl[serdes];
71 while (ptr->protocol) {
72 if (ptr->protocol == prtcl)
80 for (i = 0; i < SRDS_MAX_LANES; i++) {
81 if (ptr->lanes[i] != NONE)