diff options
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r-- | drivers/net/phy/phy.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1bb16cb79433..a47595760751 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -47,11 +47,11 @@ void phy_print_status(struct phy_device *phydev) | |||
47 | pr_info("PHY: %s - Link is %s", dev_name(&phydev->dev), | 47 | pr_info("PHY: %s - Link is %s", dev_name(&phydev->dev), |
48 | phydev->link ? "Up" : "Down"); | 48 | phydev->link ? "Up" : "Down"); |
49 | if (phydev->link) | 49 | if (phydev->link) |
50 | printk(" - %d/%s", phydev->speed, | 50 | printk(KERN_CONT " - %d/%s", phydev->speed, |
51 | DUPLEX_FULL == phydev->duplex ? | 51 | DUPLEX_FULL == phydev->duplex ? |
52 | "Full" : "Half"); | 52 | "Full" : "Half"); |
53 | 53 | ||
54 | printk("\n"); | 54 | printk(KERN_CONT "\n"); |
55 | } | 55 | } |
56 | EXPORT_SYMBOL(phy_print_status); | 56 | EXPORT_SYMBOL(phy_print_status); |
57 | 57 | ||
@@ -65,7 +65,7 @@ EXPORT_SYMBOL(phy_print_status); | |||
65 | * | 65 | * |
66 | * Returns 0 on success on < 0 on error. | 66 | * Returns 0 on success on < 0 on error. |
67 | */ | 67 | */ |
68 | int phy_clear_interrupt(struct phy_device *phydev) | 68 | static int phy_clear_interrupt(struct phy_device *phydev) |
69 | { | 69 | { |
70 | int err = 0; | 70 | int err = 0; |
71 | 71 | ||
@@ -82,7 +82,7 @@ int phy_clear_interrupt(struct phy_device *phydev) | |||
82 | * | 82 | * |
83 | * Returns 0 on success on < 0 on error. | 83 | * Returns 0 on success on < 0 on error. |
84 | */ | 84 | */ |
85 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts) | 85 | static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts) |
86 | { | 86 | { |
87 | int err = 0; | 87 | int err = 0; |
88 | 88 | ||
@@ -208,7 +208,7 @@ static inline int phy_find_valid(int idx, u32 features) | |||
208 | * duplexes. Drop down by one in this order: 1000/FULL, | 208 | * duplexes. Drop down by one in this order: 1000/FULL, |
209 | * 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF. | 209 | * 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF. |
210 | */ | 210 | */ |
211 | void phy_sanitize_settings(struct phy_device *phydev) | 211 | static void phy_sanitize_settings(struct phy_device *phydev) |
212 | { | 212 | { |
213 | u32 features = phydev->supported; | 213 | u32 features = phydev->supported; |
214 | int idx; | 214 | int idx; |
@@ -223,7 +223,6 @@ void phy_sanitize_settings(struct phy_device *phydev) | |||
223 | phydev->speed = settings[idx].speed; | 223 | phydev->speed = settings[idx].speed; |
224 | phydev->duplex = settings[idx].duplex; | 224 | phydev->duplex = settings[idx].duplex; |
225 | } | 225 | } |
226 | EXPORT_SYMBOL(phy_sanitize_settings); | ||
227 | 226 | ||
228 | /** | 227 | /** |
229 | * phy_ethtool_sset - generic ethtool sset function, handles all the details | 228 | * phy_ethtool_sset - generic ethtool sset function, handles all the details |
@@ -239,6 +238,8 @@ EXPORT_SYMBOL(phy_sanitize_settings); | |||
239 | */ | 238 | */ |
240 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) | 239 | int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) |
241 | { | 240 | { |
241 | u32 speed = ethtool_cmd_speed(cmd); | ||
242 | |||
242 | if (cmd->phy_address != phydev->addr) | 243 | if (cmd->phy_address != phydev->addr) |
243 | return -EINVAL; | 244 | return -EINVAL; |
244 | 245 | ||
@@ -254,16 +255,16 @@ int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd) | |||
254 | return -EINVAL; | 255 | return -EINVAL; |
255 | 256 | ||
256 | if (cmd->autoneg == AUTONEG_DISABLE && | 257 | if (cmd->autoneg == AUTONEG_DISABLE && |
257 | ((cmd->speed != SPEED_1000 && | 258 | ((speed != SPEED_1000 && |
258 | cmd->speed != SPEED_100 && | 259 | speed != SPEED_100 && |
259 | cmd->speed != SPEED_10) || | 260 | speed != SPEED_10) || |
260 | (cmd->duplex != DUPLEX_HALF && | 261 | (cmd->duplex != DUPLEX_HALF && |
261 | cmd->duplex != DUPLEX_FULL))) | 262 | cmd->duplex != DUPLEX_FULL))) |
262 | return -EINVAL; | 263 | return -EINVAL; |
263 | 264 | ||
264 | phydev->autoneg = cmd->autoneg; | 265 | phydev->autoneg = cmd->autoneg; |
265 | 266 | ||
266 | phydev->speed = cmd->speed; | 267 | phydev->speed = speed; |
267 | 268 | ||
268 | phydev->advertising = cmd->advertising; | 269 | phydev->advertising = cmd->advertising; |
269 | 270 | ||
@@ -287,7 +288,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) | |||
287 | 288 | ||
288 | cmd->advertising = phydev->advertising; | 289 | cmd->advertising = phydev->advertising; |
289 | 290 | ||
290 | cmd->speed = phydev->speed; | 291 | ethtool_cmd_speed_set(cmd, phydev->speed); |
291 | cmd->duplex = phydev->duplex; | 292 | cmd->duplex = phydev->duplex; |
292 | cmd->port = PORT_MII; | 293 | cmd->port = PORT_MII; |
293 | cmd->phy_address = phydev->addr; | 294 | cmd->phy_address = phydev->addr; |
@@ -320,7 +321,8 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
320 | /* fall through */ | 321 | /* fall through */ |
321 | 322 | ||
322 | case SIOCGMIIREG: | 323 | case SIOCGMIIREG: |
323 | mii_data->val_out = phy_read(phydev, mii_data->reg_num); | 324 | mii_data->val_out = mdiobus_read(phydev->bus, mii_data->phy_id, |
325 | mii_data->reg_num); | ||
324 | break; | 326 | break; |
325 | 327 | ||
326 | case SIOCSMIIREG: | 328 | case SIOCSMIIREG: |
@@ -351,8 +353,9 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
351 | } | 353 | } |
352 | } | 354 | } |
353 | 355 | ||
354 | phy_write(phydev, mii_data->reg_num, val); | 356 | mdiobus_write(phydev->bus, mii_data->phy_id, |
355 | 357 | mii_data->reg_num, val); | |
358 | |||
356 | if (mii_data->reg_num == MII_BMCR && | 359 | if (mii_data->reg_num == MII_BMCR && |
357 | val & BMCR_RESET && | 360 | val & BMCR_RESET && |
358 | phydev->drv->config_init) { | 361 | phydev->drv->config_init) { |
@@ -532,7 +535,7 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) | |||
532 | * phy_enable_interrupts - Enable the interrupts from the PHY side | 535 | * phy_enable_interrupts - Enable the interrupts from the PHY side |
533 | * @phydev: target phy_device struct | 536 | * @phydev: target phy_device struct |
534 | */ | 537 | */ |
535 | int phy_enable_interrupts(struct phy_device *phydev) | 538 | static int phy_enable_interrupts(struct phy_device *phydev) |
536 | { | 539 | { |
537 | int err; | 540 | int err; |
538 | 541 | ||
@@ -545,13 +548,12 @@ int phy_enable_interrupts(struct phy_device *phydev) | |||
545 | 548 | ||
546 | return err; | 549 | return err; |
547 | } | 550 | } |
548 | EXPORT_SYMBOL(phy_enable_interrupts); | ||
549 | 551 | ||
550 | /** | 552 | /** |
551 | * phy_disable_interrupts - Disable the PHY interrupts from the PHY side | 553 | * phy_disable_interrupts - Disable the PHY interrupts from the PHY side |
552 | * @phydev: target phy_device struct | 554 | * @phydev: target phy_device struct |
553 | */ | 555 | */ |
554 | int phy_disable_interrupts(struct phy_device *phydev) | 556 | static int phy_disable_interrupts(struct phy_device *phydev) |
555 | { | 557 | { |
556 | int err; | 558 | int err; |
557 | 559 | ||
@@ -574,7 +576,6 @@ phy_err: | |||
574 | 576 | ||
575 | return err; | 577 | return err; |
576 | } | 578 | } |
577 | EXPORT_SYMBOL(phy_disable_interrupts); | ||
578 | 579 | ||
579 | /** | 580 | /** |
580 | * phy_start_interrupts - request and enable interrupts for a PHY device | 581 | * phy_start_interrupts - request and enable interrupts for a PHY device |