History

Merge branch 'amd-xgbe-next'

Tom Lendacky says: ==================== amd-xgbe: AMD XGBE driver updates 2018-05-21 The following updates are included in this driver update series: - Fix the debug output for the max channels count - Read (once) and save the port property registers during probe - Remove the use of the comm_owned field - Remove unused SFP diagnostic support indicator field - Add ethtool --module-info support - Add ethtool --show-ring/--set-ring support - Update the driver in preparation for ethtool --set-channels support - Add ethtool --show-channels/--set-channels support - Update the driver to always perform link training in KR mode - Advertise FEC support when using a KR re-driver - Update the BelFuse quirk to now support SGMII - Improve 100Mbps auto-negotiation for BelFuse parts This patch series is based on net-next. --- Changes since v1: - Update the --set-channels support to the use of the combined, rx and tx options as specified in the ethtool man page (in other words, don't create combined channels based on the min of the tx and rx channels specified). ====================

David S. Miller committed 8 years ago

Commit 7c08c412 parents 50b464b 76cce0a7 files · +699 −258Browse files

Unified · Split

7 files
  1. drivers/net/ethernet/amd/xgbe/xgbe-drv.c +92 −45
  2. drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +217 −0
  3. drivers/net/ethernet/amd/xgbe/xgbe-main.c +1 −19
  4. drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +80 −87
  5. drivers/net/ethernet/amd/xgbe/xgbe-pci.c +27 −9
  6. drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +251 −98
  7. drivers/net/ethernet/amd/xgbe/xgbe.h +31 −0
drivers/net/ethernet/amd/xgbe/xgbe-drv.c+92−45
@@ -1312,14 +1312,83 @@ int xgbe_powerup(struct net_device *netdev, unsigned int caller) · 1311 unmodified lines
13121312 return 0;
13131313 }
13141314
1315+static void xgbe_free_memory(struct xgbe_prv_data *pdata)
1316+{
1317+ struct xgbe_desc_if *desc_if = &pdata->desc_if;
1318+
1319+ /* Free the ring descriptors and buffers */
1320+ desc_if->free_ring_resources(pdata);
1321+
1322+ /* Free the channel and ring structures */
1323+ xgbe_free_channels(pdata);
1324+}
1325+
1326+static int xgbe_alloc_memory(struct xgbe_prv_data *pdata)
1327+{
1328+ struct xgbe_desc_if *desc_if = &pdata->desc_if;
1329+ struct net_device *netdev = pdata->netdev;
1330+ int ret;
1331+
1332+ if (pdata->new_tx_ring_count) {
1333+ pdata->tx_ring_count = pdata->new_tx_ring_count;
1334+ pdata->tx_q_count = pdata->tx_ring_count;
1335+ pdata->new_tx_ring_count = 0;
1336+ }
1337+
1338+ if (pdata->new_rx_ring_count) {
1339+ pdata->rx_ring_count = pdata->new_rx_ring_count;
1340+ pdata->new_rx_ring_count = 0;
1341+ }
1342+
1343+ /* Calculate the Rx buffer size before allocating rings */
1344+ pdata->rx_buf_size = xgbe_calc_rx_buf_size(netdev, netdev->mtu);
1345+
1346+ /* Allocate the channel and ring structures */
1347+ ret = xgbe_alloc_channels(pdata);
1348+ if (ret)
1349+ return ret;
1350+
1351+ /* Allocate the ring descriptors and buffers */
1352+ ret = desc_if->alloc_ring_resources(pdata);
1353+ if (ret)
1354+ goto err_channels;
1355+
1356+ /* Initialize the service and Tx timers */
1357+ xgbe_init_timers(pdata);
1358+
1359+ return 0;
1360+
1361+err_channels:
1362+ xgbe_free_memory(pdata);
1363+
1364+ return ret;
1365+}
1366+
13151367 static int xgbe_start(struct xgbe_prv_data *pdata)
13161368 {
13171369 struct xgbe_hw_if *hw_if = &pdata->hw_if;
13181370 struct xgbe_phy_if *phy_if = &pdata->phy_if;
13191371 struct net_device *netdev = pdata->netdev;
1372+ unsigned int i;
13201373 int ret;
13211374
1322− DBGPR("-->xgbe_start\n");
1375+ /* Set the number of queues */
1376+ ret = netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count);
1377+ if (ret) {
1378+ netdev_err(netdev, "error setting real tx queue count\n");
1379+ return ret;
1380+ }
1381+
1382+ ret = netif_set_real_num_rx_queues(netdev, pdata->rx_ring_count);
1383+ if (ret) {
1384+ netdev_err(netdev, "error setting real rx queue count\n");
1385+ return ret;
1386+ }
1387+
1388+ /* Set RSS lookup table data for programming */
1389+ for (i = 0; i < XGBE_RSS_MAX_TABLE_SIZE; i++)
1390+ XGMAC_SET_BITS(pdata->rss_table[i], MAC_RSSDR, DMCH,
1391+ i % pdata->rx_ring_count);
13231392
13241393 ret = hw_if->init(pdata);
13251394 if (ret)
@@ -1347,8 +1416,6 @@ static int xgbe_start(struct xgbe_prv_data *pdata) · 21 unmodified lines
13471416
13481417 clear_bit(XGBE_STOPPED, &pdata->dev_state);
13491418
1350− DBGPR("<--xgbe_start\n");
1351−
13521419 return 0;
13531420
13541421 err_irqs:
@@ -1426,10 +1493,22 @@ static void xgbe_stopdev(struct work_struct *work) · 71 unmodified lines
14261493 netdev_alert(pdata->netdev, "device stopped\n");
14271494 }
14281495
1429−static void xgbe_restart_dev(struct xgbe_prv_data *pdata)
1496+void xgbe_full_restart_dev(struct xgbe_prv_data *pdata)
14301497 {
1431− DBGPR("-->xgbe_restart_dev\n");
1498+ /* If not running, "restart" will happen on open */
1499+ if (!netif_running(pdata->netdev))
1500+ return;
1501+
1502+ xgbe_stop(pdata);
1503+
1504+ xgbe_free_memory(pdata);
1505+ xgbe_alloc_memory(pdata);
1506+
1507+ xgbe_start(pdata);
1508+}
14321509
1510+void xgbe_restart_dev(struct xgbe_prv_data *pdata)
1511+{
14331512 /* If not running, "restart" will happen on open */
14341513 if (!netif_running(pdata->netdev))
14351514 return;
@@ -1440,8 +1519,6 @@ static void xgbe_restart_dev(struct xgbe_prv_data *pdata) · 4 unmodified lines
14401519 xgbe_free_rx_data(pdata);
14411520
14421521 xgbe_start(pdata);
1443−
1444− DBGPR("<--xgbe_restart_dev\n");
14451522 }
14461523
14471524 static void xgbe_restart(struct work_struct *work)
@@ -1827,11 +1904,8 @@ static void xgbe_packet_info(struct xgbe_prv_data *pdata, · 379 unmodified lines
18271904 static int xgbe_open(struct net_device *netdev)
18281905 {
18291906 struct xgbe_prv_data *pdata = netdev_priv(netdev);
1830− struct xgbe_desc_if *desc_if = &pdata->desc_if;
18311907 int ret;
18321908
1833− DBGPR("-->xgbe_open\n");
1834−
18351909 /* Create the various names based on netdev name */
18361910 snprintf(pdata->an_name, sizeof(pdata->an_name) - 1, "%s-pcs",
18371911 netdev_name(netdev));
@@ -1876,43 +1950,25 @@ static int xgbe_open(struct net_device *netdev) · 38 unmodified lines
18761950 goto err_sysclk;
18771951 }
18781952
1879− /* Calculate the Rx buffer size before allocating rings */
1880− ret = xgbe_calc_rx_buf_size(netdev, netdev->mtu);
1881− if (ret < 0)
1882− goto err_ptpclk;
1883− pdata->rx_buf_size = ret;
1884−
1885− /* Allocate the channel and ring structures */
1886− ret = xgbe_alloc_channels(pdata);
1887− if (ret)
1888− goto err_ptpclk;
1889−
1890− /* Allocate the ring descriptors and buffers */
1891− ret = desc_if->alloc_ring_resources(pdata);
1892− if (ret)
1893− goto err_channels;
1894−
18951953 INIT_WORK(&pdata->service_work, xgbe_service);
18961954 INIT_WORK(&pdata->restart_work, xgbe_restart);
18971955 INIT_WORK(&pdata->stopdev_work, xgbe_stopdev);
18981956 INIT_WORK(&pdata->tx_tstamp_work, xgbe_tx_tstamp);
1899− xgbe_init_timers(pdata);
1957+
1958+ ret = xgbe_alloc_memory(pdata);
1959+ if (ret)
1960+ goto err_ptpclk;
19001961
19011962 ret = xgbe_start(pdata);
19021963 if (ret)
1903− goto err_rings;
1964+ goto err_mem;
19041965
19051966 clear_bit(XGBE_DOWN, &pdata->dev_state);
19061967
1907− DBGPR("<--xgbe_open\n");
1908−
19091968 return 0;
19101969
1911−err_rings:
1912− desc_if->free_ring_resources(pdata);
1913−
1914−err_channels:
1915− xgbe_free_channels(pdata);
1970+err_mem:
1971+ xgbe_free_memory(pdata);
19161972
19171973 err_ptpclk:
19181974 clk_disable_unprepare(pdata->ptpclk);
@@ -1932,18 +1988,11 @@ err_dev_wq: · 13 unmodified lines
19321988 static int xgbe_close(struct net_device *netdev)
19331989 {
19341990 struct xgbe_prv_data *pdata = netdev_priv(netdev);
1935− struct xgbe_desc_if *desc_if = &pdata->desc_if;
1936−
1937− DBGPR("-->xgbe_close\n");
19381991
19391992 /* Stop the device */
19401993 xgbe_stop(pdata);
19411994
1942− /* Free the ring descriptors and buffers */
1943− desc_if->free_ring_resources(pdata);
1944−
1945− /* Free the channel and ring structures */
1946− xgbe_free_channels(pdata);
1995+ xgbe_free_memory(pdata);
19471996
19481997 /* Disable the clocks */
19491998 clk_disable_unprepare(pdata->ptpclk);
@@ -1957,8 +2006,6 @@ static int xgbe_close(struct net_device *netdev) · 7 unmodified lines
19572006
19582007 set_bit(XGBE_DOWN, &pdata->dev_state);
19592008
1960− DBGPR("<--xgbe_close\n");
1961−
19622009 return 0;
19632010 }
19642011
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c+217−0
@@ -626,6 +626,217 @@ static int xgbe_get_ts_info(struct net_device *netdev, · 625 unmodified lines
626626 return 0;
627627 }
628628
629+static int xgbe_get_module_info(struct net_device *netdev,
630+ struct ethtool_modinfo *modinfo)
631+{
632+ struct xgbe_prv_data *pdata = netdev_priv(netdev);
633+
634+ return pdata->phy_if.module_info(pdata, modinfo);
635+}
636+
637+static int xgbe_get_module_eeprom(struct net_device *netdev,
638+ struct ethtool_eeprom *eeprom, u8 *data)
639+{
640+ struct xgbe_prv_data *pdata = netdev_priv(netdev);
641+
642+ return pdata->phy_if.module_eeprom(pdata, eeprom, data);
643+}
644+
645+static void xgbe_get_ringparam(struct net_device *netdev,
646+ struct ethtool_ringparam *ringparam)
647+{
648+ struct xgbe_prv_data *pdata = netdev_priv(netdev);
649+
650+ ringparam->rx_max_pending = XGBE_RX_DESC_CNT_MAX;
651+ ringparam->tx_max_pending = XGBE_TX_DESC_CNT_MAX;
652+ ringparam->rx_pending = pdata->rx_desc_count;
653+ ringparam->tx_pending = pdata->tx_desc_count;
654+}
655+
656+static int xgbe_set_ringparam(struct net_device *netdev,
657+ struct ethtool_ringparam *ringparam)
658+{
659+ struct xgbe_prv_data *pdata = netdev_priv(netdev);
660+ unsigned int rx, tx;
661+
662+ if (ringparam->rx_mini_pending || ringparam->rx_jumbo_pending) {
663+ netdev_err(netdev, "unsupported ring parameter\n");
664+ return -EINVAL;
665+ }
666+
667+ if ((ringparam->rx_pending < XGBE_RX_DESC_CNT_MIN) ||
668+ (ringparam->rx_pending > XGBE_RX_DESC_CNT_MAX)) {
669+ netdev_err(netdev,
670+ "rx ring parameter must be between %u and %u\n",
671+ XGBE_RX_DESC_CNT_MIN, XGBE_RX_DESC_CNT_MAX);
672+ return -EINVAL;
673+ }
674+
675+ if ((ringparam->tx_pending < XGBE_TX_DESC_CNT_MIN) ||
676+ (ringparam->tx_pending > XGBE_TX_DESC_CNT_MAX)) {
677+ netdev_err(netdev,
678+ "tx ring parameter must be between %u and %u\n",
679+ XGBE_TX_DESC_CNT_MIN, XGBE_TX_DESC_CNT_MAX);
680+ return -EINVAL;
681+ }
682+
683+ rx = __rounddown_pow_of_two(ringparam->rx_pending);
684+ if (rx != ringparam->rx_pending)
685+ netdev_notice(netdev,
686+ "rx ring parameter rounded to power of two: %u\n",
687+ rx);
688+
689+ tx = __rounddown_pow_of_two(ringparam->tx_pending);
690+ if (tx != ringparam->tx_pending)
691+ netdev_notice(netdev,
692+ "tx ring parameter rounded to power of two: %u\n",
693+ tx);
694+
695+ if ((rx == pdata->rx_desc_count) &&
696+ (tx == pdata->tx_desc_count))
697+ goto out;
698+
699+ pdata->rx_desc_count = rx;
700+ pdata->tx_desc_count = tx;
701+
702+ xgbe_restart_dev(pdata);
703+
704+out:
705+ return 0;
706+}
707+
708+static void xgbe_get_channels(struct net_device *netdev,
709+ struct ethtool_channels *channels)
710+{
711+ struct xgbe_prv_data *pdata = netdev_priv(netdev);
712+ unsigned int rx, tx, combined;
713+
714+ /* Calculate maximums allowed:
715+ * - Take into account the number of available IRQs
716+ * - Do not take into account the number of online CPUs so that
717+ * the user can over-subscribe if desired
718+ * - Tx is additionally limited by the number of hardware queues
719+ */
720+ rx = min(pdata->hw_feat.rx_ch_cnt, pdata->rx_max_channel_count);
721+ rx = min(rx, pdata->channel_irq_count);
722+ tx = min(pdata->hw_feat.tx_ch_cnt, pdata->tx_max_channel_count);
723+ tx = min(tx, pdata->channel_irq_count);
724+ tx = min(tx, pdata->tx_max_q_count);
725+
726+ combined = min(rx, tx);
727+
728+ channels->max_combined = combined;
729+ channels->max_rx = rx ? rx - 1 : 0;
730+ channels->max_tx = tx ? tx - 1 : 0;
731+
732+ /* Get current settings based on device state */
733+ rx = pdata->new_rx_ring_count ? : pdata->rx_ring_count;
734+ tx = pdata->new_tx_ring_count ? : pdata->tx_ring_count;
735+
736+ combined = min(rx, tx);
737+ rx -= combined;
738+ tx -= combined;
739+
740+ channels->combined_count = combined;
741+ channels->rx_count = rx;
742+ channels->tx_count = tx;
743+}
744+
745+static void xgbe_print_set_channels_input(struct net_device *netdev,
746+ struct ethtool_channels *channels)
747+{
748+ netdev_err(netdev, "channel inputs: combined=%u, rx-only=%u, tx-only=%u\n",
749+ channels->combined_count, channels->rx_count,
750+ channels->tx_count);
751+}
752+
753+static int xgbe_set_channels(struct net_device *netdev,
754+ struct ethtool_channels *channels)
755+{
756+ struct xgbe_prv_data *pdata = netdev_priv(netdev);
757+ unsigned int rx, rx_curr, tx, tx_curr, combined;
758+
759+ /* Calculate maximums allowed:
760+ * - Take into account the number of available IRQs
761+ * - Do not take into account the number of online CPUs so that
762+ * the user can over-subscribe if desired
763+ * - Tx is additionally limited by the number of hardware queues
764+ */
765+ rx = min(pdata->hw_feat.rx_ch_cnt, pdata->rx_max_channel_count);
766+ rx = min(rx, pdata->channel_irq_count);
767+ tx = min(pdata->hw_feat.tx_ch_cnt, pdata->tx_max_channel_count);
768+ tx = min(tx, pdata->tx_max_q_count);
769+ tx = min(tx, pdata->channel_irq_count);
770+
771+ combined = min(rx, tx);
772+
773+ /* Should not be setting other count */
774+ if (channels->other_count) {
775+ netdev_err(netdev,
776+ "other channel count must be zero\n");
777+ return -EINVAL;
778+ }
779+
780+ /* Require at least one Combined (Rx and Tx) channel */
781+ if (!channels->combined_count) {
782+ netdev_err(netdev,
783+ "at least one combined Rx/Tx channel is required\n");
784+ xgbe_print_set_channels_input(netdev, channels);
785+ return -EINVAL;
786+ }
787+
788+ /* Check combined channels */
789+ if (channels->combined_count > combined) {
790+ netdev_err(netdev,
791+ "combined channel count cannot exceed %u\n",
792+ combined);
793+ xgbe_print_set_channels_input(netdev, channels);
794+ return -EINVAL;
795+ }
796+
797+ /* Can have some Rx-only or Tx-only channels, but not both */
798+ if (channels->rx_count && channels->tx_count) {
799+ netdev_err(netdev,
800+ "cannot specify both Rx-only and Tx-only channels\n");
801+ xgbe_print_set_channels_input(netdev, channels);
802+ return -EINVAL;
803+ }
804+
805+ /* Check that we don't exceed the maximum number of channels */
806+ if ((channels->combined_count + channels->rx_count) > rx) {
807+ netdev_err(netdev,
808+ "total Rx channels (%u) requested exceeds maximum available (%u)\n",
809+ channels->combined_count + channels->rx_count, rx);
810+ xgbe_print_set_channels_input(netdev, channels);
811+ return -EINVAL;
812+ }
813+
814+ if ((channels->combined_count + channels->tx_count) > tx) {
815+ netdev_err(netdev,
816+ "total Tx channels (%u) requested exceeds maximum available (%u)\n",
817+ channels->combined_count + channels->tx_count, tx);
818+ xgbe_print_set_channels_input(netdev, channels);
819+ return -EINVAL;
820+ }
821+
822+ rx = channels->combined_count + channels->rx_count;
823+ tx = channels->combined_count + channels->tx_count;
824+
825+ rx_curr = pdata->new_rx_ring_count ? : pdata->rx_ring_count;
826+ tx_curr = pdata->new_tx_ring_count ? : pdata->tx_ring_count;
827+
828+ if ((rx == rx_curr) && (tx == tx_curr))
829+ goto out;
830+
831+ pdata->new_rx_ring_count = rx;
832+ pdata->new_tx_ring_count = tx;
833+
834+ xgbe_full_restart_dev(pdata);
835+
836+out:
837+ return 0;
838+}
839+
629840 static const struct ethtool_ops xgbe_ethtool_ops = {
630841 .get_drvinfo = xgbe_get_drvinfo,
631842 .get_msglevel = xgbe_get_msglevel,
@@ -646,6 +857,12 @@ static const struct ethtool_ops xgbe_ethtool_ops = { · 14 unmodified lines
646857 .get_ts_info = xgbe_get_ts_info,
647858 .get_link_ksettings = xgbe_get_link_ksettings,
648859 .set_link_ksettings = xgbe_set_link_ksettings,
860+ .get_module_info = xgbe_get_module_info,
861+ .get_module_eeprom = xgbe_get_module_eeprom,
862+ .get_ringparam = xgbe_get_ringparam,
863+ .set_ringparam = xgbe_set_ringparam,
864+ .get_channels = xgbe_get_channels,
865+ .set_channels = xgbe_set_channels,
649866 };
650867
651868 const struct ethtool_ops *xgbe_get_ethtool_ops(void)
drivers/net/ethernet/amd/xgbe/xgbe-main.c+1−19
@@ -265,7 +265,6 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) · 264 unmodified lines
265265 {
266266 struct net_device *netdev = pdata->netdev;
267267 struct device *dev = pdata->dev;
268− unsigned int i;
269268 int ret;
270269
271270 netdev->irq = pdata->dev_irq;
@@ -324,26 +323,9 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata) · 52 unmodified lines
324323 pdata->tx_ring_count, pdata->rx_ring_count);
325324 }
326325
327− /* Set the number of queues */
328− ret = netif_set_real_num_tx_queues(netdev, pdata->tx_ring_count);
329− if (ret) {
330− dev_err(dev, "error setting real tx queue count\n");
331− return ret;
332− }
333−
334− ret = netif_set_real_num_rx_queues(netdev, pdata->rx_ring_count);
335− if (ret) {
336− dev_err(dev, "error setting real rx queue count\n");
337− return ret;
338− }
339−
340− /* Initialize RSS hash key and lookup table */
326+ /* Initialize RSS hash key */
341327 netdev_rss_key_fill(pdata->rss_key, sizeof(pdata->rss_key));
342328
343− for (i = 0; i < XGBE_RSS_MAX_TABLE_SIZE; i++)
344− XGMAC_SET_BITS(pdata->rss_table[i], MAC_RSSDR, DMCH,
345− i % pdata->rx_ring_count);
346−
347329 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, IP2TE, 1);
348330 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, TCP4TE, 1);
349331 XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c+80−87
@@ -126,6 +126,24 @@ · 125 unmodified lines
126126 #include "xgbe.h"
127127 #include "xgbe-common.h"
128128
129+static int xgbe_phy_module_eeprom(struct xgbe_prv_data *pdata,
130+ struct ethtool_eeprom *eeprom, u8 *data)
131+{
132+ if (!pdata->phy_if.phy_impl.module_eeprom)
133+ return -ENXIO;
134+
135+ return pdata->phy_if.phy_impl.module_eeprom(pdata, eeprom, data);
136+}
137+
138+static int xgbe_phy_module_info(struct xgbe_prv_data *pdata,
139+ struct ethtool_modinfo *modinfo)
140+{
141+ if (!pdata->phy_if.phy_impl.module_info)
142+ return -ENXIO;
143+
144+ return pdata->phy_if.phy_impl.module_info(pdata, modinfo);
145+}
146+
129147 static void xgbe_an37_clear_interrupts(struct xgbe_prv_data *pdata)
130148 {
131149 int reg;
@@ -198,31 +216,8 @@ static void xgbe_an_clear_interrupts_all(struct xgbe_prv_data *pdata) · 66 unmodified lines
198216 xgbe_an37_clear_interrupts(pdata);
199217 }
200218
201−static void xgbe_an73_enable_kr_training(struct xgbe_prv_data *pdata)
202−{
203− unsigned int reg;
204−
205− reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL);
206−
207− reg |= XGBE_KR_TRAINING_ENABLE;
208− XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);
209−}
210−
211−static void xgbe_an73_disable_kr_training(struct xgbe_prv_data *pdata)
212−{
213− unsigned int reg;
214−
215− reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL);
216−
217− reg &= ~XGBE_KR_TRAINING_ENABLE;
218− XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);
219−}
220−
221219 static void xgbe_kr_mode(struct xgbe_prv_data *pdata)
222220 {
223− /* Enable KR training */
224− xgbe_an73_enable_kr_training(pdata);
225−
226221 /* Set MAC to 10G speed */
227222 pdata->hw_if.set_speed(pdata, SPEED_10000);
228223
@@ -232,9 +227,6 @@ static void xgbe_kr_mode(struct xgbe_prv_data *pdata) · 3 unmodified lines
232227
233228 static void xgbe_kx_2500_mode(struct xgbe_prv_data *pdata)
234229 {
235− /* Disable KR training */
236− xgbe_an73_disable_kr_training(pdata);
237−
238230 /* Set MAC to 2.5G speed */
239231 pdata->hw_if.set_speed(pdata, SPEED_2500);
240232
@@ -244,9 +236,6 @@ static void xgbe_kx_2500_mode(struct xgbe_prv_data *pdata) · 3 unmodified lines
244236
245237 static void xgbe_kx_1000_mode(struct xgbe_prv_data *pdata)
246238 {
247− /* Disable KR training */
248− xgbe_an73_disable_kr_training(pdata);
249−
250239 /* Set MAC to 1G speed */
251240 pdata->hw_if.set_speed(pdata, SPEED_1000);
252241
@@ -260,9 +249,6 @@ static void xgbe_sfi_mode(struct xgbe_prv_data *pdata) · 7 unmodified lines
260249 if (pdata->kr_redrv)
261250 return xgbe_kr_mode(pdata);
262251
263− /* Disable KR training */
264− xgbe_an73_disable_kr_training(pdata);
265−
266252 /* Set MAC to 10G speed */
267253 pdata->hw_if.set_speed(pdata, SPEED_10000);
268254
@@ -272,9 +258,6 @@ static void xgbe_sfi_mode(struct xgbe_prv_data *pdata) · 3 unmodified lines
272258
273259 static void xgbe_x_mode(struct xgbe_prv_data *pdata)
274260 {
275− /* Disable KR training */
276− xgbe_an73_disable_kr_training(pdata);
277−
278261 /* Set MAC to 1G speed */
279262 pdata->hw_if.set_speed(pdata, SPEED_1000);
280263
@@ -284,9 +267,6 @@ static void xgbe_x_mode(struct xgbe_prv_data *pdata) · 3 unmodified lines
284267
285268 static void xgbe_sgmii_1000_mode(struct xgbe_prv_data *pdata)
286269 {
287− /* Disable KR training */
288− xgbe_an73_disable_kr_training(pdata);
289−
290270 /* Set MAC to 1G speed */
291271 pdata->hw_if.set_speed(pdata, SPEED_1000);
292272
@@ -296,9 +276,6 @@ static void xgbe_sgmii_1000_mode(struct xgbe_prv_data *pdata) · 3 unmodified lines
296276
297277 static void xgbe_sgmii_100_mode(struct xgbe_prv_data *pdata)
298278 {
299− /* Disable KR training */
300− xgbe_an73_disable_kr_training(pdata);
301−
302279 /* Set MAC to 1G speed */
303280 pdata->hw_if.set_speed(pdata, SPEED_1000);
304281
@@ -354,13 +331,15 @@ static void xgbe_switch_mode(struct xgbe_prv_data *pdata) · 49 unmodified lines
354331 xgbe_change_mode(pdata, pdata->phy_if.phy_impl.switch_mode(pdata));
355332 }
356333
357−static void xgbe_set_mode(struct xgbe_prv_data *pdata,
334+static bool xgbe_set_mode(struct xgbe_prv_data *pdata,
358335 enum xgbe_mode mode)
359336 {
360337 if (mode == xgbe_cur_mode(pdata))
361− return;
338+ return false;
362339
363340 xgbe_change_mode(pdata, mode);
341+
342+ return true;
364343 }
365344
366345 static bool xgbe_use_mode(struct xgbe_prv_data *pdata,
@@ -407,6 +386,12 @@ static void xgbe_an73_set(struct xgbe_prv_data *pdata, bool enable, · 40 unmodified lines
407386 {
408387 unsigned int reg;
409388
389+ /* Disable KR training for now */
390+ reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL);
391+ reg &= ~XGBE_KR_TRAINING_ENABLE;
392+ XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);
393+
394+ /* Update AN settings */
410395 reg = XMDIO_READ(pdata, MDIO_MMD_AN, MDIO_CTRL1);
411396 reg &= ~MDIO_AN_CTRL1_ENABLE;
412397
@@ -504,21 +489,19 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata, · 91 unmodified lines
504489 XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_FECCTRL, reg);
505490
506491 /* Start KR training */
507− reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL);
508− if (reg & XGBE_KR_TRAINING_ENABLE) {
509− if (pdata->phy_if.phy_impl.kr_training_pre)
510− pdata->phy_if.phy_impl.kr_training_pre(pdata);
492+ if (pdata->phy_if.phy_impl.kr_training_pre)
493+ pdata->phy_if.phy_impl.kr_training_pre(pdata);
511494
512− reg |= XGBE_KR_TRAINING_START;
513− XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL,
514− reg);
495+ reg = XMDIO_READ(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL);
496+ reg |= XGBE_KR_TRAINING_ENABLE;
497+ reg |= XGBE_KR_TRAINING_START;
498+ XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL, reg);
515499
516− netif_dbg(pdata, link, pdata->netdev,
517− "KR training initiated\n");
500+ netif_dbg(pdata, link, pdata->netdev,
501+ "KR training initiated\n");
518502
519− if (pdata->phy_if.phy_impl.kr_training_post)
520− pdata->phy_if.phy_impl.kr_training_post(pdata);
521− }
503+ if (pdata->phy_if.phy_impl.kr_training_post)
504+ pdata->phy_if.phy_impl.kr_training_post(pdata);
522505
523506 return XGBE_AN_PAGE_RECEIVED;
524507 }
@@ -1197,21 +1180,23 @@ static int xgbe_phy_config_fixed(struct xgbe_prv_data *pdata) · 672 unmodified lines
11971180 return 0;
11981181 }
11991182
1200−static int __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata)
1183+static int __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata, bool set_mode)
12011184 {
12021185 int ret;
12031186
1187+ mutex_lock(&pdata->an_mutex);
1188+
12041189 set_bit(XGBE_LINK_INIT, &pdata->dev_state);
12051190 pdata->link_check = jiffies;
12061191
12071192 ret = pdata->phy_if.phy_impl.an_config(pdata);
12081193 if (ret)
1209− return ret;
1194+ goto out;
12101195
12111196 if (pdata->phy.autoneg != AUTONEG_ENABLE) {
12121197 ret = xgbe_phy_config_fixed(pdata);
12131198 if (ret || !pdata->kr_redrv)
1214− return ret;
1199+ goto out;
12151200
12161201 netif_dbg(pdata, link, pdata->netdev, "AN redriver support\n");
12171202 } else {
@@ -1221,24 +1206,27 @@ static int __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata) · 3 unmodified lines
12211206 /* Disable auto-negotiation interrupt */
12221207 disable_irq(pdata->an_irq);
12231208
1224− /* Start auto-negotiation in a supported mode */
1225− if (xgbe_use_mode(pdata, XGBE_MODE_KR)) {
1226− xgbe_set_mode(pdata, XGBE_MODE_KR);
1227− } else if (xgbe_use_mode(pdata, XGBE_MODE_KX_2500)) {
1228− xgbe_set_mode(pdata, XGBE_MODE_KX_2500);
1229− } else if (xgbe_use_mode(pdata, XGBE_MODE_KX_1000)) {
1230− xgbe_set_mode(pdata, XGBE_MODE_KX_1000);
1231− } else if (xgbe_use_mode(pdata, XGBE_MODE_SFI)) {
1232− xgbe_set_mode(pdata, XGBE_MODE_SFI);
1233− } else if (xgbe_use_mode(pdata, XGBE_MODE_X)) {
1234− xgbe_set_mode(pdata, XGBE_MODE_X);
1235− } else if (xgbe_use_mode(pdata, XGBE_MODE_SGMII_1000)) {
1236− xgbe_set_mode(pdata, XGBE_MODE_SGMII_1000);
1237− } else if (xgbe_use_mode(pdata, XGBE_MODE_SGMII_100)) {
1238− xgbe_set_mode(pdata, XGBE_MODE_SGMII_100);
1239− } else {
1240− enable_irq(pdata->an_irq);
1241− return -EINVAL;
1209+ if (set_mode) {
1210+ /* Start auto-negotiation in a supported mode */
1211+ if (xgbe_use_mode(pdata, XGBE_MODE_KR)) {
1212+ xgbe_set_mode(pdata, XGBE_MODE_KR);
1213+ } else if (xgbe_use_mode(pdata, XGBE_MODE_KX_2500)) {
1214+ xgbe_set_mode(pdata, XGBE_MODE_KX_2500);
1215+ } else if (xgbe_use_mode(pdata, XGBE_MODE_KX_1000)) {
1216+ xgbe_set_mode(pdata, XGBE_MODE_KX_1000);
1217+ } else if (xgbe_use_mode(pdata, XGBE_MODE_SFI)) {
1218+ xgbe_set_mode(pdata, XGBE_MODE_SFI);
1219+ } else if (xgbe_use_mode(pdata, XGBE_MODE_X)) {
1220+ xgbe_set_mode(pdata, XGBE_MODE_X);
1221+ } else if (xgbe_use_mode(pdata, XGBE_MODE_SGMII_1000)) {
1222+ xgbe_set_mode(pdata, XGBE_MODE_SGMII_1000);
1223+ } else if (xgbe_use_mode(pdata, XGBE_MODE_SGMII_100)) {
1224+ xgbe_set_mode(pdata, XGBE_MODE_SGMII_100);
1225+ } else {
1226+ enable_irq(pdata->an_irq);
1227+ ret = -EINVAL;
1228+ goto out;
1229+ }
12421230 }
12431231
12441232 /* Disable and stop any in progress auto-negotiation */
@@ -1258,16 +1246,7 @@ static int __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata) · 13 unmodified lines
12581246 xgbe_an_init(pdata);
12591247 xgbe_an_restart(pdata);
12601248
1261− return 0;
1262−}
1263−
1264−static int xgbe_phy_config_aneg(struct xgbe_prv_data *pdata)
1265−{
1266− int ret;
1267−
1268− mutex_lock(&pdata->an_mutex);
1269−
1270− ret = __xgbe_phy_config_aneg(pdata);
1249+out:
12711250 if (ret)
12721251 set_bit(XGBE_LINK_ERR, &pdata->dev_state);
12731252 else
@@ -1278,6 +1257,16 @@ static int xgbe_phy_config_aneg(struct xgbe_prv_data *pdata) · 4 unmodified lines
12781257 return ret;
12791258 }
12801259
1260+static int xgbe_phy_config_aneg(struct xgbe_prv_data *pdata)
1261+{
1262+ return __xgbe_phy_config_aneg(pdata, true);
1263+}
1264+
1265+static int xgbe_phy_reconfig_aneg(struct xgbe_prv_data *pdata)
1266+{
1267+ return __xgbe_phy_config_aneg(pdata, false);
1268+}
1269+
12811270 static bool xgbe_phy_aneg_done(struct xgbe_prv_data *pdata)
12821271 {
12831272 return (pdata->an_result == XGBE_AN_COMPLETE);
@@ -1334,7 +1323,8 @@ static void xgbe_phy_status_result(struct xgbe_prv_data *pdata) · 50 unmodified lines
13341323
13351324 pdata->phy.duplex = DUPLEX_FULL;
13361325
1337− xgbe_set_mode(pdata, mode);
1326+ if (xgbe_set_mode(pdata, mode) && pdata->an_again)
1327+ xgbe_phy_reconfig_aneg(pdata);
13381328 }
13391329
13401330 static void xgbe_phy_status(struct xgbe_prv_data *pdata)
@@ -1639,4 +1629,7 @@ void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *phy_if) · 298 unmodified lines
16391629 phy_if->phy_valid_speed = xgbe_phy_valid_speed;
16401630
16411631 phy_if->an_isr = xgbe_an_combined_isr;
1632+
1633+ phy_if->module_info = xgbe_phy_module_info;
1634+ phy_if->module_eeprom = xgbe_phy_module_eeprom;
16421635 }
drivers/net/ethernet/amd/xgbe/xgbe-pci.c+27−9
@@ -335,16 +335,33 @@ static int xgbe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 334 unmodified lines
335335 pdata->awcr = XGBE_DMA_PCI_AWCR;
336336 pdata->awarcr = XGBE_DMA_PCI_AWARCR;
337337
338+ /* Read the port property registers */
339+ pdata->pp0 = XP_IOREAD(pdata, XP_PROP_0);
340+ pdata->pp1 = XP_IOREAD(pdata, XP_PROP_1);
341+ pdata->pp2 = XP_IOREAD(pdata, XP_PROP_2);
342+ pdata->pp3 = XP_IOREAD(pdata, XP_PROP_3);
343+ pdata->pp4 = XP_IOREAD(pdata, XP_PROP_4);
344+ if (netif_msg_probe(pdata)) {
345+ dev_dbg(dev, "port property 0 = %#010x\n", pdata->pp0);
346+ dev_dbg(dev, "port property 1 = %#010x\n", pdata->pp1);
347+ dev_dbg(dev, "port property 2 = %#010x\n", pdata->pp2);
348+ dev_dbg(dev, "port property 3 = %#010x\n", pdata->pp3);
349+ dev_dbg(dev, "port property 4 = %#010x\n", pdata->pp4);
350+ }
351+
338352 /* Set the maximum channels and queues */
339− reg = XP_IOREAD(pdata, XP_PROP_1);
340− pdata->tx_max_channel_count = XP_GET_BITS(reg, XP_PROP_1, MAX_TX_DMA);
341− pdata->rx_max_channel_count = XP_GET_BITS(reg, XP_PROP_1, MAX_RX_DMA);
342− pdata->tx_max_q_count = XP_GET_BITS(reg, XP_PROP_1, MAX_TX_QUEUES);
343− pdata->rx_max_q_count = XP_GET_BITS(reg, XP_PROP_1, MAX_RX_QUEUES);
353+ pdata->tx_max_channel_count = XP_GET_BITS(pdata->pp1, XP_PROP_1,
354+ MAX_TX_DMA);
355+ pdata->rx_max_channel_count = XP_GET_BITS(pdata->pp1, XP_PROP_1,
356+ MAX_RX_DMA);
357+ pdata->tx_max_q_count = XP_GET_BITS(pdata->pp1, XP_PROP_1,
358+ MAX_TX_QUEUES);
359+ pdata->rx_max_q_count = XP_GET_BITS(pdata->pp1, XP_PROP_1,
360+ MAX_RX_QUEUES);
344361 if (netif_msg_probe(pdata)) {
345362 dev_dbg(dev, "max tx/rx channel count = %u/%u\n",
346363 pdata->tx_max_channel_count,
347− pdata->tx_max_channel_count);
364+ pdata->rx_max_channel_count);
348365 dev_dbg(dev, "max tx/rx hw queue count = %u/%u\n",
349366 pdata->tx_max_q_count, pdata->rx_max_q_count);
350367 }
@@ -353,12 +370,13 @@ static int xgbe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 2 unmodified lines
353370 xgbe_set_counts(pdata);
354371
355372 /* Set the maximum fifo amounts */
356− reg = XP_IOREAD(pdata, XP_PROP_2);
357− pdata->tx_max_fifo_size = XP_GET_BITS(reg, XP_PROP_2, TX_FIFO_SIZE);
373+ pdata->tx_max_fifo_size = XP_GET_BITS(pdata->pp2, XP_PROP_2,
374+ TX_FIFO_SIZE);
358375 pdata->tx_max_fifo_size *= 16384;
359376 pdata->tx_max_fifo_size = min(pdata->tx_max_fifo_size,
360377 pdata->vdata->tx_max_fifo_size);
361− pdata->rx_max_fifo_size = XP_GET_BITS(reg, XP_PROP_2, RX_FIFO_SIZE);
378+ pdata->rx_max_fifo_size = XP_GET_BITS(pdata->pp2, XP_PROP_2,
379+ RX_FIFO_SIZE);
362380 pdata->rx_max_fifo_size *= 16384;
363381 pdata->rx_max_fifo_size = min(pdata->rx_max_fifo_size,
364382 pdata->vdata->rx_max_fifo_size);
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c+251−98
@@ -119,6 +119,7 @@ · 118 unmodified lines
119119 #include <linux/kmod.h>
120120 #include <linux/mdio.h>
121121 #include <linux/phy.h>
122+#include <linux/ethtool.h>
122123
123124 #include "xgbe.h"
124125 #include "xgbe-common.h"
@@ -270,6 +271,15 @@ struct xgbe_sfp_eeprom { · 145 unmodified lines
270271 u8 vendor[32];
271272 };
272273
274+#define XGBE_SFP_DIAGS_SUPPORTED(_x) \
275+ ((_x)->extd[XGBE_SFP_EXTD_SFF_8472] && \
276+ !((_x)->extd[XGBE_SFP_EXTD_DIAG] & XGBE_SFP_EXTD_DIAG_ADDR_CHANGE))
277+
278+#define XGBE_SFP_EEPROM_BASE_LEN 256
279+#define XGBE_SFP_EEPROM_DIAG_LEN 256
280+#define XGBE_SFP_EEPROM_MAX (XGBE_SFP_EEPROM_BASE_LEN + \
281+ XGBE_SFP_EEPROM_DIAG_LEN)
282+
273283 #define XGBE_BEL_FUSE_VENDOR "BEL-FUSE "
274284 #define XGBE_BEL_FUSE_PARTNO "1GBT-SFP06 "
275285
@@ -327,8 +337,6 @@ struct xgbe_phy_data { · 51 unmodified lines
327337
328338 unsigned int mdio_addr;
329339
330− unsigned int comm_owned;
331−
332340 /* SFP Support */
333341 enum xgbe_sfp_comm sfp_comm;
334342 unsigned int sfp_mux_address;
@@ -345,7 +353,6 @@ struct xgbe_phy_data { · 10 unmodified lines
345353 unsigned int sfp_rx_los;
346354 unsigned int sfp_tx_fault;
347355 unsigned int sfp_mod_absent;
348− unsigned int sfp_diags;
349356 unsigned int sfp_changed;
350357 unsigned int sfp_phy_avail;
351358 unsigned int sfp_cable_len;
@@ -382,12 +389,6 @@ static enum xgbe_an_mode xgbe_phy_an_mode(struct xgbe_prv_data *pdata); · 30 unmodified lines
382389 static int xgbe_phy_i2c_xfer(struct xgbe_prv_data *pdata,
383390 struct xgbe_i2c_op *i2c_op)
384391 {
385− struct xgbe_phy_data *phy_data = pdata->phy_data;
386−
387− /* Be sure we own the bus */
388− if (WARN_ON(!phy_data->comm_owned))
389− return -EIO;
390−
391392 return pdata->i2c_if.i2c_xfer(pdata, i2c_op);
392393 }
393394
@@ -549,10 +550,6 @@ static int xgbe_phy_sfp_get_mux(struct xgbe_prv_data *pdata) · 155 unmodified lines
549550
550551 static void xgbe_phy_put_comm_ownership(struct xgbe_prv_data *pdata)
551552 {
552− struct xgbe_phy_data *phy_data = pdata->phy_data;
553−
554− phy_data->comm_owned = 0;
555−
556553 mutex_unlock(&xgbe_phy_comm_lock);
557554 }
558555
@@ -562,9 +559,6 @@ static int xgbe_phy_get_comm_ownership(struct xgbe_prv_data *pdata) · 3 unmodified lines
562559 unsigned long timeout;
563560 unsigned int mutex_id;
564561
565− if (phy_data->comm_owned)
566− return 0;
567−
568562 /* The I2C and MDIO/GPIO bus is multiplexed between multiple devices,
569563 * the driver needs to take the software mutex and then the hardware
570564 * mutexes before being able to use the busses.
@@ -593,7 +587,6 @@ static int xgbe_phy_get_comm_ownership(struct xgbe_prv_data *pdata) · 22 unmodified lines
593587 XP_IOWRITE(pdata, XP_I2C_MUTEX, mutex_id);
594588 XP_IOWRITE(pdata, XP_MDIO_MUTEX, mutex_id);
595589
596− phy_data->comm_owned = 1;
597590 return 0;
598591 }
599592
@@ -867,6 +860,9 @@ static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata) · 267 unmodified lines
867860 struct xgbe_phy_data *phy_data = pdata->phy_data;
868861 unsigned int phy_id = phy_data->phydev->phy_id;
869862
863+ if (phy_data->port_mode != XGBE_PORT_MODE_SFP)
864+ return false;
865+
870866 if ((phy_id & 0xfffffff0) != 0x01ff0cc0)
871867 return false;
872868
@@ -892,8 +888,83 @@ static bool xgbe_phy_finisar_phy_quirks(struct xgbe_prv_data *pdata) · 19 unmodified lines
892888 return true;
893889 }
894890
891+static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata)
892+{
893+ struct xgbe_phy_data *phy_data = pdata->phy_data;
894+ struct xgbe_sfp_eeprom *sfp_eeprom = &phy_data->sfp_eeprom;
895+ unsigned int phy_id = phy_data->phydev->phy_id;
896+ int reg;
897+
898+ if (phy_data->port_mode != XGBE_PORT_MODE_SFP)
899+ return false;
900+
901+ if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME],
902+ XGBE_BEL_FUSE_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN))
903+ return false;
904+
905+ /* For Bel-Fuse, use the extra AN flag */
906+ pdata->an_again = 1;
907+
908+ if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_PN],
909+ XGBE_BEL_FUSE_PARTNO, XGBE_SFP_BASE_VENDOR_PN_LEN))
910+ return false;
911+
912+ if ((phy_id & 0xfffffff0) != 0x03625d10)
913+ return false;
914+
915+ /* Disable RGMII mode */
916+ phy_write(phy_data->phydev, 0x18, 0x7007);
917+ reg = phy_read(phy_data->phydev, 0x18);
918+ phy_write(phy_data->phydev, 0x18, reg & ~0x0080);
919+
920+ /* Enable fiber register bank */
921+ phy_write(phy_data->phydev, 0x1c, 0x7c00);
922+ reg = phy_read(phy_data->phydev, 0x1c);
923+ reg &= 0x03ff;
924+ reg &= ~0x0001;
925+ phy_write(phy_data->phydev, 0x1c, 0x8000 | 0x7c00 | reg | 0x0001);
926+
927+ /* Power down SerDes */
928+ reg = phy_read(phy_data->phydev, 0x00);
929+ phy_write(phy_data->phydev, 0x00, reg | 0x00800);
930+
931+ /* Configure SGMII-to-Copper mode */
932+ phy_write(phy_data->phydev, 0x1c, 0x7c00);
933+ reg = phy_read(phy_data->phydev, 0x1c);
934+ reg &= 0x03ff;
935+ reg &= ~0x0006;
936+ phy_write(phy_data->phydev, 0x1c, 0x8000 | 0x7c00 | reg | 0x0004);
937+
938+ /* Power up SerDes */
939+ reg = phy_read(phy_data->phydev, 0x00);
940+ phy_write(phy_data->phydev, 0x00, reg & ~0x00800);
941+
942+ /* Enable copper register bank */
943+ phy_write(phy_data->phydev, 0x1c, 0x7c00);
944+ reg = phy_read(phy_data->phydev, 0x1c);
945+ reg &= 0x03ff;
946+ reg &= ~0x0001;
947+ phy_write(phy_data->phydev, 0x1c, 0x8000 | 0x7c00 | reg);
948+
949+ /* Power up SerDes */
950+ reg = phy_read(phy_data->phydev, 0x00);
951+ phy_write(phy_data->phydev, 0x00, reg & ~0x00800);
952+
953+ phy_data->phydev->supported = PHY_GBIT_FEATURES;
954+ phy_data->phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
955+ phy_data->phydev->advertising = phy_data->phydev->supported;
956+
957+ netif_dbg(pdata, drv, pdata->netdev,
958+ "BelFuse PHY quirk in place\n");
959+
960+ return true;
961+}
962+
895963 static void xgbe_phy_external_phy_quirks(struct xgbe_prv_data *pdata)
896964 {
965+ if (xgbe_phy_belfuse_phy_quirks(pdata))
966+ return;
967+
897968 if (xgbe_phy_finisar_phy_quirks(pdata))
898969 return;
899970 }
@@ -910,6 +981,9 @@ static int xgbe_phy_find_phy_device(struct xgbe_prv_data *pdata) · 10 unmodified lines
910981 if (phy_data->phydev)
911982 return 0;
912983
984+ /* Clear the extra AN flag */
985+ pdata->an_again = 0;
986+
913987 /* Check for the use of an external PHY */
914988 if (phy_data->phydev_mode == XGBE_MDIO_MODE_NONE)
915989 return 0;
@@ -1034,37 +1108,6 @@ static bool xgbe_phy_check_sfp_mod_absent(struct xgbe_phy_data *phy_data) · 118 unmodified lines
10341108 return false;
10351109 }
10361110
1037−static bool xgbe_phy_belfuse_parse_quirks(struct xgbe_prv_data *pdata)
1038−{
1039− struct xgbe_phy_data *phy_data = pdata->phy_data;
1040− struct xgbe_sfp_eeprom *sfp_eeprom = &phy_data->sfp_eeprom;
1041−
1042− if (memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_NAME],
1043− XGBE_BEL_FUSE_VENDOR, XGBE_SFP_BASE_VENDOR_NAME_LEN))
1044− return false;
1045−
1046− if (!memcmp(&sfp_eeprom->base[XGBE_SFP_BASE_VENDOR_PN],
1047− XGBE_BEL_FUSE_PARTNO, XGBE_SFP_BASE_VENDOR_PN_LEN)) {
1048− phy_data->sfp_base = XGBE_SFP_BASE_1000_SX;
1049− phy_data->sfp_cable = XGBE_SFP_CABLE_ACTIVE;
1050− phy_data->sfp_speed = XGBE_SFP_SPEED_1000;
1051− if (phy_data->sfp_changed)
1052− netif_dbg(pdata, drv, pdata->netdev,
1053− "Bel-Fuse SFP quirk in place\n");
1054− return true;
1055− }
1056−
1057− return false;
1058−}
1059−
1060−static bool xgbe_phy_sfp_parse_quirks(struct xgbe_prv_data *pdata)
1061−{
1062− if (xgbe_phy_belfuse_parse_quirks(pdata))
1063− return true;
1064−
1065− return false;
1066−}
1067−
10681111 static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata)
10691112 {
10701113 struct xgbe_phy_data *phy_data = pdata->phy_data;
@@ -1083,9 +1126,6 @@ static void xgbe_phy_sfp_parse_eeprom(struct xgbe_prv_data *pdata) · 12 unmodified lines
10831126 phy_data->sfp_tx_fault = xgbe_phy_check_sfp_tx_fault(phy_data);
10841127 phy_data->sfp_rx_los = xgbe_phy_check_sfp_rx_los(phy_data);
10851128
1086− if (xgbe_phy_sfp_parse_quirks(pdata))
1087− return;
1088−
10891129 /* Assume ACTIVE cable unless told it is PASSIVE */
10901130 if (sfp_base[XGBE_SFP_BASE_CABLE] & XGBE_SFP_BASE_CABLE_PASSIVE) {
10911131 phy_data->sfp_cable = XGBE_SFP_CABLE_PASSIVE;
@@ -1227,13 +1267,6 @@ static int xgbe_phy_sfp_read_eeprom(struct xgbe_prv_data *pdata) · 135 unmodified lines
12271267
12281268 memcpy(&phy_data->sfp_eeprom, &sfp_eeprom, sizeof(sfp_eeprom));
12291269
1230− if (sfp_eeprom.extd[XGBE_SFP_EXTD_SFF_8472]) {
1231− u8 diag_type = sfp_eeprom.extd[XGBE_SFP_EXTD_DIAG];
1232−
1233− if (!(diag_type & XGBE_SFP_EXTD_DIAG_ADDR_CHANGE))
1234− phy_data->sfp_diags = 1;
1235− }
1236−
12371270 xgbe_phy_free_phy_device(pdata);
12381271 } else {
12391272 phy_data->sfp_changed = 0;
@@ -1283,7 +1316,6 @@ static void xgbe_phy_sfp_reset(struct xgbe_phy_data *phy_data) · 43 unmodified lines
12831316 phy_data->sfp_rx_los = 0;
12841317 phy_data->sfp_tx_fault = 0;
12851318 phy_data->sfp_mod_absent = 1;
1286− phy_data->sfp_diags = 0;
12871319 phy_data->sfp_base = XGBE_SFP_BASE_UNKNOWN;
12881320 phy_data->sfp_cable = XGBE_SFP_CABLE_UNKNOWN;
12891321 phy_data->sfp_speed = XGBE_SFP_SPEED_UNKNOWN;
@@ -1326,6 +1358,130 @@ put: · 36 unmodified lines
13261358 xgbe_phy_put_comm_ownership(pdata);
13271359 }
13281360
1361+static int xgbe_phy_module_eeprom(struct xgbe_prv_data *pdata,
1362+ struct ethtool_eeprom *eeprom, u8 *data)
1363+{
1364+ struct xgbe_phy_data *phy_data = pdata->phy_data;
1365+ u8 eeprom_addr, eeprom_data[XGBE_SFP_EEPROM_MAX];
1366+ struct xgbe_sfp_eeprom *sfp_eeprom;
1367+ unsigned int i, j, rem;
1368+ int ret;
1369+
1370+ rem = eeprom->len;
1371+
1372+ if (!eeprom->len) {
1373+ ret = -EINVAL;
1374+ goto done;
1375+ }
1376+
1377+ if ((eeprom->offset + eeprom->len) > XGBE_SFP_EEPROM_MAX) {
1378+ ret = -EINVAL;
1379+ goto done;
1380+ }
1381+
1382+ if (phy_data->port_mode != XGBE_PORT_MODE_SFP) {
1383+ ret = -ENXIO;
1384+ goto done;
1385+ }
1386+
1387+ if (!netif_running(pdata->netdev)) {
1388+ ret = -EIO;
1389+ goto done;
1390+ }
1391+
1392+ if (phy_data->sfp_mod_absent) {
1393+ ret = -EIO;
1394+ goto done;
1395+ }
1396+
1397+ ret = xgbe_phy_get_comm_ownership(pdata);
1398+ if (ret) {
1399+ ret = -EIO;
1400+ goto done;
1401+ }
1402+
1403+ ret = xgbe_phy_sfp_get_mux(pdata);
1404+ if (ret) {
1405+ netdev_err(pdata->netdev, "I2C error setting SFP MUX\n");
1406+ ret = -EIO;
1407+ goto put_own;
1408+ }
1409+
1410+ /* Read the SFP serial ID eeprom */
1411+ eeprom_addr = 0;
1412+ ret = xgbe_phy_i2c_read(pdata, XGBE_SFP_SERIAL_ID_ADDRESS,
1413+ &eeprom_addr, sizeof(eeprom_addr),
1414+ eeprom_data, XGBE_SFP_EEPROM_BASE_LEN);
1415+ if (ret) {
1416+ netdev_err(pdata->netdev,
1417+ "I2C error reading SFP EEPROM\n");
1418+ ret = -EIO;
1419+ goto put_mux;
1420+ }
1421+
1422+ sfp_eeprom = (struct xgbe_sfp_eeprom *)eeprom_data;
1423+
1424+ if (XGBE_SFP_DIAGS_SUPPORTED(sfp_eeprom)) {
1425+ /* Read the SFP diagnostic eeprom */
1426+ eeprom_addr = 0;
1427+ ret = xgbe_phy_i2c_read(pdata, XGBE_SFP_DIAG_INFO_ADDRESS,
1428+ &eeprom_addr, sizeof(eeprom_addr),
1429+ eeprom_data + XGBE_SFP_EEPROM_BASE_LEN,
1430+ XGBE_SFP_EEPROM_DIAG_LEN);
1431+ if (ret) {
1432+ netdev_err(pdata->netdev,
1433+ "I2C error reading SFP DIAGS\n");
1434+ ret = -EIO;
1435+ goto put_mux;
1436+ }
1437+ }
1438+
1439+ for (i = 0, j = eeprom->offset; i < eeprom->len; i++, j++) {
1440+ if ((j >= XGBE_SFP_EEPROM_BASE_LEN) &&
1441+ !XGBE_SFP_DIAGS_SUPPORTED(sfp_eeprom))
1442+ break;
1443+
1444+ data[i] = eeprom_data[j];
1445+ rem--;
1446+ }
1447+
1448+put_mux:
1449+ xgbe_phy_sfp_put_mux(pdata);
1450+
1451+put_own:
1452+ xgbe_phy_put_comm_ownership(pdata);
1453+
1454+done:
1455+ eeprom->len -= rem;
1456+
1457+ return ret;
1458+}
1459+
1460+static int xgbe_phy_module_info(struct xgbe_prv_data *pdata,
1461+ struct ethtool_modinfo *modinfo)
1462+{
1463+ struct xgbe_phy_data *phy_data = pdata->phy_data;
1464+
1465+ if (phy_data->port_mode != XGBE_PORT_MODE_SFP)
1466+ return -ENXIO;
1467+
1468+ if (!netif_running(pdata->netdev))
1469+ return -EIO;
1470+
1471+ if (phy_data->sfp_mod_absent)
1472+ return -EIO;
1473+
1474+ if (XGBE_SFP_DIAGS_SUPPORTED(&phy_data->sfp_eeprom)) {
1475+ modinfo->type = ETH_MODULE_SFF_8472;
1476+ modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
1477+ } else {
1478+ modinfo->type = ETH_MODULE_SFF_8079;
1479+ modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
1480+ }
1481+
1482+ return 0;
1483+}
1484+
13291485 static void xgbe_phy_phydev_flowctrl(struct xgbe_prv_data *pdata)
13301486 {
13311487 struct ethtool_link_ksettings *lks = &pdata->phy.lks;
@@ -1611,6 +1767,10 @@ static void xgbe_phy_an_advertising(struct xgbe_prv_data *pdata, · 279 unmodified lines
16111767 XGBE_CLR_ADV(dlks, 1000baseKX_Full);
16121768 XGBE_CLR_ADV(dlks, 10000baseKR_Full);
16131769
1770+ /* Advertise FEC support is present */
1771+ if (pdata->fec_ability & MDIO_PMA_10GBR_FECABLE_ABLE)
1772+ XGBE_SET_ADV(dlks, 10000baseR_FEC);
1773+
16141774 switch (phy_data->port_mode) {
16151775 case XGBE_PORT_MODE_BACKPLANE:
16161776 XGBE_SET_ADV(dlks, 10000baseKR_Full);
@@ -2421,22 +2581,21 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart) · 804 unmodified lines
24212581 static void xgbe_phy_sfp_gpio_setup(struct xgbe_prv_data *pdata)
24222582 {
24232583 struct xgbe_phy_data *phy_data = pdata->phy_data;
2424− unsigned int reg;
2425−
2426− reg = XP_IOREAD(pdata, XP_PROP_3);
24272584
24282585 phy_data->sfp_gpio_address = XGBE_GPIO_ADDRESS_PCA9555 +
2429− XP_GET_BITS(reg, XP_PROP_3, GPIO_ADDR);
2586+ XP_GET_BITS(pdata->pp3, XP_PROP_3,
2587+ GPIO_ADDR);
24302588
2431− phy_data->sfp_gpio_mask = XP_GET_BITS(reg, XP_PROP_3, GPIO_MASK);
2589+ phy_data->sfp_gpio_mask = XP_GET_BITS(pdata->pp3, XP_PROP_3,
2590+ GPIO_MASK);
24322591
2433− phy_data->sfp_gpio_rx_los = XP_GET_BITS(reg, XP_PROP_3,
2592+ phy_data->sfp_gpio_rx_los = XP_GET_BITS(pdata->pp3, XP_PROP_3,
24342593 GPIO_RX_LOS);
2435− phy_data->sfp_gpio_tx_fault = XP_GET_BITS(reg, XP_PROP_3,
2594+ phy_data->sfp_gpio_tx_fault = XP_GET_BITS(pdata->pp3, XP_PROP_3,
24362595 GPIO_TX_FAULT);
2437− phy_data->sfp_gpio_mod_absent = XP_GET_BITS(reg, XP_PROP_3,
2596+ phy_data->sfp_gpio_mod_absent = XP_GET_BITS(pdata->pp3, XP_PROP_3,
24382597 GPIO_MOD_ABS);
2439− phy_data->sfp_gpio_rate_select = XP_GET_BITS(reg, XP_PROP_3,
2598+ phy_data->sfp_gpio_rate_select = XP_GET_BITS(pdata->pp3, XP_PROP_3,
24402599 GPIO_RATE_SELECT);
24412600
24422601 if (netif_msg_probe(pdata)) {
@@ -2458,18 +2617,17 @@ static void xgbe_phy_sfp_gpio_setup(struct xgbe_prv_data *pdata) · 15 unmodified lines
24582617 static void xgbe_phy_sfp_comm_setup(struct xgbe_prv_data *pdata)
24592618 {
24602619 struct xgbe_phy_data *phy_data = pdata->phy_data;
2461− unsigned int reg, mux_addr_hi, mux_addr_lo;
2620+ unsigned int mux_addr_hi, mux_addr_lo;
24622621
2463− reg = XP_IOREAD(pdata, XP_PROP_4);
2464−
2465− mux_addr_hi = XP_GET_BITS(reg, XP_PROP_4, MUX_ADDR_HI);
2466− mux_addr_lo = XP_GET_BITS(reg, XP_PROP_4, MUX_ADDR_LO);
2622+ mux_addr_hi = XP_GET_BITS(pdata->pp4, XP_PROP_4, MUX_ADDR_HI);
2623+ mux_addr_lo = XP_GET_BITS(pdata->pp4, XP_PROP_4, MUX_ADDR_LO);
24672624 if (mux_addr_lo == XGBE_SFP_DIRECT)
24682625 return;
24692626
24702627 phy_data->sfp_comm = XGBE_SFP_COMM_PCA9545;
24712628 phy_data->sfp_mux_address = (mux_addr_hi << 2) + mux_addr_lo;
2472− phy_data->sfp_mux_channel = XP_GET_BITS(reg, XP_PROP_4, MUX_CHAN);
2629+ phy_data->sfp_mux_channel = XP_GET_BITS(pdata->pp4, XP_PROP_4,
2630+ MUX_CHAN);
24732631
24742632 if (netif_msg_probe(pdata)) {
24752633 dev_dbg(pdata->dev, "SFP: mux_address=%#x\n",
@@ -2592,13 +2750,11 @@ static bool xgbe_phy_redrv_error(struct xgbe_phy_data *phy_data) · 116 unmodified lines
25922750 static int xgbe_phy_mdio_reset_setup(struct xgbe_prv_data *pdata)
25932751 {
25942752 struct xgbe_phy_data *phy_data = pdata->phy_data;
2595− unsigned int reg;
25962753
25972754 if (phy_data->conn_type != XGBE_CONN_TYPE_MDIO)
25982755 return 0;
25992756
2600− reg = XP_IOREAD(pdata, XP_PROP_3);
2601− phy_data->mdio_reset = XP_GET_BITS(reg, XP_PROP_3, MDIO_RESET);
2757+ phy_data->mdio_reset = XP_GET_BITS(pdata->pp3, XP_PROP_3, MDIO_RESET);
26022758 switch (phy_data->mdio_reset) {
26032759 case XGBE_MDIO_RESET_NONE:
26042760 case XGBE_MDIO_RESET_I2C_GPIO:
@@ -2612,12 +2768,12 @@ static int xgbe_phy_mdio_reset_setup(struct xgbe_prv_data *pdata) · 7 unmodified lines
26122768
26132769 if (phy_data->mdio_reset == XGBE_MDIO_RESET_I2C_GPIO) {
26142770 phy_data->mdio_reset_addr = XGBE_GPIO_ADDRESS_PCA9555 +
2615− XP_GET_BITS(reg, XP_PROP_3,
2771+ XP_GET_BITS(pdata->pp3, XP_PROP_3,
26162772 MDIO_RESET_I2C_ADDR);
2617− phy_data->mdio_reset_gpio = XP_GET_BITS(reg, XP_PROP_3,
2773+ phy_data->mdio_reset_gpio = XP_GET_BITS(pdata->pp3, XP_PROP_3,
26182774 MDIO_RESET_I2C_GPIO);
26192775 } else if (phy_data->mdio_reset == XGBE_MDIO_RESET_INT_GPIO) {
2620− phy_data->mdio_reset_gpio = XP_GET_BITS(reg, XP_PROP_3,
2776+ phy_data->mdio_reset_gpio = XP_GET_BITS(pdata->pp3, XP_PROP_3,
26212777 MDIO_RESET_INT_GPIO);
26222778 }
26232779
@@ -2707,12 +2863,9 @@ static bool xgbe_phy_conn_type_mismatch(struct xgbe_prv_data *pdata) · 83 unmodified lines
27072863
27082864 static bool xgbe_phy_port_enabled(struct xgbe_prv_data *pdata)
27092865 {
2710− unsigned int reg;
2711−
2712− reg = XP_IOREAD(pdata, XP_PROP_0);
2713− if (!XP_GET_BITS(reg, XP_PROP_0, PORT_SPEEDS))
2866+ if (!XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_SPEEDS))
27142867 return false;
2715− if (!XP_GET_BITS(reg, XP_PROP_0, CONN_TYPE))
2868+ if (!XP_GET_BITS(pdata->pp0, XP_PROP_0, CONN_TYPE))
27162869 return false;
27172870
27182871 return true;
@@ -2921,7 +3074,6 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) · 202 unmodified lines
29213074 struct ethtool_link_ksettings *lks = &pdata->phy.lks;
29223075 struct xgbe_phy_data *phy_data;
29233076 struct mii_bus *mii;
2924− unsigned int reg;
29253077 int ret;
29263078
29273079 /* Check if enabled */
@@ -2940,12 +3092,11 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) · 12 unmodified lines
29403092 return -ENOMEM;
29413093 pdata->phy_data = phy_data;
29423094
2943− reg = XP_IOREAD(pdata, XP_PROP_0);
2944− phy_data->port_mode = XP_GET_BITS(reg, XP_PROP_0, PORT_MODE);
2945− phy_data->port_id = XP_GET_BITS(reg, XP_PROP_0, PORT_ID);
2946− phy_data->port_speeds = XP_GET_BITS(reg, XP_PROP_0, PORT_SPEEDS);
2947− phy_data->conn_type = XP_GET_BITS(reg, XP_PROP_0, CONN_TYPE);
2948− phy_data->mdio_addr = XP_GET_BITS(reg, XP_PROP_0, MDIO_ADDR);
3095+ phy_data->port_mode = XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_MODE);
3096+ phy_data->port_id = XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_ID);
3097+ phy_data->port_speeds = XP_GET_BITS(pdata->pp0, XP_PROP_0, PORT_SPEEDS);
3098+ phy_data->conn_type = XP_GET_BITS(pdata->pp0, XP_PROP_0, CONN_TYPE);
3099+ phy_data->mdio_addr = XP_GET_BITS(pdata->pp0, XP_PROP_0, MDIO_ADDR);
29493100 if (netif_msg_probe(pdata)) {
29503101 dev_dbg(pdata->dev, "port mode=%u\n", phy_data->port_mode);
29513102 dev_dbg(pdata->dev, "port id=%u\n", phy_data->port_id);
@@ -2954,12 +3105,11 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) · 2 unmodified lines
29543105 dev_dbg(pdata->dev, "mdio addr=%u\n", phy_data->mdio_addr);
29553106 }
29563107
2957− reg = XP_IOREAD(pdata, XP_PROP_4);
2958− phy_data->redrv = XP_GET_BITS(reg, XP_PROP_4, REDRV_PRESENT);
2959− phy_data->redrv_if = XP_GET_BITS(reg, XP_PROP_4, REDRV_IF);
2960− phy_data->redrv_addr = XP_GET_BITS(reg, XP_PROP_4, REDRV_ADDR);
2961− phy_data->redrv_lane = XP_GET_BITS(reg, XP_PROP_4, REDRV_LANE);
2962− phy_data->redrv_model = XP_GET_BITS(reg, XP_PROP_4, REDRV_MODEL);
3108+ phy_data->redrv = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_PRESENT);
3109+ phy_data->redrv_if = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_IF);
3110+ phy_data->redrv_addr = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_ADDR);
3111+ phy_data->redrv_lane = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_LANE);
3112+ phy_data->redrv_model = XP_GET_BITS(pdata->pp4, XP_PROP_4, REDRV_MODEL);
29633113 if (phy_data->redrv && netif_msg_probe(pdata)) {
29643114 dev_dbg(pdata->dev, "redrv present\n");
29653115 dev_dbg(pdata->dev, "redrv i/f=%u\n", phy_data->redrv_if);
@@ -3231,4 +3381,7 @@ void xgbe_init_function_ptrs_phy_v2(struct xgbe_phy_if *phy_if) · 265 unmodified lines
32313381
32323382 phy_impl->kr_training_pre = xgbe_phy_kr_training_pre;
32333383 phy_impl->kr_training_post = xgbe_phy_kr_training_post;
3384+
3385+ phy_impl->module_info = xgbe_phy_module_info;
3386+ phy_impl->module_eeprom = xgbe_phy_module_eeprom;
32343387 }
drivers/net/ethernet/amd/xgbe/xgbe.h+31−0
@@ -144,6 +144,11 @@ · 143 unmodified lines
144144 #define XGBE_TX_DESC_MAX_PROC (XGBE_TX_DESC_CNT >> 1)
145145 #define XGBE_RX_DESC_CNT 512
146146
147+#define XGBE_TX_DESC_CNT_MIN 64
148+#define XGBE_TX_DESC_CNT_MAX 4096
149+#define XGBE_RX_DESC_CNT_MIN 64
150+#define XGBE_RX_DESC_CNT_MAX 4096
151+
147152 #define XGBE_TX_MAX_BUF_SIZE (0x3fff & ~(64 - 1))
148153
149154 /* Descriptors required for maximum contiguous TSO/GSO packet */
@@ -835,6 +840,7 @@ struct xgbe_hw_if { · 685 unmodified lines
835840 * Optional routines:
836841 * an_pre, an_post
837842 * kr_training_pre, kr_training_post
843+ * module_info, module_eeprom
838844 */
839845 struct xgbe_phy_impl_if {
840846 /* Perform Setup/teardown actions */
@@ -883,6 +889,12 @@ struct xgbe_phy_impl_if { · 42 unmodified lines
883889 /* Pre/Post KR training enablement support */
884890 void (*kr_training_pre)(struct xgbe_prv_data *);
885891 void (*kr_training_post)(struct xgbe_prv_data *);
892+
893+ /* SFP module related info */
894+ int (*module_info)(struct xgbe_prv_data *pdata,
895+ struct ethtool_modinfo *modinfo);
896+ int (*module_eeprom)(struct xgbe_prv_data *pdata,
897+ struct ethtool_eeprom *eeprom, u8 *data);
886898 };
887899
888900 struct xgbe_phy_if {
@@ -905,6 +917,12 @@ struct xgbe_phy_if { · 16 unmodified lines
905917 /* For single interrupt support */
906918 irqreturn_t (*an_isr)(struct xgbe_prv_data *);
907919
920+ /* For ethtool PHY support */
921+ int (*module_info)(struct xgbe_prv_data *pdata,
922+ struct ethtool_modinfo *modinfo);
923+ int (*module_eeprom)(struct xgbe_prv_data *pdata,
924+ struct ethtool_eeprom *eeprom, u8 *data);
925+
908926 /* PHY implementation specific services */
909927 struct xgbe_phy_impl_if phy_impl;
910928 };
@@ -1027,6 +1045,13 @@ struct xgbe_prv_data { · 116 unmodified lines
10271045 void __iomem *xprop_regs; /* XGBE property registers */
10281046 void __iomem *xi2c_regs; /* XGBE I2C CSRs */
10291047
1048+ /* Port property registers */
1049+ unsigned int pp0;
1050+ unsigned int pp1;
1051+ unsigned int pp2;
1052+ unsigned int pp3;
1053+ unsigned int pp4;
1054+
10301055 /* Overall device lock */
10311056 spinlock_t lock;
10321057
@@ -1097,6 +1122,9 @@ struct xgbe_prv_data { · 64 unmodified lines
10971122 unsigned int rx_ring_count;
10981123 unsigned int rx_desc_count;
10991124
1125+ unsigned int new_tx_ring_count;
1126+ unsigned int new_rx_ring_count;
1127+
11001128 unsigned int tx_max_q_count;
11011129 unsigned int rx_max_q_count;
11021130 unsigned int tx_q_count;
@@ -1233,6 +1261,7 @@ struct xgbe_prv_data { · 130 unmodified lines
12331261 enum xgbe_rx kr_state;
12341262 enum xgbe_rx kx_state;
12351263 struct work_struct an_work;
1264+ unsigned int an_again;
12361265 unsigned int an_supported;
12371266 unsigned int parallel_detect;
12381267 unsigned int fec_ability;
@@ -1310,6 +1339,8 @@ int xgbe_powerup(struct net_device *, unsigned int); · 71 unmodified lines
13101339 int xgbe_powerdown(struct net_device *, unsigned int);
13111340 void xgbe_init_rx_coalesce(struct xgbe_prv_data *);
13121341 void xgbe_init_tx_coalesce(struct xgbe_prv_data *);
1342+void xgbe_restart_dev(struct xgbe_prv_data *pdata);
1343+void xgbe_full_restart_dev(struct xgbe_prv_data *pdata);
13131344
13141345 #ifdef CONFIG_DEBUG_FS
13151346 void xgbe_debugfs_init(struct xgbe_prv_data *);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t