diff options
author | Zhao Qiang <B45475@freescale.com> | 2014-03-28 03:39:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-29 18:20:30 -0400 |
commit | 77a9939426f7a3f35f460afc9b11f1fe45955409 (patch) | |
tree | 8b683bc0b6fe719d857dcbb99a927cd36780f6cc | |
parent | 437de07ced703c2d171b43bd63cf47e0af09a241 (diff) |
phy/at8031: enable at8031 to work on interrupt mode
The at8031 can work on polling mode and interrupt mode.
Add ack_interrupt and config intr funcs to enable
interrupt mode for it.
Signed-off-by: Zhao Qiang <B45475@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/at803x.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index bc71947b1ec3..643464d5a727 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c | |||
@@ -27,6 +27,9 @@ | |||
27 | #define AT803X_MMD_ACCESS_CONTROL 0x0D | 27 | #define AT803X_MMD_ACCESS_CONTROL 0x0D |
28 | #define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E | 28 | #define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E |
29 | #define AT803X_FUNC_DATA 0x4003 | 29 | #define AT803X_FUNC_DATA 0x4003 |
30 | #define AT803X_INER 0x0012 | ||
31 | #define AT803X_INER_INIT 0xec00 | ||
32 | #define AT803X_INSR 0x0013 | ||
30 | #define AT803X_DEBUG_ADDR 0x1D | 33 | #define AT803X_DEBUG_ADDR 0x1D |
31 | #define AT803X_DEBUG_DATA 0x1E | 34 | #define AT803X_DEBUG_DATA 0x1E |
32 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 | 35 | #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 |
@@ -191,6 +194,31 @@ static int at803x_config_init(struct phy_device *phydev) | |||
191 | return 0; | 194 | return 0; |
192 | } | 195 | } |
193 | 196 | ||
197 | static int at803x_ack_interrupt(struct phy_device *phydev) | ||
198 | { | ||
199 | int err; | ||
200 | |||
201 | err = phy_read(phydev, AT803X_INSR); | ||
202 | |||
203 | return (err < 0) ? err : 0; | ||
204 | } | ||
205 | |||
206 | static int at803x_config_intr(struct phy_device *phydev) | ||
207 | { | ||
208 | int err; | ||
209 | int value; | ||
210 | |||
211 | value = phy_read(phydev, AT803X_INER); | ||
212 | |||
213 | if (phydev->interrupts == PHY_INTERRUPT_ENABLED) | ||
214 | err = phy_write(phydev, AT803X_INER, | ||
215 | value | AT803X_INER_INIT); | ||
216 | else | ||
217 | err = phy_write(phydev, AT803X_INER, 0); | ||
218 | |||
219 | return err; | ||
220 | } | ||
221 | |||
194 | static struct phy_driver at803x_driver[] = { | 222 | static struct phy_driver at803x_driver[] = { |
195 | { | 223 | { |
196 | /* ATHEROS 8035 */ | 224 | /* ATHEROS 8035 */ |
@@ -240,6 +268,8 @@ static struct phy_driver at803x_driver[] = { | |||
240 | .flags = PHY_HAS_INTERRUPT, | 268 | .flags = PHY_HAS_INTERRUPT, |
241 | .config_aneg = genphy_config_aneg, | 269 | .config_aneg = genphy_config_aneg, |
242 | .read_status = genphy_read_status, | 270 | .read_status = genphy_read_status, |
271 | .ack_interrupt = &at803x_ack_interrupt, | ||
272 | .config_intr = &at803x_config_intr, | ||
243 | .driver = { | 273 | .driver = { |
244 | .owner = THIS_MODULE, | 274 | .owner = THIS_MODULE, |
245 | }, | 275 | }, |