Mathew McBride | e605fb1 | 2022-01-31 18:34:43 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2017 NXP |
| 4 | * Copyright 2019-2021 Traverse Technologies Australia |
| 5 | */ |
| 6 | #include <common.h> |
| 7 | #include <command.h> |
| 8 | #include <netdev.h> |
| 9 | #include <malloc.h> |
| 10 | #include <fsl_mdio.h> |
| 11 | #include <miiphy.h> |
| 12 | #include <phy.h> |
| 13 | #include <fm_eth.h> |
| 14 | #include <asm/io.h> |
| 15 | #include <exports.h> |
| 16 | #include <asm/arch/fsl_serdes.h> |
| 17 | #include <fsl-mc/fsl_mc.h> |
| 18 | #include <fsl-mc/ldpaa_wriop.h> |
| 19 | |
| 20 | void reset_phy(void) |
| 21 | { |
| 22 | mc_env_boot(); |
| 23 | } |
| 24 | |
| 25 | int board_phy_config(struct phy_device *phydev) |
| 26 | { |
| 27 | /* These settings only apply to VSC8514 */ |
| 28 | if (phydev->phy_id == 0x70670) { |
| 29 | /* First, ensure LEDs are driven to rails (not tristate) |
| 30 | * This is in the extended page 0x0010 |
| 31 | */ |
| 32 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1F, 0x0010); |
| 33 | phy_write(phydev, MDIO_DEVAD_NONE, 0x0E, 0x2000); |
| 34 | /* Restore to page 0 */ |
| 35 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1F, 0x0000); |
| 36 | |
| 37 | /* Disable blink on the left LEDs, and make the activity LEDs blink faster */ |
| 38 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1E, 0xC03); |
| 39 | |
| 40 | phy_write(phydev, MDIO_DEVAD_NONE, 0x1D, 0x3421); |
| 41 | } |
| 42 | |
| 43 | if (phydev->drv->config) |
| 44 | phydev->drv->config(phydev); |
| 45 | |
| 46 | return 0; |
| 47 | } |