diff options
Diffstat (limited to 'drivers/net/chelsio/vsc8244.c')
-rw-r--r-- | drivers/net/chelsio/vsc8244.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/drivers/net/chelsio/vsc8244.c b/drivers/net/chelsio/vsc8244.c index f947cf6059b1..251d4859c91d 100644 --- a/drivers/net/chelsio/vsc8244.c +++ b/drivers/net/chelsio/vsc8244.c | |||
@@ -54,7 +54,7 @@ enum { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | #define CFG_CHG_INTR_MASK (VSC_INTR_LINK_CHG | VSC_INTR_NEG_ERR | \ | 56 | #define CFG_CHG_INTR_MASK (VSC_INTR_LINK_CHG | VSC_INTR_NEG_ERR | \ |
57 | VSC_INTR_NEG_DONE) | 57 | VSC_INTR_NEG_DONE) |
58 | #define INTR_MASK (CFG_CHG_INTR_MASK | VSC_INTR_TX_FIFO | VSC_INTR_RX_FIFO | \ | 58 | #define INTR_MASK (CFG_CHG_INTR_MASK | VSC_INTR_TX_FIFO | VSC_INTR_RX_FIFO | \ |
59 | VSC_INTR_ENABLE) | 59 | VSC_INTR_ENABLE) |
60 | 60 | ||
@@ -94,19 +94,18 @@ static int vsc8244_intr_enable(struct cphy *cphy) | |||
94 | { | 94 | { |
95 | simple_mdio_write(cphy, VSC8244_INTR_ENABLE, INTR_MASK); | 95 | simple_mdio_write(cphy, VSC8244_INTR_ENABLE, INTR_MASK); |
96 | 96 | ||
97 | /* Enable interrupts through Elmer */ | 97 | /* Enable interrupts through Elmer */ |
98 | if (t1_is_asic(cphy->adapter)) { | 98 | if (t1_is_asic(cphy->adapter)) { |
99 | u32 elmer; | 99 | u32 elmer; |
100 | 100 | ||
101 | t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer); | 101 | t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer); |
102 | elmer |= ELMER0_GP_BIT1; | 102 | elmer |= ELMER0_GP_BIT1; |
103 | if (is_T2(cphy->adapter)) { | 103 | if (is_T2(cphy->adapter)) |
104 | elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4; | 104 | elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4; |
105 | } | ||
106 | t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer); | 105 | t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer); |
107 | } | 106 | } |
108 | 107 | ||
109 | return 0; | 108 | return 0; |
110 | } | 109 | } |
111 | 110 | ||
112 | static int vsc8244_intr_disable(struct cphy *cphy) | 111 | static int vsc8244_intr_disable(struct cphy *cphy) |
@@ -118,19 +117,18 @@ static int vsc8244_intr_disable(struct cphy *cphy) | |||
118 | 117 | ||
119 | t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer); | 118 | t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer); |
120 | elmer &= ~ELMER0_GP_BIT1; | 119 | elmer &= ~ELMER0_GP_BIT1; |
121 | if (is_T2(cphy->adapter)) { | 120 | if (is_T2(cphy->adapter)) |
122 | elmer &= ~(ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4); | 121 | elmer &= ~(ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4); |
123 | } | ||
124 | t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer); | 122 | t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer); |
125 | } | 123 | } |
126 | 124 | ||
127 | return 0; | 125 | return 0; |
128 | } | 126 | } |
129 | 127 | ||
130 | static int vsc8244_intr_clear(struct cphy *cphy) | 128 | static int vsc8244_intr_clear(struct cphy *cphy) |
131 | { | 129 | { |
132 | u32 val; | 130 | u32 val; |
133 | u32 elmer; | 131 | u32 elmer; |
134 | 132 | ||
135 | /* Clear PHY interrupts by reading the register. */ | 133 | /* Clear PHY interrupts by reading the register. */ |
136 | simple_mdio_read(cphy, VSC8244_INTR_ENABLE, &val); | 134 | simple_mdio_read(cphy, VSC8244_INTR_ENABLE, &val); |
@@ -138,13 +136,12 @@ static int vsc8244_intr_clear(struct cphy *cphy) | |||
138 | if (t1_is_asic(cphy->adapter)) { | 136 | if (t1_is_asic(cphy->adapter)) { |
139 | t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer); | 137 | t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer); |
140 | elmer |= ELMER0_GP_BIT1; | 138 | elmer |= ELMER0_GP_BIT1; |
141 | if (is_T2(cphy->adapter)) { | 139 | if (is_T2(cphy->adapter)) |
142 | elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4; | 140 | elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4; |
143 | } | ||
144 | t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer); | 141 | t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer); |
145 | } | 142 | } |
146 | 143 | ||
147 | return 0; | 144 | return 0; |
148 | } | 145 | } |
149 | 146 | ||
150 | /* | 147 | /* |
@@ -179,13 +176,13 @@ static int vsc8244_set_speed_duplex(struct cphy *phy, int speed, int duplex) | |||
179 | 176 | ||
180 | int t1_mdio_set_bits(struct cphy *phy, int mmd, int reg, unsigned int bits) | 177 | int t1_mdio_set_bits(struct cphy *phy, int mmd, int reg, unsigned int bits) |
181 | { | 178 | { |
182 | int ret; | 179 | int ret; |
183 | unsigned int val; | 180 | unsigned int val; |
184 | 181 | ||
185 | ret = mdio_read(phy, mmd, reg, &val); | 182 | ret = mdio_read(phy, mmd, reg, &val); |
186 | if (!ret) | 183 | if (!ret) |
187 | ret = mdio_write(phy, mmd, reg, val | bits); | 184 | ret = mdio_write(phy, mmd, reg, val | bits); |
188 | return ret; | 185 | return ret; |
189 | } | 186 | } |
190 | 187 | ||
191 | static int vsc8244_autoneg_enable(struct cphy *cphy) | 188 | static int vsc8244_autoneg_enable(struct cphy *cphy) |
@@ -235,7 +232,7 @@ static int vsc8244_advertise(struct cphy *phy, unsigned int advertise_map) | |||
235 | } | 232 | } |
236 | 233 | ||
237 | static int vsc8244_get_link_status(struct cphy *cphy, int *link_ok, | 234 | static int vsc8244_get_link_status(struct cphy *cphy, int *link_ok, |
238 | int *speed, int *duplex, int *fc) | 235 | int *speed, int *duplex, int *fc) |
239 | { | 236 | { |
240 | unsigned int bmcr, status, lpa, adv; | 237 | unsigned int bmcr, status, lpa, adv; |
241 | int err, sp = -1, dplx = -1, pause = 0; | 238 | int err, sp = -1, dplx = -1, pause = 0; |
@@ -343,7 +340,8 @@ static struct cphy_ops vsc8244_ops = { | |||
343 | .get_link_status = vsc8244_get_link_status | 340 | .get_link_status = vsc8244_get_link_status |
344 | }; | 341 | }; |
345 | 342 | ||
346 | static struct cphy* vsc8244_phy_create(adapter_t *adapter, int phy_addr, struct mdio_ops *mdio_ops) | 343 | static struct cphy* vsc8244_phy_create(adapter_t *adapter, int phy_addr, |
344 | struct mdio_ops *mdio_ops) | ||
347 | { | 345 | { |
348 | struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); | 346 | struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); |
349 | 347 | ||