aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/chelsio/mv88x201x.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-04-29 04:06:34 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-29 20:32:31 -0400
commit23c3320cb039debfb94b27e8e9bfe26dd47692c3 (patch)
treebfb9253e7a6bc4472050db8e9241ad85a99283ab /drivers/net/chelsio/mv88x201x.c
parent68e7f45e118f98b77cfa007aa2d97b5dac69fe6b (diff)
chelsio: Use generic MDIO definitions and mdio_mii_ioctl()
Compile-tested only. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/chelsio/mv88x201x.c')
-rw-r--r--drivers/net/chelsio/mv88x201x.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/net/chelsio/mv88x201x.c b/drivers/net/chelsio/mv88x201x.c
index cd856041af34..29e0cba48d53 100644
--- a/drivers/net/chelsio/mv88x201x.c
+++ b/drivers/net/chelsio/mv88x201x.c
@@ -53,7 +53,7 @@ static int led_init(struct cphy *cphy)
53 * Writing these bits maps control to another 53 * Writing these bits maps control to another
54 * register. mmd(0x1) addr(0x7) 54 * register. mmd(0x1) addr(0x7)
55 */ 55 */
56 mdio_write(cphy, 0x3, 0x8304, 0xdddd); 56 cphy_mdio_write(cphy, MDIO_MMD_PCS, 0x8304, 0xdddd);
57 return 0; 57 return 0;
58} 58}
59 59
@@ -62,14 +62,14 @@ static int led_link(struct cphy *cphy, u32 do_enable)
62 u32 led = 0; 62 u32 led = 0;
63#define LINK_ENABLE_BIT 0x1 63#define LINK_ENABLE_BIT 0x1
64 64
65 mdio_read(cphy, 0x1, 0x7, &led); 65 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_CTRL2, &led);
66 66
67 if (do_enable & LINK_ENABLE_BIT) { 67 if (do_enable & LINK_ENABLE_BIT) {
68 led |= LINK_ENABLE_BIT; 68 led |= LINK_ENABLE_BIT;
69 mdio_write(cphy, 0x1, 0x7, led); 69 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, MDIO_CTRL2, led);
70 } else { 70 } else {
71 led &= ~LINK_ENABLE_BIT; 71 led &= ~LINK_ENABLE_BIT;
72 mdio_write(cphy, 0x1, 0x7, led); 72 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, MDIO_CTRL2, led);
73 } 73 }
74 return 0; 74 return 0;
75} 75}
@@ -86,7 +86,7 @@ static int mv88x201x_reset(struct cphy *cphy, int wait)
86static int mv88x201x_interrupt_enable(struct cphy *cphy) 86static int mv88x201x_interrupt_enable(struct cphy *cphy)
87{ 87{
88 /* Enable PHY LASI interrupts. */ 88 /* Enable PHY LASI interrupts. */
89 mdio_write(cphy, 0x1, 0x9002, 0x1); 89 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, 0x9002, 0x1);
90 90
91 /* Enable Marvell interrupts through Elmer0. */ 91 /* Enable Marvell interrupts through Elmer0. */
92 if (t1_is_asic(cphy->adapter)) { 92 if (t1_is_asic(cphy->adapter)) {
@@ -102,7 +102,7 @@ static int mv88x201x_interrupt_enable(struct cphy *cphy)
102static int mv88x201x_interrupt_disable(struct cphy *cphy) 102static int mv88x201x_interrupt_disable(struct cphy *cphy)
103{ 103{
104 /* Disable PHY LASI interrupts. */ 104 /* Disable PHY LASI interrupts. */
105 mdio_write(cphy, 0x1, 0x9002, 0x0); 105 cphy_mdio_write(cphy, MDIO_MMD_PMAPMD, 0x9002, 0x0);
106 106
107 /* Disable Marvell interrupts through Elmer0. */ 107 /* Disable Marvell interrupts through Elmer0. */
108 if (t1_is_asic(cphy->adapter)) { 108 if (t1_is_asic(cphy->adapter)) {
@@ -122,25 +122,25 @@ static int mv88x201x_interrupt_clear(struct cphy *cphy)
122 122
123#ifdef MV88x2010_LINK_STATUS_BUGS 123#ifdef MV88x2010_LINK_STATUS_BUGS
124 /* Required to read twice before clear takes affect. */ 124 /* Required to read twice before clear takes affect. */
125 mdio_read(cphy, 0x1, 0x9003, &val); 125 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, 0x9003, &val);
126 mdio_read(cphy, 0x1, 0x9004, &val); 126 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, 0x9004, &val);
127 mdio_read(cphy, 0x1, 0x9005, &val); 127 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, 0x9005, &val);
128 128
129 /* Read this register after the others above it else 129 /* Read this register after the others above it else
130 * the register doesn't clear correctly. 130 * the register doesn't clear correctly.
131 */ 131 */
132 mdio_read(cphy, 0x1, 0x1, &val); 132 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT1, &val);
133#endif 133#endif
134 134
135 /* Clear link status. */ 135 /* Clear link status. */
136 mdio_read(cphy, 0x1, 0x1, &val); 136 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT1, &val);
137 /* Clear PHY LASI interrupts. */ 137 /* Clear PHY LASI interrupts. */
138 mdio_read(cphy, 0x1, 0x9005, &val); 138 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, 0x9005, &val);
139 139
140#ifdef MV88x2010_LINK_STATUS_BUGS 140#ifdef MV88x2010_LINK_STATUS_BUGS
141 /* Do it again. */ 141 /* Do it again. */
142 mdio_read(cphy, 0x1, 0x9003, &val); 142 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, 0x9003, &val);
143 mdio_read(cphy, 0x1, 0x9004, &val); 143 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, 0x9004, &val);
144#endif 144#endif
145 145
146 /* Clear Marvell interrupts through Elmer0. */ 146 /* Clear Marvell interrupts through Elmer0. */
@@ -172,13 +172,12 @@ static int mv88x201x_get_link_status(struct cphy *cphy, int *link_ok,
172 int *speed, int *duplex, int *fc) 172 int *speed, int *duplex, int *fc)
173{ 173{
174 u32 val = 0; 174 u32 val = 0;
175#define LINK_STATUS_BIT 0x4
176 175
177 if (link_ok) { 176 if (link_ok) {
178 /* Read link status. */ 177 /* Read link status. */
179 mdio_read(cphy, 0x1, 0x1, &val); 178 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT1, &val);
180 val &= LINK_STATUS_BIT; 179 val &= MDIO_STAT1_LSTATUS;
181 *link_ok = (val == LINK_STATUS_BIT); 180 *link_ok = (val == MDIO_STAT1_LSTATUS);
182 /* Turn on/off Link LED */ 181 /* Turn on/off Link LED */
183 led_link(cphy, *link_ok); 182 led_link(cphy, *link_ok);
184 } 183 }
@@ -205,6 +204,8 @@ static struct cphy_ops mv88x201x_ops = {
205 .interrupt_handler = mv88x201x_interrupt_handler, 204 .interrupt_handler = mv88x201x_interrupt_handler,
206 .get_link_status = mv88x201x_get_link_status, 205 .get_link_status = mv88x201x_get_link_status,
207 .set_loopback = mv88x201x_set_loopback, 206 .set_loopback = mv88x201x_set_loopback,
207 .mmds = (MDIO_DEVS_PMAPMD | MDIO_DEVS_PCS |
208 MDIO_DEVS_PHYXS | MDIO_DEVS_WIS),
208}; 209};
209 210
210static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr, 211static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr,
@@ -219,12 +220,12 @@ static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr,
219 cphy_init(cphy, adapter, phy_addr, &mv88x201x_ops, mdio_ops); 220 cphy_init(cphy, adapter, phy_addr, &mv88x201x_ops, mdio_ops);
220 221
221 /* Commands the PHY to enable XFP's clock. */ 222 /* Commands the PHY to enable XFP's clock. */
222 mdio_read(cphy, 0x3, 0x8300, &val); 223 cphy_mdio_read(cphy, MDIO_MMD_PCS, 0x8300, &val);
223 mdio_write(cphy, 0x3, 0x8300, val | 1); 224 cphy_mdio_write(cphy, MDIO_MMD_PCS, 0x8300, val | 1);
224 225
225 /* Clear link status. Required because of a bug in the PHY. */ 226 /* Clear link status. Required because of a bug in the PHY. */
226 mdio_read(cphy, 0x1, 0x8, &val); 227 cphy_mdio_read(cphy, MDIO_MMD_PMAPMD, MDIO_STAT2, &val);
227 mdio_read(cphy, 0x3, 0x8, &val); 228 cphy_mdio_read(cphy, MDIO_MMD_PCS, MDIO_STAT2, &val);
228 229
229 /* Allows for Link,Ack LED turn on/off */ 230 /* Allows for Link,Ack LED turn on/off */
230 led_init(cphy); 231 led_init(cphy);