Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Zhao Qiang and committed by
David S. Miller
77a99394 437de07c

+30
+30
drivers/net/phy/at803x.c
··· 27 27 #define AT803X_MMD_ACCESS_CONTROL 0x0D 28 28 #define AT803X_MMD_ACCESS_CONTROL_DATA 0x0E 29 29 #define AT803X_FUNC_DATA 0x4003 30 + #define AT803X_INER 0x0012 31 + #define AT803X_INER_INIT 0xec00 32 + #define AT803X_INSR 0x0013 30 33 #define AT803X_DEBUG_ADDR 0x1D 31 34 #define AT803X_DEBUG_DATA 0x1E 32 35 #define AT803X_DEBUG_SYSTEM_MODE_CTRL 0x05 ··· 194 191 return 0; 195 192 } 196 193 194 + static int at803x_ack_interrupt(struct phy_device *phydev) 195 + { 196 + int err; 197 + 198 + err = phy_read(phydev, AT803X_INSR); 199 + 200 + return (err < 0) ? err : 0; 201 + } 202 + 203 + static int at803x_config_intr(struct phy_device *phydev) 204 + { 205 + int err; 206 + int value; 207 + 208 + value = phy_read(phydev, AT803X_INER); 209 + 210 + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) 211 + err = phy_write(phydev, AT803X_INER, 212 + value | AT803X_INER_INIT); 213 + else 214 + err = phy_write(phydev, AT803X_INER, 0); 215 + 216 + return err; 217 + } 218 + 197 219 static struct phy_driver at803x_driver[] = { 198 220 { 199 221 /* ATHEROS 8035 */ ··· 268 240 .flags = PHY_HAS_INTERRUPT, 269 241 .config_aneg = genphy_config_aneg, 270 242 .read_status = genphy_read_status, 243 + .ack_interrupt = &at803x_ack_interrupt, 244 + .config_intr = &at803x_config_intr, 271 245 .driver = { 272 246 .owner = THIS_MODULE, 273 247 },