aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/dp83640.c19
-rw-r--r--drivers/net/phy/mdio-sun4i.c3
-rw-r--r--drivers/net/phy/phy_device.c38
3 files changed, 40 insertions, 20 deletions
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 547725fa8671..9414fa272160 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;
@@ -1058,6 +1061,13 @@ static void dp83640_remove(struct phy_device *phydev)
1058 kfree(dp83640); 1061 kfree(dp83640);
1059} 1062}
1060 1063
1064static int dp83640_config_init(struct phy_device *phydev)
1065{
1066 enable_status_frames(phydev, true);
1067 ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE);
1068 return 0;
1069}
1070
1061static int dp83640_ack_interrupt(struct phy_device *phydev) 1071static int dp83640_ack_interrupt(struct phy_device *phydev)
1062{ 1072{
1063 int err = phy_read(phydev, MII_DP83640_MISR); 1073 int err = phy_read(phydev, MII_DP83640_MISR);
@@ -1195,11 +1205,6 @@ static int dp83640_hwtstamp(struct phy_device *phydev, struct ifreq *ifr)
1195 1205
1196 mutex_lock(&dp83640->clock->extreg_lock); 1206 mutex_lock(&dp83640->clock->extreg_lock);
1197 1207
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); 1208 ext_write(0, phydev, PAGE5, PTP_TXCFG0, txcfg0);
1204 ext_write(0, phydev, PAGE5, PTP_RXCFG0, rxcfg0); 1209 ext_write(0, phydev, PAGE5, PTP_RXCFG0, rxcfg0);
1205 1210
@@ -1281,6 +1286,7 @@ static void dp83640_txtstamp(struct phy_device *phydev,
1281 } 1286 }
1282 /* fall through */ 1287 /* fall through */
1283 case HWTSTAMP_TX_ON: 1288 case HWTSTAMP_TX_ON:
1289 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1284 skb_queue_tail(&dp83640->tx_queue, skb); 1290 skb_queue_tail(&dp83640->tx_queue, skb);
1285 schedule_work(&dp83640->ts_work); 1291 schedule_work(&dp83640->ts_work);
1286 break; 1292 break;
@@ -1330,6 +1336,7 @@ static struct phy_driver dp83640_driver = {
1330 .flags = PHY_HAS_INTERRUPT, 1336 .flags = PHY_HAS_INTERRUPT,
1331 .probe = dp83640_probe, 1337 .probe = dp83640_probe,
1332 .remove = dp83640_remove, 1338 .remove = dp83640_remove,
1339 .config_init = dp83640_config_init,
1333 .config_aneg = genphy_config_aneg, 1340 .config_aneg = genphy_config_aneg,
1334 .read_status = genphy_read_status, 1341 .read_status = genphy_read_status,
1335 .ack_interrupt = dp83640_ack_interrupt, 1342 .ack_interrupt = dp83640_ack_interrupt,
diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c
index bb88bc7d81fb..9367acc84fbb 100644
--- a/drivers/net/phy/mdio-sun4i.c
+++ b/drivers/net/phy/mdio-sun4i.c
@@ -170,6 +170,9 @@ static int sun4i_mdio_remove(struct platform_device *pdev)
170} 170}
171 171
172static const struct of_device_id sun4i_mdio_dt_ids[] = { 172static const struct of_device_id sun4i_mdio_dt_ids[] = {
173 { .compatible = "allwinner,sun4i-a10-mdio" },
174
175 /* Deprecated */
173 { .compatible = "allwinner,sun4i-mdio" }, 176 { .compatible = "allwinner,sun4i-mdio" },
174 { } 177 { }
175}; 178};
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 4b03e63639b7..82514e72b3d8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -719,7 +719,7 @@ int phy_resume(struct phy_device *phydev)
719static int genphy_config_advert(struct phy_device *phydev) 719static int genphy_config_advert(struct phy_device *phydev)
720{ 720{
721 u32 advertise; 721 u32 advertise;
722 int oldadv, adv; 722 int oldadv, adv, bmsr;
723 int err, changed = 0; 723 int err, changed = 0;
724 724
725 /* Only allow advertising what this PHY supports */ 725 /* Only allow advertising what this PHY supports */
@@ -744,26 +744,36 @@ static int genphy_config_advert(struct phy_device *phydev)
744 changed = 1; 744 changed = 1;
745 } 745 }
746 746
747 bmsr = phy_read(phydev, MII_BMSR);
748 if (bmsr < 0)
749 return bmsr;
750
751 /* Per 802.3-2008, Section 22.2.4.2.16 Extended status all
752 * 1000Mbits/sec capable PHYs shall have the BMSR_ESTATEN bit set to a
753 * logical 1.
754 */
755 if (!(bmsr & BMSR_ESTATEN))
756 return changed;
757
747 /* Configure gigabit if it's supported */ 758 /* Configure gigabit if it's supported */
759 adv = phy_read(phydev, MII_CTRL1000);
760 if (adv < 0)
761 return adv;
762
763 oldadv = adv;
764 adv &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF);
765
748 if (phydev->supported & (SUPPORTED_1000baseT_Half | 766 if (phydev->supported & (SUPPORTED_1000baseT_Half |
749 SUPPORTED_1000baseT_Full)) { 767 SUPPORTED_1000baseT_Full)) {
750 adv = phy_read(phydev, MII_CTRL1000);
751 if (adv < 0)
752 return adv;
753
754 oldadv = adv;
755 adv &= ~(ADVERTISE_1000FULL | ADVERTISE_1000HALF);
756 adv |= ethtool_adv_to_mii_ctrl1000_t(advertise); 768 adv |= ethtool_adv_to_mii_ctrl1000_t(advertise);
757 769 if (adv != oldadv)
758 if (adv != oldadv) {
759 err = phy_write(phydev, MII_CTRL1000, adv);
760
761 if (err < 0)
762 return err;
763 changed = 1; 770 changed = 1;
764 }
765 } 771 }
766 772
773 err = phy_write(phydev, MII_CTRL1000, adv);
774 if (err < 0)
775 return err;
776
767 return changed; 777 return changed;
768} 778}
769 779