1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) Marvell International Ltd. and its affiliates
9 #include <asm/arch/cpu.h>
10 #include <asm/arch/soc.h>
11 #include <linux/bitops.h>
12 #include <linux/delay.h>
15 #include "sys_env_lib.h"
17 int hws_pex_config(const struct serdes_map *serdes_map, u8 count)
19 enum serdes_type serdes_type;
22 DEBUG_INIT_FULL_S("\n### hws_pex_config ###\n");
24 tmp = reg_read(SOC_CONTROL_REG1);
27 for (idx = 0; idx < count; idx++) {
28 serdes_type = serdes_map[idx].serdes_type;
29 if ((serdes_type != PEX0) &&
30 ((serdes_map[idx].serdes_mode == PEX_ROOT_COMPLEX_X4) ||
31 (serdes_map[idx].serdes_mode == PEX_END_POINT_X4))) {
32 /* for PEX by4 - relevant for the first port only */
36 switch (serdes_type) {
38 tmp |= 0x1 << PCIE0_ENABLE_OFFS;
41 tmp |= 0x1 << PCIE1_ENABLE_OFFS;
44 tmp |= 0x1 << PCIE2_ENABLE_OFFS;
47 tmp |= 0x1 << PCIE3_ENABLE_OFFS;
54 reg_write(SOC_CONTROL_REG1, tmp);