diff options
author | Johnson Leung <r58129@freescale.com> | 2008-02-03 06:50:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-03 07:28:42 -0500 |
commit | 097c2aa89f22f55db19fd0f72aede460bcb61f29 (patch) | |
tree | a2746aacc233c2cd79f111cecf11f4c8a5a5ae16 /drivers/net | |
parent | 6344f0521aac9f93c312826216762f2185268390 (diff) |
phylib: Add Realtek 821x eth PHY support
this PHY present on the MPC8315E and MPC837xE RDB boards.
Signed-off-by: Johnson Leung <r58129@freescale.com>
Signed-off-by: Kevin Lam <r43770@freescale.com>
Signed-off-by: Joe D'Abbraccio <ljd015@freescale.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/Kconfig | 5 | ||||
-rw-r--r-- | drivers/net/phy/Makefile | 1 | ||||
-rw-r--r-- | drivers/net/phy/realtek.c | 80 |
3 files changed, 86 insertions, 0 deletions
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 7fe03ce774b1..f4ca0591231d 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -60,6 +60,11 @@ config ICPLUS_PHY | |||
60 | ---help--- | 60 | ---help--- |
61 | Currently supports the IP175C PHY. | 61 | Currently supports the IP175C PHY. |
62 | 62 | ||
63 | config REALTEK_PHY | ||
64 | tristate "Drivers for Realtek PHYs" | ||
65 | ---help--- | ||
66 | Supports the Realtek 821x PHY. | ||
67 | |||
63 | config FIXED_PHY | 68 | config FIXED_PHY |
64 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" | 69 | bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs" |
65 | ---help--- | 70 | ---help--- |
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index 3d6cc7b67a80..5997d6ef702b 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile | |||
@@ -12,5 +12,6 @@ obj-$(CONFIG_SMSC_PHY) += smsc.o | |||
12 | obj-$(CONFIG_VITESSE_PHY) += vitesse.o | 12 | obj-$(CONFIG_VITESSE_PHY) += vitesse.o |
13 | obj-$(CONFIG_BROADCOM_PHY) += broadcom.o | 13 | obj-$(CONFIG_BROADCOM_PHY) += broadcom.o |
14 | obj-$(CONFIG_ICPLUS_PHY) += icplus.o | 14 | obj-$(CONFIG_ICPLUS_PHY) += icplus.o |
15 | obj-$(CONFIG_REALTEK_PHY) += realtek.o | ||
15 | obj-$(CONFIG_FIXED_PHY) += fixed.o | 16 | obj-$(CONFIG_FIXED_PHY) += fixed.o |
16 | obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o | 17 | obj-$(CONFIG_MDIO_BITBANG) += mdio-bitbang.o |
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c new file mode 100644 index 000000000000..a052a6744a51 --- /dev/null +++ b/drivers/net/phy/realtek.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * drivers/net/phy/realtek.c | ||
3 | * | ||
4 | * Driver for Realtek PHYs | ||
5 | * | ||
6 | * Author: Johnson Leung <r58129@freescale.com> | ||
7 | * | ||
8 | * Copyright (c) 2004 Freescale Semiconductor, 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 | */ | ||
16 | #include <linux/phy.h> | ||
17 | |||
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 | ||
24 | |||
25 | MODULE_DESCRIPTION("Realtek PHY driver"); | ||
26 | MODULE_AUTHOR("Johnson Leung"); | ||
27 | MODULE_LICENSE("GPL"); | ||
28 | |||
29 | static int rtl821x_ack_interrupt(struct phy_device *phydev) | ||
30 | { | ||
31 | int err; | ||
32 | |||
33 | err = phy_read(phydev, RTL821x_INSR); | ||
34 | |||
35 | return (err < 0) ? err : 0; | ||
36 | } | ||
37 | |||
38 | static int rtl821x_config_intr(struct phy_device *phydev) | ||
39 | { | ||
40 | int err; | ||
41 | |||
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); | ||
47 | |||
48 | return err; | ||
49 | } | ||
50 | |||
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,}, | ||
63 | }; | ||
64 | |||
65 | static int __init realtek_init(void) | ||
66 | { | ||
67 | int ret; | ||
68 | |||
69 | ret = phy_driver_register(&rtl821x_driver); | ||
70 | |||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | static void __exit realtek_exit(void) | ||
75 | { | ||
76 | phy_driver_unregister(&rtl821x_driver); | ||
77 | } | ||
78 | |||
79 | module_init(realtek_init); | ||
80 | module_exit(realtek_exit); | ||