summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/cortina.c48
-rw-r--r--drivers/net/phy/mv88e61xx.c51
2 files changed, 77 insertions, 22 deletions
diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
index 9b60d1aac5..a04a118f90 100644
--- a/drivers/net/phy/cortina.c
+++ b/drivers/net/phy/cortina.c
@@ -284,6 +284,38 @@ int cs4340_startup(struct phy_device *phydev)
return 0;
}
+int cs4223_phy_init(struct phy_device *phydev)
+{
+ int reg_value;
+
+ reg_value = phy_read(phydev, 0x00, CS4223_EEPROM_STATUS);
+ if (!(reg_value & CS4223_EEPROM_FIRMWARE_LOADDONE)) {
+ printf("%s CS4223 Firmware not present in EERPOM\n", __func__);
+ return -ENOSYS;
+ }
+
+ return 0;
+}
+
+int cs4223_config(struct phy_device *phydev)
+{
+ return cs4223_phy_init(phydev);
+}
+
+int cs4223_probe(struct phy_device *phydev)
+{
+ phydev->flags = PHY_FLAG_BROKEN_RESET;
+ return 0;
+}
+
+int cs4223_startup(struct phy_device *phydev)
+{
+ phydev->link = 1;
+ phydev->speed = SPEED_10000;
+ phydev->duplex = DUPLEX_FULL;
+ return 0;
+}
+
struct phy_driver cs4340_driver = {
.name = "Cortina CS4315/CS4340",
.uid = PHY_UID_CS4340,
@@ -298,9 +330,23 @@ struct phy_driver cs4340_driver = {
.shutdown = &gen10g_shutdown,
};
+struct phy_driver cs4223_driver = {
+ .name = "Cortina CS4223",
+ .uid = PHY_UID_CS4223,
+ .mask = 0x0ffff00f,
+ .features = PHY_10G_FEATURES,
+ .mmds = (MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS |
+ MDIO_DEVS_AN),
+ .config = &cs4223_config,
+ .probe = &cs4223_probe,
+ .startup = &cs4223_startup,
+ .shutdown = &gen10g_shutdown,
+};
+
int phy_cortina_init(void)
{
phy_register(&cs4340_driver);
+ phy_register(&cs4223_driver);
return 0;
}
@@ -319,7 +365,7 @@ int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
return -EIO;
*phy_id |= (phy_reg & 0xffff);
- if (*phy_id == PHY_UID_CS4340)
+ if ((*phy_id == PHY_UID_CS4340) || (*phy_id == PHY_UID_CS4223))
return 0;
/*
diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c
index 17040bd6cc..ea54a15310 100644
--- a/drivers/net/phy/mv88e61xx.c
+++ b/drivers/net/phy/mv88e61xx.c
@@ -705,6 +705,31 @@ unforce:
return res;
}
+static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
+{
+ int val;
+
+ val = mv88e61xx_port_read(phydev, port, PORT_REG_PHYS_CTRL);
+ if (val < 0)
+ return val;
+
+ val &= ~(PORT_REG_PHYS_CTRL_SPD_MASK |
+ PORT_REG_PHYS_CTRL_FC_VALUE);
+ val |= PORT_REG_PHYS_CTRL_PCS_AN_EN |
+ PORT_REG_PHYS_CTRL_PCS_AN_RST |
+ PORT_REG_PHYS_CTRL_FC_FORCE |
+ PORT_REG_PHYS_CTRL_DUPLEX_VALUE |
+ PORT_REG_PHYS_CTRL_DUPLEX_FORCE |
+ PORT_REG_PHYS_CTRL_SPD1000;
+
+ if (port == CONFIG_MV88E61XX_CPU_PORT)
+ val |= PORT_REG_PHYS_CTRL_LINK_VALUE |
+ PORT_REG_PHYS_CTRL_LINK_FORCE;
+
+ return mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL,
+ val);
+}
+
static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
{
int val;
@@ -748,6 +773,11 @@ static int mv88e61xx_set_cpu_port(struct phy_device *phydev)
if (val < 0)
return val;
}
+ } else {
+ val = mv88e61xx_fixed_port_setup(phydev,
+ CONFIG_MV88E61XX_CPU_PORT);
+ if (val < 0)
+ return val;
}
return 0;
@@ -810,27 +840,6 @@ static int mv88e61xx_phy_setup(struct phy_device *phydev, u8 phy)
return 0;
}
-static int mv88e61xx_fixed_port_setup(struct phy_device *phydev, u8 port)
-{
- int val;
-
- val = mv88e61xx_port_read(phydev, port, PORT_REG_PHYS_CTRL);
- if (val < 0)
- return val;
-
- val &= ~(PORT_REG_PHYS_CTRL_SPD_MASK |
- PORT_REG_PHYS_CTRL_FC_VALUE);
- val |= PORT_REG_PHYS_CTRL_PCS_AN_EN |
- PORT_REG_PHYS_CTRL_PCS_AN_RST |
- PORT_REG_PHYS_CTRL_FC_FORCE |
- PORT_REG_PHYS_CTRL_DUPLEX_VALUE |
- PORT_REG_PHYS_CTRL_DUPLEX_FORCE |
- PORT_REG_PHYS_CTRL_SPD1000;
-
- return mv88e61xx_port_write(phydev, port, PORT_REG_PHYS_CTRL,
- val);
-}
-
static int mv88e61xx_phy_config_port(struct phy_device *phydev, u8 phy)
{
int val;