Commit 6a443a0f authored by Matt Carlson's avatar Matt Carlson Committed by David S. Miller

tg3: Push phylib definitions to phylib

This patch pushes phylib definitions out to phylib headers.  For phy
IDs, this removes some code duplication.
Signed-off-by: default avatarMatt Carlson <mcarlson@broadcom.com>
Reviewed-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 79eb6904
...@@ -18,9 +18,6 @@ ...@@ -18,9 +18,6 @@
#include <linux/phy.h> #include <linux/phy.h>
#include <linux/brcmphy.h> #include <linux/brcmphy.h>
#define PHY_ID_BCM50610 0x0143bd60
#define PHY_ID_BCM50610M 0x0143bd70
#define PHY_ID_BCM57780 0x03625d90
#define BRCM_PHY_MODEL(phydev) \ #define BRCM_PHY_MODEL(phydev) \
((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
...@@ -823,7 +820,7 @@ static struct phy_driver bcm57780_driver = { ...@@ -823,7 +820,7 @@ static struct phy_driver bcm57780_driver = {
}; };
static struct phy_driver bcmac131_driver = { static struct phy_driver bcmac131_driver = {
.phy_id = 0x0143bc70, .phy_id = PHY_ID_BCMAC131,
.phy_id_mask = 0xfffffff0, .phy_id_mask = 0xfffffff0,
.name = "Broadcom BCMAC131", .name = "Broadcom BCMAC131",
.features = PHY_BASIC_FEATURES | .features = PHY_BASIC_FEATURES |
......
...@@ -955,17 +955,17 @@ static void tg3_mdio_config_5785(struct tg3 *tp) ...@@ -955,17 +955,17 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
case TG3_PHY_ID_BCM50610: case PHY_ID_BCM50610:
case TG3_PHY_ID_BCM50610M: case PHY_ID_BCM50610M:
val = MAC_PHYCFG2_50610_LED_MODES; val = MAC_PHYCFG2_50610_LED_MODES;
break; break;
case TG3_PHY_ID_BCMAC131: case PHY_ID_BCMAC131:
val = MAC_PHYCFG2_AC131_LED_MODES; val = MAC_PHYCFG2_AC131_LED_MODES;
break; break;
case TG3_PHY_ID_RTL8211C: case PHY_ID_RTL8211C:
val = MAC_PHYCFG2_RTL8211C_LED_MODES; val = MAC_PHYCFG2_RTL8211C_LED_MODES;
break; break;
case TG3_PHY_ID_RTL8201E: case PHY_ID_RTL8201E:
val = MAC_PHYCFG2_RTL8201E_LED_MODES; val = MAC_PHYCFG2_RTL8201E_LED_MODES;
break; break;
default: default:
...@@ -1115,12 +1115,12 @@ static int tg3_mdio_init(struct tg3 *tp) ...@@ -1115,12 +1115,12 @@ static int tg3_mdio_init(struct tg3 *tp)
} }
switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) {
case TG3_PHY_ID_BCM57780: case PHY_ID_BCM57780:
phydev->interface = PHY_INTERFACE_MODE_GMII; phydev->interface = PHY_INTERFACE_MODE_GMII;
phydev->dev_flags |= PHY_BRCM_AUTO_PWRDWN_ENABLE; phydev->dev_flags |= PHY_BRCM_AUTO_PWRDWN_ENABLE;
break; break;
case TG3_PHY_ID_BCM50610: case PHY_ID_BCM50610:
case TG3_PHY_ID_BCM50610M: case PHY_ID_BCM50610M:
phydev->dev_flags |= PHY_BRCM_CLEAR_RGMII_MODE | phydev->dev_flags |= PHY_BRCM_CLEAR_RGMII_MODE |
PHY_BRCM_RX_REFCLK_UNUSED | PHY_BRCM_RX_REFCLK_UNUSED |
PHY_BRCM_DIS_TXCRXC_NOENRGY | PHY_BRCM_DIS_TXCRXC_NOENRGY |
...@@ -1132,11 +1132,11 @@ static int tg3_mdio_init(struct tg3 *tp) ...@@ -1132,11 +1132,11 @@ static int tg3_mdio_init(struct tg3 *tp)
if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_TX_EN) if (tp->tg3_flags3 & TG3_FLG3_RGMII_EXT_IBND_TX_EN)
phydev->dev_flags |= PHY_BRCM_EXT_IBND_TX_ENABLE; phydev->dev_flags |= PHY_BRCM_EXT_IBND_TX_ENABLE;
/* fallthru */ /* fallthru */
case TG3_PHY_ID_RTL8211C: case PHY_ID_RTL8211C:
phydev->interface = PHY_INTERFACE_MODE_RGMII; phydev->interface = PHY_INTERFACE_MODE_RGMII;
break; break;
case TG3_PHY_ID_RTL8201E: case PHY_ID_RTL8201E:
case TG3_PHY_ID_BCMAC131: case PHY_ID_BCMAC131:
phydev->interface = PHY_INTERFACE_MODE_MII; phydev->interface = PHY_INTERFACE_MODE_MII;
phydev->dev_flags |= PHY_BRCM_AUTO_PWRDWN_ENABLE; phydev->dev_flags |= PHY_BRCM_AUTO_PWRDWN_ENABLE;
tp->tg3_flags3 |= TG3_FLG3_PHY_IS_FET; tp->tg3_flags3 |= TG3_FLG3_PHY_IS_FET;
...@@ -2563,11 +2563,11 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) ...@@ -2563,11 +2563,11 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
phy_start_aneg(phydev); phy_start_aneg(phydev);
phyid = phydev->drv->phy_id & phydev->drv->phy_id_mask; phyid = phydev->drv->phy_id & phydev->drv->phy_id_mask;
if (phyid != TG3_PHY_ID_BCMAC131) { if (phyid != PHY_ID_BCMAC131) {
phyid &= TG3_PHY_OUI_MASK; phyid &= PHY_BCM_OUI_MASK;
if (phyid == TG3_PHY_OUI_1 || if (phyid == PHY_BCM_OUI_1 ||
phyid == TG3_PHY_OUI_2 || phyid == PHY_BCM_OUI_2 ||
phyid == TG3_PHY_OUI_3) phyid == PHY_BCM_OUI_3)
do_low_power = true; do_low_power = true;
} }
} }
......
...@@ -2943,22 +2943,14 @@ struct tg3 { ...@@ -2943,22 +2943,14 @@ struct tg3 {
#define TG3_PHY_ID_BCM57765 0x5c0d8a40 #define TG3_PHY_ID_BCM57765 0x5c0d8a40
#define TG3_PHY_ID_BCM5906 0xdc00ac40 #define TG3_PHY_ID_BCM5906 0xdc00ac40
#define TG3_PHY_ID_BCM8002 0x60010140 #define TG3_PHY_ID_BCM8002 0x60010140
#define TG3_PHY_ID_BCM50610 0x0143bd60
#define TG3_PHY_ID_BCM50610M 0x0143bd70
#define TG3_PHY_ID_BCMAC131 0x0143bc70
#define TG3_PHY_ID_RTL8211C 0x001cc910
#define TG3_PHY_ID_RTL8201E 0x00008200
#define TG3_PHY_ID_BCM57780 0x03625d90
#define TG3_PHY_ID_INVALID 0xffffffff #define TG3_PHY_ID_INVALID 0xffffffff
#define PHY_ID_RTL8211C 0x001cc910
#define PHY_ID_RTL8201E 0x00008200
#define TG3_PHY_ID_REV_MASK 0x0000000f #define TG3_PHY_ID_REV_MASK 0x0000000f
#define TG3_PHY_REV_BCM5401_B0 0x1 #define TG3_PHY_REV_BCM5401_B0 0x1
#define TG3_PHY_OUI_MASK 0xfffffc00
#define TG3_PHY_OUI_1 0x00206000
#define TG3_PHY_OUI_2 0x0143bc00
#define TG3_PHY_OUI_3 0x03625c00
/* This macro assumes the passed PHY ID is /* This macro assumes the passed PHY ID is
* already masked with TG3_PHY_ID_MASK. * already masked with TG3_PHY_ID_MASK.
*/ */
......
#define PHY_ID_BCM50610 0x0143bd60
#define PHY_ID_BCM50610M 0x0143bd70
#define PHY_ID_BCMAC131 0x0143bc70
#define PHY_ID_BCM57780 0x03625d90
#define PHY_BCM_OUI_MASK 0xfffffc00
#define PHY_BCM_OUI_1 0x00206000
#define PHY_BCM_OUI_2 0x0143bc00
#define PHY_BCM_OUI_3 0x03625c00
#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 #define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
#define PHY_BCM_FLAGS_MODE_1000BX 0x00000002 #define PHY_BCM_FLAGS_MODE_1000BX 0x00000002
#define PHY_BCM_FLAGS_INTF_SGMII 0x00000010 #define PHY_BCM_FLAGS_INTF_SGMII 0x00000010
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment