| 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 | |
| 29 | MODULE_DESCRIPTION("Moschip MCS814x PHY driver"); |
| 30 | MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); |
| 31 | MODULE_LICENSE("GPL"); |
| 32 | |
| 33 | /* Nothing special about this PHY but its OUI (O) */ |
| 34 | static struct phy_driver mcs8140_driver = { |
| 35 | .phy_id = 0, |
| 36 | .name = "Moschip MCS8140", |
| 37 | .phy_id_mask = 0x02, |
| 38 | .features = PHY_BASIC_FEATURES, |
| 39 | .config_aneg = &genphy_config_aneg, |
| 40 | .read_status = &genphy_read_status, |
| 41 | .suspend = genphy_suspend, |
| 42 | .resume = genphy_resume, |
| 43 | .driver = { .owner = THIS_MODULE,}, |
| 44 | }; |
| 45 | |
| 46 | static int __init mcs814x_phy_init(void) |
| 47 | { |
| 48 | return phy_driver_register(&mcs8140_driver); |
| 49 | } |
| 50 | |
| 51 | static void __exit mcs814x_phy_exit(void) |
| 52 | { |
| 53 | phy_driver_unregister(&mcs8140_driver); |
| 54 | } |
| 55 | |
| 56 | module_init(mcs814x_phy_init); |
| 57 | module_exit(mcs814x_phy_exit); |
| 58 | |
| 59 | static struct mdio_device_id __maybe_unused mcs814x_phy_tbl[] = { |
| 60 | { 0x0, 0x0ffffff0 }, |
| 61 | { } |
| 62 | }; |
| 63 | |
| 64 | MODULE_DEVICE_TABLE(mdio, mcs814x_phy_tbl); |
| 65 | |