diff options
author | David S. Miller <davem@davemloft.net> | 2015-05-25 18:22:00 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-25 18:22:00 -0400 |
commit | 5f59102fdcfeee937439bb4a5e5c9dbc0d6eb4b0 (patch) | |
tree | 49480fdc4359c842f64a480ead42a9531addcc2c | |
parent | 466c5ac8bdf29a382d064923a60ef302dd3b2aeb (diff) | |
parent | adbe088f6f8b0b7701fe07f51fe6f2bd602a6665 (diff) |
Merge branch 'phyter-bug-fixes'
Richard Cochran says:
====================
phyter bug fixes
While working on a project using the phyter, I noticed some bugs that
have crept in over time. This series fixes those bugs. These patches
are also meant for stable.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/dp83640.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 496e02f961d3..00cb41e71312 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #define PSF_TX 0x1000 | 47 | #define PSF_TX 0x1000 |
48 | #define EXT_EVENT 1 | 48 | #define EXT_EVENT 1 |
49 | #define CAL_EVENT 7 | 49 | #define CAL_EVENT 7 |
50 | #define CAL_TRIGGER 7 | 50 | #define CAL_TRIGGER 1 |
51 | #define DP83640_N_PINS 12 | 51 | #define DP83640_N_PINS 12 |
52 | 52 | ||
53 | #define MII_DP83640_MICR 0x11 | 53 | #define MII_DP83640_MICR 0x11 |
@@ -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; |
@@ -838,7 +846,7 @@ static void decode_rxts(struct dp83640_private *dp83640, | |||
838 | list_del_init(&rxts->list); | 846 | list_del_init(&rxts->list); |
839 | phy2rxts(phy_rxts, rxts); | 847 | phy2rxts(phy_rxts, rxts); |
840 | 848 | ||
841 | spin_lock_irqsave(&dp83640->rx_queue.lock, flags); | 849 | spin_lock(&dp83640->rx_queue.lock); |
842 | skb_queue_walk(&dp83640->rx_queue, skb) { | 850 | skb_queue_walk(&dp83640->rx_queue, skb) { |
843 | struct dp83640_skb_info *skb_info; | 851 | struct dp83640_skb_info *skb_info; |
844 | 852 | ||
@@ -853,7 +861,7 @@ static void decode_rxts(struct dp83640_private *dp83640, | |||
853 | break; | 861 | break; |
854 | } | 862 | } |
855 | } | 863 | } |
856 | spin_unlock_irqrestore(&dp83640->rx_queue.lock, flags); | 864 | spin_unlock(&dp83640->rx_queue.lock); |
857 | 865 | ||
858 | if (!shhwtstamps) | 866 | if (!shhwtstamps) |
859 | list_add_tail(&rxts->list, &dp83640->rxts); | 867 | list_add_tail(&rxts->list, &dp83640->rxts); |
@@ -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 | ||