aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/dp83640.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/dp83640.c')
-rw-r--r--drivers/net/phy/dp83640.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 547725fa8671..98e7cbf720a5 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -437,7 +437,10 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
437 if (on) { 437 if (on) {
438 gpio_num = gpio_tab[EXTTS0_GPIO + index]; 438 gpio_num = gpio_tab[EXTTS0_GPIO + index];
439 evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT; 439 evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
440 evnt |= EVNT_RISE; 440 if (rq->extts.flags & PTP_FALLING_EDGE)
441 evnt |= EVNT_FALL;
442 else
443 evnt |= EVNT_RISE;
441 } 444 }
442 ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); 445 ext_write(0, phydev, PAGE5, PTP_EVNT, evnt);
443 return 0; 446 return 0;
@@ -1003,11 +1006,6 @@ static int dp83640_probe(struct phy_device *phydev)
1003 } else 1006 } else
1004 list_add_tail(&dp83640->list, &clock->phylist); 1007 list_add_tail(&dp83640->list, &clock->phylist);
1005 1008
1006 if (clock->chosen && !list_empty(&clock->phylist))
1007 recalibrate(clock);
1008 else
1009 enable_broadcast(dp83640->phydev, clock->page, 1);
1010
1011 dp83640_clock_put(clock); 1009 dp83640_clock_put(clock);
1012 return 0; 1010 return 0;
1013 1011
@@ -1058,6 +1056,21 @@ static void dp83640_remove(struct phy_device *phydev)
1058 kfree(dp83640); 1056 kfree(dp83640);
1059} 1057}
1060 1058
1059static int dp83640_config_init(struct phy_device *phydev)
1060{
1061 struct dp83640_private *dp83640 = phydev->priv;
1062 struct dp83640_clock *clock = dp83640->clock;
1063
1064 if (clock->chosen && !list_empty(&clock->phylist))
1065 recalibrate(clock);
1066 else
1067 enable_broadcast(phydev, clock->page, 1);
1068
1069 enable_status_frames(phydev, true);
1070 ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
1071 return 0;
1072}
1073
1061static int dp83640_ack_interrupt(struct phy_device *phydev) 1074static int dp83640_ack_interrupt(struct phy_device *phydev)
1062{ 1075{
1063 int err = phy_read(phydev, MII_DP83640_MISR); 1076 int err = phy_read(phydev, MII_DP83640_MISR);
@@ -1195,11 +1208,6 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
1195 1208
1196 mutex_lock(&dp83640->clock->extreg_lock); 1209 mutex_lock(&dp83640->clock->extreg_lock);
1197 1210
1198 if (dp83640->hwts_tx_en || dp83640->hwts_rx_en) {
1199 enable_status_frames(phydev, true);
1200 ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
1201 }
1202
1203 ext_write(0, phydev, PAGE5, PTP_TXCFG0, txcfg0); 1211 ext_write(0, phydev, PAGE5, PTP_TXCFG0, txcfg0);
1204 ext_write(0, phydev, PAGE5, PTP_RXCFG0, rxcfg0); 1212 ext_write(0, phydev, PAGE5, PTP_RXCFG0, rxcfg0);
1205 1213
@@ -1281,6 +1289,7 @@ static void dp83640_txtstamp(struct phy_device *phydev,
1281 } 1289 }
1282 /* fall through */ 1290 /* fall through */
1283 case HWTSTAMP_TX_ON: 1291 case HWTSTAMP_TX_ON:
1292 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1284 skb_queue_tail(&dp83640->tx_queue, skb); 1293 skb_queue_tail(&dp83640->tx_queue, skb);
1285 schedule_work(&dp83640->ts_work); 1294 schedule_work(&dp83640->ts_work);
1286 break; 1295 break;
@@ -1330,6 +1339,7 @@ static struct phy_driver dp83640_driver = {
1330 .flags = PHY_HAS_INTERRUPT, 1339 .flags = PHY_HAS_INTERRUPT,
1331 .probe = dp83640_probe, 1340 .probe = dp83640_probe,
1332 .remove = dp83640_remove, 1341 .remove = dp83640_remove,
1342 .config_init = dp83640_config_init,
1333 .config_aneg = genphy_config_aneg, 1343 .config_aneg = genphy_config_aneg,
1334 .read_status = genphy_read_status, 1344 .read_status = genphy_read_status,
1335 .ack_interrupt = dp83640_ack_interrupt, 1345 .ack_interrupt = dp83640_ack_interrupt,