|
1 | | -// SPDX-License-Identifier: GPL-2.0 |
| 1 | +// SPDX-License-Identifier: GPL |
2 | 2 | /* Intel FPGA E-tile Ethernet MAC driver |
3 | | - * Copyright (C) 2022 Intel Corporation. All rights reserved |
| 3 | + * Copyright (C) 2022,2023 Intel Corporation. All rights reserved |
4 | 4 | * |
5 | 5 | * Contributors: |
6 | 6 | * Preetam Narayan |
7 | 7 | * |
8 | | - * Original driver contributed by GlobalLogic. |
9 | 8 | */ |
10 | 9 |
|
11 | 10 | #include <linux/phylink.h> |
@@ -272,6 +271,41 @@ void pma_digital_reset(struct intel_fpga_etile_eth_private *priv, |
272 | 271 | chan, eth_phy_csroffs(phy_config), 0x2); |
273 | 272 | } |
274 | 273 |
|
| 274 | +void pma_analog_reset(struct intel_fpga_etile_eth_private *priv) |
| 275 | +{ |
| 276 | + struct platform_device *pdev = priv->pdev_hssi; |
| 277 | + u32 chan = priv->chan; |
| 278 | + |
| 279 | + /* Step: Trigger PMA analog reset |
| 280 | + * 1. PMA AVMM Write, Offset = 0x200, value = 0x0 |
| 281 | + * 2. PMA AVMM Write, Offset = 0x201, value = 0x0 |
| 282 | + * 3. PMA AVMM Write, Offset = 0x202, value = 0x0 |
| 283 | + * 4. PMA AVMM Write, Ofset = 0x203, value = 0x81 |
| 284 | + * 5. PMA AVMM Read, Offset = 0x207, expected value = 0x80 |
| 285 | + * 6. PMA AVMM Read, Offset = 0x204, expected value = 0x0 (channel #) |
| 286 | + */ |
| 287 | + hssi_csrwr8(pdev, HSSI_PHY_XCVR_PMAAVMM, chan, eth_pma_avmm_csroffs(reg_200), 0x0); |
| 288 | + hssi_csrwr8(pdev, HSSI_PHY_XCVR_PMAAVMM, chan, eth_pma_avmm_csroffs(reg_201), 0x0); |
| 289 | + hssi_csrwr8(pdev, HSSI_PHY_XCVR_PMAAVMM, chan, eth_pma_avmm_csroffs(reg_202), 0x0); |
| 290 | + hssi_csrwr8(pdev, HSSI_PHY_XCVR_PMAAVMM, chan, eth_pma_avmm_csroffs(reg_203), 0x81); |
| 291 | + |
| 292 | + if (xtile_check_counter_complete(priv, HSSI_PHY_XCVR_PMAAVMM, |
| 293 | + eth_pma_avmm_csroffs(reg_207), |
| 294 | + XCVR_PMA_AVMM_207_LAST_OP_ON_200_203_SUCCESS, |
| 295 | + true, INTEL_FPGA_BYTE_ALIGN)) { |
| 296 | + netdev_err(priv->dev, "Analog PMA reset failed, abort\n"); |
| 297 | + return ; |
| 298 | + } |
| 299 | + |
| 300 | + if (xtile_check_counter_complete(priv, HSSI_PHY_XCVR_PMAAVMM, |
| 301 | + eth_pma_avmm_csroffs(reg_204), |
| 302 | + XCVR_PMA_AVMM_204_RET_PHYS_CHANNEL_NUMBER, |
| 303 | + false, INTEL_FPGA_BYTE_ALIGN)) |
| 304 | + netdev_warn(priv->dev, "Cannot read channel number\n"); |
| 305 | + |
| 306 | + |
| 307 | +} |
| 308 | + |
275 | 309 | int init_mac(struct intel_fpga_etile_eth_private *priv) |
276 | 310 | { |
277 | 311 | int ret; |
|
0 commit comments