]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | Commit-Id: 78e4689e908adc8334272756c32c9218d1967408 |
2 | From: Divy Le Ray <divy@chelsio.com> | |
3 | Date: Wed, 8 Oct 2008 17:38:01 -0700 | |
4 | Acked-by: Karsten Keil <kkeil@novell.com> | |
5 | Subject: [PATCH] cxgb3: allow for PHY reset status | |
6 | Reference: bnc#446739 | |
7 | ||
8 | First step towards overall PHY layering re-organization. | |
9 | Allow a status return when a PHY is reset. | |
10 | ||
11 | Signed-off-by: Divy Le Ray <divy@chelsio.com> | |
12 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
13 | ||
14 | Index: linux-2.6.27/drivers/net/cxgb3/ael1002.c | |
15 | =================================================================== | |
16 | --- linux-2.6.27.orig/drivers/net/cxgb3/ael1002.c | |
17 | +++ linux-2.6.27/drivers/net/cxgb3/ael1002.c | |
18 | @@ -119,11 +119,12 @@ static struct cphy_ops ael1002_ops = { | |
19 | .power_down = ael1002_power_down, | |
20 | }; | |
21 | ||
22 | -void t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, | |
23 | - int phy_addr, const struct mdio_ops *mdio_ops) | |
24 | +int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, | |
25 | + int phy_addr, const struct mdio_ops *mdio_ops) | |
26 | { | |
27 | cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops); | |
28 | ael100x_txon(phy); | |
29 | + return 0; | |
30 | } | |
31 | ||
32 | static int ael1006_reset(struct cphy *phy, int wait) | |
33 | @@ -174,11 +175,12 @@ static struct cphy_ops ael1006_ops = { | |
34 | .power_down = ael1006_power_down, | |
35 | }; | |
36 | ||
37 | -void t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, | |
38 | - int phy_addr, const struct mdio_ops *mdio_ops) | |
39 | +int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, | |
40 | + int phy_addr, const struct mdio_ops *mdio_ops) | |
41 | { | |
42 | cphy_init(phy, adapter, phy_addr, &ael1006_ops, mdio_ops); | |
43 | ael100x_txon(phy); | |
44 | + return 0; | |
45 | } | |
46 | ||
47 | static struct cphy_ops qt2045_ops = { | |
48 | @@ -191,8 +193,8 @@ static struct cphy_ops qt2045_ops = { | |
49 | .power_down = ael1006_power_down, | |
50 | }; | |
51 | ||
52 | -void t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, | |
53 | - int phy_addr, const struct mdio_ops *mdio_ops) | |
54 | +int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, | |
55 | + int phy_addr, const struct mdio_ops *mdio_ops) | |
56 | { | |
57 | unsigned int stat; | |
58 | ||
59 | @@ -205,6 +207,7 @@ void t3_qt2045_phy_prep(struct cphy *phy | |
60 | if (!phy_addr && !mdio_read(phy, MDIO_DEV_PMA_PMD, MII_BMSR, &stat) && | |
61 | stat == 0xffff) | |
62 | phy->addr = 1; | |
63 | + return 0; | |
64 | } | |
65 | ||
66 | static int xaui_direct_reset(struct cphy *phy, int wait) | |
67 | @@ -250,8 +253,9 @@ static struct cphy_ops xaui_direct_ops = | |
68 | .power_down = xaui_direct_power_down, | |
69 | }; | |
70 | ||
71 | -void t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, | |
72 | - int phy_addr, const struct mdio_ops *mdio_ops) | |
73 | +int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, | |
74 | + int phy_addr, const struct mdio_ops *mdio_ops) | |
75 | { | |
76 | cphy_init(phy, adapter, phy_addr, &xaui_direct_ops, mdio_ops); | |
77 | + return 0; | |
78 | } | |
79 | Index: linux-2.6.27/drivers/net/cxgb3/common.h | |
80 | =================================================================== | |
81 | --- linux-2.6.27.orig/drivers/net/cxgb3/common.h | |
82 | +++ linux-2.6.27/drivers/net/cxgb3/common.h | |
83 | @@ -203,8 +203,8 @@ struct adapter_info { | |
84 | }; | |
85 | ||
86 | struct port_type_info { | |
87 | - void (*phy_prep)(struct cphy *phy, struct adapter *adapter, | |
88 | - int phy_addr, const struct mdio_ops *ops); | |
89 | + int (*phy_prep)(struct cphy *phy, struct adapter *adapter, | |
90 | + int phy_addr, const struct mdio_ops *ops); | |
91 | unsigned int caps; | |
92 | const char *desc; | |
93 | }; | |
94 | @@ -775,14 +775,14 @@ int t3_sge_read_rspq(struct adapter *ada | |
95 | int t3_sge_cqcntxt_op(struct adapter *adapter, unsigned int id, unsigned int op, | |
96 | unsigned int credits); | |
97 | ||
98 | -void t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter, | |
99 | - int phy_addr, const struct mdio_ops *mdio_ops); | |
100 | -void t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, | |
101 | - int phy_addr, const struct mdio_ops *mdio_ops); | |
102 | -void t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, | |
103 | - int phy_addr, const struct mdio_ops *mdio_ops); | |
104 | -void t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr, | |
105 | - const struct mdio_ops *mdio_ops); | |
106 | -void t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, | |
107 | - int phy_addr, const struct mdio_ops *mdio_ops); | |
108 | +int t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter, | |
109 | + int phy_addr, const struct mdio_ops *mdio_ops); | |
110 | +int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter, | |
111 | + int phy_addr, const struct mdio_ops *mdio_ops); | |
112 | +int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter, | |
113 | + int phy_addr, const struct mdio_ops *mdio_ops); | |
114 | +int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter, int phy_addr, | |
115 | + const struct mdio_ops *mdio_ops); | |
116 | +int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter, | |
117 | + int phy_addr, const struct mdio_ops *mdio_ops); | |
118 | #endif /* __CHELSIO_COMMON_H */ | |
119 | Index: linux-2.6.27/drivers/net/cxgb3/t3_hw.c | |
120 | =================================================================== | |
121 | --- linux-2.6.27.orig/drivers/net/cxgb3/t3_hw.c | |
122 | +++ linux-2.6.27/drivers/net/cxgb3/t3_hw.c | |
123 | @@ -3626,8 +3626,11 @@ int t3_prep_adapter(struct adapter *adap | |
124 | ++j; | |
125 | ||
126 | p->port_type = &port_types[adapter->params.vpd.port_type[j]]; | |
127 | - p->port_type->phy_prep(&p->phy, adapter, ai->phy_base_addr + j, | |
128 | - ai->mdio_ops); | |
129 | + ret = p->port_type->phy_prep(&p->phy, adapter, | |
130 | + ai->phy_base_addr + j, | |
131 | + ai->mdio_ops); | |
132 | + if (ret) | |
133 | + return ret; | |
134 | mac_prep(&p->mac, adapter, j); | |
135 | ++j; | |
136 | ||
137 | @@ -3674,9 +3677,11 @@ int t3_replay_prep_adapter(struct adapte | |
138 | while (!adapter->params.vpd.port_type[j]) | |
139 | ++j; | |
140 | ||
141 | - p->port_type->phy_prep(&p->phy, adapter, ai->phy_base_addr + j, | |
142 | - ai->mdio_ops); | |
143 | - | |
144 | + ret = p->port_type->phy_prep(&p->phy, adapter, | |
145 | + ai->phy_base_addr + j, | |
146 | + ai->mdio_ops); | |
147 | + if (ret) | |
148 | + return ret; | |
149 | p->phy.ops->power_down(&p->phy, 1); | |
150 | ++j; | |
151 | } | |
152 | Index: linux-2.6.27/drivers/net/cxgb3/vsc8211.c | |
153 | =================================================================== | |
154 | --- linux-2.6.27.orig/drivers/net/cxgb3/vsc8211.c | |
155 | +++ linux-2.6.27/drivers/net/cxgb3/vsc8211.c | |
156 | @@ -221,8 +221,9 @@ static struct cphy_ops vsc8211_ops = { | |
157 | .power_down = vsc8211_power_down, | |
158 | }; | |
159 | ||
160 | -void t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter, | |
161 | - int phy_addr, const struct mdio_ops *mdio_ops) | |
162 | +int t3_vsc8211_phy_prep(struct cphy *phy, struct adapter *adapter, | |
163 | + int phy_addr, const struct mdio_ops *mdio_ops) | |
164 | { | |
165 | cphy_init(phy, adapter, phy_addr, &vsc8211_ops, mdio_ops); | |
166 | + return 0; | |
167 | } |