cxgb3: simplify port type struct and usage
[linux-3.10.git] / drivers / net / cxgb3 / ael1002.c
index 73a41e6..f4e046e 100644 (file)
@@ -119,11 +119,14 @@ static struct cphy_ops ael1002_ops = {
        .power_down = ael1002_power_down,
 };
 
-void t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_ael1002_phy_prep(struct cphy *phy, struct adapter *adapter,
+                       int phy_addr, const struct mdio_ops *mdio_ops)
 {
-       cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops);
+       cphy_init(phy, adapter, phy_addr, &ael1002_ops, mdio_ops,
+                 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE,
+                  "10GBASE-R");
        ael100x_txon(phy);
+       return 0;
 }
 
 static int ael1006_reset(struct cphy *phy, int wait)
@@ -174,11 +177,14 @@ static struct cphy_ops ael1006_ops = {
        .power_down = ael1006_power_down,
 };
 
-void t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
-                        int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_ael1006_phy_prep(struct cphy *phy, struct adapter *adapter,
+                            int phy_addr, const struct mdio_ops *mdio_ops)
 {
-       cphy_init(phy, adapter, phy_addr, &ael1006_ops, mdio_ops);
+       cphy_init(phy, adapter, phy_addr, &ael1006_ops, mdio_ops,
+                 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_FIBRE,
+                  "10GBASE-SR");
        ael100x_txon(phy);
+       return 0;
 }
 
 static struct cphy_ops qt2045_ops = {
@@ -191,12 +197,14 @@ static struct cphy_ops qt2045_ops = {
        .power_down = ael1006_power_down,
 };
 
-void t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter,
-                       int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter,
+                      int phy_addr, const struct mdio_ops *mdio_ops)
 {
        unsigned int stat;
 
-       cphy_init(phy, adapter, phy_addr, &qt2045_ops, mdio_ops);
+       cphy_init(phy, adapter, phy_addr, &qt2045_ops, mdio_ops,
+                 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_TP,
+                 "10GBASE-CX4");
 
        /*
         * Some cards where the PHY is supposed to be at address 0 actually
@@ -205,6 +213,7 @@ void t3_qt2045_phy_prep(struct cphy *phy, struct adapter *adapter,
        if (!phy_addr && !mdio_read(phy, MDIO_DEV_PMA_PMD, MII_BMSR, &stat) &&
            stat == 0xffff)
                phy->addr = 1;
+       return 0;
 }
 
 static int xaui_direct_reset(struct cphy *phy, int wait)
@@ -219,7 +228,13 @@ static int xaui_direct_get_link_status(struct cphy *phy, int *link_ok,
                unsigned int status;
 
                status = t3_read_reg(phy->adapter,
-                                    XGM_REG(A_XGM_SERDES_STAT0, phy->addr));
+                                    XGM_REG(A_XGM_SERDES_STAT0, phy->addr)) |
+                   t3_read_reg(phy->adapter,
+                               XGM_REG(A_XGM_SERDES_STAT1, phy->addr)) |
+                   t3_read_reg(phy->adapter,
+                               XGM_REG(A_XGM_SERDES_STAT2, phy->addr)) |
+                   t3_read_reg(phy->adapter,
+                               XGM_REG(A_XGM_SERDES_STAT3, phy->addr));
                *link_ok = !(status & F_LOWSIG0);
        }
        if (speed)
@@ -244,8 +259,11 @@ static struct cphy_ops xaui_direct_ops = {
        .power_down = xaui_direct_power_down,
 };
 
-void t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
-                            int phy_addr, const struct mdio_ops *mdio_ops)
+int t3_xaui_direct_phy_prep(struct cphy *phy, struct adapter *adapter,
+                           int phy_addr, const struct mdio_ops *mdio_ops)
 {
-       cphy_init(phy, adapter, 1, &xaui_direct_ops, mdio_ops);
+       cphy_init(phy, adapter, phy_addr, &xaui_direct_ops, mdio_ops,
+                 SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_TP,
+                 "10GBASE-CX4");
+       return 0;
 }