aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/skge.c26
-rw-r--r--drivers/net/skge.h11
2 files changed, 14 insertions, 23 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 9ff1261f07ca..3990829d3c46 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -189,7 +189,7 @@ static u32 skge_supported_modes(const struct skge_hw *hw)
189{ 189{
190 u32 supported; 190 u32 supported;
191 191
192 if (iscopper(hw)) { 192 if (hw->copper) {
193 supported = SUPPORTED_10baseT_Half 193 supported = SUPPORTED_10baseT_Half
194 | SUPPORTED_10baseT_Full 194 | SUPPORTED_10baseT_Full
195 | SUPPORTED_100baseT_Half 195 | SUPPORTED_100baseT_Half
@@ -222,7 +222,7 @@ static int skge_get_settings(struct net_device *dev,
222 ecmd->transceiver = XCVR_INTERNAL; 222 ecmd->transceiver = XCVR_INTERNAL;
223 ecmd->supported = skge_supported_modes(hw); 223 ecmd->supported = skge_supported_modes(hw);
224 224
225 if (iscopper(hw)) { 225 if (hw->copper) {
226 ecmd->port = PORT_TP; 226 ecmd->port = PORT_TP;
227 ecmd->phy_address = hw->phy_addr; 227 ecmd->phy_address = hw->phy_addr;
228 } else 228 } else
@@ -1599,7 +1599,7 @@ static void yukon_init(struct skge_hw *hw, int port)
1599 adv = PHY_AN_CSMA; 1599 adv = PHY_AN_CSMA;
1600 1600
1601 if (skge->autoneg == AUTONEG_ENABLE) { 1601 if (skge->autoneg == AUTONEG_ENABLE) {
1602 if (iscopper(hw)) { 1602 if (hw->copper) {
1603 if (skge->advertising & ADVERTISED_1000baseT_Full) 1603 if (skge->advertising & ADVERTISED_1000baseT_Full)
1604 ct1000 |= PHY_M_1000C_AFD; 1604 ct1000 |= PHY_M_1000C_AFD;
1605 if (skge->advertising & ADVERTISED_1000baseT_Half) 1605 if (skge->advertising & ADVERTISED_1000baseT_Half)
@@ -1691,7 +1691,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port)
1691 /* Set hardware config mode */ 1691 /* Set hardware config mode */
1692 reg = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP | 1692 reg = GPC_INT_POL_HI | GPC_DIS_FC | GPC_DIS_SLEEP |
1693 GPC_ENA_XC | GPC_ANEG_ADV_ALL_M | GPC_ENA_PAUSE; 1693 GPC_ENA_XC | GPC_ANEG_ADV_ALL_M | GPC_ENA_PAUSE;
1694 reg |= iscopper(hw) ? GPC_HWCFG_GMII_COP : GPC_HWCFG_GMII_FIB; 1694 reg |= hw->copper ? GPC_HWCFG_GMII_COP : GPC_HWCFG_GMII_FIB;
1695 1695
1696 /* Clear GMC reset */ 1696 /* Clear GMC reset */
1697 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET); 1697 skge_write32(hw, SK_REG(port, GPHY_CTRL), reg | GPC_RST_SET);
@@ -2865,7 +2865,7 @@ static const char *skge_board_name(const struct skge_hw *hw)
2865static int skge_reset(struct skge_hw *hw) 2865static int skge_reset(struct skge_hw *hw)
2866{ 2866{
2867 u16 ctst; 2867 u16 ctst;
2868 u8 t8, mac_cfg; 2868 u8 t8, mac_cfg, pmd_type, phy_type;
2869 int i; 2869 int i;
2870 2870
2871 ctst = skge_read16(hw, B0_CTST); 2871 ctst = skge_read16(hw, B0_CTST);
@@ -2884,18 +2884,19 @@ static int skge_reset(struct skge_hw *hw)
2884 ctst & (CS_CLK_RUN_HOT|CS_CLK_RUN_RST|CS_CLK_RUN_ENA)); 2884 ctst & (CS_CLK_RUN_HOT|CS_CLK_RUN_RST|CS_CLK_RUN_ENA));
2885 2885
2886 hw->chip_id = skge_read8(hw, B2_CHIP_ID); 2886 hw->chip_id = skge_read8(hw, B2_CHIP_ID);
2887 hw->phy_type = skge_read8(hw, B2_E_1) & 0xf; 2887 phy_type = skge_read8(hw, B2_E_1) & 0xf;
2888 hw->pmd_type = skge_read8(hw, B2_PMD_TYP); 2888 pmd_type = skge_read8(hw, B2_PMD_TYP);
2889 hw->copper = (pmd_type == 'T' || pmd_type == '1');
2889 2890
2890 switch (hw->chip_id) { 2891 switch (hw->chip_id) {
2891 case CHIP_ID_GENESIS: 2892 case CHIP_ID_GENESIS:
2892 switch (hw->phy_type) { 2893 switch (phy_type) {
2893 case SK_PHY_BCOM: 2894 case SK_PHY_BCOM:
2894 hw->phy_addr = PHY_ADDR_BCOM; 2895 hw->phy_addr = PHY_ADDR_BCOM;
2895 break; 2896 break;
2896 default: 2897 default:
2897 printk(KERN_ERR PFX "%s: unsupported phy type 0x%x\n", 2898 printk(KERN_ERR PFX "%s: unsupported phy type 0x%x\n",
2898 pci_name(hw->pdev), hw->phy_type); 2899 pci_name(hw->pdev), phy_type);
2899 return -EOPNOTSUPP; 2900 return -EOPNOTSUPP;
2900 } 2901 }
2901 break; 2902 break;
@@ -2903,13 +2904,10 @@ static int skge_reset(struct skge_hw *hw)
2903 case CHIP_ID_YUKON: 2904 case CHIP_ID_YUKON:
2904 case CHIP_ID_YUKON_LITE: 2905 case CHIP_ID_YUKON_LITE:
2905 case CHIP_ID_YUKON_LP: 2906 case CHIP_ID_YUKON_LP:
2906 if (hw->phy_type < SK_PHY_MARV_COPPER && hw->pmd_type != 'S') 2907 if (phy_type < SK_PHY_MARV_COPPER && pmd_type != 'S')
2907 hw->phy_type = SK_PHY_MARV_COPPER; 2908 hw->copper = 1;
2908 2909
2909 hw->phy_addr = PHY_ADDR_MARV; 2910 hw->phy_addr = PHY_ADDR_MARV;
2910 if (!iscopper(hw))
2911 hw->phy_type = SK_PHY_MARV_FIBER;
2912
2913 break; 2911 break;
2914 2912
2915 default: 2913 default:
diff --git a/drivers/net/skge.h b/drivers/net/skge.h
index 636729fcbbaa..f1680beb8e68 100644
--- a/drivers/net/skge.h
+++ b/drivers/net/skge.h
@@ -2460,24 +2460,17 @@ struct skge_hw {
2460 2460
2461 u8 chip_id; 2461 u8 chip_id;
2462 u8 chip_rev; 2462 u8 chip_rev;
2463 u8 phy_type; 2463 u8 copper;
2464 u8 pmd_type;
2465 u16 phy_addr;
2466 u8 ports; 2464 u8 ports;
2467 2465
2468 u32 ram_size; 2466 u32 ram_size;
2469 u32 ram_offset; 2467 u32 ram_offset;
2468 u16 phy_addr;
2470 2469
2471 struct tasklet_struct ext_tasklet; 2470 struct tasklet_struct ext_tasklet;
2472 spinlock_t phy_lock; 2471 spinlock_t phy_lock;
2473}; 2472};
2474 2473
2475
2476static inline int iscopper(const struct skge_hw *hw)
2477{
2478 return (hw->pmd_type == 'T');
2479}
2480
2481enum { 2474enum {
2482 FLOW_MODE_NONE = 0, /* No Flow-Control */ 2475 FLOW_MODE_NONE = 0, /* No Flow-Control */
2483 FLOW_MODE_LOC_SEND = 1, /* Local station sends PAUSE */ 2476 FLOW_MODE_LOC_SEND = 1, /* Local station sends PAUSE */