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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// SPDX-License-Identifier: GPL-2.0+
/*
Copyright (c) 2015 Broadcom Corporation
All Rights Reserved
*/
/*
* Created on: Dec 2015
* Author: yuval.raviv@broadcom.com
*/
/*
* Phy driver for external 1G phys: BCM5461S, BCM54810
*/
#include "bus_drv.h"
#include "phy_drv.h"
#include "phy_drv_mii.h"
#include "phy_drv_brcm.h"
static int _phy_init(phy_dev_t *phy_dev)
{
int ret;
/* Access IEEE register set instead of LRE */
if ((ret = phy_bus_write(phy_dev, 0x0e, 0x06)))
goto Exit;
if ((ret = mii_init(phy_dev)))
goto Exit;
/* Disable BroadR-Reach function */
if ((ret = brcm_exp_write(phy_dev, 0x90, 0x00)))
goto Exit;
if ((phy_dev->mii_type == PHY_MII_TYPE_RGMII) && (ret = brcm_shadow_rgmii_init(phy_dev)))
goto Exit;
if ((ret = brcm_shadow_18_force_auto_mdix_set(phy_dev, 1)))
goto Exit;
if ((ret = brcm_shadow_18_eth_wirespeed_set(phy_dev, 1)))
goto Exit;
Exit:
return ret;
}
phy_drv_t phy_drv_ext1 =
{
.phy_type = PHY_TYPE_EXT1,
.name = "EXT1",
.power_get = mii_power_get,
.power_set = mii_power_set,
.apd_get = brcm_shadow_1c_apd_get,
.apd_set = brcm_shadow_1c_apd_set,
.read_status = brcm_read_status,
.speed_set = mii_speed_set,
.caps_get = mii_caps_get,
.caps_set = mii_caps_set,
.phyid_get = mii_phyid_get,
.auto_mdix_set = brcm_shadow_18_force_auto_mdix_set,
.auto_mdix_get = brcm_shadow_18_force_auto_mdix_get,
.wirespeed_set = brcm_shadow_18_eth_wirespeed_set,
.wirespeed_get = brcm_shadow_18_eth_wirespeed_get,
.init = _phy_init,
};
|