summaryrefslogtreecommitdiff
path: root/board/traverse/ten64/eth_ten64.c
blob: 3f96e572b75a58087e43ba5df5ac321b2dfe9ab9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright 2017 NXP
 * Copyright 2019-2021 Traverse Technologies Australia
 */
#include <common.h>
#include <command.h>
#include <netdev.h>
#include <malloc.h>
#include <fsl_mdio.h>
#include <miiphy.h>
#include <phy.h>
#include <fm_eth.h>
#include <asm/io.h>
#include <exports.h>
#include <asm/arch/fsl_serdes.h>
#include <fsl-mc/fsl_mc.h>
#include <fsl-mc/ldpaa_wriop.h>

void reset_phy(void)
{
	mc_env_boot();
}

int board_phy_config(struct phy_device *phydev)
{
	/* These settings only apply to VSC8514 */
	if (phydev->phy_id == 0x70670) {
		/* First, ensure LEDs are driven to rails (not tristate)
		 * This is in the extended page 0x0010
		 */
		phy_write(phydev, MDIO_DEVAD_NONE, 0x1F, 0x0010);
		phy_write(phydev, MDIO_DEVAD_NONE, 0x0E, 0x2000);
		/* Restore to page 0 */
		phy_write(phydev, MDIO_DEVAD_NONE, 0x1F, 0x0000);

		/* Disable blink on the left LEDs, and make the activity LEDs blink faster */
		phy_write(phydev, MDIO_DEVAD_NONE, 0x1E, 0xC03);

		phy_write(phydev, MDIO_DEVAD_NONE, 0x1D, 0x3421);
	}

	if (phydev->drv->config)
		phydev->drv->config(phydev);

	return 0;
}