staging: hv: add newline to log messages in netvsc
[linux/fpc-iii.git] / drivers / net / phy / realtek.c
bloba4eae750a4145084b0cf45e90b875f1eb2c019c3
1 /*
2 * drivers/net/phy/realtek.c
4 * Driver for Realtek PHYs
6 * Author: Johnson Leung <r58129@freescale.com>
8 * Copyright (c) 2004 Freescale Semiconductor, Inc.
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.
16 #include <linux/phy.h>
18 #define RTL821x_PHYSR 0x11
19 #define RTL821x_PHYSR_DUPLEX 0x2000
20 #define RTL821x_PHYSR_SPEED 0xc000
21 #define RTL821x_INER 0x12
22 #define RTL821x_INER_INIT 0x6400
23 #define RTL821x_INSR 0x13
25 MODULE_DESCRIPTION("Realtek PHY driver");
26 MODULE_AUTHOR("Johnson Leung");
27 MODULE_LICENSE("GPL");
29 static int rtl821x_ack_interrupt(struct phy_device *phydev)
31 int err;
33 err = phy_read(phydev, RTL821x_INSR);
35 return (err < 0) ? err : 0;
38 static int rtl821x_config_intr(struct phy_device *phydev)
40 int err;
42 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
43 err = phy_write(phydev, RTL821x_INER,
44 RTL821x_INER_INIT);
45 else
46 err = phy_write(phydev, RTL821x_INER, 0);
48 return err;
51 /* RTL8211B */
52 static struct phy_driver rtl821x_driver = {
53 .phy_id = 0x001cc912,
54 .name = "RTL821x Gigabit Ethernet",
55 .phy_id_mask = 0x001fffff,
56 .features = PHY_GBIT_FEATURES,
57 .flags = PHY_HAS_INTERRUPT,
58 .config_aneg = &genphy_config_aneg,
59 .read_status = &genphy_read_status,
60 .ack_interrupt = &rtl821x_ack_interrupt,
61 .config_intr = &rtl821x_config_intr,
62 .driver = { .owner = THIS_MODULE,},
65 static int __init realtek_init(void)
67 int ret;
69 ret = phy_driver_register(&rtl821x_driver);
71 return ret;
74 static void __exit realtek_exit(void)
76 phy_driver_unregister(&rtl821x_driver);
79 module_init(realtek_init);
80 module_exit(realtek_exit);
82 static struct mdio_device_id __maybe_unused realtek_tbl[] = {
83 { 0x001cc912, 0x001fffff },
84 { }
87 MODULE_DEVICE_TABLE(mdio, realtek_tbl);