From 217a55a338262521d5106dafda2fe7bfff6583be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 12 Feb 2013 23:14:51 +0000 Subject: [PATCH] bgmac: return error on failed PHY write MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: David S. Miller --- drivers/net/ethernet/broadcom/bgmac.c | 10 +++++++--- 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) * 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; @@ -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; @@ -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 */ 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) 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 */ -- 2.20.1