|
33 | 33 | #define TSTCNTL_WRITE_ADDRESS GENMASK(4, 0)
|
34 | 34 | #define TSTREAD1 21
|
35 | 35 | #define TSTWRITE 23
|
| 36 | +#define INTSRC_FLAG 29 |
| 37 | +#define INTSRC_ANEG_PR BIT(1) |
| 38 | +#define INTSRC_PARALLEL_FAULT BIT(2) |
| 39 | +#define INTSRC_ANEG_LP_ACK BIT(3) |
| 40 | +#define INTSRC_LINK_DOWN BIT(4) |
| 41 | +#define INTSRC_REMOTE_FAULT BIT(5) |
| 42 | +#define INTSRC_ANEG_COMPLETE BIT(6) |
| 43 | +#define INTSRC_MASK 30 |
36 | 44 |
|
37 | 45 | #define BANK_ANALOG_DSP 0
|
38 | 46 | #define BANK_WOL 1
|
@@ -193,16 +201,43 @@ static int meson_gxl_read_status(struct phy_device *phydev)
|
193 | 201 | return genphy_read_status(phydev);
|
194 | 202 | }
|
195 | 203 |
|
| 204 | +static int meson_gxl_ack_interrupt(struct phy_device *phydev) |
| 205 | +{ |
| 206 | + int ret = phy_read(phydev, INTSRC_FLAG); |
| 207 | + |
| 208 | + return ret < 0 ? ret : 0; |
| 209 | +} |
| 210 | + |
| 211 | +static int meson_gxl_config_intr(struct phy_device *phydev) |
| 212 | +{ |
| 213 | + u16 val; |
| 214 | + |
| 215 | + if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { |
| 216 | + val = INTSRC_ANEG_PR |
| 217 | + | INTSRC_PARALLEL_FAULT |
| 218 | + | INTSRC_ANEG_LP_ACK |
| 219 | + | INTSRC_LINK_DOWN |
| 220 | + | INTSRC_REMOTE_FAULT |
| 221 | + | INTSRC_ANEG_COMPLETE; |
| 222 | + } else { |
| 223 | + val = 0; |
| 224 | + } |
| 225 | + |
| 226 | + return phy_write(phydev, INTSRC_MASK, val); |
| 227 | +} |
| 228 | + |
196 | 229 | static struct phy_driver meson_gxl_phy[] = {
|
197 | 230 | {
|
198 | 231 | .phy_id = 0x01814400,
|
199 | 232 | .phy_id_mask = 0xfffffff0,
|
200 | 233 | .name = "Meson GXL Internal PHY",
|
201 | 234 | .features = PHY_BASIC_FEATURES,
|
202 |
| - .flags = PHY_IS_INTERNAL, |
| 235 | + .flags = PHY_IS_INTERNAL | PHY_HAS_INTERRUPT, |
203 | 236 | .config_init = meson_gxl_config_init,
|
204 | 237 | .aneg_done = genphy_aneg_done,
|
205 | 238 | .read_status = meson_gxl_read_status,
|
| 239 | + .ack_interrupt = meson_gxl_ack_interrupt, |
| 240 | + .config_intr = meson_gxl_config_intr, |
206 | 241 | .suspend = genphy_suspend,
|
207 | 242 | .resume = genphy_resume,
|
208 | 243 | },
|
|
0 commit comments