diff options
-rw-r--r-- | drivers/net/phy/dp83640.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 7a068d99ea46..e570036275e2 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -496,7 +496,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, | |||
496 | else | 496 | else |
497 | evnt |= EVNT_RISE; | 497 | evnt |= EVNT_RISE; |
498 | } | 498 | } |
499 | mutex_lock(&clock->extreg_lock); | ||
499 | ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); | 500 | ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); |
501 | mutex_unlock(&clock->extreg_lock); | ||
500 | return 0; | 502 | return 0; |
501 | 503 | ||
502 | case PTP_CLK_REQ_PEROUT: | 504 | case PTP_CLK_REQ_PEROUT: |
@@ -532,6 +534,8 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F }; | |||
532 | 534 | ||
533 | static void enable_status_frames(struct phy_device *phydev, bool on) | 535 | static void enable_status_frames(struct phy_device *phydev, bool on) |
534 | { | 536 | { |
537 | struct dp83640_private *dp83640 = phydev->priv; | ||
538 | struct dp83640_clock *clock = dp83640->clock; | ||
535 | u16 cfg0 = 0, ver; | 539 | u16 cfg0 = 0, ver; |
536 | 540 | ||
537 | if (on) | 541 | if (on) |
@@ -539,9 +543,13 @@ static void enable_status_frames(struct phy_device *phydev, bool on) | |||
539 | 543 | ||
540 | ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; | 544 | ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; |
541 | 545 | ||
546 | mutex_lock(&clock->extreg_lock); | ||
547 | |||
542 | ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); | 548 | ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); |
543 | ext_write(0, phydev, PAGE6, PSF_CFG1, ver); | 549 | ext_write(0, phydev, PAGE6, PSF_CFG1, ver); |
544 | 550 | ||
551 | mutex_unlock(&clock->extreg_lock); | ||
552 | |||
545 | if (!phydev->attached_dev) { | 553 | if (!phydev->attached_dev) { |
546 | pr_warn("expected to find an attached netdevice\n"); | 554 | pr_warn("expected to find an attached netdevice\n"); |
547 | return; | 555 | return; |
@@ -1173,11 +1181,18 @@ static int dp83640_config_init(struct phy_device *phydev) | |||
1173 | 1181 | ||
1174 | if (clock->chosen && !list_empty(&clock->phylist)) | 1182 | if (clock->chosen && !list_empty(&clock->phylist)) |
1175 | recalibrate(clock); | 1183 | recalibrate(clock); |
1176 | else | 1184 | else { |
1185 | mutex_lock(&clock->extreg_lock); | ||
1177 | enable_broadcast(phydev, clock->page, 1); | 1186 | enable_broadcast(phydev, clock->page, 1); |
1187 | mutex_unlock(&clock->extreg_lock); | ||
1188 | } | ||
1178 | 1189 | ||
1179 | enable_status_frames(phydev, true); | 1190 | enable_status_frames(phydev, true); |
1191 | |||
1192 | mutex_lock(&clock->extreg_lock); | ||
1180 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); | 1193 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); |
1194 | mutex_unlock(&clock->extreg_lock); | ||
1195 | |||
1181 | return 0; | 1196 | return 0; |
1182 | } | 1197 | } |
1183 | 1198 | ||