aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-06-11 02:33:59 -0400
committerDavid S. Miller <davem@davemloft.net>2015-06-11 02:33:59 -0400
commit1531407c81830e8b9b0fb00d4f49bcc1ee91dfd1 (patch)
tree2f3b239538e5b2d3bbeeba06d3f74ed9465dc18f
parentf9c2ff22bb2df7b8f153afd2a4bea07176bad144 (diff)
parentaafc66f106c03336e6e4ab9fd741c2b33110b7be (diff)
Merge branch 'brcm-pseudo-phy-addr'
Florian Fainelli says: ==================== net: phy: broadcom: define pseudo-PHY address This patch series converts existing in-tree users of the Broadcom pseudo-PHY address (30) used to configure MDIO-connected switches to share a constant in a shared header files. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/bcm_sf2.c7
-rw-r--r--drivers/net/ethernet/broadcom/b44.h8
-rw-r--r--drivers/net/ethernet/broadcom/bgmac.h3
-rw-r--r--include/linux/brcmphy.h7
4 files changed, 19 insertions, 6 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 103fde3da476..972982f8bea7 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -24,6 +24,7 @@
24#include <net/dsa.h> 24#include <net/dsa.h>
25#include <linux/ethtool.h> 25#include <linux/ethtool.h>
26#include <linux/if_bridge.h> 26#include <linux/if_bridge.h>
27#include <linux/brcmphy.h>
27 28
28#include "bcm_sf2.h" 29#include "bcm_sf2.h"
29#include "bcm_sf2_regs.h" 30#include "bcm_sf2_regs.h"
@@ -697,7 +698,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
697 /* Include the pseudo-PHY address and the broadcast PHY address to 698 /* Include the pseudo-PHY address and the broadcast PHY address to
698 * divert reads towards our workaround 699 * divert reads towards our workaround
699 */ 700 */
700 ds->phys_mii_mask |= ((1 << 30) | (1 << 0)); 701 ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));
701 702
702 rev = reg_readl(priv, REG_SWITCH_REVISION); 703 rev = reg_readl(priv, REG_SWITCH_REVISION);
703 priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) & 704 priv->hw_params.top_rev = (rev >> SWITCH_TOP_REV_SHIFT) &
@@ -782,7 +783,7 @@ static int bcm_sf2_sw_phy_read(struct dsa_switch *ds, int addr, int regnum)
782 */ 783 */
783 switch (addr) { 784 switch (addr) {
784 case 0: 785 case 0:
785 case 30: 786 case BRCM_PSEUDO_PHY_ADDR:
786 return bcm_sf2_sw_indir_rw(ds, 1, addr, regnum, 0); 787 return bcm_sf2_sw_indir_rw(ds, 1, addr, regnum, 0);
787 default: 788 default:
788 return 0xffff; 789 return 0xffff;
@@ -797,7 +798,7 @@ static int bcm_sf2_sw_phy_write(struct dsa_switch *ds, int addr, int regnum,
797 */ 798 */
798 switch (addr) { 799 switch (addr) {
799 case 0: 800 case 0:
800 case 30: 801 case BRCM_PSEUDO_PHY_ADDR:
801 bcm_sf2_sw_indir_rw(ds, 0, addr, regnum, val); 802 bcm_sf2_sw_indir_rw(ds, 0, addr, regnum, val);
802 break; 803 break;
803 } 804 }
diff --git a/drivers/net/ethernet/broadcom/b44.h b/drivers/net/ethernet/broadcom/b44.h
index 3e9c3fc7591b..65d88d7c5581 100644
--- a/drivers/net/ethernet/broadcom/b44.h
+++ b/drivers/net/ethernet/broadcom/b44.h
@@ -1,6 +1,8 @@
1#ifndef _B44_H 1#ifndef _B44_H
2#define _B44_H 2#define _B44_H
3 3
4#include <linux/brcmphy.h>
5
4/* Register layout. (These correspond to struct _bcmenettregs in bcm4400.) */ 6/* Register layout. (These correspond to struct _bcmenettregs in bcm4400.) */
5#define B44_DEVCTRL 0x0000UL /* Device Control */ 7#define B44_DEVCTRL 0x0000UL /* Device Control */
6#define DEVCTRL_MPM 0x00000040 /* Magic Packet PME Enable (B0 only) */ 8#define DEVCTRL_MPM 0x00000040 /* Magic Packet PME Enable (B0 only) */
@@ -281,8 +283,10 @@ struct ring_info {
281}; 283};
282 284
283#define B44_MCAST_TABLE_SIZE 32 285#define B44_MCAST_TABLE_SIZE 32
284#define B44_PHY_ADDR_NO_LOCAL_PHY 30 /* no local phy regs */ 286/* no local phy regs, e.g: Broadcom switches pseudo-PHY */
285#define B44_PHY_ADDR_NO_PHY 31 /* no phy present at all */ 287#define B44_PHY_ADDR_NO_LOCAL_PHY BRCM_PSEUDO_PHY_ADDR
288/* no phy present at all */
289#define B44_PHY_ADDR_NO_PHY 31
286#define B44_MDC_RATIO 5000000 290#define B44_MDC_RATIO 5000000
287 291
288#define B44_STAT_REG_DECLARE \ 292#define B44_STAT_REG_DECLARE \
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h
index db27febbb215..4fbb093e0d84 100644
--- a/drivers/net/ethernet/broadcom/bgmac.h
+++ b/drivers/net/ethernet/broadcom/bgmac.h
@@ -13,6 +13,7 @@
13 dev_dbg(&(bgmac)->core->dev, fmt, ##__VA_ARGS__) 13 dev_dbg(&(bgmac)->core->dev, fmt, ##__VA_ARGS__)
14 14
15#include <linux/bcma/bcma.h> 15#include <linux/bcma/bcma.h>
16#include <linux/brcmphy.h>
16#include <linux/netdevice.h> 17#include <linux/netdevice.h>
17 18
18#define BGMAC_DEV_CTL 0x000 19#define BGMAC_DEV_CTL 0x000
@@ -349,7 +350,7 @@
349#define BGMAC_DESC_CTL0_SOF 0x80000000 /* Start of frame */ 350#define BGMAC_DESC_CTL0_SOF 0x80000000 /* Start of frame */
350#define BGMAC_DESC_CTL1_LEN 0x00001FFF 351#define BGMAC_DESC_CTL1_LEN 0x00001FFF
351 352
352#define BGMAC_PHY_NOREGS 0x1E 353#define BGMAC_PHY_NOREGS BRCM_PSEUDO_PHY_ADDR
353#define BGMAC_PHY_MASK 0x1F 354#define BGMAC_PHY_MASK 0x1F
354 355
355#define BGMAC_MAX_TX_RINGS 4 356#define BGMAC_MAX_TX_RINGS 4
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 656da2a12ffe..697ca7795bd9 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -1,6 +1,13 @@
1#ifndef _LINUX_BRCMPHY_H 1#ifndef _LINUX_BRCMPHY_H
2#define _LINUX_BRCMPHY_H 2#define _LINUX_BRCMPHY_H
3 3
4#include <linux/phy.h>
5
6/* All Broadcom Ethernet switches have a pseudo-PHY at address 30 which is used
7 * to configure the switch internal registers via MDIO accesses.
8 */
9#define BRCM_PSEUDO_PHY_ADDR 30
10
4#define PHY_ID_BCM50610 0x0143bd60 11#define PHY_ID_BCM50610 0x0143bd60
5#define PHY_ID_BCM50610M 0x0143bd70 12#define PHY_ID_BCM50610M 0x0143bd70
6#define PHY_ID_BCM5241 0x0143bc30 13#define PHY_ID_BCM5241 0x0143bc30