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