diff options
author | Andrei Andreyanau <a.andreyanau@sam-solutions.net> | 2013-04-01 14:34:54 +0300 |
---|---|---|
committer | Justin Waters <justin.waters@timesys.com> | 2013-11-07 12:19:26 -0500 |
commit | 8597992508dadd7998935a657681648d75892ade (patch) | |
tree | 1dcc3bed5d6cdff6d0e44e8acdcac6d644aa1f8e | |
parent | 0cb87312dbd2feb29e09e8dd0492bf7447f3aae3 (diff) |
Fixed support for Micrel's ksz9031 Gigabit phy modified: drivers/net/phy/micrel.c modified: include/linux/micrel_phy.h
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
-rw-r--r-- | drivers/net/phy/micrel.c | 45 | ||||
-rw-r--r-- | include/linux/micrel_phy.h | 1 |
2 files changed, 36 insertions, 10 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 80747d2d1118..5737bc57d02c 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -12,7 +12,7 @@ * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * - * Support : ksz9021 1000/100/10 phy from Micrel + * Support : ksz9021, ksz9031 1000/100/10 phy from Micrel * ks8001, ks8737, ks8721, ks8041, ks8051 100/10 phy */ @@ -38,7 +38,7 @@ #define MII_KSZPHY_CTRL 0x1F /* bitmap of PHY register to set interrupt mode */ #define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9) -#define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14) +#define KSZ90X1_CTRL_INT_ACTIVE_HIGH (1 << 14) #define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14) #define KSZ8051_RMII_50MHZ_CLK (1 << 7) @@ -72,13 +72,13 @@ static int kszphy_config_intr(struct phy_device *phydev) return rc < 0 ? rc : 0; } -static int ksz9021_config_intr(struct phy_device *phydev) +static int ksz90X1_config_intr(struct phy_device *phydev) { int temp, rc; /* set the interrupt pin active low */ temp = phy_read(phydev, MII_KSZPHY_CTRL); - temp &= ~KSZ9021_CTRL_INT_ACTIVE_HIGH; + temp &= ~KSZ90X1_CTRL_INT_ACTIVE_HIGH; phy_write(phydev, MII_KSZPHY_CTRL, temp); rc = kszphy_set_interrupt(phydev); return rc < 0 ? rc : 0; @@ -183,7 +183,22 @@ static struct phy_driver ksz9021_driver = { .config_aneg = genphy_config_aneg, .read_status = genphy_read_status, .ack_interrupt = kszphy_ack_interrupt, - .config_intr = ksz9021_config_intr, + .config_intr = ksz90X1_config_intr, + .driver = { .owner = THIS_MODULE, }, +}; + +static struct phy_driver ksz9031_driver = { + .phy_id = PHY_ID_KSZ9031, + .phy_id_mask = 0x00ffffff, + .name = "Micrel KSZ9031 Gigabit PHY", + .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause + | SUPPORTED_Asym_Pause), + .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, + .config_init = kszphy_config_init, + .config_aneg = genphy_config_aneg, + .read_status = genphy_read_status, + .ack_interrupt = kszphy_ack_interrupt, + .config_intr = ksz90X1_config_intr, .driver = { .owner = THIS_MODULE, }, }; @@ -199,22 +214,30 @@ static int __init ksphy_init(void) if (ret) goto err2; - ret = phy_driver_register(&ks8737_driver); + ret = phy_driver_register(&ksz9031_driver); if (ret) goto err3; - ret = phy_driver_register(&ks8041_driver); + + ret = phy_driver_register(&ks8737_driver); if (ret) goto err4; - ret = phy_driver_register(&ks8051_driver); + + ret = phy_driver_register(&ks8041_driver); if (ret) goto err5; + ret = phy_driver_register(&ks8051_driver); + if (ret) + goto err6; + return 0; -err5: +err6: phy_driver_unregister(&ks8041_driver); -err4: +err5: phy_driver_unregister(&ks8737_driver); +err4: + phy_driver_unregister(&ksz9031_driver); err3: phy_driver_unregister(&ksz9021_driver); err2: @@ -228,6 +251,7 @@ static void __exit ksphy_exit(void) phy_driver_unregister(&ks8001_driver); phy_driver_unregister(&ks8737_driver); phy_driver_unregister(&ksz9021_driver); + phy_driver_unregister(&ksz9031_driver); phy_driver_unregister(&ks8041_driver); phy_driver_unregister(&ks8051_driver); } @@ -241,6 +265,7 @@ MODULE_LICENSE("GPL"); static struct mdio_device_id __maybe_unused micrel_tbl[] = { { PHY_ID_KSZ9021, 0x00ffffff }, + { PHY_ID_KSZ9031, 0x00ffffff }, { PHY_ID_KS8001, 0x00ffffff }, { PHY_ID_KS8737, 0x00ffffff }, { PHY_ID_KS8041, 0x00ffffff }, diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 85ca0116eb4e..392b49d5b22d 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -4,6 +4,7 @@ #define MICREL_PHY_ID_MASK 0x00fffff0 #define PHY_ID_KSZ9021 0x00221611 +#define PHY_ID_KSZ9031 0x00221621 #define PHY_ID_KS8737 0x00221720 #define PHY_ID_KS8041 0x00221510 #define PHY_ID_KS8051 0x00221550 |