diff options
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 1c680ff51013..afcc593108ce 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -1162,6 +1162,52 @@ static void tg3_mdio_fini(struct tg3 *tp) | |||
1162 | } | 1162 | } |
1163 | } | 1163 | } |
1164 | 1164 | ||
1165 | static int tg3_phy_cl45_write(struct tg3 *tp, u32 devad, u32 addr, u32 val) | ||
1166 | { | ||
1167 | int err; | ||
1168 | |||
1169 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad); | ||
1170 | if (err) | ||
1171 | goto done; | ||
1172 | |||
1173 | err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr); | ||
1174 | if (err) | ||
1175 | goto done; | ||
1176 | |||
1177 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, | ||
1178 | MII_TG3_MMD_CTRL_DATA_NOINC | devad); | ||
1179 | if (err) | ||
1180 | goto done; | ||
1181 | |||
1182 | err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, val); | ||
1183 | |||
1184 | done: | ||
1185 | return err; | ||
1186 | } | ||
1187 | |||
1188 | static int tg3_phy_cl45_read(struct tg3 *tp, u32 devad, u32 addr, u32 *val) | ||
1189 | { | ||
1190 | int err; | ||
1191 | |||
1192 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad); | ||
1193 | if (err) | ||
1194 | goto done; | ||
1195 | |||
1196 | err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr); | ||
1197 | if (err) | ||
1198 | goto done; | ||
1199 | |||
1200 | err = tg3_writephy(tp, MII_TG3_MMD_CTRL, | ||
1201 | MII_TG3_MMD_CTRL_DATA_NOINC | devad); | ||
1202 | if (err) | ||
1203 | goto done; | ||
1204 | |||
1205 | err = tg3_readphy(tp, MII_TG3_MMD_ADDRESS, val); | ||
1206 | |||
1207 | done: | ||
1208 | return err; | ||
1209 | } | ||
1210 | |||
1165 | /* tp->lock is held. */ | 1211 | /* tp->lock is held. */ |
1166 | static inline void tg3_generate_fw_event(struct tg3 *tp) | 1212 | static inline void tg3_generate_fw_event(struct tg3 *tp) |
1167 | { | 1213 | { |