|
@@ -376,6 +376,45 @@ static void xgbe_set_mode(struct xgbe_prv_data *pdata,
|
|
xgbe_switch_mode(pdata);
|
|
xgbe_switch_mode(pdata);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static bool xgbe_use_xgmii_mode(struct xgbe_prv_data *pdata)
|
|
|
|
+{
|
|
|
|
+ if (pdata->phy.autoneg == AUTONEG_ENABLE) {
|
|
|
|
+ if (pdata->phy.advertising & ADVERTISED_10000baseKR_Full)
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ if (pdata->phy.speed == SPEED_10000)
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static bool xgbe_use_gmii_2500_mode(struct xgbe_prv_data *pdata)
|
|
|
|
+{
|
|
|
|
+ if (pdata->phy.autoneg == AUTONEG_ENABLE) {
|
|
|
|
+ if (pdata->phy.advertising & ADVERTISED_2500baseX_Full)
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ if (pdata->phy.speed == SPEED_2500)
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static bool xgbe_use_gmii_mode(struct xgbe_prv_data *pdata)
|
|
|
|
+{
|
|
|
|
+ if (pdata->phy.autoneg == AUTONEG_ENABLE) {
|
|
|
|
+ if (pdata->phy.advertising & ADVERTISED_1000baseKX_Full)
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ if (pdata->phy.speed == SPEED_1000)
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
static void xgbe_set_an(struct xgbe_prv_data *pdata, bool enable, bool restart)
|
|
static void xgbe_set_an(struct xgbe_prv_data *pdata, bool enable, bool restart)
|
|
{
|
|
{
|
|
unsigned int reg;
|
|
unsigned int reg;
|
|
@@ -1108,11 +1147,11 @@ static int xgbe_phy_start(struct xgbe_prv_data *pdata)
|
|
/* Set initial mode - call the mode setting routines
|
|
/* Set initial mode - call the mode setting routines
|
|
* directly to insure we are properly configured
|
|
* directly to insure we are properly configured
|
|
*/
|
|
*/
|
|
- if (pdata->phy.advertising & ADVERTISED_10000baseKR_Full) {
|
|
|
|
|
|
+ if (xgbe_use_xgmii_mode(pdata)) {
|
|
xgbe_xgmii_mode(pdata);
|
|
xgbe_xgmii_mode(pdata);
|
|
- } else if (pdata->phy.advertising & ADVERTISED_1000baseKX_Full) {
|
|
|
|
|
|
+ } else if (xgbe_use_gmii_mode(pdata)) {
|
|
xgbe_gmii_mode(pdata);
|
|
xgbe_gmii_mode(pdata);
|
|
- } else if (pdata->phy.advertising & ADVERTISED_2500baseX_Full) {
|
|
|
|
|
|
+ } else if (xgbe_use_gmii_2500_mode(pdata)) {
|
|
xgbe_gmii_2500_mode(pdata);
|
|
xgbe_gmii_2500_mode(pdata);
|
|
} else {
|
|
} else {
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|