Commit 05407b0e authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by David S. Miller

net: dsa: mv88e6xxx: export mv88e6xxx_pcs_decode_state()

Rename and export the PCS state decoding function so our PCS can
make use of the functionality provided by this.
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b92143d4
...@@ -45,9 +45,8 @@ static int mv88e6390_serdes_write(struct mv88e6xxx_chip *chip, ...@@ -45,9 +45,8 @@ static int mv88e6390_serdes_write(struct mv88e6xxx_chip *chip,
return mv88e6xxx_phy_write_c45(chip, lane, device, reg, val); return mv88e6xxx_phy_write_c45(chip, lane, device, reg, val);
} }
static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int mv88e6xxx_pcs_decode_state(struct device *dev, u16 bmsr, u16 lpa,
u16 bmsr, u16 lpa, u16 status, u16 status, struct phylink_link_state *state)
struct phylink_link_state *state)
{ {
state->link = false; state->link = false;
...@@ -88,7 +87,7 @@ static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, ...@@ -88,7 +87,7 @@ static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip,
state->speed = SPEED_10; state->speed = SPEED_10;
break; break;
default: default:
dev_err(chip->dev, "invalid PHY speed\n"); dev_err(dev, "invalid PHY speed\n");
return -EINVAL; return -EINVAL;
} }
} else if (state->link && } else if (state->link &&
...@@ -211,7 +210,7 @@ int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, ...@@ -211,7 +210,7 @@ int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port,
return err; return err;
} }
return mv88e6xxx_serdes_pcs_get_state(chip, bmsr, lpa, status, state); return mv88e6xxx_pcs_decode_state(chip->dev, bmsr, lpa, status, state);
} }
int mv88e6352_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, int mv88e6352_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port,
...@@ -942,7 +941,7 @@ static int mv88e6390_serdes_pcs_get_state_sgmii(struct mv88e6xxx_chip *chip, ...@@ -942,7 +941,7 @@ static int mv88e6390_serdes_pcs_get_state_sgmii(struct mv88e6xxx_chip *chip,
return err; return err;
} }
return mv88e6xxx_serdes_pcs_get_state(chip, bmsr, lpa, status, state); return mv88e6xxx_pcs_decode_state(chip->dev, bmsr, lpa, status, state);
} }
static int mv88e6390_serdes_pcs_get_state_10g(struct mv88e6xxx_chip *chip, static int mv88e6390_serdes_pcs_get_state_10g(struct mv88e6xxx_chip *chip,
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include "chip.h" #include "chip.h"
struct phylink_link_state;
#define MV88E6352_ADDR_SERDES 0x0f #define MV88E6352_ADDR_SERDES 0x0f
#define MV88E6352_SERDES_PAGE_FIBER 0x01 #define MV88E6352_SERDES_PAGE_FIBER 0x01
#define MV88E6352_SERDES_IRQ 0x0b #define MV88E6352_SERDES_IRQ 0x0b
...@@ -107,6 +109,9 @@ ...@@ -107,6 +109,9 @@
#define MV88E6393X_ERRATA_4_8_REG 0xF074 #define MV88E6393X_ERRATA_4_8_REG 0xF074
#define MV88E6393X_ERRATA_4_8_BIT BIT(14) #define MV88E6393X_ERRATA_4_8_BIT BIT(14)
int mv88e6xxx_pcs_decode_state(struct device *dev, u16 bmsr, u16 lpa,
u16 status, struct phylink_link_state *state);
int mv88e6185_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); int mv88e6185_serdes_get_lane(struct mv88e6xxx_chip *chip, int port);
int mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); int mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port);
int mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); int mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment