mcs814x.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Driver for Moschip MCS814x internal PHY
  3. *
  4. * Copyright (c) 2012 Florian Fainelli <florian@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. *
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/string.h>
  14. #include <linux/errno.h>
  15. #include <linux/unistd.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/init.h>
  18. #include <linux/delay.h>
  19. #include <linux/netdevice.h>
  20. #include <linux/etherdevice.h>
  21. #include <linux/skbuff.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/mm.h>
  24. #include <linux/module.h>
  25. #include <linux/mii.h>
  26. #include <linux/ethtool.h>
  27. #include <linux/phy.h>
  28. MODULE_DESCRIPTION("Moschip MCS814x PHY driver");
  29. MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
  30. MODULE_LICENSE("GPL");
  31. /* Nothing special about this PHY but its OUI (O) */
  32. static struct phy_driver mcs8140_driver = {
  33. .phy_id = 0,
  34. .name = "Moschip MCS8140",
  35. .phy_id_mask = 0x02,
  36. .features = PHY_BASIC_FEATURES,
  37. .config_aneg = &genphy_config_aneg,
  38. .read_status = &genphy_read_status,
  39. .suspend = genphy_suspend,
  40. .resume = genphy_resume,
  41. .driver = { .owner = THIS_MODULE,},
  42. };
  43. static int __init mcs814x_phy_init(void)
  44. {
  45. return phy_driver_register(&mcs8140_driver);
  46. }
  47. static void __exit mcs814x_phy_exit(void)
  48. {
  49. phy_driver_unregister(&mcs8140_driver);
  50. }
  51. module_init(mcs814x_phy_init);
  52. module_exit(mcs814x_phy_exit);
  53. static struct mdio_device_id __maybe_unused mcs814x_phy_tbl[] = {
  54. { 0x0, 0x0ffffff0 },
  55. { }
  56. };
  57. MODULE_DEVICE_TABLE(mdio, mcs814x_phy_tbl);