summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-03-03 05:35:46 +0300
committerJakub Kicinski <kuba@kernel.org>2026-03-03 05:35:46 +0300
commitd03c9ae654dd2f18f99f0efd873b209cba723007 (patch)
tree76a2351694501955d07ea244546661721f094daf
parentdf548e627b8ce5d354b1b19060dfb52a32f27d83 (diff)
parent07a8531d44272a1b9fd646f5fc09fc397e5b8a65 (diff)
downloadlinux-d03c9ae654dd2f18f99f0efd873b209cba723007.tar.xz
Merge branch 'net-stmmac-further-cleanups'
Russell King says: ==================== net: stmmac: further cleanups Yet another bunch of patches cleaning up the stmmac driver. We start off by cleaning up the formatting for stmmac_mac_finish(). Then remove a plat_dat->port_node which is redundant, followed by several descriptor methods that aren't called. We then remove useless dwmac4 interrupt definitions, and realise that v4.10 definitions are the same as v4.0, so get rid of those as well. We also remove the write-only priv->hw->xlgmac member. Next, we change priv->extend_desc and priv->chain_mode to be a boolean and document what each of these are doing. Also do the same for dma_cfg->fixed_burst and dma_cfg->mixed_burst. Then, move the initialisation of dma_cfg->atds into stmmac_hw_init() as this is where we have all the dependencies for this known, and simplify its initialisation. Also comment what this is doing. Finally, move the check that priv->plat->dma_cfg is present and the programmable burst limit is set into the driver probe rather than checking it each time we are just about to reset the dwmac core. It is unnecessary to keep checking this. This makes a platform glue driver fail early when it hasn't setup everything that's required rather than when attempting to bring the netdev up for the first time. ==================== Link: https://patch.msgid.link/aaFpZvuIzOLaNM0m@shell.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h1
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c4
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c19
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h8
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c36
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c18
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/enh_desc.c18
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/hwif.c9
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/hwif.h11
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/norm_desc.c18
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac.h9
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c39
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c7
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c3
-rw-r--r--include/linux/stmmac.h5
16 files changed, 37 insertions, 170 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index d26e8a063022..42a48f655849 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -635,7 +635,6 @@ struct mac_device_info {
unsigned int mcast_bits_log2;
unsigned int rx_csum;
unsigned int pcs;
- unsigned int xlgmac;
unsigned int num_vlan;
u32 vlan_filter[32];
bool vlan_fail_q_en;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index 92d77b0c2f54..ece2a0c38562 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -636,8 +636,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
plat->dma_cfg->pbl = 32;
plat->dma_cfg->pblx8 = true;
- plat->dma_cfg->fixed_burst = 0;
- plat->dma_cfg->mixed_burst = 0;
plat->dma_cfg->aal = 0;
plat->dma_cfg->dche = true;
@@ -1106,7 +1104,7 @@ static int quark_default_data(struct pci_dev *pdev,
plat->dma_cfg->pbl = 16;
plat->dma_cfg->pblx8 = true;
- plat->dma_cfg->fixed_burst = 1;
+ plat->dma_cfg->fixed_burst = true;
/* AXI (TODO) */
return 0;
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
index e226dc6a1b17..1bbf02504dad 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
@@ -171,16 +171,6 @@ static int dwmac4_wrback_get_rx_status(struct stmmac_extra_stats *x,
return ret;
}
-static int dwmac4_rd_get_tx_len(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des2) & TDES2_BUFFER1_SIZE_MASK);
-}
-
-static int dwmac4_get_tx_owner(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des3) & TDES3_OWN) >> TDES3_OWN_SHIFT;
-}
-
static void dwmac4_set_tx_owner(struct dma_desc *p)
{
p->des3 |= cpu_to_le32(TDES3_OWN);
@@ -196,12 +186,6 @@ static void dwmac4_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
p->des3 |= cpu_to_le32(flags);
}
-static int dwmac4_get_tx_ls(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des3) & TDES3_LAST_DESCRIPTOR)
- >> TDES3_LAST_DESCRIPTOR_SHIFT;
-}
-
static u16 dwmac4_wrback_get_rx_vlan_tci(struct dma_desc *p)
{
return (le32_to_cpu(p->des0) & RDES0_VLAN_TAG_MASK);
@@ -551,11 +535,8 @@ static void dwmac4_set_tbs(struct dma_edesc *p, u32 sec, u32 nsec)
const struct stmmac_desc_ops dwmac4_desc_ops = {
.tx_status = dwmac4_wrback_get_tx_status,
.rx_status = dwmac4_wrback_get_rx_status,
- .get_tx_len = dwmac4_rd_get_tx_len,
- .get_tx_owner = dwmac4_get_tx_owner,
.set_tx_owner = dwmac4_set_tx_owner,
.set_rx_owner = dwmac4_set_rx_owner,
- .get_tx_ls = dwmac4_get_tx_ls,
.get_rx_vlan_tci = dwmac4_wrback_get_rx_vlan_tci,
.get_rx_vlan_valid = dwmac4_wrback_get_rx_vlan_valid,
.get_rx_frame_len = dwmac4_wrback_get_rx_frame_len,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
index 60b880cdd9da..28728271fbc9 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
@@ -582,7 +582,7 @@ const struct stmmac_dma_ops dwmac410_dma_ops = {
.dump_regs = dwmac4_dump_dma_regs,
.dma_rx_mode = dwmac4_dma_rx_chan_op_mode,
.dma_tx_mode = dwmac4_dma_tx_chan_op_mode,
- .enable_dma_irq = dwmac410_enable_dma_irq,
+ .enable_dma_irq = dwmac4_enable_dma_irq,
.disable_dma_irq = dwmac4_disable_dma_irq,
.start_tx = dwmac4_dma_start_tx,
.stop_tx = dwmac4_dma_stop_tx,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
index 9d9077a4ac9f..af6580332d49 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
@@ -111,8 +111,6 @@ static inline u32 dma_chanx_base_addr(const struct dwmac4_addrs *addrs,
/* DMA default interrupt mask for 4.00 */
#define DMA_CHAN_INTR_DEFAULT_MASK (DMA_CHAN_INTR_NORMAL | \
DMA_CHAN_INTR_ABNORMAL)
-#define DMA_CHAN_INTR_DEFAULT_RX (DMA_CHAN_INTR_ENA_RIE)
-#define DMA_CHAN_INTR_DEFAULT_TX (DMA_CHAN_INTR_ENA_TIE)
#define DMA_CHAN_INTR_NORMAL_4_10 (DMA_CHAN_INTR_ENA_NIE_4_10 | \
DMA_CHAN_INTR_ENA_RIE | \
@@ -123,8 +121,6 @@ static inline u32 dma_chanx_base_addr(const struct dwmac4_addrs *addrs,
/* DMA default interrupt mask for 4.10a */
#define DMA_CHAN_INTR_DEFAULT_MASK_4_10 (DMA_CHAN_INTR_NORMAL_4_10 | \
DMA_CHAN_INTR_ABNORMAL_4_10)
-#define DMA_CHAN_INTR_DEFAULT_RX_4_10 (DMA_CHAN_INTR_ENA_RIE)
-#define DMA_CHAN_INTR_DEFAULT_TX_4_10 (DMA_CHAN_INTR_ENA_TIE)
#define DMA_CHAN_RX_WATCHDOG(addrs, x) (dma_chanx_base_addr(addrs, x) + 0x38)
#define DMA_CHAN_SLOT_CTRL_STATUS(addrs, x) (dma_chanx_base_addr(addrs, x) + 0x3c)
@@ -174,12 +170,8 @@ static inline u32 dma_chanx_base_addr(const struct dwmac4_addrs *addrs,
int dwmac4_dma_reset(void __iomem *ioaddr);
void dwmac4_enable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
u32 chan, bool rx, bool tx);
-void dwmac410_enable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
- u32 chan, bool rx, bool tx);
void dwmac4_disable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
u32 chan, bool rx, bool tx);
-void dwmac410_disable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
- u32 chan, bool rx, bool tx);
void dwmac4_dma_start_tx(struct stmmac_priv *priv, void __iomem *ioaddr,
u32 chan);
void dwmac4_dma_stop_tx(struct stmmac_priv *priv, void __iomem *ioaddr,
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index c098047a3bff..8c87a20880c4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -116,23 +116,9 @@ void dwmac4_enable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
u32 value = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
if (rx)
- value |= DMA_CHAN_INTR_DEFAULT_RX;
+ value |= DMA_CHAN_INTR_ENA_RIE;
if (tx)
- value |= DMA_CHAN_INTR_DEFAULT_TX;
-
- writel(value, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
-}
-
-void dwmac410_enable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
- u32 chan, bool rx, bool tx)
-{
- const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
- u32 value = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
-
- if (rx)
- value |= DMA_CHAN_INTR_DEFAULT_RX_4_10;
- if (tx)
- value |= DMA_CHAN_INTR_DEFAULT_TX_4_10;
+ value |= DMA_CHAN_INTR_ENA_TIE;
writel(value, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
}
@@ -144,23 +130,9 @@ void dwmac4_disable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
u32 value = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
if (rx)
- value &= ~DMA_CHAN_INTR_DEFAULT_RX;
- if (tx)
- value &= ~DMA_CHAN_INTR_DEFAULT_TX;
-
- writel(value, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
-}
-
-void dwmac410_disable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
- u32 chan, bool rx, bool tx)
-{
- const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
- u32 value = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
-
- if (rx)
- value &= ~DMA_CHAN_INTR_DEFAULT_RX_4_10;
+ value &= ~DMA_CHAN_INTR_ENA_RIE;
if (tx)
- value &= ~DMA_CHAN_INTR_DEFAULT_TX_4_10;
+ value &= ~DMA_CHAN_INTR_ENA_TIE;
writel(value, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
index 41e5b420a215..1009ef436a1e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
@@ -40,16 +40,6 @@ static int dwxgmac2_get_rx_status(struct stmmac_extra_stats *x,
return good_frame;
}
-static int dwxgmac2_get_tx_len(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des2) & XGMAC_TDES2_B1L);
-}
-
-static int dwxgmac2_get_tx_owner(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des3) & XGMAC_TDES3_OWN) > 0;
-}
-
static void dwxgmac2_set_tx_owner(struct dma_desc *p)
{
p->des3 |= cpu_to_le32(XGMAC_TDES3_OWN);
@@ -65,11 +55,6 @@ static void dwxgmac2_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
p->des3 |= cpu_to_le32(flags);
}
-static int dwxgmac2_get_tx_ls(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des3) & XGMAC_RDES3_LD) > 0;
-}
-
static u16 dwxgmac2_wrback_get_rx_vlan_tci(struct dma_desc *p)
{
return le32_to_cpu(p->des0) & XGMAC_RDES0_VLAN_TAG_MASK;
@@ -355,11 +340,8 @@ static void dwxgmac2_set_tbs(struct dma_edesc *p, u32 sec, u32 nsec)
const struct stmmac_desc_ops dwxgmac210_desc_ops = {
.tx_status = dwxgmac2_get_tx_status,
.rx_status = dwxgmac2_get_rx_status,
- .get_tx_len = dwxgmac2_get_tx_len,
- .get_tx_owner = dwxgmac2_get_tx_owner,
.set_tx_owner = dwxgmac2_set_tx_owner,
.set_rx_owner = dwxgmac2_set_rx_owner,
- .get_tx_ls = dwxgmac2_get_tx_ls,
.get_rx_vlan_tci = dwxgmac2_wrback_get_rx_vlan_tci,
.get_rx_vlan_valid = dwxgmac2_wrback_get_rx_vlan_valid,
.get_rx_frame_len = dwxgmac2_get_rx_frame_len,
diff --git a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
index 8f6993c8bcae..ead468f4b645 100644
--- a/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/enh_desc.c
@@ -76,11 +76,6 @@ static int enh_desc_get_tx_status(struct stmmac_extra_stats *x,
return ret;
}
-static int enh_desc_get_tx_len(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des1) & ETDES1_BUFFER1_SIZE_MASK);
-}
-
static int enh_desc_coe_rdes0(int ipc_err, int type, int payload_err)
{
int ret = good_frame;
@@ -277,11 +272,6 @@ static void enh_desc_init_tx_desc(struct dma_desc *p, int mode, int end)
enh_desc_end_tx_desc_on_ring(p, end);
}
-static int enh_desc_get_tx_owner(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des0) & ETDES0_OWN) >> 31;
-}
-
static void enh_desc_set_tx_owner(struct dma_desc *p)
{
p->des0 |= cpu_to_le32(ETDES0_OWN);
@@ -292,11 +282,6 @@ static void enh_desc_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
p->des0 |= cpu_to_le32(RDES0_OWN);
}
-static int enh_desc_get_tx_ls(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des0) & ETDES0_LAST_SEGMENT) >> 29;
-}
-
static void enh_desc_release_tx_desc(struct dma_desc *p, int mode)
{
int ter = (le32_to_cpu(p->des0) & ETDES0_END_RING) >> 21;
@@ -445,14 +430,11 @@ static void enh_desc_clear(struct dma_desc *p)
const struct stmmac_desc_ops enh_desc_ops = {
.tx_status = enh_desc_get_tx_status,
.rx_status = enh_desc_get_rx_status,
- .get_tx_len = enh_desc_get_tx_len,
.init_rx_desc = enh_desc_init_rx_desc,
.init_tx_desc = enh_desc_init_tx_desc,
- .get_tx_owner = enh_desc_get_tx_owner,
.release_tx_desc = enh_desc_release_tx_desc,
.prepare_tx_desc = enh_desc_prepare_tx_desc,
.set_tx_ic = enh_desc_set_tx_ic,
- .get_tx_ls = enh_desc_get_tx_ls,
.set_tx_owner = enh_desc_set_tx_owner,
.set_rx_owner = enh_desc_set_rx_owner,
.get_rx_frame_len = enh_desc_get_rx_frame_len,
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 7e69ff4b9a98..71dac8c1a3ca 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -76,7 +76,7 @@ static int stmmac_dwmac1_quirks(struct stmmac_priv *priv)
/* GMAC older than 3.50 has no extended descriptors */
if (priv->synopsys_id >= DWMAC_CORE_3_50) {
dev_info(priv->device, "Enabled extended descriptors\n");
- priv->extend_desc = 1;
+ priv->extend_desc = true;
} else {
dev_warn(priv->device, "Extended descriptors not supported\n");
}
@@ -97,12 +97,6 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv)
return 0;
}
-static int stmmac_dwxlgmac_quirks(struct stmmac_priv *priv)
-{
- priv->hw->xlgmac = true;
- return 0;
-}
-
int stmmac_reset(struct stmmac_priv *priv)
{
struct plat_stmmacenet_data *plat = priv->plat;
@@ -293,7 +287,6 @@ static const struct stmmac_hwif_entry {
.mmc = &dwxgmac_mmc_ops,
.est = &dwmac510_est_ops,
.setup = dwxlgmac2_setup,
- .quirks = stmmac_dwxlgmac_quirks,
},
};
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
index 0db96a387259..374f326efa01 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
@@ -51,14 +51,11 @@ struct stmmac_desc_ops {
unsigned int tcppayloadlen);
/* Set/get the owner of the descriptor */
void (*set_tx_owner)(struct dma_desc *p);
- int (*get_tx_owner)(struct dma_desc *p);
/* Clean the tx descriptor as soon as the tx irq is received */
void (*release_tx_desc)(struct dma_desc *p, int mode);
/* Clear interrupt on tx frame completion. When this bit is
* set an interrupt happens as soon as the frame is transmitted */
void (*set_tx_ic)(struct dma_desc *p);
- /* Last tx segment reports the transmit status */
- int (*get_tx_ls)(struct dma_desc *p);
/* Get the tag of the descriptor */
u16 (*get_rx_vlan_tci)(struct dma_desc *p);
/* Get the valid status of descriptor */
@@ -66,8 +63,6 @@ struct stmmac_desc_ops {
/* Return the transmit status looking at the TDES1 */
int (*tx_status)(struct stmmac_extra_stats *x,
struct dma_desc *p, void __iomem *ioaddr);
- /* Get the buffer size from the descriptor */
- int (*get_tx_len)(struct dma_desc *p);
/* Handle extra events on specific interrupts hw dependent */
void (*set_rx_owner)(struct dma_desc *p, int disable_rx_ic);
/* Get the receive frame size */
@@ -116,22 +111,16 @@ struct stmmac_desc_ops {
stmmac_do_void_callback(__priv, desc, prepare_tso_tx_desc, __args)
#define stmmac_set_tx_owner(__priv, __args...) \
stmmac_do_void_callback(__priv, desc, set_tx_owner, __args)
-#define stmmac_get_tx_owner(__priv, __args...) \
- stmmac_do_callback(__priv, desc, get_tx_owner, __args)
#define stmmac_release_tx_desc(__priv, __args...) \
stmmac_do_void_callback(__priv, desc, release_tx_desc, __args)
#define stmmac_set_tx_ic(__priv, __args...) \
stmmac_do_void_callback(__priv, desc, set_tx_ic, __args)
-#define stmmac_get_tx_ls(__priv, __args...) \
- stmmac_do_callback(__priv, desc, get_tx_ls, __args)
#define stmmac_get_rx_vlan_tci(__priv, __args...) \
stmmac_do_callback(__priv, desc, get_rx_vlan_tci, __args)
#define stmmac_get_rx_vlan_valid(__priv, __args...) \
stmmac_do_callback(__priv, desc, get_rx_vlan_valid, __args)
#define stmmac_tx_status(__priv, __args...) \
stmmac_do_callback(__priv, desc, tx_status, __args)
-#define stmmac_get_tx_len(__priv, __args...) \
- stmmac_do_callback(__priv, desc, get_tx_len, __args)
#define stmmac_set_rx_owner(__priv, __args...) \
stmmac_do_void_callback(__priv, desc, set_rx_owner, __args)
#define stmmac_get_rx_frame_len(__priv, __args...) \
diff --git a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
index 859cb9242a52..7c3a818c33c1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/norm_desc.c
@@ -55,11 +55,6 @@ static int ndesc_get_tx_status(struct stmmac_extra_stats *x,
return ret;
}
-static int ndesc_get_tx_len(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des1) & RDES1_BUFFER1_SIZE_MASK);
-}
-
/* This function verifies if each incoming frame has some errors
* and, if required, updates the multicast statistics.
* In case of success, it returns good_frame because the GMAC device
@@ -141,11 +136,6 @@ static void ndesc_init_tx_desc(struct dma_desc *p, int mode, int end)
ndesc_end_tx_desc_on_ring(p, end);
}
-static int ndesc_get_tx_owner(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des0) & TDES0_OWN) >> 31;
-}
-
static void ndesc_set_tx_owner(struct dma_desc *p)
{
p->des0 |= cpu_to_le32(TDES0_OWN);
@@ -156,11 +146,6 @@ static void ndesc_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
p->des0 |= cpu_to_le32(RDES0_OWN);
}
-static int ndesc_get_tx_ls(struct dma_desc *p)
-{
- return (le32_to_cpu(p->des1) & TDES1_LAST_SEGMENT) >> 30;
-}
-
static void ndesc_release_tx_desc(struct dma_desc *p, int mode)
{
int ter = (le32_to_cpu(p->des1) & TDES1_END_RING) >> 25;
@@ -291,14 +276,11 @@ static void ndesc_clear(struct dma_desc *p)
const struct stmmac_desc_ops ndesc_ops = {
.tx_status = ndesc_get_tx_status,
.rx_status = ndesc_get_rx_status,
- .get_tx_len = ndesc_get_tx_len,
.init_rx_desc = ndesc_init_rx_desc,
.init_tx_desc = ndesc_init_tx_desc,
- .get_tx_owner = ndesc_get_tx_owner,
.release_tx_desc = ndesc_release_tx_desc,
.prepare_tx_desc = ndesc_prepare_tx_desc,
.set_tx_ic = ndesc_set_tx_ic,
- .get_tx_ls = ndesc_get_tx_ls,
.set_tx_owner = ndesc_set_tx_owner,
.set_rx_owner = ndesc_set_rx_owner,
.get_rx_frame_len = ndesc_get_rx_frame_len,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 51c96a738151..e98cb9f3a44c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -302,9 +302,14 @@ struct stmmac_priv {
bool eee_active;
bool eee_sw_timer_en;
bool legacy_serdes_is_powered;
+ /* descriptor format:
+ * when clear: struct dma_desc or for tx TBS struct dma_edesc
+ * when set, struct dma_extended_desc
+ */
+ bool extend_desc;
+ /* chain_mode: requested descriptor mode */
+ bool chain_mode;
unsigned int mode;
- unsigned int chain_mode;
- int extend_desc;
struct kernel_hwtstamp_config tstamp_config;
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_clock_ops;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8772d735c577..029e9b518160 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -968,7 +968,8 @@ static int stmmac_mac_finish(struct phylink_config *config, unsigned int mode,
struct stmmac_priv *priv = netdev_priv(ndev);
if (priv->plat->mac_finish)
- priv->plat->mac_finish(ndev, priv->plat->bsp_priv, mode, interface);
+ priv->plat->mac_finish(ndev, priv->plat->bsp_priv, mode,
+ interface);
return 0;
}
@@ -1251,10 +1252,7 @@ static int stmmac_init_phy(struct net_device *dev)
xpcs_get_an_mode(priv->hw->xpcs, mode) == DW_AN_C73)
return 0;
- fwnode = priv->plat->port_node;
- if (!fwnode)
- fwnode = dev_fwnode(priv->device);
-
+ fwnode = dev_fwnode(priv->device);
if (fwnode)
phy_fwnode = fwnode_get_phy_node(fwnode);
else
@@ -1312,7 +1310,6 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
{
struct stmmac_mdio_bus_data *mdio_bus_data;
struct phylink_config *config;
- struct fwnode_handle *fwnode;
struct phylink_pcs *pcs;
struct phylink *phylink;
@@ -1399,11 +1396,8 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
config->wol_mac_support |= WAKE_MAGIC;
}
- fwnode = priv->plat->port_node;
- if (!fwnode)
- fwnode = dev_fwnode(priv->device);
-
- phylink = phylink_create(config, fwnode, priv->plat->phy_interface,
+ phylink = phylink_create(config, dev_fwnode(priv->device),
+ priv->plat->phy_interface,
&stmmac_phylink_mac_ops);
if (IS_ERR(phylink))
return PTR_ERR(phylink);
@@ -3250,14 +3244,6 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
u32 chan = 0;
int ret = 0;
- if (!priv->plat->dma_cfg || !priv->plat->dma_cfg->pbl) {
- netdev_err(priv->dev, "Invalid DMA configuration\n");
- return -EINVAL;
- }
-
- if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE))
- priv->plat->dma_cfg->atds = 1;
-
ret = stmmac_prereset_configure(priv);
if (ret)
return ret;
@@ -7345,7 +7331,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
/* dwmac-sun8i only work in chain mode */
if (priv->plat->flags & STMMAC_FLAG_HAS_SUN8I)
chain_mode = 1;
- priv->chain_mode = chain_mode;
+ priv->chain_mode = !!chain_mode;
/* Initialize HW Interface */
ret = stmmac_hwif_init(priv);
@@ -7450,6 +7436,14 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
return ret;
}
+ /* Set alternate descriptor size (which tells the hardware that
+ * descriptors are 8 32-bit words) when using extended descriptors
+ * with ring mode. Only applicable for pre-v4.0 cores. Platform glue
+ * is not expected to change this.
+ */
+ priv->plat->dma_cfg->atds = priv->extend_desc &&
+ priv->mode == STMMAC_RING_MODE;
+
/* Rx Watchdog is available in the COREs newer than the 3.40.
* In some case, for example on bugged HW this feature
* has to be disable and this can be done by passing the
@@ -7729,6 +7723,11 @@ static int __stmmac_dvr_probe(struct device *device,
u32 rxq;
int i, ret = 0;
+ if (!plat_dat->dma_cfg || !plat_dat->dma_cfg->pbl) {
+ dev_err(device, "invalid DMA configuration\n");
+ return -EINVAL;
+ }
+
ndev = devm_alloc_etherdev_mqs(device, sizeof(struct stmmac_priv),
MTL_MAX_TX_QUEUES, MTL_MAX_RX_QUEUES);
if (!ndev)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index a7c2496b39f2..485a0d790baa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -430,7 +430,7 @@ int stmmac_pcs_setup(struct net_device *ndev)
struct dw_xpcs *xpcs = NULL;
int addr, ret;
- devnode = priv->plat->port_node;
+ devnode = dev_fwnode(priv->device);
if (priv->plat->pcs_init) {
ret = priv->plat->pcs_init(priv);
@@ -649,10 +649,7 @@ int stmmac_mdio_register(struct net_device *ndev)
stmmac_xgmac2_mdio_read_c45(new_bus, 0, 0, 0);
/* If fixed-link is set, skip PHY scanning */
- fwnode = priv->plat->port_node;
- if (!fwnode)
- fwnode = dev_fwnode(priv->device);
-
+ fwnode = dev_fwnode(priv->device);
if (fwnode) {
fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
if (fixed_node) {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 5c9fd91a1db9..c34998486293 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -446,9 +446,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
* they are not converted to phylink. */
plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
- /* PHYLINK automatically parses the phy-handle property */
- plat->port_node = of_fwnode_handle(np);
-
/* Get max speed of operation from device tree */
of_property_read_u32(np, "max-speed", &plat->max_speed);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index b96ae9dadfab..2fc169c7117e 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -97,8 +97,8 @@ struct stmmac_dma_cfg {
int txpbl;
int rxpbl;
bool pblx8;
- int fixed_burst;
- int mixed_burst;
+ bool fixed_burst;
+ bool mixed_burst;
bool aal;
bool eame;
bool multi_msi_en;
@@ -225,7 +225,6 @@ struct plat_stmmacenet_data {
phy_interface_t phy_interface;
struct stmmac_mdio_bus_data *mdio_bus_data;
struct device_node *phy_node;
- struct fwnode_handle *port_node;
struct device_node *mdio_node;
struct stmmac_dma_cfg *dma_cfg;
struct stmmac_safety_feature_cfg *safety_feat_cfg;