Philip Oberfichtner | 4246035 | 2024-08-02 11:25:39 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 |
| 2 | * |
| 3 | * Copyright (c) 2023-2024 DENX Software Engineering GmbH |
| 4 | * Philip Oberfichtner <pro@denx.de> |
| 5 | * |
| 6 | * This header is based on linux v6.6.39, |
| 7 | * |
| 8 | * drivers/net/pcs/pcs-xpcs.h |
| 9 | * drivers/net/ethernet/stmicro/stmmac/dwmac-intel.h, |
| 10 | * |
| 11 | * Copyright (c) 2020 Synopsys, Inc. and/or its affiliates |
| 12 | * Copyright (c) 2020 Intel Corporation |
| 13 | */ |
| 14 | |
| 15 | #ifndef __DWMAC_INTEL_H__ |
| 16 | #define __DWMAC_INTEL_H__ |
| 17 | |
| 18 | #define POLL_DELAY_US 8 |
| 19 | |
| 20 | /* SERDES Register */ |
| 21 | #define SERDES_GCR 0x0 /* Global Conguration */ |
| 22 | #define SERDES_GSR0 0x5 /* Global Status Reg0 */ |
| 23 | #define SERDES_GCR0 0xb /* Global Configuration Reg0 */ |
| 24 | |
| 25 | /* SERDES defines */ |
| 26 | #define SERDES_PLL_CLK BIT(0) /* PLL clk valid signal */ |
| 27 | #define SERDES_PHY_RX_CLK BIT(1) /* PSE SGMII PHY rx clk */ |
| 28 | #define SERDES_RST BIT(2) /* Serdes Reset */ |
| 29 | #define SERDES_PWR_ST_MASK GENMASK(6, 4) /* Serdes Power state*/ |
| 30 | #define SERDES_RATE_MASK GENMASK(9, 8) |
| 31 | #define SERDES_PCLK_MASK GENMASK(14, 12) /* PCLK rate to PHY */ |
| 32 | #define SERDES_LINK_MODE_MASK GENMASK(2, 1) |
| 33 | #define SERDES_PWR_ST_SHIFT 4 |
| 34 | #define SERDES_PWR_ST_P0 0x0 |
| 35 | #define SERDES_PWR_ST_P3 0x3 |
| 36 | #define SERDES_LINK_MODE_2G5 0x3 |
| 37 | #define SERSED_LINK_MODE_1G 0x2 |
| 38 | #define SERDES_PCLK_37p5MHZ 0x0 |
| 39 | #define SERDES_PCLK_70MHZ 0x1 |
| 40 | #define SERDES_RATE_PCIE_GEN1 0x0 |
| 41 | #define SERDES_RATE_PCIE_GEN2 0x1 |
| 42 | #define SERDES_RATE_PCIE_SHIFT 8 |
| 43 | #define SERDES_PCLK_SHIFT 12 |
| 44 | |
| 45 | #define INTEL_MGBE_ADHOC_ADDR 0x15 |
| 46 | #define INTEL_MGBE_XPCS_ADDR 0x16 |
| 47 | |
| 48 | /* XPCS defines */ |
| 49 | #define XPCS_MODE_SGMII BIT(2) |
| 50 | #define XPCS_MAC_AUTO_SW BIT(9) |
| 51 | #define XPCS_AN_CL37_EN BIT(12) |
| 52 | |
| 53 | #define VR_MII_MMD_CTRL 0x0000 |
| 54 | #define VR_MII_DIG_CTRL1 0x8000 |
| 55 | #define VR_MII_AN_CTRL 0x8001 |
| 56 | |
| 57 | #endif /* __DWMAC_INTEL_H__ */ |