Skip to content

Commit 9ad8bd8

Browse files
atenartdavem330
authored andcommitted
phy: cp110-comphy: 2.5G SGMII mode
This patch allow the CP110 comphy to configure some lanes in the 2.5G SGMII mode. This mode is quite close to SGMII and uses nearly the same code path. Signed-off-by: Antoine Tenart <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5490b87 commit 9ad8bd8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/phy/marvell/phy-mvebu-cp110-comphy.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,25 @@ struct mvebu_comhy_conf {
135135
static const struct mvebu_comhy_conf mvebu_comphy_cp110_modes[] = {
136136
/* lane 0 */
137137
MVEBU_COMPHY_CONF(0, 1, PHY_MODE_SGMII, 0x1),
138+
MVEBU_COMPHY_CONF(0, 1, PHY_MODE_2500SGMII, 0x1),
138139
/* lane 1 */
139140
MVEBU_COMPHY_CONF(1, 2, PHY_MODE_SGMII, 0x1),
141+
MVEBU_COMPHY_CONF(1, 2, PHY_MODE_2500SGMII, 0x1),
140142
/* lane 2 */
141143
MVEBU_COMPHY_CONF(2, 0, PHY_MODE_SGMII, 0x1),
144+
MVEBU_COMPHY_CONF(2, 0, PHY_MODE_2500SGMII, 0x1),
142145
MVEBU_COMPHY_CONF(2, 0, PHY_MODE_10GKR, 0x1),
143146
/* lane 3 */
144147
MVEBU_COMPHY_CONF(3, 1, PHY_MODE_SGMII, 0x2),
148+
MVEBU_COMPHY_CONF(3, 1, PHY_MODE_2500SGMII, 0x2),
145149
/* lane 4 */
146150
MVEBU_COMPHY_CONF(4, 0, PHY_MODE_SGMII, 0x2),
151+
MVEBU_COMPHY_CONF(4, 0, PHY_MODE_2500SGMII, 0x2),
147152
MVEBU_COMPHY_CONF(4, 0, PHY_MODE_10GKR, 0x2),
148153
MVEBU_COMPHY_CONF(4, 1, PHY_MODE_SGMII, 0x1),
149154
/* lane 5 */
150155
MVEBU_COMPHY_CONF(5, 2, PHY_MODE_SGMII, 0x1),
156+
MVEBU_COMPHY_CONF(5, 2, PHY_MODE_2500SGMII, 0x1),
151157
};
152158

153159
struct mvebu_comphy_priv {
@@ -206,6 +212,10 @@ static void mvebu_comphy_ethernet_init_reset(struct mvebu_comphy_lane *lane,
206212
if (mode == PHY_MODE_10GKR)
207213
val |= MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0xe) |
208214
MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0xe);
215+
else if (mode == PHY_MODE_2500SGMII)
216+
val |= MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0x8) |
217+
MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0x8) |
218+
MVEBU_COMPHY_SERDES_CFG0_HALF_BUS;
209219
else if (mode == PHY_MODE_SGMII)
210220
val |= MVEBU_COMPHY_SERDES_CFG0_GEN_RX(0x6) |
211221
MVEBU_COMPHY_SERDES_CFG0_GEN_TX(0x6) |
@@ -296,13 +306,13 @@ static int mvebu_comphy_init_plls(struct mvebu_comphy_lane *lane,
296306
return 0;
297307
}
298308

299-
static int mvebu_comphy_set_mode_sgmii(struct phy *phy)
309+
static int mvebu_comphy_set_mode_sgmii(struct phy *phy, enum phy_mode mode)
300310
{
301311
struct mvebu_comphy_lane *lane = phy_get_drvdata(phy);
302312
struct mvebu_comphy_priv *priv = lane->priv;
303313
u32 val;
304314

305-
mvebu_comphy_ethernet_init_reset(lane, PHY_MODE_SGMII);
315+
mvebu_comphy_ethernet_init_reset(lane, mode);
306316

307317
val = readl(priv->base + MVEBU_COMPHY_RX_CTRL1(lane->id));
308318
val &= ~MVEBU_COMPHY_RX_CTRL1_CLK8T_EN;
@@ -487,7 +497,8 @@ static int mvebu_comphy_power_on(struct phy *phy)
487497

488498
switch (lane->mode) {
489499
case PHY_MODE_SGMII:
490-
ret = mvebu_comphy_set_mode_sgmii(phy);
500+
case PHY_MODE_2500SGMII:
501+
ret = mvebu_comphy_set_mode_sgmii(phy, lane->mode);
491502
break;
492503
case PHY_MODE_10GKR:
493504
ret = mvebu_comphy_set_mode_10gkr(phy);

0 commit comments

Comments
 (0)