Skip to content

Commit

Permalink
bgmac: return error on failed PHY write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafał Miłecki authored and David S. Miller committed Feb 13, 2013
1 parent 9e9ff4b commit 217a55a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 7 additions & 3 deletions drivers/net/ethernet/broadcom/bgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ static void bgmac_dma_init(struct bgmac *bgmac)
* PHY ops
**************************************************/

u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg)
static u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg)
{
struct bcma_device *core;
u16 phy_access_addr;
Expand Down Expand Up @@ -584,7 +584,7 @@ u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg)
}

/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphywr */
void bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value)
static int bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value)
{
struct bcma_device *core;
u16 phy_access_addr;
Expand Down Expand Up @@ -617,9 +617,13 @@ void bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value)
tmp |= value;
bcma_write32(core, phy_access_addr, tmp);

if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000))
if (!bgmac_wait_value(core, phy_access_addr, BGMAC_PA_START, 0, 1000)) {
bgmac_err(bgmac, "Writing to PHY %d register 0x%X failed\n",
phyaddr, reg);
return -ETIMEDOUT;
}

return 0;
}

/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyforce */
Expand Down
3 changes: 0 additions & 3 deletions drivers/net/ethernet/broadcom/bgmac.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,4 @@ static inline void bgmac_set(struct bgmac *bgmac, u16 offset, u32 set)
bgmac_maskset(bgmac, offset, ~0, set);
}

u16 bgmac_phy_read(struct bgmac *bgmac, u8 phyaddr, u8 reg);
void bgmac_phy_write(struct bgmac *bgmac, u8 phyaddr, u8 reg, u16 value);

#endif /* _BGMAC_H */

0 comments on commit 217a55a

Please sign in to comment.