Commit 5f59102f authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 466c5ac8 adbe088f
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
#define PSF_TX 0x1000 #define PSF_TX 0x1000
#define EXT_EVENT 1 #define EXT_EVENT 1
#define CAL_EVENT 7 #define CAL_EVENT 7
#define CAL_TRIGGER 7 #define CAL_TRIGGER 1
#define DP83640_N_PINS 12 #define DP83640_N_PINS 12
#define MII_DP83640_MICR 0x11 #define MII_DP83640_MICR 0x11
...@@ -496,7 +496,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, ...@@ -496,7 +496,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
else else
evnt |= EVNT_RISE; evnt |= EVNT_RISE;
} }
mutex_lock(&clock->extreg_lock);
ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); ext_write(0, phydev, PAGE5, PTP_EVNT, evnt);
mutex_unlock(&clock->extreg_lock);
return 0; return 0;
case PTP_CLK_REQ_PEROUT: case PTP_CLK_REQ_PEROUT:
...@@ -532,6 +534,8 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F }; ...@@ -532,6 +534,8 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F };
static void enable_status_frames(struct phy_device *phydev, bool on) static void enable_status_frames(struct phy_device *phydev, bool on)
{ {
struct dp83640_private *dp83640 = phydev->priv;
struct dp83640_clock *clock = dp83640->clock;
u16 cfg0 = 0, ver; u16 cfg0 = 0, ver;
if (on) if (on)
...@@ -539,9 +543,13 @@ static void enable_status_frames(struct phy_device *phydev, bool on) ...@@ -539,9 +543,13 @@ static void enable_status_frames(struct phy_device *phydev, bool on)
ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT;
mutex_lock(&clock->extreg_lock);
ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0);
ext_write(0, phydev, PAGE6, PSF_CFG1, ver); ext_write(0, phydev, PAGE6, PSF_CFG1, ver);
mutex_unlock(&clock->extreg_lock);
if (!phydev->attached_dev) { if (!phydev->attached_dev) {
pr_warn("expected to find an attached netdevice\n"); pr_warn("expected to find an attached netdevice\n");
return; return;
...@@ -838,7 +846,7 @@ static void decode_rxts(struct dp83640_private *dp83640, ...@@ -838,7 +846,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
list_del_init(&rxts->list); list_del_init(&rxts->list);
phy2rxts(phy_rxts, rxts); phy2rxts(phy_rxts, rxts);
spin_lock_irqsave(&dp83640->rx_queue.lock, flags); spin_lock(&dp83640->rx_queue.lock);
skb_queue_walk(&dp83640->rx_queue, skb) { skb_queue_walk(&dp83640->rx_queue, skb) {
struct dp83640_skb_info *skb_info; struct dp83640_skb_info *skb_info;
...@@ -853,7 +861,7 @@ static void decode_rxts(struct dp83640_private *dp83640, ...@@ -853,7 +861,7 @@ static void decode_rxts(struct dp83640_private *dp83640,
break; break;
} }
} }
spin_unlock_irqrestore(&dp83640->rx_queue.lock, flags); spin_unlock(&dp83640->rx_queue.lock);
if (!shhwtstamps) if (!shhwtstamps)
list_add_tail(&rxts->list, &dp83640->rxts); list_add_tail(&rxts->list, &dp83640->rxts);
...@@ -1173,11 +1181,18 @@ static int dp83640_config_init(struct phy_device *phydev) ...@@ -1173,11 +1181,18 @@ static int dp83640_config_init(struct phy_device *phydev)
if (clock->chosen && !list_empty(&clock->phylist)) if (clock->chosen && !list_empty(&clock->phylist))
recalibrate(clock); recalibrate(clock);
else else {
mutex_lock(&clock->extreg_lock);
enable_broadcast(phydev, clock->page, 1); enable_broadcast(phydev, clock->page, 1);
mutex_unlock(&clock->extreg_lock);
}
enable_status_frames(phydev, true); enable_status_frames(phydev, true);
mutex_lock(&clock->extreg_lock);
ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
mutex_unlock(&clock->extreg_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment