micrel.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * drivers/net/phy/micrel.c
  3. *
  4. * Driver for Micrel PHYs
  5. *
  6. * Author: David J. Choi
  7. *
  8. * Copyright (c) 2010 Micrel, Inc.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * Support : ksz9021 , vsc8201, ks8001
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/module.h>
  19. #include <linux/phy.h>
  20. #define PHY_ID_KSZ9021 0x00221611
  21. #define PHY_ID_VSC8201 0x000FC413
  22. #define PHY_ID_KS8001 0x0022161A
  23. static int kszphy_config_init(struct phy_device *phydev)
  24. {
  25. return 0;
  26. }
  27. static struct phy_driver ks8001_driver = {
  28. .phy_id = PHY_ID_KS8001,
  29. .name = "Micrel KS8001",
  30. .phy_id_mask = 0x00fffff0,
  31. .features = PHY_BASIC_FEATURES,
  32. .flags = PHY_POLL,
  33. .config_init = kszphy_config_init,
  34. .config_aneg = genphy_config_aneg,
  35. .read_status = genphy_read_status,
  36. .driver = { .owner = THIS_MODULE,},
  37. };
  38. static struct phy_driver vsc8201_driver = {
  39. .phy_id = PHY_ID_VSC8201,
  40. .name = "Micrel VSC8201",
  41. .phy_id_mask = 0x00fffff0,
  42. .features = PHY_BASIC_FEATURES,
  43. .flags = PHY_POLL,
  44. .config_init = kszphy_config_init,
  45. .config_aneg = genphy_config_aneg,
  46. .read_status = genphy_read_status,
  47. .driver = { .owner = THIS_MODULE,},
  48. };
  49. static struct phy_driver ksz9021_driver = {
  50. .phy_id = PHY_ID_KSZ9021,
  51. .phy_id_mask = 0x000fff10,
  52. .name = "Micrel KSZ9021 Gigabit PHY",
  53. .features = PHY_GBIT_FEATURES | SUPPORTED_Pause,
  54. .flags = PHY_POLL,
  55. .config_init = kszphy_config_init,
  56. .config_aneg = genphy_config_aneg,
  57. .read_status = genphy_read_status,
  58. .driver = { .owner = THIS_MODULE, },
  59. };
  60. static int __init ksphy_init(void)
  61. {
  62. int ret;
  63. ret = phy_driver_register(&ks8001_driver);
  64. if (ret)
  65. goto err1;
  66. ret = phy_driver_register(&vsc8201_driver);
  67. if (ret)
  68. goto err2;
  69. ret = phy_driver_register(&ksz9021_driver);
  70. if (ret)
  71. goto err3;
  72. return 0;
  73. err3:
  74. phy_driver_unregister(&vsc8201_driver);
  75. err2:
  76. phy_driver_unregister(&ks8001_driver);
  77. err1:
  78. return ret;
  79. }
  80. static void __exit ksphy_exit(void)
  81. {
  82. phy_driver_unregister(&ks8001_driver);
  83. phy_driver_unregister(&vsc8201_driver);
  84. phy_driver_unregister(&ksz9021_driver);
  85. }
  86. module_init(ksphy_init);
  87. module_exit(ksphy_exit);
  88. MODULE_DESCRIPTION("Micrel PHY driver");
  89. MODULE_AUTHOR("David J. Choi");
  90. MODULE_LICENSE("GPL");
  91. static struct mdio_device_id micrel_tbl[] = {
  92. { PHY_ID_KSZ9021, 0x000fff10 },
  93. { PHY_ID_VSC8201, 0x00fffff0 },
  94. { PHY_ID_KS8001, 0x00fffff0 },
  95. { }
  96. };
  97. MODULE_DEVICE_TABLE(mdio, micrel_tbl);