marvell.c (3c1bcc8614db10803f1f57ef0295363917448cb2) marvell.c (c0ec3c2736774c69bf5c641aea7712132c0f0eba)
1/*
2 * drivers/net/phy/marvell.c
3 *
4 * Driver for Marvell PHYs
5 *
6 * Author: Andy Fleming
7 *
8 * Copyright (c) 2004 Freescale Semiconductor, Inc.

--- 1035 unchanged lines hidden (view full) ---

1044 err = marvell_of_reg_init(phydev);
1045 if (err < 0)
1046 return err;
1047
1048 return 0;
1049}
1050
1051/**
1/*
2 * drivers/net/phy/marvell.c
3 *
4 * Driver for Marvell PHYs
5 *
6 * Author: Andy Fleming
7 *
8 * Copyright (c) 2004 Freescale Semiconductor, Inc.

--- 1035 unchanged lines hidden (view full) ---

1044 err = marvell_of_reg_init(phydev);
1045 if (err < 0)
1046 return err;
1047
1048 return 0;
1049}
1050
1051/**
1052 * fiber_lpa_to_ethtool_lpa_t
1052 * fiber_lpa_to_linkmode_lpa_t
1053 * @advertising: the linkmode advertisement settings
1053 * @lpa: value of the MII_LPA register for fiber link
1054 *
1055 * A small helper function that translates MII_LPA
1054 * @lpa: value of the MII_LPA register for fiber link
1055 *
1056 * A small helper function that translates MII_LPA
1056 * bits to ethtool LP advertisement settings.
1057 * bits to linkmode LP advertisement settings.
1057 */
1058 */
1058static u32 fiber_lpa_to_ethtool_lpa_t(u32 lpa)
1059static void fiber_lpa_to_linkmode_lpa_t(unsigned long *advertising, u32 lpa)
1059{
1060{
1060 u32 result = 0;
1061
1062 if (lpa & LPA_FIBER_1000HALF)
1061 if (lpa & LPA_FIBER_1000HALF)
1063 result |= ADVERTISED_1000baseT_Half;
1062 linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
1063 advertising);
1064 if (lpa & LPA_FIBER_1000FULL)
1064 if (lpa & LPA_FIBER_1000FULL)
1065 result |= ADVERTISED_1000baseT_Full;
1066
1067 return result;
1065 linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
1066 advertising);
1068}
1069
1070/**
1071 * marvell_update_link - update link status in real time in @phydev
1072 * @phydev: target phy_device struct
1073 *
1074 * Description: Update the value in phydev->link to reflect the
1075 * current link value.

--- 59 unchanged lines hidden (view full) ---

1135 break;
1136
1137 default:
1138 phydev->speed = SPEED_10;
1139 break;
1140 }
1141
1142 if (!fiber) {
1067}
1068
1069/**
1070 * marvell_update_link - update link status in real time in @phydev
1071 * @phydev: target phy_device struct
1072 *
1073 * Description: Update the value in phydev->link to reflect the
1074 * current link value.

--- 59 unchanged lines hidden (view full) ---

1134 break;
1135
1136 default:
1137 phydev->speed = SPEED_10;
1138 break;
1139 }
1140
1141 if (!fiber) {
1143 phydev->lp_advertising =
1144 mii_stat1000_to_ethtool_lpa_t(lpagb) |
1145 mii_lpa_to_ethtool_lpa_t(lpa);
1142 mii_lpa_to_linkmode_lpa_t(phydev->lp_advertising, lpa);
1143 mii_stat1000_to_linkmode_lpa_t(phydev->lp_advertising, lpagb);
1146
1147 if (phydev->duplex == DUPLEX_FULL) {
1148 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
1149 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
1150 }
1151 } else {
1152 /* The fiber link is only 1000M capable */
1144
1145 if (phydev->duplex == DUPLEX_FULL) {
1146 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
1147 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
1148 }
1149 } else {
1150 /* The fiber link is only 1000M capable */
1153 phydev->lp_advertising = fiber_lpa_to_ethtool_lpa_t(lpa);
1151 fiber_lpa_to_linkmode_lpa_t(phydev->lp_advertising, lpa);
1154
1155 if (phydev->duplex == DUPLEX_FULL) {
1156 if (!(lpa & LPA_PAUSE_FIBER)) {
1157 phydev->pause = 0;
1158 phydev->asym_pause = 0;
1159 } else if ((lpa & LPA_PAUSE_ASYM_FIBER)) {
1160 phydev->pause = 1;
1161 phydev->asym_pause = 1;

--- 22 unchanged lines hidden (view full) ---

1184 phydev->speed = SPEED_1000;
1185 else if (bmcr & BMCR_SPEED100)
1186 phydev->speed = SPEED_100;
1187 else
1188 phydev->speed = SPEED_10;
1189
1190 phydev->pause = 0;
1191 phydev->asym_pause = 0;
1152
1153 if (phydev->duplex == DUPLEX_FULL) {
1154 if (!(lpa & LPA_PAUSE_FIBER)) {
1155 phydev->pause = 0;
1156 phydev->asym_pause = 0;
1157 } else if ((lpa & LPA_PAUSE_ASYM_FIBER)) {
1158 phydev->pause = 1;
1159 phydev->asym_pause = 1;

--- 22 unchanged lines hidden (view full) ---

1182 phydev->speed = SPEED_1000;
1183 else if (bmcr & BMCR_SPEED100)
1184 phydev->speed = SPEED_100;
1185 else
1186 phydev->speed = SPEED_10;
1187
1188 phydev->pause = 0;
1189 phydev->asym_pause = 0;
1192 phydev->lp_advertising = 0;
1190 linkmode_zero(phydev->lp_advertising);
1193
1194 return 0;
1195}
1196
1197/* marvell_read_status_page
1198 *
1199 * Description:
1200 * Check the link, then figure out the current state

--- 1126 unchanged lines hidden ---
1191
1192 return 0;
1193}
1194
1195/* marvell_read_status_page
1196 *
1197 * Description:
1198 * Check the link, then figure out the current state

--- 1126 unchanged lines hidden ---