Skip to content

Commit 99bf893

Browse files
eth: etile_driver: adding analog pma reset support
1 parent 72e9df2 commit 99bf893

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

drivers/net/ethernet/altera/intel_fpga_etile_driver.c

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// SPDX-License-Identifier: GPL-2.0
1+
// SPDX-License-Identifier: GPL
22
/* 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
44
*
55
* Contributors:
66
* Preetam Narayan
77
*
8-
* Original driver contributed by GlobalLogic.
98
*/
109

1110
#include <linux/phylink.h>
@@ -272,6 +271,41 @@ void pma_digital_reset(struct intel_fpga_etile_eth_private *priv,
272271
chan, eth_phy_csroffs(phy_config), 0x2);
273272
}
274273

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+
275309
int init_mac(struct intel_fpga_etile_eth_private *priv)
276310
{
277311
int ret;

0 commit comments

Comments
 (0)