Commit def3833f authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'net-stmmac-replace-boolean-fields-in-plat_stmmacenet_data-with-flags'

Bartosz Golaszewski says:

====================
net: stmmac: replace boolean fields in plat_stmmacenet_data with flags

As suggested by Jose Abreu: let's drop all 12 boolean fields in
plat_stmmacenet_data and replace them with a common bitfield.
====================

Link: https://lore.kernel.org/r/20230710090001.303225-1-brgl@bgdev.plSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents bec9ce34 9d0c0d5e
...@@ -113,7 +113,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, ...@@ -113,7 +113,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
/* dwc-qos needs GMAC4, AAL, TSO and PMT */ /* dwc-qos needs GMAC4, AAL, TSO and PMT */
plat_dat->has_gmac4 = 1; plat_dat->has_gmac4 = 1;
plat_dat->dma_cfg->aal = 1; plat_dat->dma_cfg->aal = 1;
plat_dat->tso_en = 1; plat_dat->flags |= STMMAC_FLAG_TSO_EN;
plat_dat->pmt = 1; plat_dat->pmt = 1;
return 0; return 0;
...@@ -359,7 +359,7 @@ static int tegra_eqos_probe(struct platform_device *pdev, ...@@ -359,7 +359,7 @@ static int tegra_eqos_probe(struct platform_device *pdev,
data->fix_mac_speed = tegra_eqos_fix_speed; data->fix_mac_speed = tegra_eqos_fix_speed;
data->init = tegra_eqos_init; data->init = tegra_eqos_init;
data->bsp_priv = eqos; data->bsp_priv = eqos;
data->sph_disable = 1; data->flags |= STMMAC_FLAG_SPH_DISABLE;
err = tegra_eqos_init(pdev, eqos); err = tegra_eqos_init(pdev, eqos);
if (err < 0) if (err < 0)
......
...@@ -326,10 +326,10 @@ static int intel_crosststamp(ktime_t *device, ...@@ -326,10 +326,10 @@ static int intel_crosststamp(ktime_t *device,
/* Both internal crosstimestamping and external triggered event /* Both internal crosstimestamping and external triggered event
* timestamping cannot be run concurrently. * timestamping cannot be run concurrently.
*/ */
if (priv->plat->ext_snapshot_en) if (priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN)
return -EBUSY; return -EBUSY;
priv->plat->int_snapshot_en = 1; priv->plat->flags |= STMMAC_FLAG_INT_SNAPSHOT_EN;
mutex_lock(&priv->aux_ts_lock); mutex_lock(&priv->aux_ts_lock);
/* Enable Internal snapshot trigger */ /* Enable Internal snapshot trigger */
...@@ -350,7 +350,7 @@ static int intel_crosststamp(ktime_t *device, ...@@ -350,7 +350,7 @@ static int intel_crosststamp(ktime_t *device,
break; break;
default: default:
mutex_unlock(&priv->aux_ts_lock); mutex_unlock(&priv->aux_ts_lock);
priv->plat->int_snapshot_en = 0; priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
return -EINVAL; return -EINVAL;
} }
writel(acr_value, ptpaddr + PTP_ACR); writel(acr_value, ptpaddr + PTP_ACR);
...@@ -376,7 +376,7 @@ static int intel_crosststamp(ktime_t *device, ...@@ -376,7 +376,7 @@ static int intel_crosststamp(ktime_t *device,
if (!wait_event_interruptible_timeout(priv->tstamp_busy_wait, if (!wait_event_interruptible_timeout(priv->tstamp_busy_wait,
stmmac_cross_ts_isr(priv), stmmac_cross_ts_isr(priv),
HZ / 100)) { HZ / 100)) {
priv->plat->int_snapshot_en = 0; priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -395,7 +395,7 @@ static int intel_crosststamp(ktime_t *device, ...@@ -395,7 +395,7 @@ static int intel_crosststamp(ktime_t *device,
} }
system->cycles *= intel_priv->crossts_adj; system->cycles *= intel_priv->crossts_adj;
priv->plat->int_snapshot_en = 0; priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
return 0; return 0;
} }
...@@ -458,8 +458,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, ...@@ -458,8 +458,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
plat->has_gmac = 0; plat->has_gmac = 0;
plat->has_gmac4 = 1; plat->has_gmac4 = 1;
plat->force_sf_dma_mode = 0; plat->force_sf_dma_mode = 0;
plat->tso_en = 1; plat->flags |= (STMMAC_FLAG_TSO_EN | STMMAC_FLAG_SPH_DISABLE);
plat->sph_disable = 1;
/* Multiplying factor to the clk_eee_i clock time /* Multiplying factor to the clk_eee_i clock time
* period to make it closer to 100 ns. This value * period to make it closer to 100 ns. This value
...@@ -561,7 +560,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, ...@@ -561,7 +560,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
/* Set the maxmtu to a default of JUMBO_LEN */ /* Set the maxmtu to a default of JUMBO_LEN */
plat->maxmtu = JUMBO_LEN; plat->maxmtu = JUMBO_LEN;
plat->vlan_fail_q_en = true; plat->flags |= STMMAC_FLAG_VLAN_FAIL_Q_EN;
/* Use the last Rx queue */ /* Use the last Rx queue */
plat->vlan_fail_q = plat->rx_queues_to_use - 1; plat->vlan_fail_q = plat->rx_queues_to_use - 1;
...@@ -610,7 +609,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, ...@@ -610,7 +609,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
plat->ext_snapshot_num = AUX_SNAPSHOT0; plat->ext_snapshot_num = AUX_SNAPSHOT0;
plat->crosststamp = intel_crosststamp; plat->crosststamp = intel_crosststamp;
plat->int_snapshot_en = 0; plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
/* Setup MSI vector offset specific to Intel mGbE controller */ /* Setup MSI vector offset specific to Intel mGbE controller */
plat->msi_mac_vec = 29; plat->msi_mac_vec = 29;
...@@ -628,7 +627,7 @@ static int ehl_common_data(struct pci_dev *pdev, ...@@ -628,7 +627,7 @@ static int ehl_common_data(struct pci_dev *pdev,
{ {
plat->rx_queues_to_use = 8; plat->rx_queues_to_use = 8;
plat->tx_queues_to_use = 8; plat->tx_queues_to_use = 8;
plat->use_phy_wol = 1; plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
plat->safety_feat_cfg->tsoee = 1; plat->safety_feat_cfg->tsoee = 1;
plat->safety_feat_cfg->mrxpee = 1; plat->safety_feat_cfg->mrxpee = 1;
...@@ -954,7 +953,7 @@ static int stmmac_config_single_msi(struct pci_dev *pdev, ...@@ -954,7 +953,7 @@ static int stmmac_config_single_msi(struct pci_dev *pdev,
res->irq = pci_irq_vector(pdev, 0); res->irq = pci_irq_vector(pdev, 0);
res->wol_irq = res->irq; res->wol_irq = res->irq;
plat->multi_msi_en = 0; plat->flags &= ~STMMAC_FLAG_MULTI_MSI_EN;
dev_info(&pdev->dev, "%s: Single IRQ enablement successful\n", dev_info(&pdev->dev, "%s: Single IRQ enablement successful\n",
__func__); __func__);
...@@ -1006,7 +1005,7 @@ static int stmmac_config_multi_msi(struct pci_dev *pdev, ...@@ -1006,7 +1005,7 @@ static int stmmac_config_multi_msi(struct pci_dev *pdev,
if (plat->msi_sfty_ue_vec < STMMAC_MSI_VEC_MAX) if (plat->msi_sfty_ue_vec < STMMAC_MSI_VEC_MAX)
res->sfty_ue_irq = pci_irq_vector(pdev, plat->msi_sfty_ue_vec); res->sfty_ue_irq = pci_irq_vector(pdev, plat->msi_sfty_ue_vec);
plat->multi_msi_en = 1; plat->flags |= STMMAC_FLAG_MULTI_MSI_EN;
dev_info(&pdev->dev, "%s: multi MSI enablement successful\n", __func__); dev_info(&pdev->dev, "%s: multi MSI enablement successful\n", __func__);
return 0; return 0;
......
...@@ -588,7 +588,10 @@ static int mediatek_dwmac_common_data(struct platform_device *pdev, ...@@ -588,7 +588,10 @@ static int mediatek_dwmac_common_data(struct platform_device *pdev,
int i; int i;
plat->interface = priv_plat->phy_mode; plat->interface = priv_plat->phy_mode;
plat->use_phy_wol = priv_plat->mac_wol ? 0 : 1; if (priv_plat->mac_wol)
plat->flags |= STMMAC_FLAG_USE_PHY_WOL;
else
plat->flags &= ~STMMAC_FLAG_USE_PHY_WOL;
plat->riwt_off = 1; plat->riwt_off = 1;
plat->maxmtu = ETH_DATA_LEN; plat->maxmtu = ETH_DATA_LEN;
plat->host_dma_width = priv_plat->variant->dma_bit_mask; plat->host_dma_width = priv_plat->variant->dma_bit_mask;
......
...@@ -783,10 +783,12 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ...@@ -783,10 +783,12 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
if (ethqos->has_emac_ge_3) if (ethqos->has_emac_ge_3)
plat_dat->dwmac4_addrs = &data->dwmac4_addrs; plat_dat->dwmac4_addrs = &data->dwmac4_addrs;
plat_dat->pmt = 1; plat_dat->pmt = 1;
plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); if (of_property_read_bool(np, "snps,tso"))
plat_dat->flags |= STMMAC_FLAG_TSO_EN;
if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) if (of_device_is_compatible(np, "qcom,qcs404-ethqos"))
plat_dat->rx_clk_runs_in_lpi = 1; plat_dat->flags |= STMMAC_FLAG_RX_CLK_RUNS_IN_LPI;
plat_dat->has_integrated_pcs = data->has_integrated_pcs; if (data->has_integrated_pcs)
plat_dat->flags |= STMMAC_FLAG_HAS_INTEGRATED_PCS;
if (ethqos->serdes_phy) { if (ethqos->serdes_phy) {
plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup; plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup;
......
...@@ -1227,7 +1227,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) ...@@ -1227,7 +1227,7 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
plat_dat->interface = interface; plat_dat->interface = interface;
plat_dat->rx_coe = STMMAC_RX_COE_TYPE2; plat_dat->rx_coe = STMMAC_RX_COE_TYPE2;
plat_dat->tx_coe = 1; plat_dat->tx_coe = 1;
plat_dat->has_sun8i = true; plat_dat->flags |= STMMAC_FLAG_HAS_SUN8I;
plat_dat->bsp_priv = gmac; plat_dat->bsp_priv = gmac;
plat_dat->init = sun8i_dwmac_init; plat_dat->init = sun8i_dwmac_init;
plat_dat->exit = sun8i_dwmac_exit; plat_dat->exit = sun8i_dwmac_exit;
......
...@@ -290,7 +290,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev) ...@@ -290,7 +290,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
} }
plat->has_xgmac = 1; plat->has_xgmac = 1;
plat->tso_en = 1; plat->flags |= STMMAC_FLAG_TSO_EN;
plat->pmt = 1; plat->pmt = 1;
plat->bsp_priv = mgbe; plat->bsp_priv = mgbe;
...@@ -337,7 +337,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev) ...@@ -337,7 +337,7 @@ static int tegra_mgbe_probe(struct platform_device *pdev)
/* Program SID */ /* Program SID */
writel(MGBE_SID, mgbe->hv + MGBE_WRAP_AXI_ASID0_CTRL); writel(MGBE_SID, mgbe->hv + MGBE_WRAP_AXI_ASID0_CTRL);
plat->serdes_up_after_phy_linkup = 1; plat->flags |= STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP;
err = stmmac_dvr_probe(&pdev->dev, plat, &res); err = stmmac_dvr_probe(&pdev->dev, plat, &res);
if (err < 0) if (err < 0)
......
...@@ -180,7 +180,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv) ...@@ -180,7 +180,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
u64 ptp_time; u64 ptp_time;
int i; int i;
if (priv->plat->int_snapshot_en) { if (priv->plat->flags & STMMAC_FLAG_INT_SNAPSHOT_EN) {
wake_up(&priv->tstamp_busy_wait); wake_up(&priv->tstamp_busy_wait);
return; return;
} }
...@@ -195,7 +195,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv) ...@@ -195,7 +195,7 @@ static void timestamp_interrupt(struct stmmac_priv *priv)
*/ */
ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS);
if (!priv->plat->ext_snapshot_en) if (priv->plat->flags & STMMAC_FLAG_EXT_SNAPSHOT_EN)
return; return;
num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >>
......
...@@ -325,7 +325,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) ...@@ -325,7 +325,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
priv->clk_csr = STMMAC_CSR_250_300M; priv->clk_csr = STMMAC_CSR_250_300M;
} }
if (priv->plat->has_sun8i) { if (priv->plat->flags & STMMAC_FLAG_HAS_SUN8I) {
if (clk_rate > 160000000) if (clk_rate > 160000000)
priv->clk_csr = 0x03; priv->clk_csr = 0x03;
else if (clk_rate > 80000000) else if (clk_rate > 80000000)
...@@ -421,7 +421,7 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv) ...@@ -421,7 +421,7 @@ static int stmmac_enable_eee_mode(struct stmmac_priv *priv)
/* Check and enter in LPI mode */ /* Check and enter in LPI mode */
if (!priv->tx_path_in_lpi_mode) if (!priv->tx_path_in_lpi_mode)
stmmac_set_eee_mode(priv, priv->hw, stmmac_set_eee_mode(priv, priv->hw,
priv->plat->en_tx_lpi_clockgating); priv->plat->flags & STMMAC_FLAG_EN_TX_LPI_CLOCKGATING);
return 0; return 0;
} }
...@@ -991,7 +991,8 @@ static void stmmac_mac_link_up(struct phylink_config *config, ...@@ -991,7 +991,8 @@ static void stmmac_mac_link_up(struct phylink_config *config,
struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
u32 old_ctrl, ctrl; u32 old_ctrl, ctrl;
if (priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) if ((priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) &&
priv->plat->serdes_powerup)
priv->plat->serdes_powerup(priv->dev, priv->plat->bsp_priv); priv->plat->serdes_powerup(priv->dev, priv->plat->bsp_priv);
old_ctrl = readl(priv->ioaddr + MAC_CTRL_REG); old_ctrl = readl(priv->ioaddr + MAC_CTRL_REG);
...@@ -1084,7 +1085,8 @@ static void stmmac_mac_link_up(struct phylink_config *config, ...@@ -1084,7 +1085,8 @@ static void stmmac_mac_link_up(struct phylink_config *config,
stmmac_mac_set(priv, priv->ioaddr, true); stmmac_mac_set(priv, priv->ioaddr, true);
if (phy && priv->dma_cap.eee) { if (phy && priv->dma_cap.eee) {
priv->eee_active = priv->eee_active =
phy_init_eee(phy, !priv->plat->rx_clk_runs_in_lpi) >= 0; phy_init_eee(phy, !(priv->plat->flags &
STMMAC_FLAG_RX_CLK_RUNS_IN_LPI)) >= 0;
priv->eee_enabled = stmmac_eee_init(priv); priv->eee_enabled = stmmac_eee_init(priv);
priv->tx_lpi_enabled = priv->eee_enabled; priv->tx_lpi_enabled = priv->eee_enabled;
stmmac_set_eee_pls(priv, priv->hw, true); stmmac_set_eee_pls(priv, priv->hw, true);
...@@ -3710,7 +3712,7 @@ static int stmmac_request_irq(struct net_device *dev) ...@@ -3710,7 +3712,7 @@ static int stmmac_request_irq(struct net_device *dev)
int ret; int ret;
/* Request the IRQ lines */ /* Request the IRQ lines */
if (priv->plat->multi_msi_en) if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN)
ret = stmmac_request_irq_multi_msi(dev); ret = stmmac_request_irq_multi_msi(dev);
else else
ret = stmmac_request_irq_single(dev); ret = stmmac_request_irq_single(dev);
...@@ -3838,7 +3840,8 @@ static int __stmmac_open(struct net_device *dev, ...@@ -3838,7 +3840,8 @@ static int __stmmac_open(struct net_device *dev,
stmmac_reset_queues_param(priv); stmmac_reset_queues_param(priv);
if (!priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) { if (!(priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) &&
priv->plat->serdes_powerup) {
ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); ret = priv->plat->serdes_powerup(dev, priv->plat->bsp_priv);
if (ret < 0) { if (ret < 0) {
netdev_err(priv->dev, "%s: Serdes powerup failed\n", netdev_err(priv->dev, "%s: Serdes powerup failed\n",
...@@ -5677,7 +5680,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, ...@@ -5677,7 +5680,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
features &= ~NETIF_F_CSUM_MASK; features &= ~NETIF_F_CSUM_MASK;
/* Disable tso if asked by ethtool */ /* Disable tso if asked by ethtool */
if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { if ((priv->plat->flags & STMMAC_FLAG_TSO_EN) && (priv->dma_cap.tsoen)) {
if (features & NETIF_F_TSO) if (features & NETIF_F_TSO)
priv->tso = true; priv->tso = true;
else else
...@@ -5798,7 +5801,8 @@ static void stmmac_common_interrupt(struct stmmac_priv *priv) ...@@ -5798,7 +5801,8 @@ static void stmmac_common_interrupt(struct stmmac_priv *priv)
} }
/* PCS link status */ /* PCS link status */
if (priv->hw->pcs && !priv->plat->has_integrated_pcs) { if (priv->hw->pcs &&
!(priv->plat->flags & STMMAC_FLAG_HAS_INTEGRATED_PCS)) {
if (priv->xstats.pcs_link) if (priv->xstats.pcs_link)
netif_carrier_on(priv->dev); netif_carrier_on(priv->dev);
else else
...@@ -5951,7 +5955,7 @@ static void stmmac_poll_controller(struct net_device *dev) ...@@ -5951,7 +5955,7 @@ static void stmmac_poll_controller(struct net_device *dev)
if (test_bit(STMMAC_DOWN, &priv->state)) if (test_bit(STMMAC_DOWN, &priv->state))
return; return;
if (priv->plat->multi_msi_en) { if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN) {
for (i = 0; i < priv->plat->rx_queues_to_use; i++) for (i = 0; i < priv->plat->rx_queues_to_use; i++)
stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]); stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]);
...@@ -6855,7 +6859,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv) ...@@ -6855,7 +6859,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
int ret; int ret;
/* dwmac-sun8i only work in chain mode */ /* dwmac-sun8i only work in chain mode */
if (priv->plat->has_sun8i) if (priv->plat->flags & STMMAC_FLAG_HAS_SUN8I)
chain_mode = 1; chain_mode = 1;
priv->chain_mode = chain_mode; priv->chain_mode = chain_mode;
...@@ -6876,7 +6880,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv) ...@@ -6876,7 +6880,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
*/ */
priv->plat->enh_desc = priv->dma_cap.enh_desc; priv->plat->enh_desc = priv->dma_cap.enh_desc;
priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up && priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up &&
!priv->plat->use_phy_wol; !(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
priv->hw->pmt = priv->plat->pmt; priv->hw->pmt = priv->plat->pmt;
if (priv->dma_cap.hash_tb_sz) { if (priv->dma_cap.hash_tb_sz) {
priv->hw->multicast_filter_bins = priv->hw->multicast_filter_bins =
...@@ -6920,7 +6924,8 @@ static int stmmac_hw_init(struct stmmac_priv *priv) ...@@ -6920,7 +6924,8 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
if (priv->dma_cap.tsoen) if (priv->dma_cap.tsoen)
dev_info(priv->device, "TSO supported\n"); dev_info(priv->device, "TSO supported\n");
priv->hw->vlan_fail_q_en = priv->plat->vlan_fail_q_en; priv->hw->vlan_fail_q_en =
(priv->plat->flags & STMMAC_FLAG_VLAN_FAIL_Q_EN);
priv->hw->vlan_fail_q = priv->plat->vlan_fail_q; priv->hw->vlan_fail_q = priv->plat->vlan_fail_q;
/* Run HW quirks, if any */ /* Run HW quirks, if any */
...@@ -7165,7 +7170,8 @@ int stmmac_dvr_probe(struct device *device, ...@@ -7165,7 +7170,8 @@ int stmmac_dvr_probe(struct device *device,
priv->plat = plat_dat; priv->plat = plat_dat;
priv->ioaddr = res->addr; priv->ioaddr = res->addr;
priv->dev->base_addr = (unsigned long)res->addr; priv->dev->base_addr = (unsigned long)res->addr;
priv->plat->dma_cfg->multi_msi_en = priv->plat->multi_msi_en; priv->plat->dma_cfg->multi_msi_en =
(priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN);
priv->dev->irq = res->irq; priv->dev->irq = res->irq;
priv->wol_irq = res->wol_irq; priv->wol_irq = res->wol_irq;
...@@ -7249,7 +7255,7 @@ int stmmac_dvr_probe(struct device *device, ...@@ -7249,7 +7255,7 @@ int stmmac_dvr_probe(struct device *device,
ndev->hw_features |= NETIF_F_HW_TC; ndev->hw_features |= NETIF_F_HW_TC;
} }
if ((priv->plat->tso_en) && (priv->dma_cap.tsoen)) { if ((priv->plat->flags & STMMAC_FLAG_TSO_EN) && (priv->dma_cap.tsoen)) {
ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6; ndev->hw_features |= NETIF_F_TSO | NETIF_F_TSO6;
if (priv->plat->has_gmac4) if (priv->plat->has_gmac4)
ndev->hw_features |= NETIF_F_GSO_UDP_L4; ndev->hw_features |= NETIF_F_GSO_UDP_L4;
...@@ -7257,7 +7263,8 @@ int stmmac_dvr_probe(struct device *device, ...@@ -7257,7 +7263,8 @@ int stmmac_dvr_probe(struct device *device,
dev_info(priv->device, "TSO feature enabled\n"); dev_info(priv->device, "TSO feature enabled\n");
} }
if (priv->dma_cap.sphen && !priv->plat->sph_disable) { if (priv->dma_cap.sphen &&
!(priv->plat->flags & STMMAC_FLAG_SPH_DISABLE)) {
ndev->hw_features |= NETIF_F_GRO; ndev->hw_features |= NETIF_F_GRO;
priv->sph_cap = true; priv->sph_cap = true;
priv->sph = priv->sph_cap; priv->sph = priv->sph_cap;
...@@ -7621,7 +7628,8 @@ int stmmac_resume(struct device *dev) ...@@ -7621,7 +7628,8 @@ int stmmac_resume(struct device *dev)
stmmac_mdio_reset(priv->mii); stmmac_mdio_reset(priv->mii);
} }
if (!priv->plat->serdes_up_after_phy_linkup && priv->plat->serdes_powerup) { if (!(priv->plat->flags & STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP) &&
priv->plat->serdes_powerup) {
ret = priv->plat->serdes_powerup(ndev, ret = priv->plat->serdes_powerup(ndev,
priv->plat->bsp_priv); priv->plat->bsp_priv);
......
...@@ -77,7 +77,7 @@ static int snps_gmac5_default_data(struct pci_dev *pdev, ...@@ -77,7 +77,7 @@ static int snps_gmac5_default_data(struct pci_dev *pdev,
plat->clk_csr = 5; plat->clk_csr = 5;
plat->has_gmac4 = 1; plat->has_gmac4 = 1;
plat->force_sf_dma_mode = 1; plat->force_sf_dma_mode = 1;
plat->tso_en = 1; plat->flags |= STMMAC_FLAG_TSO_EN;
plat->pmt = 1; plat->pmt = 1;
/* Set default value for multicast hash bins */ /* Set default value for multicast hash bins */
......
...@@ -466,8 +466,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) ...@@ -466,8 +466,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
plat->force_sf_dma_mode = plat->force_sf_dma_mode =
of_property_read_bool(np, "snps,force_sf_dma_mode"); of_property_read_bool(np, "snps,force_sf_dma_mode");
plat->en_tx_lpi_clockgating = if (of_property_read_bool(np, "snps,en-tx-lpi-clockgating"))
of_property_read_bool(np, "snps,en-tx-lpi-clockgating"); plat->flags |= STMMAC_FLAG_EN_TX_LPI_CLOCKGATING;
/* Set the maxmtu to a default of JUMBO_LEN in case the /* Set the maxmtu to a default of JUMBO_LEN in case the
* parameter is not present in the device tree. * parameter is not present in the device tree.
...@@ -525,7 +525,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) ...@@ -525,7 +525,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
plat->has_gmac4 = 1; plat->has_gmac4 = 1;
plat->has_gmac = 0; plat->has_gmac = 0;
plat->pmt = 1; plat->pmt = 1;
plat->tso_en = of_property_read_bool(np, "snps,tso"); if (of_property_read_bool(np, "snps,tso"))
plat->flags |= STMMAC_FLAG_TSO_EN;
} }
if (of_device_is_compatible(np, "snps,dwmac-3.610") || if (of_device_is_compatible(np, "snps,dwmac-3.610") ||
...@@ -538,7 +539,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) ...@@ -538,7 +539,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
if (of_device_is_compatible(np, "snps,dwxgmac")) { if (of_device_is_compatible(np, "snps,dwxgmac")) {
plat->has_xgmac = 1; plat->has_xgmac = 1;
plat->pmt = 1; plat->pmt = 1;
plat->tso_en = of_property_read_bool(np, "snps,tso"); if (of_property_read_bool(np, "snps,tso"))
plat->flags |= STMMAC_FLAG_TSO_EN;
} }
dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
......
...@@ -192,7 +192,10 @@ static int stmmac_enable(struct ptp_clock_info *ptp, ...@@ -192,7 +192,10 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
write_unlock_irqrestore(&priv->ptp_lock, flags); write_unlock_irqrestore(&priv->ptp_lock, flags);
break; break;
case PTP_CLK_REQ_EXTTS: case PTP_CLK_REQ_EXTTS:
priv->plat->ext_snapshot_en = on; if (on)
priv->plat->flags |= STMMAC_FLAG_EXT_SNAPSHOT_EN;
else
priv->plat->flags &= ~STMMAC_FLAG_EXT_SNAPSHOT_EN;
mutex_lock(&priv->aux_ts_lock); mutex_lock(&priv->aux_ts_lock);
acr_value = readl(ptpaddr + PTP_ACR); acr_value = readl(ptpaddr + PTP_ACR);
acr_value &= ~PTP_ACR_MASK; acr_value &= ~PTP_ACR_MASK;
......
...@@ -204,6 +204,19 @@ struct dwmac4_addrs { ...@@ -204,6 +204,19 @@ struct dwmac4_addrs {
u32 mtl_low_cred_offset; u32 mtl_low_cred_offset;
}; };
#define STMMAC_FLAG_HAS_INTEGRATED_PCS BIT(0)
#define STMMAC_FLAG_SPH_DISABLE BIT(1)
#define STMMAC_FLAG_USE_PHY_WOL BIT(2)
#define STMMAC_FLAG_HAS_SUN8I BIT(3)
#define STMMAC_FLAG_TSO_EN BIT(4)
#define STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP BIT(5)
#define STMMAC_FLAG_VLAN_FAIL_Q_EN BIT(6)
#define STMMAC_FLAG_MULTI_MSI_EN BIT(7)
#define STMMAC_FLAG_EXT_SNAPSHOT_EN BIT(8)
#define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9)
#define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10)
#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)
struct plat_stmmacenet_data { struct plat_stmmacenet_data {
int bus_id; int bus_id;
int phy_addr; int phy_addr;
...@@ -266,22 +279,14 @@ struct plat_stmmacenet_data { ...@@ -266,22 +279,14 @@ struct plat_stmmacenet_data {
struct reset_control *stmmac_ahb_rst; struct reset_control *stmmac_ahb_rst;
struct stmmac_axi *axi; struct stmmac_axi *axi;
int has_gmac4; int has_gmac4;
bool has_sun8i;
bool tso_en;
int rss_en; int rss_en;
int mac_port_sel_speed; int mac_port_sel_speed;
bool en_tx_lpi_clockgating;
bool rx_clk_runs_in_lpi;
int has_xgmac; int has_xgmac;
bool vlan_fail_q_en;
u8 vlan_fail_q; u8 vlan_fail_q;
unsigned int eee_usecs_rate; unsigned int eee_usecs_rate;
struct pci_dev *pdev; struct pci_dev *pdev;
int int_snapshot_num; int int_snapshot_num;
int ext_snapshot_num; int ext_snapshot_num;
bool int_snapshot_en;
bool ext_snapshot_en;
bool multi_msi_en;
int msi_mac_vec; int msi_mac_vec;
int msi_wol_vec; int msi_wol_vec;
int msi_lpi_vec; int msi_lpi_vec;
...@@ -289,10 +294,7 @@ struct plat_stmmacenet_data { ...@@ -289,10 +294,7 @@ struct plat_stmmacenet_data {
int msi_sfty_ue_vec; int msi_sfty_ue_vec;
int msi_rx_base_vec; int msi_rx_base_vec;
int msi_tx_base_vec; int msi_tx_base_vec;
bool use_phy_wol;
bool sph_disable;
bool serdes_up_after_phy_linkup;
const struct dwmac4_addrs *dwmac4_addrs; const struct dwmac4_addrs *dwmac4_addrs;
bool has_integrated_pcs; unsigned int flags;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment