diff options
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r-- | drivers/net/phy/marvell.c | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 22aec5cce683..b87f8d2a888b 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -54,6 +54,12 @@ | |||
54 | #define MII_M1111_PHY_LED_CONTROL 0x18 | 54 | #define MII_M1111_PHY_LED_CONTROL 0x18 |
55 | #define MII_M1111_PHY_LED_DIRECT 0x4100 | 55 | #define MII_M1111_PHY_LED_DIRECT 0x4100 |
56 | #define MII_M1111_PHY_LED_COMBINE 0x411c | 56 | #define MII_M1111_PHY_LED_COMBINE 0x411c |
57 | #define MII_M1111_PHY_EXT_CR 0x14 | ||
58 | #define MII_M1111_RX_DELAY 0x80 | ||
59 | #define MII_M1111_TX_DELAY 0x2 | ||
60 | #define MII_M1111_PHY_EXT_SR 0x1b | ||
61 | #define MII_M1111_HWCFG_MODE_MASK 0xf | ||
62 | #define MII_M1111_HWCFG_MODE_RGMII 0xb | ||
57 | 63 | ||
58 | MODULE_DESCRIPTION("Marvell PHY driver"); | 64 | MODULE_DESCRIPTION("Marvell PHY driver"); |
59 | MODULE_AUTHOR("Andy Fleming"); | 65 | MODULE_AUTHOR("Andy Fleming"); |
@@ -131,6 +137,45 @@ static int marvell_config_aneg(struct phy_device *phydev) | |||
131 | return err; | 137 | return err; |
132 | } | 138 | } |
133 | 139 | ||
140 | static int m88e1111_config_init(struct phy_device *phydev) | ||
141 | { | ||
142 | int err; | ||
143 | |||
144 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || | ||
145 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) { | ||
146 | int temp; | ||
147 | |||
148 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { | ||
149 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); | ||
150 | if (temp < 0) | ||
151 | return temp; | ||
152 | |||
153 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); | ||
154 | |||
155 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | ||
156 | if (err < 0) | ||
157 | return err; | ||
158 | } | ||
159 | |||
160 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | ||
161 | if (temp < 0) | ||
162 | return temp; | ||
163 | |||
164 | temp &= ~(MII_M1111_HWCFG_MODE_MASK); | ||
165 | temp |= MII_M1111_HWCFG_MODE_RGMII; | ||
166 | |||
167 | err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | ||
168 | if (err < 0) | ||
169 | return err; | ||
170 | } | ||
171 | |||
172 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
173 | if (err < 0) | ||
174 | return err; | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
134 | static int m88e1145_config_init(struct phy_device *phydev) | 179 | static int m88e1145_config_init(struct phy_device *phydev) |
135 | { | 180 | { |
136 | int err; | 181 | int err; |
@@ -152,7 +197,7 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
152 | if (err < 0) | 197 | if (err < 0) |
153 | return err; | 198 | return err; |
154 | 199 | ||
155 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { | 200 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) { |
156 | int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); | 201 | int temp = phy_read(phydev, MII_M1145_PHY_EXT_CR); |
157 | if (temp < 0) | 202 | if (temp < 0) |
158 | return temp; | 203 | return temp; |
@@ -206,7 +251,7 @@ static struct phy_driver m88e1101_driver = { | |||
206 | .driver = {.owner = THIS_MODULE,}, | 251 | .driver = {.owner = THIS_MODULE,}, |
207 | }; | 252 | }; |
208 | 253 | ||
209 | static struct phy_driver m88e1111s_driver = { | 254 | static struct phy_driver m88e1111_driver = { |
210 | .phy_id = 0x01410cc0, | 255 | .phy_id = 0x01410cc0, |
211 | .phy_id_mask = 0xfffffff0, | 256 | .phy_id_mask = 0xfffffff0, |
212 | .name = "Marvell 88E1111", | 257 | .name = "Marvell 88E1111", |
@@ -216,6 +261,7 @@ static struct phy_driver m88e1111s_driver = { | |||
216 | .read_status = &genphy_read_status, | 261 | .read_status = &genphy_read_status, |
217 | .ack_interrupt = &marvell_ack_interrupt, | 262 | .ack_interrupt = &marvell_ack_interrupt, |
218 | .config_intr = &marvell_config_intr, | 263 | .config_intr = &marvell_config_intr, |
264 | .config_init = &m88e1111_config_init, | ||
219 | .driver = {.owner = THIS_MODULE,}, | 265 | .driver = {.owner = THIS_MODULE,}, |
220 | }; | 266 | }; |
221 | 267 | ||
@@ -241,9 +287,9 @@ static int __init marvell_init(void) | |||
241 | if (ret) | 287 | if (ret) |
242 | return ret; | 288 | return ret; |
243 | 289 | ||
244 | ret = phy_driver_register(&m88e1111s_driver); | 290 | ret = phy_driver_register(&m88e1111_driver); |
245 | if (ret) | 291 | if (ret) |
246 | goto err1111s; | 292 | goto err1111; |
247 | 293 | ||
248 | ret = phy_driver_register(&m88e1145_driver); | 294 | ret = phy_driver_register(&m88e1145_driver); |
249 | if (ret) | 295 | if (ret) |
@@ -251,9 +297,9 @@ static int __init marvell_init(void) | |||
251 | 297 | ||
252 | return 0; | 298 | return 0; |
253 | 299 | ||
254 | err1145: | 300 | err1145: |
255 | phy_driver_unregister(&m88e1111s_driver); | 301 | phy_driver_unregister(&m88e1111_driver); |
256 | err1111s: | 302 | err1111: |
257 | phy_driver_unregister(&m88e1101_driver); | 303 | phy_driver_unregister(&m88e1101_driver); |
258 | return ret; | 304 | return ret; |
259 | } | 305 | } |
@@ -261,7 +307,7 @@ static int __init marvell_init(void) | |||
261 | static void __exit marvell_exit(void) | 307 | static void __exit marvell_exit(void) |
262 | { | 308 | { |
263 | phy_driver_unregister(&m88e1101_driver); | 309 | phy_driver_unregister(&m88e1101_driver); |
264 | phy_driver_unregister(&m88e1111s_driver); | 310 | phy_driver_unregister(&m88e1111_driver); |
265 | phy_driver_unregister(&m88e1145_driver); | 311 | phy_driver_unregister(&m88e1145_driver); |
266 | } | 312 | } |
267 | 313 | ||