]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
net: phy: micrel: add support for KSZ886x switches in MIIM mode
authorAlexey Firago <alexey_firago@mentor.com>
Thu, 26 May 2016 13:28:44 +0000 (16:28 +0300)
committerJoe Hershberger <joe.hershberger@ni.com>
Tue, 21 Jun 2016 22:01:52 +0000 (17:01 -0500)
This patch adds a phy driver for the Micrel KSZ886x switches.

Similarly to the KSZ8895, SoC MAC is directly connected to the switch
MAC on the switch CPU port, so the link to the switch is always up.

KSZ886x switches can be used in the following configuration modes:
- Unmanaged mode with config stored in external EEPROM
- Managed mode over SPI
- Managed mode over I2C
- Managed mode over mdio/mdc (aka MIIM or SMI)

This patch supports only unmanaged and MIIM modes.

Based on Micrel KSZ886x driver from Linux kernel and
Micrel KSZ8895 driver from U-Boot.

Verified with the KSZ8863MLL.

Signed-off-by: Alexey Firago <alexey_firago@mentor.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/phy/micrel.c

index b08788a2b0516dfd3517b5f08b6a2e0714a21c9c..6b313a9fd3244662ae8218b12276d970341ae98b 100644 (file)
@@ -487,6 +487,31 @@ static struct phy_driver ksz9031_driver = {
        .readext = &ksz9031_phy_extread,
 };
 
+int ksz886x_config(struct phy_device *phydev)
+{
+       /* we are connected directly to the switch without
+        * dedicated PHY. */
+       phydev->link = 1;
+       phydev->duplex = DUPLEX_FULL;
+       phydev->speed = SPEED_100;
+       return 0;
+}
+
+static int ksz886x_startup(struct phy_device *phydev)
+{
+       return 0;
+}
+
+static struct phy_driver ksz886x_driver = {
+       .name = "Micrel KSZ886x Switch",
+       .uid  = 0x00221430,
+       .mask = 0xfffff0,
+       .features = PHY_BASIC_FEATURES,
+       .config = &ksz886x_config,
+       .startup = &ksz886x_startup,
+       .shutdown = &genphy_shutdown,
+};
+
 int phy_micrel_init(void)
 {
        phy_register(&KSZ804_driver);
@@ -500,5 +525,6 @@ int phy_micrel_init(void)
 #endif
        phy_register(&ksz9031_driver);
        phy_register(&ksz8895_driver);
+       phy_register(&ksz886x_driver);
        return 0;
 }