forked from acooks/tn40xx-driver
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CX4.c
74 lines (55 loc) · 1.4 KB
/
CX4.c
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
70
71
72
73
74
#include "tn40.h"
#define LINK_LOOP_MAX (10)
void CX4_register_settings(struct bdx_priv *priv);
int CX4_mdio_reset(struct bdx_priv *priv, int port, unsigned short phy);
u32 CX4_link_changed(struct bdx_priv *priv);
void CX4_leds(struct bdx_priv *priv, enum PHY_LEDS_OP op);
int CX4_mdio_reset(struct bdx_priv *priv, int port, unsigned short phy)
{
return 0;
}
u32 CX4_link_changed(struct bdx_priv *priv)
{
u32 link = 0;
if (priv->link_speed != SPEED_10000) {
bdx_speed_changed(priv, SPEED_10000);
}
link = READ_REG(priv, regMAC_LNK_STAT) & MAC_LINK_STAT;
if (link) {
link = SPEED_10000;
pr_debug("CX4 link speed is 10G\n");
} else {
if (priv->link_loop_cnt++ > LINK_LOOP_MAX) {
pr_debug("CX4 MAC reset\n");
priv->link_speed = 0;
priv->link_loop_cnt = 0;
}
pr_debug("CX4 no link, setting 1/5 sec timer\n");
WRITE_REG(priv, 0x5150, 1000000); /* 1/5 sec timeout */
}
return link;
}
void CX4_leds(struct bdx_priv *priv, enum PHY_LEDS_OP op)
{
switch (op) {
case PHY_LEDS_SAVE:
break;
case PHY_LEDS_RESTORE:
break;
case PHY_LEDS_ON:
break;
case PHY_LEDS_OFF:
break;
default:
pr_debug("CX4_leds() unknown op 0x%x\n", op);
break;
}
}
__init enum PHY_TYPE CX4_register(struct bdx_priv *priv)
{
priv->phy_ops.mdio_reset = CX4_mdio_reset;
priv->phy_ops.link_changed = CX4_link_changed;
priv->phy_ops.ledset = CX4_leds;
CX4_register_settings(priv);
return PHY_TYPE_CX4;
}