diff options
author | David S. Miller <davem@davemloft.net> | 2008-11-27 02:48:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-27 02:48:40 -0500 |
commit | 5b9ab2ec04ec1e1e53939768805612ac191d7ba2 (patch) | |
tree | 22d29905c148d2d743b3eccb585fbe60fb91e25a /drivers/net/phy | |
parent | 851fd7bd88524bb4e20f3def3127cd9167d6d0cf (diff) | |
parent | 3ec192559033ed457f0d7856838654c100fc659f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/hp-plus.c
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath9k/recv.c
net/wireless/reg.c
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy_device.c | 13 | ||||
-rw-r--r-- | drivers/net/phy/vitesse.c | 64 |
2 files changed, 66 insertions, 11 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b344a0b55dbf..29546a206045 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -227,8 +227,17 @@ struct phy_device * get_phy_device(struct mii_bus *bus, int addr) | |||
227 | if (r) | 227 | if (r) |
228 | return ERR_PTR(r); | 228 | return ERR_PTR(r); |
229 | 229 | ||
230 | /* If the phy_id is all Fs or all 0s, there is no device there */ | 230 | /* If the phy_id is mostly Fs, there is no device there */ |
231 | if ((0xffff == phy_id) || (0x00 == phy_id)) | 231 | if ((phy_id & 0x1fffffff) == 0x1fffffff) |
232 | return NULL; | ||
233 | |||
234 | /* | ||
235 | * Broken hardware is sometimes missing the pull down resistor on the | ||
236 | * MDIO line, which results in reads to non-existent devices returning | ||
237 | * 0 rather than 0xffff. Catch this here and treat 0 as a non-existent | ||
238 | * device as well. | ||
239 | */ | ||
240 | if (phy_id == 0) | ||
232 | return NULL; | 241 | return NULL; |
233 | 242 | ||
234 | dev = phy_device_create(bus, addr, phy_id); | 243 | dev = phy_device_create(bus, addr, phy_id); |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 8874497b6bbf..dd3b2447e85a 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #define MII_VSC8244_IMASK_DUPLEX 0x1000 | 34 | #define MII_VSC8244_IMASK_DUPLEX 0x1000 |
35 | #define MII_VSC8244_IMASK_MASK 0xf000 | 35 | #define MII_VSC8244_IMASK_MASK 0xf000 |
36 | 36 | ||
37 | #define MII_VSC8221_IMASK_MASK 0xa000 | ||
38 | |||
37 | /* Vitesse Interrupt Status Register */ | 39 | /* Vitesse Interrupt Status Register */ |
38 | #define MII_VSC8244_ISTAT 0x1a | 40 | #define MII_VSC8244_ISTAT 0x1a |
39 | #define MII_VSC8244_ISTAT_STATUS 0x8000 | 41 | #define MII_VSC8244_ISTAT_STATUS 0x8000 |
@@ -49,6 +51,12 @@ | |||
49 | #define MII_VSC8244_AUXCONSTAT_GBIT 0x0010 | 51 | #define MII_VSC8244_AUXCONSTAT_GBIT 0x0010 |
50 | #define MII_VSC8244_AUXCONSTAT_100 0x0008 | 52 | #define MII_VSC8244_AUXCONSTAT_100 0x0008 |
51 | 53 | ||
54 | #define MII_VSC8221_AUXCONSTAT_INIT 0x0004 /* need to set this bit? */ | ||
55 | #define MII_VSC8221_AUXCONSTAT_RESERVED 0x0004 | ||
56 | |||
57 | #define PHY_ID_VSC8244 0x000fc6c0 | ||
58 | #define PHY_ID_VSC8221 0x000fc550 | ||
59 | |||
52 | MODULE_DESCRIPTION("Vitesse PHY driver"); | 60 | MODULE_DESCRIPTION("Vitesse PHY driver"); |
53 | MODULE_AUTHOR("Kriston Carson"); | 61 | MODULE_AUTHOR("Kriston Carson"); |
54 | MODULE_LICENSE("GPL"); | 62 | MODULE_LICENSE("GPL"); |
@@ -95,13 +103,15 @@ static int vsc824x_ack_interrupt(struct phy_device *phydev) | |||
95 | return (err < 0) ? err : 0; | 103 | return (err < 0) ? err : 0; |
96 | } | 104 | } |
97 | 105 | ||
98 | static int vsc824x_config_intr(struct phy_device *phydev) | 106 | static int vsc82xx_config_intr(struct phy_device *phydev) |
99 | { | 107 | { |
100 | int err; | 108 | int err; |
101 | 109 | ||
102 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) | 110 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) |
103 | err = phy_write(phydev, MII_VSC8244_IMASK, | 111 | err = phy_write(phydev, MII_VSC8244_IMASK, |
104 | MII_VSC8244_IMASK_MASK); | 112 | phydev->drv->phy_id == PHY_ID_VSC8244 ? |
113 | MII_VSC8244_IMASK_MASK : | ||
114 | MII_VSC8221_IMASK_MASK); | ||
105 | else { | 115 | else { |
106 | /* | 116 | /* |
107 | * The Vitesse PHY cannot clear the interrupt | 117 | * The Vitesse PHY cannot clear the interrupt |
@@ -120,7 +130,7 @@ static int vsc824x_config_intr(struct phy_device *phydev) | |||
120 | 130 | ||
121 | /* Vitesse 824x */ | 131 | /* Vitesse 824x */ |
122 | static struct phy_driver vsc8244_driver = { | 132 | static struct phy_driver vsc8244_driver = { |
123 | .phy_id = 0x000fc6c0, | 133 | .phy_id = PHY_ID_VSC8244, |
124 | .name = "Vitesse VSC8244", | 134 | .name = "Vitesse VSC8244", |
125 | .phy_id_mask = 0x000fffc0, | 135 | .phy_id_mask = 0x000fffc0, |
126 | .features = PHY_GBIT_FEATURES, | 136 | .features = PHY_GBIT_FEATURES, |
@@ -129,19 +139,55 @@ static struct phy_driver vsc8244_driver = { | |||
129 | .config_aneg = &genphy_config_aneg, | 139 | .config_aneg = &genphy_config_aneg, |
130 | .read_status = &genphy_read_status, | 140 | .read_status = &genphy_read_status, |
131 | .ack_interrupt = &vsc824x_ack_interrupt, | 141 | .ack_interrupt = &vsc824x_ack_interrupt, |
132 | .config_intr = &vsc824x_config_intr, | 142 | .config_intr = &vsc82xx_config_intr, |
133 | .driver = { .owner = THIS_MODULE,}, | 143 | .driver = { .owner = THIS_MODULE,}, |
134 | }; | 144 | }; |
135 | 145 | ||
136 | static int __init vsc8244_init(void) | 146 | static int vsc8221_config_init(struct phy_device *phydev) |
137 | { | 147 | { |
138 | return phy_driver_register(&vsc8244_driver); | 148 | int err; |
149 | |||
150 | err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT, | ||
151 | MII_VSC8221_AUXCONSTAT_INIT); | ||
152 | return err; | ||
153 | |||
154 | /* Perhaps we should set EXT_CON1 based on the interface? | ||
155 | Options are 802.3Z SerDes or SGMII */ | ||
156 | } | ||
157 | |||
158 | /* Vitesse 8221 */ | ||
159 | static struct phy_driver vsc8221_driver = { | ||
160 | .phy_id = PHY_ID_VSC8221, | ||
161 | .phy_id_mask = 0x000ffff0, | ||
162 | .name = "Vitesse VSC8221", | ||
163 | .features = PHY_GBIT_FEATURES, | ||
164 | .flags = PHY_HAS_INTERRUPT, | ||
165 | .config_init = &vsc8221_config_init, | ||
166 | .config_aneg = &genphy_config_aneg, | ||
167 | .read_status = &genphy_read_status, | ||
168 | .ack_interrupt = &vsc824x_ack_interrupt, | ||
169 | .config_intr = &vsc82xx_config_intr, | ||
170 | .driver = { .owner = THIS_MODULE,}, | ||
171 | }; | ||
172 | |||
173 | static int __init vsc82xx_init(void) | ||
174 | { | ||
175 | int err; | ||
176 | |||
177 | err = phy_driver_register(&vsc8244_driver); | ||
178 | if (err < 0) | ||
179 | return err; | ||
180 | err = phy_driver_register(&vsc8221_driver); | ||
181 | if (err < 0) | ||
182 | phy_driver_unregister(&vsc8244_driver); | ||
183 | return err; | ||
139 | } | 184 | } |
140 | 185 | ||
141 | static void __exit vsc8244_exit(void) | 186 | static void __exit vsc82xx_exit(void) |
142 | { | 187 | { |
143 | phy_driver_unregister(&vsc8244_driver); | 188 | phy_driver_unregister(&vsc8244_driver); |
189 | phy_driver_unregister(&vsc8221_driver); | ||
144 | } | 190 | } |
145 | 191 | ||
146 | module_init(vsc8244_init); | 192 | module_init(vsc82xx_init); |
147 | module_exit(vsc8244_exit); | 193 | module_exit(vsc82xx_exit); |