diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2013-02-12 18:14:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-13 13:58:18 -0500 |
commit | 217a55a338262521d5106dafda2fe7bfff6583be (patch) | |
tree | 4845cb6ee3ebf888c29e7d522c6e65489ed4fbd2 | |
parent | 9e9ff4b766e25624198b623fe3eda0b3e6c669cd (diff) |
bgmac: return error on failed PHY write
Some callers may want to know if PHY write succeed. Also make PHY
functions static, they are not exported anywhere.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.h | 3 |
2 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c index 7bc8017ccf47..52d9a544c8ca 100644 --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c | |||
@@ -535,7 +535,7 @@ static void bgmac_dma_init(struct bgmac *bgmac) | |||
535 | * PHY ops | 535 | * PHY ops |
536 | **************************************************/ | 536 | **************************************************/ |
537 | 537 | ||
538 | u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg) | 538 | static u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg) |
539 | { | 539 | { |
540 | struct bcma_device *core; | 540 | struct bcma_device *core; |
541 | u16 phy_access_addr; | 541 | u16 phy_access_addr; |
@@ -584,7 +584,7 @@ u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg) | |||
584 | } | 584 | } |
585 | 585 | ||
586 | /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */ | 586 | /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */ |
587 | void bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value) | 587 | static int bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value) |
588 | { | 588 | { |
589 | struct bcma_device *core; | 589 | struct bcma_device *core; |
590 | u16 phy_access_addr; | 590 | u16 phy_access_addr; |
@@ -617,9 +617,13 @@ void bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value) | |||
617 | tmp |= value; | 617 | tmp |= value; |
618 | bcma_write32(core, phy_access_addr, tmp); | 618 | bcma_write32(core, phy_access_addr, tmp); |
619 | 619 | ||
620 | if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) | 620 | if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) { |
621 | bgmac_err(bgmac, "Writing to PHY %d register 0x%X failed\n", | 621 | bgmac_err(bgmac, "Writing to PHY %d register 0x%X failed\n", |
622 | phyaddr, reg); | 622 | phyaddr, reg); |
623 | return -ETIMEDOUT; | ||
624 | } | ||
625 | |||
626 | return 0; | ||
623 | } | 627 | } |
624 | 628 | ||
625 | /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyforce */ | 629 | /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyforce */ |
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h index 3dd6f6f7a098..4ede614c81f8 100644 --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h | |||
@@ -450,7 +450,4 @@ static inline void bgmac_set(struct bgmac *bgmac, u16 offset, u32 set) | |||
450 | bgmac_maskset(bgmac, offset, ~0, set); | 450 | bgmac_maskset(bgmac, offset, ~0, set); |
451 | } | 451 | } |
452 | 452 | ||
453 | u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg); | ||
454 | void bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value); | ||
455 | |||
456 | #endif /* _BGMAC_H */ | 453 | #endif /* _BGMAC_H */ |