mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 22:24:11 +08:00
Merge branch 'net-stmmac-use-correct-pps-input-indexing'
Johannes Zink says: ==================== net: stmmac: use correct PPS input indexing The stmmac can have 0 to 4 auxiliary snapshot in channels, which can be used for capturing external triggers with respect to the eqos PTP timer. Previously when enabling the auxiliary snapshot, an invalid request was written to the hardware register, except for the Intel variant of this driver, where the only snapshot available was hardcoded. Patch 1 of this series cleans up the debug netdev_dbg message indicating the auxiliary snapshot being {en,dis}abled. No functional changes here Patch 2 of this series writes the correct PPS input indexing to the hardware registers instead of a previously used fixed value Patch 3 of this series removes a field member from plat_stmmacnet_data that is no longer needed Patch 4 of this series prepares Patch 5 by protecting the snapshot enabled flag by the aux_ts_lock mutex Patch 5 of this series adds a temporary workaround, since at the moment the driver can handle only one single auxiliary snapshot at a time. Previously the driver silently dropped the previous configuration and enabled the new one. Now, if a snapshot is already enabled and userspace tries to enable another without previously disabling the snapshot currently enabled: issue a netdev_err and return an errorcode indicating the device is busy. This series is a "never worked, doesn't hurt anyone" touchup to the PPS capture for non-intel variants of the dwmac driver. ==================== Link: https://lore.kernel.org/r/20231010-stmmac_fix_auxiliary_event_capture-v2-0-51d5f56542d7@pengutronix.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
commit
70b9a3d3c1
@ -605,7 +605,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
|
||||
plat->mdio_bus_data->phy_mask |= 1 << INTEL_MGBE_XPCS_ADDR;
|
||||
|
||||
plat->int_snapshot_num = AUX_SNAPSHOT1;
|
||||
plat->ext_snapshot_num = AUX_SNAPSHOT0;
|
||||
|
||||
plat->crosststamp = intel_crosststamp;
|
||||
plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
|
||||
|
@ -191,26 +191,33 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
|
||||
priv->systime_flags);
|
||||
write_unlock_irqrestore(&priv->ptp_lock, flags);
|
||||
break;
|
||||
case PTP_CLK_REQ_EXTTS:
|
||||
if (on)
|
||||
priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN;
|
||||
else
|
||||
priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN;
|
||||
case PTP_CLK_REQ_EXTTS: {
|
||||
u8 channel;
|
||||
|
||||
mutex_lock(&priv->aux_ts_lock);
|
||||
acr_value = readl(ptpaddr + PTP_ACR);
|
||||
channel = ilog2(FIELD_GET(PTP_ACR_MASK, acr_value));
|
||||
acr_value &= ~PTP_ACR_MASK;
|
||||
|
||||
if (on) {
|
||||
if (FIELD_GET(PTP_ACR_MASK, acr_value)) {
|
||||
netdev_err(priv->dev,
|
||||
"Cannot enable auxiliary snapshot %d as auxiliary snapshot %d is already enabled",
|
||||
rq->extts.index, channel);
|
||||
mutex_unlock(&priv->aux_ts_lock);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN;
|
||||
|
||||
/* Enable External snapshot trigger */
|
||||
acr_value |= priv->plat->ext_snapshot_num;
|
||||
acr_value |= PTP_ACR_ATSEN(rq->extts.index);
|
||||
acr_value |= PTP_ACR_ATSFC;
|
||||
netdev_dbg(priv->dev, "Auxiliary Snapshot %d enabled.\n",
|
||||
priv->plat->ext_snapshot_num >>
|
||||
PTP_ACR_ATSEN_SHIFT);
|
||||
} else {
|
||||
netdev_dbg(priv->dev, "Auxiliary Snapshot %d disabled.\n",
|
||||
priv->plat->ext_snapshot_num >>
|
||||
PTP_ACR_ATSEN_SHIFT);
|
||||
priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN;
|
||||
}
|
||||
netdev_dbg(priv->dev, "Auxiliary Snapshot %d %s.\n",
|
||||
rq->extts.index, on ? "enabled" : "disabled");
|
||||
writel(acr_value, ptpaddr + PTP_ACR);
|
||||
mutex_unlock(&priv->aux_ts_lock);
|
||||
/* wait for auxts fifo clear to finish */
|
||||
@ -218,6 +225,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
|
||||
!(acr_value & PTP_ACR_ATSFC),
|
||||
10, 10000);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -79,7 +79,7 @@
|
||||
#define PTP_ACR_ATSEN1 BIT(5) /* Auxiliary Snapshot 1 Enable */
|
||||
#define PTP_ACR_ATSEN2 BIT(6) /* Auxiliary Snapshot 2 Enable */
|
||||
#define PTP_ACR_ATSEN3 BIT(7) /* Auxiliary Snapshot 3 Enable */
|
||||
#define PTP_ACR_ATSEN_SHIFT 5 /* Auxiliary Snapshot shift */
|
||||
#define PTP_ACR_ATSEN(index) (PTP_ACR_ATSEN0 << (index))
|
||||
#define PTP_ACR_MASK GENMASK(7, 4) /* Aux Snapshot Mask */
|
||||
#define PMC_ART_VALUE0 0x01 /* PMC_ART[15:0] timer value */
|
||||
#define PMC_ART_VALUE1 0x02 /* PMC_ART[31:16] timer value */
|
||||
|
@ -303,7 +303,6 @@ struct plat_stmmacenet_data {
|
||||
unsigned int eee_usecs_rate;
|
||||
struct pci_dev *pdev;
|
||||
int int_snapshot_num;
|
||||
int ext_snapshot_num;
|
||||
int msi_mac_vec;
|
||||
int msi_wol_vec;
|
||||
int msi_lpi_vec;
|
||||
|
Loading…
Reference in New Issue
Block a user