Skip to content

Commit a281c6b

Browse files
author
Herton R. Krzesinski
committed
Merge: [ADL-S] Enable Real-time TSN support on ADL-S platform
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/1961 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2100606 Testing: external Intel Voon Weifeng (1): net: phy: marvell10g: enable WoL for 88X3310 and 88E2110 Song Yoong Siang (1): net: phy: marvell: Add WAKE_PHY support to WOL event Tan Tee Min (2): net: phy: dp83867: retrigger SGMII AN when link change stmmac: intel: Update PCH PTP clock rate from 200MHz to 204.8MHz Aminuddin Jamaluddin (1): net: phy: marvell: add sleep time after enabling the loopback bit Mohammad Athari Bin Ismail (1): net: phy: marvell: add Marvell specific PHY loopback Andrew Lunn (1): net: phylink: Convert to mdiobus_c45_{read|write} Wong Vee Khee (1): stmmac: intel: remove unused 'has_crossts' flag Wolfram Sang (1): net: ethernet: move from strlcpy with unused retval to strscpy Kurt Kanzenbach (2): net: stmmac: Disable automatic FCS/Pad stripping net: stmmac: Fix queue statistics reading Corinna Vinschen (1): redhat/configs: Enable CONFIG_PCIE_PTM Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Approved-by: José Ignacio Tornos Martínez <jtornosm@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Approved-by: Prarit Bhargava <prarit@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 164aef6 + ca0ef5c commit a281c6b

File tree

15 files changed

+252
-72
lines changed

15 files changed

+252
-72
lines changed

drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
610610
plat->int_snapshot_num = AUX_SNAPSHOT1;
611611
plat->ext_snapshot_num = AUX_SNAPSHOT0;
612612

613-
plat->has_crossts = true;
614613
plat->crosststamp = intel_crosststamp;
615614
plat->int_snapshot_en = 0;
616615

@@ -630,7 +629,6 @@ static int ehl_common_data(struct pci_dev *pdev,
630629
{
631630
plat->rx_queues_to_use = 8;
632631
plat->tx_queues_to_use = 8;
633-
plat->clk_ptp_rate = 200000000;
634632
plat->use_phy_wol = 1;
635633

636634
plat->safety_feat_cfg->tsoee = 1;
@@ -655,6 +653,8 @@ static int ehl_sgmii_data(struct pci_dev *pdev,
655653
plat->serdes_powerup = intel_serdes_powerup;
656654
plat->serdes_powerdown = intel_serdes_powerdown;
657655

656+
plat->clk_ptp_rate = 204800000;
657+
658658
return ehl_common_data(pdev, plat);
659659
}
660660

@@ -668,6 +668,8 @@ static int ehl_rgmii_data(struct pci_dev *pdev,
668668
plat->bus_id = 1;
669669
plat->phy_interface = PHY_INTERFACE_MODE_RGMII;
670670

671+
plat->clk_ptp_rate = 204800000;
672+
671673
return ehl_common_data(pdev, plat);
672674
}
673675

@@ -684,6 +686,8 @@ static int ehl_pse0_common_data(struct pci_dev *pdev,
684686
plat->bus_id = 2;
685687
plat->addr64 = 32;
686688

689+
plat->clk_ptp_rate = 200000000;
690+
687691
intel_mgbe_pse_crossts_adj(intel_priv, EHL_PSE_ART_MHZ);
688692

689693
return ehl_common_data(pdev, plat);
@@ -723,6 +727,8 @@ static int ehl_pse1_common_data(struct pci_dev *pdev,
723727
plat->bus_id = 3;
724728
plat->addr64 = 32;
725729

730+
plat->clk_ptp_rate = 200000000;
731+
726732
intel_mgbe_pse_crossts_adj(intel_priv, EHL_PSE_ART_MHZ);
727733

728734
return ehl_common_data(pdev, plat);
@@ -758,7 +764,7 @@ static int tgl_common_data(struct pci_dev *pdev,
758764
{
759765
plat->rx_queues_to_use = 6;
760766
plat->tx_queues_to_use = 4;
761-
plat->clk_ptp_rate = 200000000;
767+
plat->clk_ptp_rate = 204800000;
762768
plat->speed_mode_2500 = intel_speed_mode_2500;
763769

764770
plat->safety_feat_cfg->tsoee = 1;

drivers/net/ethernet/stmicro/stmmac/dwmac100.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#define MAC_CONTROL_TE 0x00000008 /* Transmitter Enable */
5757
#define MAC_CONTROL_RE 0x00000004 /* Receiver Enable */
5858

59-
#define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
59+
#define MAC_CORE_INIT (MAC_CONTROL_HBD)
6060

6161
/* MAC FLOW CTRL defines */
6262
#define MAC_FLOW_CTRL_PT_MASK 0xffff0000 /* Pause Time Mask */

drivers/net/ethernet/stmicro/stmmac/dwmac1000.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ enum inter_frame_gap {
126126
#define GMAC_CONTROL_TE 0x00000008 /* Transmitter Enable */
127127
#define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */
128128

129-
#define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \
129+
#define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | \
130130
GMAC_CONTROL_BE | GMAC_CONTROL_DCRS)
131131

132132
/* GMAC Frame Filter defines */

drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/crc32.h>
1616
#include <linux/slab.h>
1717
#include <linux/ethtool.h>
18-
#include <net/dsa.h>
1918
#include <asm/io.h>
2019
#include "stmmac.h"
2120
#include "stmmac_pcs.h"
@@ -24,21 +23,13 @@
2423
static void dwmac1000_core_init(struct mac_device_info *hw,
2524
struct net_device *dev)
2625
{
27-
struct stmmac_priv *priv = netdev_priv(dev);
2826
void __iomem *ioaddr = hw->pcsr;
2927
u32 value = readl(ioaddr + GMAC_CONTROL);
3028
int mtu = dev->mtu;
3129

3230
/* Configure GMAC core */
3331
value |= GMAC_CORE_INIT;
3432

35-
/* Clear ACS bit because Ethernet switch tagging formats such as
36-
* Broadcom tags can look like invalid LLC/SNAP packets and cause the
37-
* hardware to truncate packets on reception.
38-
*/
39-
if (netdev_uses_dsa(dev) || !priv->plat->enh_desc)
40-
value &= ~GMAC_CONTROL_ACS;
41-
4233
if (mtu > 1500)
4334
value |= GMAC_CONTROL_2K;
4435
if (mtu > 2000)

drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*******************************************************************************/
1616

1717
#include <linux/crc32.h>
18-
#include <net/dsa.h>
1918
#include <asm/io.h>
2019
#include "stmmac.h"
2120
#include "dwmac100.h"
@@ -28,13 +27,6 @@ static void dwmac100_core_init(struct mac_device_info *hw,
2827

2928
value |= MAC_CORE_INIT;
3029

31-
/* Clear ASTP bit because Ethernet switch tagging formats such as
32-
* Broadcom tags can look like invalid LLC/SNAP packets and cause the
33-
* hardware to truncate packets on reception.
34-
*/
35-
if (netdev_uses_dsa(dev))
36-
value &= ~MAC_CONTROL_ASTP;
37-
3830
writel(value, ioaddr + MAC_CONTROL);
3931

4032
#ifdef STMMAC_VLAN_TAG_USED

drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/slab.h>
1515
#include <linux/ethtool.h>
1616
#include <linux/io.h>
17-
#include <net/dsa.h>
1817
#include "stmmac.h"
1918
#include "stmmac_pcs.h"
2019
#include "dwmac4.h"

drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,15 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
287287
struct stmmac_priv *priv = netdev_priv(dev);
288288

289289
if (priv->plat->has_gmac || priv->plat->has_gmac4)
290-
strlcpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver));
290+
strscpy(info->driver, GMAC_ETHTOOL_NAME, sizeof(info->driver));
291291
else if (priv->plat->has_xgmac)
292-
strlcpy(info->driver, XGMAC_ETHTOOL_NAME, sizeof(info->driver));
292+
strscpy(info->driver, XGMAC_ETHTOOL_NAME, sizeof(info->driver));
293293
else
294-
strlcpy(info->driver, MAC100_ETHTOOL_NAME,
294+
strscpy(info->driver, MAC100_ETHTOOL_NAME,
295295
sizeof(info->driver));
296296

297297
if (priv->plat->pdev) {
298-
strlcpy(info->bus_info, pci_name(priv->plat->pdev),
298+
strscpy(info->bus_info, pci_name(priv->plat->pdev),
299299
sizeof(info->bus_info));
300300
}
301301
}
@@ -551,16 +551,16 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data)
551551
p = (char *)priv + offsetof(struct stmmac_priv,
552552
xstats.txq_stats[q].tx_pkt_n);
553553
for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
554-
*data++ = (*(u64 *)p);
555-
p += sizeof(u64 *);
554+
*data++ = (*(unsigned long *)p);
555+
p += sizeof(unsigned long);
556556
}
557557
}
558558
for (q = 0; q < rx_cnt; q++) {
559559
p = (char *)priv + offsetof(struct stmmac_priv,
560560
xstats.rxq_stats[q].rx_pkt_n);
561561
for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
562-
*data++ = (*(u64 *)p);
563-
p += sizeof(u64 *);
562+
*data++ = (*(unsigned long *)p);
563+
p += sizeof(unsigned long);
564564
}
565565
}
566566
}

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5092,16 +5092,8 @@ static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
50925092
buf1_len = stmmac_rx_buf1_len(priv, p, status, len);
50935093
len += buf1_len;
50945094

5095-
/* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
5096-
* Type frames (LLC/LLC-SNAP)
5097-
*
5098-
* llc_snap is never checked in GMAC >= 4, so this ACS
5099-
* feature is always disabled and packets need to be
5100-
* stripped manually.
5101-
*/
5102-
if (likely(!(status & rx_not_ls)) &&
5103-
(likely(priv->synopsys_id >= DWMAC_CORE_4_00) ||
5104-
unlikely(status != llc_snap))) {
5095+
/* ACS is disabled; strip manually. */
5096+
if (likely(!(status & rx_not_ls))) {
51055097
buf1_len -= ETH_FCS_LEN;
51065098
len -= ETH_FCS_LEN;
51075099
}
@@ -5278,16 +5270,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
52785270
buf2_len = stmmac_rx_buf2_len(priv, p, status, len);
52795271
len += buf2_len;
52805272

5281-
/* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
5282-
* Type frames (LLC/LLC-SNAP)
5283-
*
5284-
* llc_snap is never checked in GMAC >= 4, so this ACS
5285-
* feature is always disabled and packets need to be
5286-
* stripped manually.
5287-
*/
5288-
if (likely(!(status & rx_not_ls)) &&
5289-
(likely(priv->synopsys_id >= DWMAC_CORE_4_00) ||
5290-
unlikely(status != llc_snap))) {
5273+
/* ACS is disabled; strip manually. */
5274+
if (likely(!(status & rx_not_ls))) {
52915275
if (buf2_len) {
52925276
buf2_len -= ETH_FCS_LEN;
52935277
len -= ETH_FCS_LEN;

drivers/net/phy/dp83867.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
#define DP83867_DOWNSHIFT_2_COUNT 2
138138
#define DP83867_DOWNSHIFT_4_COUNT 4
139139
#define DP83867_DOWNSHIFT_8_COUNT 8
140+
#define DP83867_SGMII_AUTONEG_EN BIT(7)
140141

141142
/* CFG3 bits */
142143
#define DP83867_CFG3_INT_OE BIT(7)
@@ -836,6 +837,32 @@ static int dp83867_phy_reset(struct phy_device *phydev)
836837
DP83867_PHYCR_FORCE_LINK_GOOD, 0);
837838
}
838839

840+
static void dp83867_link_change_notify(struct phy_device *phydev)
841+
{
842+
/* There is a limitation in DP83867 PHY device where SGMII AN is
843+
* only triggered once after the device is booted up. Even after the
844+
* PHY TPI is down and up again, SGMII AN is not triggered and
845+
* hence no new in-band message from PHY to MAC side SGMII.
846+
* This could cause an issue during power up, when PHY is up prior
847+
* to MAC. At this condition, once MAC side SGMII is up, MAC side
848+
* SGMII wouldn`t receive new in-band message from TI PHY with
849+
* correct link status, speed and duplex info.
850+
* Thus, implemented a SW solution here to retrigger SGMII Auto-Neg
851+
* whenever there is a link change.
852+
*/
853+
if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
854+
int val = 0;
855+
856+
val = phy_clear_bits(phydev, DP83867_CFG2,
857+
DP83867_SGMII_AUTONEG_EN);
858+
if (val < 0)
859+
return;
860+
861+
phy_set_bits(phydev, DP83867_CFG2,
862+
DP83867_SGMII_AUTONEG_EN);
863+
}
864+
}
865+
839866
static struct phy_driver dp83867_driver[] = {
840867
{
841868
.phy_id = DP83867_PHY_ID,
@@ -860,6 +887,8 @@ static struct phy_driver dp83867_driver[] = {
860887

861888
.suspend = genphy_suspend,
862889
.resume = genphy_resume,
890+
891+
.link_change_notify = dp83867_link_change_notify,
863892
},
864893
};
865894
module_phy_driver(dp83867_driver);

0 commit comments

Comments
 (0)