]> git.sur5r.net Git - u-boot/commitdiff
net: phy/vitesse: Add support for VSC8664 phy module
authorChunhe Lan <Chunhe.Lan@freescale.com>
Wed, 16 Apr 2014 08:40:52 +0000 (16:40 +0800)
committerYork Sun <yorksun@freescale.com>
Fri, 16 May 2014 21:24:05 +0000 (16:24 -0500)
This patch adds support for VSC8664 PHY module which can
be found on Freescale's T4240RDB boards.

Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
drivers/net/phy/vitesse.c

index 3a55d271a532f9c95756c377b5d8f252264dd0fe..c58fe50b7206e8d6fd5e78e9dfaf8f510306d85f 100644 (file)
 #define MIIM_VSC8514_18G_QSGMII                0x80e0
 #define MIIM_VSC8514_18G_CMDSTAT       0x8000
 
+/* Vitesse VSC8664 Control/Status Register */
+#define MIIM_VSC8664_SERDES_AND_SIGDET 0x13
+#define MIIM_VSC8664_ADDITIONAL_DEV    0x16
+#define MIIM_VSC8664_EPHY_CON          0x17
+#define MIIM_VSC8664_LED_CON           0x1E
+
+#define PHY_EXT_PAGE_ACCESS_EXTENDED   0x0001
+
 /* CIS8201 */
 static int vitesse_config(struct phy_device *phydev)
 {
@@ -244,6 +252,33 @@ static int vsc8514_config(struct phy_device *phydev)
        return 0;
 }
 
+static int vsc8664_config(struct phy_device *phydev)
+{
+       u32 val;
+
+       /* Enable MAC interface auto-negotiation */
+       phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS, 0);
+       val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8664_EPHY_CON);
+       val |= (1 << 13);
+       phy_write(phydev, MDIO_DEVAD_NONE, MIIM_VSC8664_EPHY_CON, val);
+
+       phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS,
+                 PHY_EXT_PAGE_ACCESS_EXTENDED);
+       val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8664_SERDES_AND_SIGDET);
+       val |= (1 << 11);
+       phy_write(phydev, MDIO_DEVAD_NONE, MIIM_VSC8664_SERDES_AND_SIGDET, val);
+       phy_write(phydev, MDIO_DEVAD_NONE, PHY_EXT_PAGE_ACCESS, 0);
+
+       /* Enable LED blink */
+       val = phy_read(phydev, MDIO_DEVAD_NONE, MIIM_VSC8664_LED_CON);
+       val &= ~(1 << 2);
+       phy_write(phydev, MDIO_DEVAD_NONE, MIIM_VSC8664_LED_CON, val);
+
+       genphy_config_aneg(phydev);
+
+       return 0;
+}
+
 static struct phy_driver VSC8211_driver = {
        .name   = "Vitesse VSC8211",
        .uid    = 0xfc4b0,
@@ -334,6 +369,16 @@ static struct phy_driver VSC8662_driver = {
        .shutdown = &genphy_shutdown,
 };
 
+static struct phy_driver VSC8664_driver = {
+       .name = "Vitesse VSC8664",
+       .uid = 0x70660,
+       .mask = 0xffff0,
+       .features = PHY_GBIT_FEATURES,
+       .config = &vsc8664_config,
+       .startup = &vitesse_startup,
+       .shutdown = &genphy_shutdown,
+};
+
 /* Vitesse bought Cicada, so we'll put these here */
 static struct phy_driver cis8201_driver = {
        .name = "CIS8201",
@@ -366,6 +411,7 @@ int phy_vitesse_init(void)
        phy_register(&VSC8574_driver);
        phy_register(&VSC8514_driver);
        phy_register(&VSC8662_driver);
+       phy_register(&VSC8664_driver);
        phy_register(&cis8201_driver);
        phy_register(&cis8204_driver);