stmmac: Add Loongson platform support
Subsystems (6)
v6 cover stmmac: Add Loongson platform support
v6:
* Refer to Serge's suggestion:
- Add new platform feature flag:
include/linux/stmmac.h:
+#define STMMAC_FLAG_HAS_LGMAC BIT(13)- Add the IRQs macros specific to the Loongson Multi-channels GMAC:
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h:
+#define DMA_INTR_ENA_NIE_LOONGSON 0x00060000 /* Normal Loongson Tx/Rx Summary */
#define DMA_INTR_ENA_NIE 0x00010000 /* Normal Summary */
... - Drop all of redundant changes that don't require the prototypes being converted to accepting the stmmac_priv pointer.
* Refer to andrew's suggestion:
- Drop white space changes.
- break patch up into lots of smaller parts.
Some small patches have been put into another series as a preparation see <https://lore.kernel.org/loongarch/[email protected]/T/#t>
*note* : This series of patches relies on the three small patches above.
* others
- Drop irq_flags changes.
- Changed patch order.
v4 -> v5:
* Remove an ugly and useless patch (fix channel number).
* Remove the non-standard dma64 driver code, and also remove the HWIF entries, since the associated custom callbacks no longer exist.
* Refer to Serge's suggestion: Update the dwmac1000_dma.c to support the multi-DMA-channels controller setup.
See:
v4: <https://lore.kernel.org/loongarch/[email protected]/>
v3: <https://lore.kernel.org/loongarch/[email protected]/>
v2: <https://lore.kernel.org/loongarch/[email protected]/>
v1: <https://lore.kernel.org/loongarch/[email protected]/>
Yanteng Si (9):
net: stmmac: Pass stmmac_priv and chan in some callbacks
net: stmmac: dwmac-loongson: Refactor code for loongson_dwmac_probe()
net: stmmac: dwmac-loongson: Add full PCI support
net: stmmac: Add multi-channel supports
net: stmmac: Add Loongson-specific register definitions
net: stmmac: dwmac-loongson: Add MSI support
net: stmmac: dwmac-loongson: Add GNET support
net: stmmac: dwmac-loongson: Disable flow control for GMAC
net: stmmac: Disable coe for some Loongson GNET
drivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../ethernet/stmicro/stmmac/dwmac-loongson.c | 296 ++++++++++++++---- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 61 +++- .../ethernet/stmicro/stmmac/dwmac100_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 47 ++- .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 65 ++-- .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 8 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 11 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +- include/linux/stmmac.h | 4 + 14 files changed, 413 insertions(+), 107 deletions(-)
Signature · 1 line
2.31.4
PATCH v6 1/9 net: stmmac: Pass stmmac_priv and chan in some callbacks
Loongson GMAC and GNET have some special features. To prepare for that, pass stmmac_priv and chan to more callbacks, and adjust the callbacks accordingly.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h | 3 ++- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 3 ++- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 11 ++++++----- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 9 files changed, 18 insertions(+), 15 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +1 -1
@@ -395,7 +395,7 @@ static void sun8i_dwmac_dma_start_tx(struct stmmac_priv *priv,writel (v, ioaddr +EMAC_TX_CTL1 ); } -static void sun8i_dwmac_enable_dma_transmission (void __iomem *ioaddr) +static void sun8i_dwmac_enable_dma_transmission (void __iomem *ioaddr,u32 chan) {u32 v;
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +1 -1
@@ -70,7 +70,7 @@ static void dwmac1000_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)writel (value, ioaddr +DMA_AXI_BUS_MODE ); } -static void dwmac1000_dma_init (void __iomem *ioaddr, +static void dwmac1000_dma_init (struct stmmac_priv *priv,void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,int atds) {u32 value =readl (ioaddr +DMA_BUS_MODE );
drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c +1 -1
@@ -18,7 +18,7 @@#include "dwmac100.h" #include "dwmac_dma.h" -static void dwmac100_dma_init (void __iomem *ioaddr, +static void dwmac100_dma_init (struct stmmac_priv *priv,void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,int atds) {/* Enable Application Access by writing to DMA CSR0 */
drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +1 -1
@@ -152,7 +152,7 @@ static void dwmac410_dma_init_channel(struct stmmac_priv *priv, ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan)); } -static void dwmac4_dma_init (void __iomem *ioaddr, +static void dwmac4_dma_init (struct stmmac_priv *priv,void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,int atds) {u32 value =readl (ioaddr +DMA_SYS_BUS_MODE );
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +2 -1
@@ -152,7 +152,8 @@#define NUM_DWMAC1000_DMA_REGS 23#define NUM_DWMAC4_DMA_REGS 27 -void dwmac_enable_dma_transmission (void __iomem *ioaddr); +void dwmac_enable_dma_transmission (struct stmmac_priv *priv, +void __iomem *ioaddr,u32 chan);void dwmac_enable_dma_irq (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan,bool rx,bool tx); void dwmac_disable_dma_irq(struct stmmac_priv *priv, void __iomem *ioaddr,
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +2 -1
@@ -28,7 +28,8 @@ int dwmac_dma_reset(void __iomem *ioaddr) }/* CSR1 enables the transmit DMA to check for new descriptor */ -void dwmac_enable_dma_transmission (void __iomem *ioaddr) +void dwmac_enable_dma_transmission (struct stmmac_priv *priv, +void __iomem *ioaddr,u32 chan) {writel (1 , ioaddr +DMA_XMT_POLL_DEMAND ); }
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +1 -1
@@ -19,7 +19,7 @@ static int dwxgmac2_dma_reset(void __iomem *ioaddr) !(value & XGMAC_SWR), 0, 100000); } -static void dwxgmac2_dma_init (void __iomem *ioaddr, +static void dwxgmac2_dma_init (struct stmmac_priv *priv,void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,int atds) {u32 value =readl (ioaddr +XGMAC_DMA_SYSBUS_MODE );
drivers/net/ethernet/stmicro/stmmac/hwif.h +6 -5
@@ -175,8 +175,8 @@ struct dma_features;struct stmmac_dma_ops {/* DMA core initialization */ int (*reset)(void __iomem *ioaddr); -void (*init)(void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg, -int atds); +void (*init)(struct stmmac_priv *priv,void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg,int atds);void (*init_chan)(struct stmmac_priv *priv,void __iomem *ioaddr,struct stmmac_dma_cfg *dma_cfg,u32 chan); void (*init_rx_chan)(struct stmmac_priv *priv, void __iomem *ioaddr,
@@ -198,7 +198,8 @@ struct stmmac_dma_ops {/* To track extra statistic (if supported) */ void (*dma_diagnostic_fr)(struct stmmac_extra_stats *x,void __iomem *ioaddr); -void (*enable_dma_transmission) (void __iomem *ioaddr); +void (*enable_dma_transmission)(struct stmmac_priv *priv, +void __iomem *ioaddr,u32 chan);void (*enable_dma_irq)(struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan,bool rx,bool tx); void (*disable_dma_irq)(struct stmmac_priv *priv, void __iomem *ioaddr,
@@ -240,7 +241,7 @@ struct stmmac_dma_ops { }; #define stmmac_dma_init(__priv, __args...) \ - stmmac_do_void_callback(__priv, dma, init, __args) + stmmac_do_void_callback(__priv, dma, init, __priv, __args) #define stmmac_init_chan(__priv, __args...) \ stmmac_do_void_callback(__priv, dma, init_chan, __priv, __args) #define stmmac_init_rx_chan(__priv, __args...) \
@@ -258,7 +259,7 @@ struct stmmac_dma_ops { #define stmmac_dma_diagnostic_fr(__priv, __args...) \ stmmac_do_void_callback(__priv, dma, dma_diagnostic_fr, __args) #define stmmac_enable_dma_transmission(__priv, __args...) \ - stmmac_do_void_callback(__priv, dma, enable_dma_transmission, __args) + stmmac_do_void_callback(__priv, dma, enable_dma_transmission, __priv, __args) #define stmmac_enable_dma_irq(__priv, __args...) \ stmmac_do_void_callback(__priv, dma, enable_dma_irq, __priv, __args) #define stmmac_disable_dma_irq(__priv, __args...) \
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -3
@@ -2558,7 +2558,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) true, priv->mode, true, true, xdp_desc.len); -stmmac_enable_dma_transmission (priv, priv->ioaddr); +stmmac_enable_dma_transmission (priv, priv->ioaddr, queue);xsk_tx_metadata_to_compl (meta, &tx_q->tx_skbuff_dma[entry].xsk_meta);
@@ -4679,7 +4679,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)netdev_tx_sent_queue (netdev_get_tx_queue (dev, queue), skb->len); -stmmac_enable_dma_transmission (priv, priv->ioaddr); +stmmac_enable_dma_transmission (priv, priv->ioaddr, queue);stmmac_flush_tx_descriptors (priv, queue);stmmac_tx_timer_arm (priv, queue);
@@ -4899,7 +4899,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,u64_stats_update_end_irqrestore (&txq_stats->syncp, flags); } -stmmac_enable_dma_transmission (priv, priv->ioaddr); +stmmac_enable_dma_transmission (priv, priv->ioaddr, queue); entry =STMMAC_GET_ENTRY (entry, priv->dma_conf.dma_tx_size); tx_q->cur_tx = entry;
Signature · 1 line
2.31.4
Re: [PATCH v6 1/9] net: stmmac: Pass stmmac_priv and chan in some callbacks
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · line 4682
Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2
-2-static void sun8i_dwmac_enable_dma_transmission(void __iomem *ioaddr) +static void sun8i_dwmac_enable_dma_transmission(void __iomem *ioaddr, u32 chan) - stmmac_enable_dma_transmission(priv, priv->ioaddr); + stmmac_enable_dma_transmission(priv, priv->ioaddr, queue);
As i've said a few times, i don't know this driver.
Is it a queue or is it a chan? Is this change consistent with the reset of the code base?
Andrew
Re: [PATCH v6 1/9] net: stmmac: Pass stmmac_priv and chan in some callbacks
Quoted 10 lines · Andrew Lunn
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · line 4682
Quoted 6 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2
-2-static void sun8i_dwmac_enable_dma_transmission(void __iomem *ioaddr) +static void sun8i_dwmac_enable_dma_transmission(void __iomem *ioaddr, u32 chan) - stmmac_enable_dma_transmission(priv, priv->ioaddr); + stmmac_enable_dma_transmission(priv, priv->ioaddr, queue);As i've said a few times, i don't know this driver.
Is it a queue or is it a chan? Is this change consistent with the reset of the code base?
It is a chan, but there is only queue here. so we refer to dwmac4:
static void dwmac4_rx_watchdog(struct stmmac_priv *priv, void __iomem *ioaddr, u32 riwt, u32 queue)
{
const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
writel(riwt, ioaddr + DMA_CHAN_RX_WATCHDOG(dwmac4_addrs, queue)); }
---------------------------------------------------------------------------------
@@ -271,12 +299,13 @@ static int dwmac1000_get_hw_feature(void __iomem *ioaddr, static void dwmac1000_rx_watchdog(struct stmmac_priv *priv,
void __iomem *ioaddr, u32 riwt, u32 queue)
{
- writel(riwt, ioaddr + DMA_RX_WATCHDOG);
+ writel(riwt, ioaddr + DMA_CHAN_RX_WATCHDOG(queue));
}
We also use queue instead of chan.
Thanks,
Yanteng
Quoted 1 line
Andrew
PATCH v6 2/9 net: stmmac: dwmac-loongson: Refactor code for loongson_dwmac_probe()
In reply to Yanteng SiAdd a setup() function to initialize data, and simplify code for loongson_dwmac_probe().
--- .../ethernet/stmicro/stmmac/dwmac-loongson.c | 68 +++++++++++++------ 1 file changed, 47 insertions(+), 21 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +47 -21
@@ -9,7 +9,12 @@#include <linux/of_irq.h> #include "stmmac.h" -static int loongson_default_data (struct plat_stmmacenet_data *plat) +struct stmmac_pci_info { +int (*setup)(struct pci_dev *pdev,struct plat_stmmacenet_data *plat); +}; + +static void loongson_default_data (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat) { plat->clk_csr =2 ;/* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */ plat->has_gmac =1 ;
@@ -34,23 +39,38 @@ static int loongson_default_data(struct plat_stmmacenet_data *plat)/* Disable RX queues routing by default */ plat->rx_queues_cfg[0 ].pkt_route =0x0 ; +} + +static int loongson_gmac_data (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat) +{ +loongson_default_data (pdev, plat); + + plat->multicast_filter_bins =256 ; + + plat->mdio_bus_data->phy_mask =0 ; -/* Default to phy auto-detection */ plat->phy_addr =-1 ; + plat->phy_interface =PHY_INTERFACE_MODE_RGMII_ID ; plat->dma_cfg->pbl =32 ; plat->dma_cfg->pblx8 = true; - plat->multicast_filter_bins =256 ;return 0 ; } -static int loongson_dwmac_probe (struct pci_dev *pdev,const struct pci_device_id *id) +static struct stmmac_pci_info loongson_gmac_pci_info = { + .setup = loongson_gmac_data, +}; + +static int loongson_dwmac_probe (struct pci_dev *pdev, +const struct pci_device_id *id) { +int ret, i, bus_id, phy_mode;struct plat_stmmacenet_data *plat; +struct stmmac_pci_info *info;struct stmmac_resources res;struct device_node *np; -int ret, i, phy_mode; np =dev_of_node (&pdev->dev);
@@ -69,22 +89,22 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_idif (!plat->mdio_bus_data)return -ENOMEM ; + plat->dma_cfg =devm_kzalloc (&pdev->dev,sizeof (*plat->dma_cfg), +GFP_KERNEL ); +if (!plat->dma_cfg) +return -ENOMEM ; + plat->mdio_node =of_get_child_by_name (np,"mdio" );if (plat->mdio_node) {dev_info (&pdev->dev,"Found MDIO subnode\n" ); plat->mdio_bus_data->needs_reset = true; } - plat->dma_cfg =devm_kzalloc (&pdev->dev,sizeof (*plat->dma_cfg),GFP_KERNEL ); -if (!plat->dma_cfg) { - ret = -ENOMEM ; - goto err_put_node; - } -/* Enable pci device */ ret =pci_enable_device (pdev);if (ret) { -dev_err (&pdev->dev,"%s: ERROR: failed to enable device\n" , __func__); +dev_err (&pdev->dev,"%s: ERROR: failed to enable device\n" , + __func__); goto err_put_node; }
@@ -98,9 +118,16 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_idbreak ; } - plat->bus_id =of_alias_get_id (np,"ethernet" ); -if (plat->bus_id <0 ) - plat->bus_id =pci_dev_id (pdev); +pci_set_master (pdev); + + info = (struct stmmac_pci_info *)id->driver_data; + ret = info->setup (pdev, plat); +if (ret) + goto err_disable_device; + + bus_id =of_alias_get_id (np,"ethernet" ); +if (bus_id >=0 ) + plat->bus_id = bus_id; phy_mode =device_get_phy_mode (&pdev->dev);if (phy_mode <0 ) {
@@ -110,11 +137,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id } plat->phy_interface = phy_mode; - plat->mac_interface =PHY_INTERFACE_MODE_GMII ; -pci_set_master (pdev); - -loongson_default_data (plat);pci_enable_msi (pdev);memset (&res,0 ,sizeof (res)); res.addr =pcim_iomap_table (pdev)[0 ];
@@ -128,7 +151,8 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id res.wol_irq =of_irq_get_byname (np,"eth_wake_irq" );if (res.wol_irq <0 ) { -dev_info (&pdev->dev,"IRQ eth_wake_irq not found, using macirq\n" ); +dev_info (&pdev->dev, +"IRQ eth_wake_irq not found, using macirq\n" ); res.wol_irq = res.irq; }
@@ -212,8 +236,10 @@ static int __maybe_unused loongson_dwmac_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(loongson_dwmac_pm_ops, loongson_dwmac_suspend, loongson_dwmac_resume); +#define PCI_DEVICE_ID_LOONGSON_GMAC 0x7a03 +static const struct pci_device_id loongson_dwmac_id_table[] = { - {PCI_VDEVICE (LOONGSON ,0x7a03 ) }, + {PCI_DEVICE_DATA (LOONGSON ,GMAC , &loongson_gmac_pci_info) }, {} };MODULE_DEVICE_TABLE (pci, loongson_dwmac_id_table);
Signature · 1 line
2.31.4
PATCH v6 3/9 net: stmmac: dwmac-loongson: Add full PCI support
In reply to Yanteng SiCurrent dwmac-loongson only support LS2K in the "probed with PCI and configured with DT" manner. Add LS7A support on which the devices are fully PCI (non-DT).
--- .../ethernet/stmicro/stmmac/dwmac-loongson.c | 79 ++++++++++--------- 1 file changed, 43 insertions(+), 36 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +43 -36
@@ -16,6 +16,10 @@ struct stmmac_pci_info {static void loongson_default_data (struct pci_dev *pdev,struct plat_stmmacenet_data *plat) { +/* Get bus_id, this can be overloaded later */ + plat->bus_id = (pci_domain_nr (pdev->bus) <<16 ) | +PCI_DEVID (pdev->bus->number, pdev->devfn); + plat->clk_csr =2 ;/* clk_csr_i = 20-35MHz & MDC = clk_csr_i/16 */ plat->has_gmac =1 ; plat->force_sf_dma_mode =1 ;
@@ -56,6 +60,9 @@ static int loongson_gmac_data(struct pci_dev *pdev, plat->dma_cfg->pbl =32 ; plat->dma_cfg->pblx8 = true; + plat->clk_ref_rate =125000000 ; + plat->clk_ptp_rate =125000000 ; +return 0 ; }
@@ -72,13 +79,6 @@ static int loongson_dwmac_probe(struct pci_dev *pdev,struct stmmac_resources res;struct device_node *np; - np =dev_of_node (&pdev->dev); - -if (!np) { -pr_info ("dwmac_loongson_pci: No OF node\n" ); -return -ENODEV ; - } - plat =devm_kzalloc (&pdev->dev,sizeof (*plat),GFP_KERNEL );if (!plat)return -ENOMEM ;
@@ -94,6 +94,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev,if (!plat->dma_cfg)return -ENOMEM ; + np =dev_of_node (&pdev->dev); plat->mdio_node =of_get_child_by_name (np,"mdio" );if (plat->mdio_node) {dev_info (&pdev->dev,"Found MDIO subnode\n" );
@@ -125,42 +126,48 @@ static int loongson_dwmac_probe(struct pci_dev *pdev,if (ret) goto err_disable_device; - bus_id =of_alias_get_id (np,"ethernet" ); -if (bus_id >=0 ) - plat->bus_id = bus_id; +if (np) { + bus_id =of_alias_get_id (np,"ethernet" ); +if (bus_id >=0 ) + plat->bus_id = bus_id; - phy_mode =device_get_phy_mode (&pdev->dev); -if (phy_mode <0 ) { -dev_err (&pdev->dev,"phy_mode not found\n" ); - ret = phy_mode; - goto err_disable_device; + phy_mode =device_get_phy_mode (&pdev->dev); +if (phy_mode <0 ) { +dev_err (&pdev->dev,"phy_mode not found\n" ); + ret = phy_mode; + goto err_disable_device; + } + plat->phy_interface = phy_mode; } - plat->phy_interface = phy_mode; -pci_enable_msi (pdev);memset (&res,0 ,sizeof (res)); res.addr =pcim_iomap_table (pdev)[0 ]; - res.irq =of_irq_get_byname (np,"macirq" ); -if (res.irq <0 ) { -dev_err (&pdev->dev,"IRQ macirq not found\n" ); - ret = -ENODEV ; - goto err_disable_msi; - } - - res.wol_irq =of_irq_get_byname (np,"eth_wake_irq" ); -if (res.wol_irq <0 ) { -dev_info (&pdev->dev, -"IRQ eth_wake_irq not found, using macirq\n" ); - res.wol_irq = res.irq; - } - - res.lpi_irq =of_irq_get_byname (np,"eth_lpi" ); -if (res.lpi_irq <0 ) { -dev_err (&pdev->dev,"IRQ eth_lpi not found\n" ); - ret = -ENODEV ; - goto err_disable_msi; +if (np) { + res.irq =of_irq_get_byname (np,"macirq" ); +if (res.irq <0 ) { +dev_err (&pdev->dev,"IRQ macirq not found\n" ); + ret = -ENODEV ; + goto err_disable_msi; + } + + res.wol_irq =of_irq_get_byname (np,"eth_wake_irq" ); +if (res.wol_irq <0 ) { +dev_info (&pdev->dev, +"IRQ eth_wake_irq not found, using macirq\n" ); + res.wol_irq = res.irq; + } + + res.lpi_irq =of_irq_get_byname (np,"eth_lpi" ); +if (res.lpi_irq <0 ) { +dev_err (&pdev->dev,"IRQ eth_lpi not found\n" ); + ret = -ENODEV ; + goto err_disable_msi; + } + }else { + res.irq = pdev->irq; + res.wol_irq = pdev->irq; } ret =stmmac_dvr_probe (&pdev->dev, plat, &res);
Signature · 1 line
2.31.4
PATCH v6 4/9 net: stmmac: Add multi-channel supports
In reply to Yanteng SiLoongson platforms use a DWGMAC which supports multi-channel.
Added dwmac1000_dma_init_channel() and init_chan(), factor out all the channel-specific setups from dwmac1000_dma_init() to the new function dma_config(), then distinguish dma initialization and multi-channel initialization through different parameters.
--- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 55 ++++++++++++++----- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 17 ++++++ .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 30 +++++----- 3 files changed, 74 insertions(+), 28 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +42 -13
@@ -12,7 +12,8 @@Author: Giuseppe Cavallaro <[email protected]> *******************************************************************************/ -#include <asm/io.h> +#include <linux/io.h> +#include "stmmac.h" #include "dwmac1000.h" #include "dwmac_dma.h"
@@ -70,13 +71,16 @@ static void dwmac1000_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)writel (value, ioaddr +DMA_AXI_BUS_MODE ); } -static void dwmac1000_dma_init (struct stmmac_priv *priv,void __iomem *ioaddr, -struct stmmac_dma_cfg *dma_cfg,int atds) +static void dma_config (void __iomem *modeaddr,void __iomem *enaddr, +struct stmmac_dma_cfg *dma_cfg,u32 dma_intr_mask, +int atds) { -u32 value =readl (ioaddr +DMA_BUS_MODE ); +u32 value;int txpbl = dma_cfg->txpbl ?: dma_cfg->pbl;int rxpbl = dma_cfg->rxpbl ?: dma_cfg->pbl; + value =readl (modeaddr); +/* * Set the DMA PBL (Programmable Burst Length) mode. *
@@ -104,10 +108,34 @@ static void dwmac1000_dma_init(struct stmmac_priv *priv, void __iomem *ioaddr,if (dma_cfg->aal) value |=DMA_BUS_MODE_AAL ; -writel (value, ioaddr +DMA_BUS_MODE ); +writel (value, modeaddr); +writel (dma_intr_mask, enaddr); +} + +static void dwmac1000_dma_init (struct stmmac_priv *priv,void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg,int atds) +{ +u32 dma_intr_mask;/* Mask interrupts by writing to CSR7 */ -writel (DMA_INTR_DEFAULT_MASK , ioaddr +DMA_INTR_ENA ); + dma_intr_mask =DMA_INTR_DEFAULT_MASK ; + +dma_config (ioaddr +DMA_BUS_MODE , ioaddr +DMA_INTR_ENA , + dma_cfg, dma_intr_mask, atds); +} + +static void dwmac1000_dma_init_channel (struct stmmac_priv *priv,void __iomem *ioaddr, +struct stmmac_dma_cfg *dma_cfg,u32 chan) +{ +u32 dma_intr_mask; + +/* Mask interrupts by writing to CSR7 */ + dma_intr_mask =DMA_INTR_DEFAULT_MASK ; + +if (dma_cfg->multi_msi_en) +dma_config (ioaddr +DMA_CHAN_BUS_MODE (chan), + ioaddr +DMA_CHAN_INTR_ENA (chan), dma_cfg, + dma_intr_mask, dma_cfg->multi_msi_en); } static void dwmac1000_dma_init_rx(struct stmmac_priv *priv,
@@ -116,7 +144,7 @@ static void dwmac1000_dma_init_rx(struct stmmac_priv *priv, dma_addr_t dma_rx_phy, u32 chan) {/* RX descriptor base address list must be written into DMA CSR3 */ - writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR); + writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_CHAN_RCV_BASE_ADDR(chan)); } static void dwmac1000_dma_init_tx(struct stmmac_priv *priv,
@@ -125,7 +153,7 @@ static void dwmac1000_dma_init_tx(struct stmmac_priv *priv, dma_addr_t dma_tx_phy, u32 chan) {/* TX descriptor base address list must be written into DMA CSR4 */ - writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR); + writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_CHAN_TX_BASE_ADDR(chan)); }static u32 dwmac1000_configure_fc (u32 csr6,int rxfifosz)
@@ -153,7 +181,7 @@ static void dwmac1000_dma_operation_mode_rx(struct stmmac_priv *priv, void __iomem *ioaddr, int mode, u32 channel, int fifosz, u8 qmode) { - u32 csr6 = readl(ioaddr + DMA_CONTROL); + u32 csr6 = readl(ioaddr + DMA_CHAN_CONTROL(channel));if (mode ==SF_DMA_MODE ) {pr_debug ("GMAC: enable RX store and forward mode\n" );
@@ -175,14 +203,14 @@ static void dwmac1000_dma_operation_mode_rx(struct stmmac_priv *priv,/* Configure flow control based on rx fifo size */ csr6 =dwmac1000_configure_fc (csr6, fifosz); -writel (csr6, ioaddr +DMA_CONTROL ); +writel (csr6, ioaddr +DMA_CHAN_CONTROL (channel)); }static void dwmac1000_dma_operation_mode_tx (struct stmmac_priv *priv,void __iomem *ioaddr,int mode,u32 channel,int fifosz,u8 qmode) { -u32 csr6 =readl (ioaddr +DMA_CONTROL ); +u32 csr6 =readl (ioaddr +DMA_CHAN_CONTROL (channel));if (mode ==SF_DMA_MODE ) {pr_debug ("GMAC: enable TX store and forward mode\n" );
@@ -209,7 +237,7 @@ static void dwmac1000_dma_operation_mode_tx(struct stmmac_priv *priv, csr6 |=DMA_CONTROL_TTC_256 ; } -writel (csr6, ioaddr +DMA_CONTROL ); +writel (csr6, ioaddr +DMA_CHAN_CONTROL (channel)); } static void dwmac1000_dump_dma_regs(struct stmmac_priv *priv,
@@ -271,12 +299,13 @@ static int dwmac1000_get_hw_feature(void __iomem *ioaddr,static void dwmac1000_rx_watchdog (struct stmmac_priv *priv,void __iomem *ioaddr,u32 riwt,u32 queue) { -writel (riwt, ioaddr +DMA_RX_WATCHDOG ); +writel (riwt, ioaddr +DMA_CHAN_RX_WATCHDOG (queue)); }const struct stmmac_dma_ops dwmac1000_dma_ops = { .reset = dwmac_dma_reset, .init = dwmac1000_dma_init, + .init_chan = dwmac1000_dma_init_channel, .init_rx_chan = dwmac1000_dma_init_rx, .init_tx_chan = dwmac1000_dma_init_tx, .axi = dwmac1000_dma_axi,
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +17 -0
@@ -148,6 +148,9 @@ DMA_STATUS_TI | \ DMA_STATUS_MSK_COMMON) +/* Following DMA defines are chanels oriented */ +#define DMA_CHAN_OFFSET 0x100 +#define NUM_DWMAC100_DMA_REGS 9#define NUM_DWMAC1000_DMA_REGS 23#define NUM_DWMAC4_DMA_REGS 27
@@ -170,4 +173,18 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, struct stmmac_extra_stats *x, u32 chan, u32 dir);int dwmac_dma_reset (void __iomem *ioaddr); +static inline u32 dma_chan_base_addr (u32 base,u32 chan) +{ +return base + chan *DMA_CHAN_OFFSET ; +} + +#define DMA_CHAN_XMT_POLL_DEMAND (chan) dma_chan_base_addr(DMA_XMT_POLL_DEMAND, chan) +#define DMA_CHAN_INTR_ENA (chan) dma_chan_base_addr(DMA_INTR_ENA, chan) +#define DMA_CHAN_CONTROL (chan) dma_chan_base_addr(DMA_CONTROL, chan) +#define DMA_CHAN_STATUS (chan) dma_chan_base_addr(DMA_STATUS, chan) +#define DMA_CHAN_BUS_MODE (chan) dma_chan_base_addr(DMA_BUS_MODE, chan) +#define DMA_CHAN_RCV_BASE_ADDR (chan) dma_chan_base_addr(DMA_RCV_BASE_ADDR, chan) +#define DMA_CHAN_TX_BASE_ADDR (chan) dma_chan_base_addr(DMA_TX_BASE_ADDR, chan) +#define DMA_CHAN_RX_WATCHDOG (chan) dma_chan_base_addr(DMA_RX_WATCHDOG, chan) +#endif /* __DWMAC_DMA_H__ */
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +15 -15
@@ -31,63 +31,63 @@ int dwmac_dma_reset(void __iomem *ioaddr)void dwmac_enable_dma_transmission (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan) { -writel (1 , ioaddr +DMA_XMT_POLL_DEMAND ); +writel (1 , ioaddr +DMA_CHAN_XMT_POLL_DEMAND (chan)); }void dwmac_enable_dma_irq (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan,bool rx,bool tx) { -u32 value =readl (ioaddr +DMA_INTR_ENA ); +u32 value =readl (ioaddr +DMA_CHAN_INTR_ENA (chan));if (rx) value |=DMA_INTR_DEFAULT_RX ;if (tx) value |=DMA_INTR_DEFAULT_TX ; -writel (value, ioaddr +DMA_INTR_ENA ); +writel (value, ioaddr +DMA_CHAN_INTR_ENA (chan)); }void dwmac_disable_dma_irq (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan,bool rx,bool tx) { -u32 value =readl (ioaddr +DMA_INTR_ENA ); +u32 value =readl (ioaddr +DMA_CHAN_INTR_ENA (chan));if (rx) value &= ~DMA_INTR_DEFAULT_RX ;if (tx) value &= ~DMA_INTR_DEFAULT_TX ; -writel (value, ioaddr +DMA_INTR_ENA ); +writel (value, ioaddr +DMA_CHAN_INTR_ENA (chan)); }void dwmac_dma_start_tx (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CONTROL ); +u32 value =readl (ioaddr +DMA_CHAN_CONTROL (chan)); value |=DMA_CONTROL_ST ; -writel (value, ioaddr +DMA_CONTROL ); +writel (value, ioaddr +DMA_CHAN_CONTROL (chan)); }void dwmac_dma_stop_tx (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CONTROL ); +u32 value =readl (ioaddr +DMA_CHAN_CONTROL (chan)); value &= ~DMA_CONTROL_ST ; -writel (value, ioaddr +DMA_CONTROL ); +writel (value, ioaddr +DMA_CHAN_CONTROL (chan)); }void dwmac_dma_start_rx (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CONTROL ); +u32 value =readl (ioaddr +DMA_CHAN_CONTROL (chan)); value |=DMA_CONTROL_SR ; -writel (value, ioaddr +DMA_CONTROL ); +writel (value, ioaddr +DMA_CHAN_CONTROL (chan)); }void dwmac_dma_stop_rx (struct stmmac_priv *priv,void __iomem *ioaddr,u32 chan) { -u32 value =readl (ioaddr +DMA_CONTROL ); +u32 value =readl (ioaddr +DMA_CHAN_CONTROL (chan)); value &= ~DMA_CONTROL_SR ; -writel (value, ioaddr +DMA_CONTROL ); +writel (value, ioaddr +DMA_CHAN_CONTROL (chan)); }#ifdef DWMAC_DMA_DEBUG
@@ -167,7 +167,7 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];int ret =0 ;/* read the status register (CSR5) */ -u32 intr_status =readl (ioaddr +DMA_STATUS ); +u32 intr_status =readl (ioaddr +DMA_CHAN_STATUS (chan));#ifdef DWMAC_DMA_DEBUG /* Enable it to monitor DMA rx/tx status in case of critical problems */
@@ -237,7 +237,7 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,pr_warn ("%s: unexpected status %08x\n" , __func__, intr_status);/* Clear the interrupt by writing a logic 1 to the CSR5[15-0] */ -writel ((intr_status &0x1ffff ), ioaddr +DMA_STATUS ); +writel ((intr_status &0x7ffff ), ioaddr +DMA_CHAN_STATUS (chan));return ret; }
Signature · 1 line
2.31.4
PATCH v6 5/9 net: stmmac: Add Loongson-specific register definitions
In reply to Yanteng SiThere are two types of Loongson DWGMAC. The first type shares the same register definitions and has similar logic as dwmac1000. The second type uses several different register definitions.
Simply put, we split some single bit fields into double bits fileds:
DMA_INTR_ENA_NIE = 0x00040000 + 0x00020000DMA_INTR_ENA_AIE = 0x00010000 + 0x00008000DMA_STATUS_NIS = 0x00040000 + 0x00020000DMA_STATUS_AIS = 0x00010000 + 0x00008000DMA_STATUS_FBI = 0x00002000 + 0x00001000
--- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../ethernet/stmicro/stmmac/dwmac-loongson.c | 2 ++ .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 10 ++++-- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 27 ++++++++++++++++ .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 32 +++++++++++++++---- drivers/net/ethernet/stmicro/stmmac/hwif.c | 3 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 1 + include/linux/stmmac.h | 1 + 8 files changed, 67 insertions(+), 10 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -34,6 +34,7 @@#define DWMAC_CORE_5_00 0x50#define DWMAC_CORE_5_10 0x51#define DWMAC_CORE_5_20 0x52 +#define DWLGMAC_CORE_1_00 0x10#define DWXGMAC_CORE_2_10 0x21#define DWXGMAC_CORE_2_20 0x22#define DWXLGMAC_CORE_2_00 0x20
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +2 -0
@@ -101,6 +101,8 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, plat->mdio_bus_data->needs_reset = true; } + plat->flags |=STMMAC_FLAG_HAS_LGMAC ; +/* Enable pci device */ ret =pci_enable_device (pdev);if (ret) {
drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c +8 -2
@@ -118,7 +118,10 @@ static void dwmac1000_dma_init(struct stmmac_priv *priv, void __iomem *ioaddr,u32 dma_intr_mask;/* Mask interrupts by writing to CSR7 */ - dma_intr_mask =DMA_INTR_DEFAULT_MASK ; +if (priv->plat->flags &STMMAC_FLAG_HAS_LGMAC ) + dma_intr_mask =DMA_INTR_DEFAULT_MASK_LOONGSON ; +else + dma_intr_mask =DMA_INTR_DEFAULT_MASK ;dma_config (ioaddr +DMA_BUS_MODE , ioaddr +DMA_INTR_ENA , dma_cfg, dma_intr_mask, atds);
@@ -130,7 +133,10 @@ static void dwmac1000_dma_init_channel(struct stmmac_priv *priv, void __iomem *iu32 dma_intr_mask;/* Mask interrupts by writing to CSR7 */ - dma_intr_mask =DMA_INTR_DEFAULT_MASK ; +if (priv->plat->flags &STMMAC_FLAG_HAS_LGMAC ) + dma_intr_mask =DMA_INTR_DEFAULT_MASK_LOONGSON ; +else + dma_intr_mask =DMA_INTR_DEFAULT_MASK ;if (dma_cfg->multi_msi_en) dma_config(ioaddr + DMA_CHAN_BUS_MODE(chan),
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h +27 -0
@@ -70,16 +70,20 @@#define DMA_CONTROL_SR 0x00000002/* Start/Stop Receive */ /* DMA Normal interrupt */ +#define DMA_INTR_ENA_NIE_LOONGSON 0x00060000/* Normal Loongson Tx/Rx Summary */ #define DMA_INTR_ENA_NIE 0x00010000/* Normal Summary */ #define DMA_INTR_ENA_TIE 0x00000001/* Transmit Interrupt */ #define DMA_INTR_ENA_TUE 0x00000004/* Transmit Buffer Unavailable */ #define DMA_INTR_ENA_RIE 0x00000040/* Receive Interrupt */ #define DMA_INTR_ENA_ERE 0x00004000/* Early Receive */ +#define DMA_INTR_NORMAL_LOONGSON (DMA_INTR_ENA_NIE_LOONGSON | DMA_INTR_ENA_RIE | \ + DMA_INTR_ENA_TIE)#define DMA_INTR_NORMAL (DMA_INTR_ENA_NIE | DMA_INTR_ENA_RIE | \ DMA_INTR_ENA_TIE)/* DMA Abnormal interrupt */ +#define DMA_INTR_ENA_AIE_LOONGSON 0x00018000/* Abnormal Loongson Tx/Rx Summary */ #define DMA_INTR_ENA_AIE 0x00008000/* Abnormal Summary */ #define DMA_INTR_ENA_FBE 0x00002000/* Fatal Bus Error */ #define DMA_INTR_ENA_ETE 0x00000400/* Early Transmit */
@@ -91,10 +95,13 @@#define DMA_INTR_ENA_TJE 0x00000008/* Transmit Jabber */ #define DMA_INTR_ENA_TSE 0x00000002/* Transmit Stopped */ +#define DMA_INTR_ABNORMAL_LOONGSON (DMA_INTR_ENA_AIE_LOONGSON | DMA_INTR_ENA_FBE | \ + DMA_INTR_ENA_UNE)#define DMA_INTR_ABNORMAL (DMA_INTR_ENA_AIE | DMA_INTR_ENA_FBE | \ DMA_INTR_ENA_UNE)/* DMA default interrupt mask */ +#define DMA_INTR_DEFAULT_MASK_LOONGSON (DMA_INTR_NORMAL_LOONGSON | DMA_INTR_ABNORMAL_LOONGSON)#define DMA_INTR_DEFAULT_MASK (DMA_INTR_NORMAL | DMA_INTR_ABNORMAL)#define DMA_INTR_DEFAULT_RX (DMA_INTR_ENA_RIE)#define DMA_INTR_DEFAULT_TX (DMA_INTR_ENA_TIE)
@@ -111,9 +118,12 @@#define DMA_STATUS_TS_SHIFT 20#define DMA_STATUS_RS_MASK 0x000e0000/* Receive Process State */ #define DMA_STATUS_RS_SHIFT 17 +#define DMA_STATUS_NIS_LOONGSON 0x00060000/* Normal Loongson Tx/Rx Interrupt Summary */ #define DMA_STATUS_NIS 0x00010000/* Normal Interrupt Summary */ +#define DMA_STATUS_AIS_LOONGSON 0x00018000/* Abnormal Loongson Tx/Rx Interrupt Summary */ #define DMA_STATUS_AIS 0x00008000/* Abnormal Interrupt Summary */ #define DMA_STATUS_ERI 0x00004000/* Early Receive Interrupt */ +#define DMA_STATUS_FBI_LOONGSON 0x00003000/* Fatal Loongson Tx/Rx Bus Error Interrupt */ #define DMA_STATUS_FBI 0x00002000/* Fatal Bus Error Interrupt */ #define DMA_STATUS_ETI 0x00000400/* Early Transmit Interrupt */ #define DMA_STATUS_RWT 0x00000200/* Receive Watchdog Timeout */
@@ -128,10 +138,20 @@#define DMA_STATUS_TI 0x00000001/* Transmit Interrupt */ #define DMA_CONTROL_FTF 0x00100000/* Flush transmit FIFO */ +#define DMA_STATUS_MSK_COMMON_LOONGSON (DMA_STATUS_NIS_LOONGSON | \ + DMA_STATUS_AIS_LOONGSON | \ + DMA_STATUS_FBI_LOONGSON)#define DMA_STATUS_MSK_COMMON (DMA_STATUS_NIS | \ DMA_STATUS_AIS | \ DMA_STATUS_FBI) +#define DMA_STATUS_MSK_RX_LOONGSON (DMA_STATUS_ERI | \ + DMA_STATUS_RWT | \ + DMA_STATUS_RPS | \ + DMA_STATUS_RU | \ + DMA_STATUS_RI | \ + DMA_STATUS_OVF | \ + DMA_STATUS_MSK_COMMON_LOONGSON)#define DMA_STATUS_MSK_RX (DMA_STATUS_ERI | \ DMA_STATUS_RWT | \ DMA_STATUS_RPS | \
@@ -140,6 +160,13 @@ DMA_STATUS_OVF | \ DMA_STATUS_MSK_COMMON) +#define DMA_STATUS_MSK_TX_LOONGSON (DMA_STATUS_ETI | \ + DMA_STATUS_UNF | \ + DMA_STATUS_TJT | \ + DMA_STATUS_TU | \ + DMA_STATUS_TPS | \ + DMA_STATUS_TI | \ + DMA_STATUS_MSK_COMMON_LOONGSON)#define DMA_STATUS_MSK_TX (DMA_STATUS_ETI | \ DMA_STATUS_UNF | \ DMA_STATUS_TJT | \
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +25 -7
@@ -167,6 +167,9 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];int ret =0 ;/* read the status register (CSR5) */ +u32 nor_intr_status; +u32 abnor_intr_status; +u32 fb_intr_status;u32 intr_status =readl (ioaddr +DMA_CHAN_STATUS (chan));#ifdef DWMAC_DMA_DEBUG
@@ -176,13 +179,28 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,show_rx_process_state (intr_status);#endif -if (dir ==DMA_DIR_RX ) - intr_status &=DMA_STATUS_MSK_RX ; -else if (dir ==DMA_DIR_TX ) - intr_status &=DMA_STATUS_MSK_TX ; +if (priv->plat->flags &STMMAC_FLAG_HAS_LGMAC ) { +if (dir ==DMA_DIR_RX ) + intr_status &=DMA_STATUS_MSK_RX_LOONGSON ; +else if (dir ==DMA_DIR_TX ) + intr_status &=DMA_STATUS_MSK_TX_LOONGSON ; + + nor_intr_status = intr_status &DMA_STATUS_NIS_LOONGSON ; + abnor_intr_status = intr_status &DMA_STATUS_AIS_LOONGSON ; + fb_intr_status = intr_status &DMA_STATUS_FBI_LOONGSON ; + }else { +if (dir ==DMA_DIR_RX ) + intr_status &=DMA_STATUS_MSK_RX ; +else if (dir ==DMA_DIR_TX ) + intr_status &=DMA_STATUS_MSK_TX ; + + nor_intr_status = intr_status &DMA_STATUS_NIS ; + abnor_intr_status = intr_status &DMA_STATUS_AIS ; + fb_intr_status = intr_status &DMA_STATUS_FBI ; + }/* ABNORMAL interrupts */ -if (unlikely (intr_status &DMA_STATUS_AIS )) { +if (unlikely (abnor_intr_status)) {if (unlikely (intr_status &DMA_STATUS_UNF )) { ret = tx_hard_error_bump_tc; x->tx_undeflow_irq++;
@@ -205,13 +223,13 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, x->tx_process_stopped_irq++; ret = tx_hard_error; } -if (unlikely (intr_status &DMA_STATUS_FBI )) { +if (unlikely (intr_status & fb_intr_status)) { x->fatal_bus_error_irq++; ret = tx_hard_error; } }/* TX/RX NORMAL interrupts */ -if (likely (intr_status &DMA_STATUS_NIS )) { +if (likely (nor_intr_status)) {if (likely (intr_status &DMA_STATUS_RI )) {u32 value =readl (ioaddr +DMA_INTR_ENA );/* to schedule NAPI on real RIE event. */
drivers/net/ethernet/stmicro/stmmac/hwif.c +2 -1
@@ -59,7 +59,8 @@ static int stmmac_dwmac1_quirks(struct stmmac_priv *priv)dev_info (priv->device,"Enhanced/Alternate descriptors\n" );/* GMAC older than 3.50 has no extended descriptors */ -if (priv->synopsys_id >=DWMAC_CORE_3_50 ) { +if (priv->synopsys_id >=DWMAC_CORE_3_50 || + priv->synopsys_id ==DWLGMAC_CORE_1_00 ) {dev_info (priv->device,"Enabled extended descriptors\n" ); priv->extend_desc =1 ; }else {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -0
@@ -7218,6 +7218,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)* riwt_off field from the platform. */ if (((priv->synopsys_id >=DWMAC_CORE_3_50 ) || + (priv->synopsys_id ==DWLGMAC_CORE_1_00 ) || (priv->plat->has_xgmac)) && (!priv->plat->riwt_off)) { priv->use_riwt =1 ; dev_info(priv->device,
include/linux/stmmac.h +1 -0
@@ -221,6 +221,7 @@ struct dwmac4_addrs {#define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10)#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(12) +#define STMMAC_FLAG_HAS_LGMAC BIT(13)struct plat_stmmacenet_data {int bus_id;
Signature · 1 line
2.31.4
Re: [PATCH v6 5/9] net: stmmac: Add Loongson-specific register definitions
Quoted 11 lines · Yanteng Si
There are two types of Loongson DWGMAC. The first type shares the same register definitions and has similar logic as dwmac1000. The second type uses several different register definitions.
Simply put, we split some single bit fields into double bits fileds:
DMA_INTR_ENA_NIE=0x00040000+0x00020000DMA_INTR_ENA_AIE=0x00010000+0x00008000DMA_STATUS_NIS=0x00040000+0x00020000DMA_STATUS_AIS=0x00010000+0x00008000DMA_STATUS_FBI=0x00002000+0x00001000
What is missing here is why? What are the second bits used for? And why does the driver not care which bit is set when handing interrupts?
Andrew
Re: [PATCH v6 5/9] net: stmmac: Add Loongson-specific register definitions
Quoted 5 lines · Andrew Lunn
Quoted 4 lines · Yanteng Si
There are two types of Loongson DWGMAC. The first type shares the same register definitions and has similar logic as dwmac1000. The second type uses several different register definitions.
Quoted 8 lines
Quoted 7 lines
Simply put, we split some single bit fields into double bits fileds:
DMA_INTR_ENA_NIE=0x00040000+0x00020000DMA_INTR_ENA_AIE=0x00010000+0x00008000DMA_STATUS_NIS=0x00040000+0x00020000DMA_STATUS_AIS=0x00010000+0x00008000DMA_STATUS_FBI=0x00002000+0x00001000What is missing here is why? What are the second bits used for? And
We think it is necessary to distinguish rx and tx, so we split these bits into two.
this is:
DMA_INTR_ENA_NIE = rx + tx
Quoted 1 line
why does the driver not care which bit is set when handing interrupts?
We will care about it later. Because now we will support the minimum feature set
first, which can reduce everyone’s review pressure.
Thanks,
Yanteng
Quoted 2 lines
Andrew
Re: [PATCH v6 5/9] net: stmmac: Add Loongson-specific register definitions
Quoted 14 lines · Yanteng Si
Quoted 12 lines · Andrew Lunn
Quoted 11 lines · Yanteng Si
There are two types of Loongson DWGMAC. The first type shares the same register definitions and has similar logic as dwmac1000. The second type uses several different register definitions.
Simply put, we split some single bit fields into double bits fileds:
DMA_INTR_ENA_NIE=0x00040000+0x00020000DMA_INTR_ENA_AIE=0x00010000+0x00008000DMA_STATUS_NIS=0x00040000+0x00020000DMA_STATUS_AIS=0x00010000+0x00008000DMA_STATUS_FBI=0x00002000+0x00001000
Quoted 8 lines
Quoted 1 line
What is missing here is why? What are the second bits used for? And
We think it is necessary to distinguish rx and tx, so we split these bits into two.
this is:
DMA_INTR_ENA_NIE= rx + tx
O.K, so please add DMA_INTR_ENA_NIE_RX and DMA_INTR_ENA_NIE_TX #define's, etc.
Quoted 2 lines
We will care about it later. Because now we will support the minimum feature set first, which can reduce everyone’s review pressure.
Well, you failed with that, since you did not provide the details what these bits are. If you had directly handled the bits separately, it would of been obvious what they are for.
Andrew
Re: [PATCH v6 5/9] net: stmmac: Add Loongson-specific register definitions
Quoted 15 lines · Andrew Lunn
Quoted 14 lines · Yanteng Si
Quoted 13 lines · Andrew Lunn
Quoted 11 lines · Yanteng Si
There are two types of Loongson DWGMAC. The first type shares the same register definitions and has similar logic as dwmac1000. The second type uses several different register definitions.
Simply put, we split some single bit fields into double bits fileds:
DMA_INTR_ENA_NIE=0x00040000+0x00020000DMA_INTR_ENA_AIE=0x00010000+0x00008000DMA_STATUS_NIS=0x00040000+0x00020000DMA_STATUS_AIS=0x00010000+0x00008000DMA_STATUS_FBI=0x00002000+0x00001000What is missing here is why? What are the second bits used for? And
Quoted 8 lines
Quoted 6 lines
We think it is necessary to distinguish rx and tx, so we split these bits into two.
this is:
DMA_INTR_ENA_NIE= rx + txO.K, so please add
DMA_INTR_ENA_NIE_RXandDMA_INTR_ENA_NIE_TX#define's, etc.
OK!
Quoted 6 lines
Quoted 3 lines
We will care about it later. Because now we will support the minimum feature set first, which can reduce everyone’s review pressure.
Well, you failed with that, since you did not provide the details what these bits are. If you had directly handled the bits separately, it would of been obvious what they are for.
It is because I did not give a clear reply to serge's comment, which was more detailed. :)
Thanks,
Yanteng
Quoted 2 lines
Andrew
PATCH v6 6/9 net: stmmac: dwmac-loongson: Add MSI support
In reply to Yanteng SiRequest allocation for MSI for specific versions.
Some features of Loongson platforms are bound to the GMAC_VERSION register. We have to read its value in order to get the correct channel number.
--- .../ethernet/stmicro/stmmac/dwmac-loongson.c | 132 ++++++++++++++---- 1 file changed, 102 insertions(+), 30 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +102 -30
@@ -11,8 +11,85 @@struct stmmac_pci_info {int (*setup)(struct pci_dev *pdev,struct plat_stmmacenet_data *plat); +int (*config)(struct pci_dev *pdev,struct plat_stmmacenet_data *plat, +struct stmmac_resources *res,struct device_node *np); }; +static int loongson_dwmac_config_legacy (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat, +struct stmmac_resources *res, +struct device_node *np) +{ +if (np) { + res->irq =of_irq_get_byname (np,"macirq" ); +if (res->irq <0 ) { +dev_err (&pdev->dev,"IRQ macirq not found\n" ); +return -ENODEV ; + } + + res->wol_irq =of_irq_get_byname (np,"eth_wake_irq" ); +if (res->wol_irq <0 ) { +dev_info (&pdev->dev, +"IRQ eth_wake_irq not found, using macirq\n" ); + res->wol_irq = res->irq; + } + + res->lpi_irq =of_irq_get_byname (np,"eth_lpi" ); +if (res->lpi_irq <0 ) { +dev_err (&pdev->dev,"IRQ eth_lpi not found\n" ); +return -ENODEV ; + } + }else { + res->irq = pdev->irq; + res->wol_irq = res->irq; + } + + plat->flags &= ~STMMAC_FLAG_MULTI_MSI_EN ; +dev_info (&pdev->dev,"%s: Single IRQ enablement successful\n" , + __func__); + +return 0 ; +} + +static int loongson_dwmac_config_multi_msi (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat, +struct stmmac_resources *res, +struct device_node *np, +int channel_num) +{ +int i, ret, vecs; + + vecs =roundup_pow_of_two (channel_num *2 +1 ); + ret =pci_alloc_irq_vectors (pdev, vecs, vecs,PCI_IRQ_MSI ); +if (ret <0 ) { +dev_info (&pdev->dev, +"MSI enable failed, Fallback to legacy interrupt\n" ); +return loongson_dwmac_config_legacy (pdev, plat, res, np); + } + + plat->rx_queues_to_use = channel_num; + plat->tx_queues_to_use = channel_num; + + res->irq =pci_irq_vector (pdev,0 ); + res->wol_irq = res->irq; + +/* INT NAME | MAC | CH7 rx | CH7 tx | ... | CH0 rx | CH0 tx | +* --------- ----- -------- -------- ... -------- -------- +* IRQ NUM | 0 | 1 | 2 | ... | 15 | 16 | +*/ +for (i =0 ; i < channel_num; i++) { + res->rx_irq[channel_num -1 - i] = +pci_irq_vector (pdev,1 + i *2 ); + res->tx_irq[channel_num -1 - i] = +pci_irq_vector (pdev,2 + i *2 ); + } + + plat->flags |=STMMAC_FLAG_MULTI_MSI_EN ; +dev_info (&pdev->dev,"%s: multi MSI enablement successful\n" , __func__); + +return 0 ; +} +static void loongson_default_data (struct pci_dev *pdev,struct plat_stmmacenet_data *plat) {
@@ -66,8 +143,29 @@ static int loongson_gmac_data(struct pci_dev *pdev,return 0 ; } +static int loongson_gmac_config (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat, +struct stmmac_resources *res, +struct device_node *np) +{ +int ret; +u32 version =readl (res->addr +GMAC_VERSION ); + +switch (version &0xff ) { +case DWLGMAC_CORE_1_00 : + ret =loongson_dwmac_config_multi_msi (pdev, plat, res, np,8 ); +break ; +default : + ret =loongson_dwmac_config_legacy (pdev, plat, res, np); +break ; + } + +return ret; +} +static struct stmmac_pci_info loongson_gmac_pci_info = { .setup = loongson_gmac_data, + .config = loongson_gmac_config, }; static int loongson_dwmac_probe(struct pci_dev *pdev,
@@ -142,44 +240,19 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, plat->phy_interface = phy_mode; } -pci_enable_msi (pdev);memset (&res,0 ,sizeof (res)); res.addr =pcim_iomap_table (pdev)[0 ]; -if (np) { - res.irq =of_irq_get_byname (np,"macirq" ); -if (res.irq <0 ) { -dev_err (&pdev->dev,"IRQ macirq not found\n" ); - ret = -ENODEV ; - goto err_disable_msi; - } - - res.wol_irq =of_irq_get_byname (np,"eth_wake_irq" ); -if (res.wol_irq <0 ) { -dev_info (&pdev->dev, -"IRQ eth_wake_irq not found, using macirq\n" ); - res.wol_irq = res.irq; - } - - res.lpi_irq =of_irq_get_byname (np,"eth_lpi" ); -if (res.lpi_irq <0 ) { -dev_err (&pdev->dev,"IRQ eth_lpi not found\n" ); - ret = -ENODEV ; - goto err_disable_msi; - } - }else { - res.irq = pdev->irq; - res.wol_irq = pdev->irq; - } + ret = info->config (pdev, plat, &res, np); +if (ret) + goto err_disable_device; ret =stmmac_dvr_probe (&pdev->dev, plat, &res);if (ret) - goto err_disable_msi; + goto err_disable_device;return ret; -err_disable_msi: -pci_disable_msi (pdev); err_disable_device:pci_disable_device (pdev); err_put_node:
@@ -203,7 +276,6 @@ static void loongson_dwmac_remove(struct pci_dev *pdev)break ; } -pci_disable_msi (pdev);pci_disable_device (pdev); }
Signature · 1 line
2.31.4
PATCH v6 7/9 net: stmmac: dwmac-loongson: Add GNET support
In reply to Yanteng SiAdd Loongson GNET (GMAC with PHY) support. Current GNET does not support half duplex mode, and GNET on LS7A only supports ANE when speed is set to 1000M.
--- .../ethernet/stmicro/stmmac/dwmac-loongson.c | 79 +++++++++++++++++++ .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 ++ include/linux/stmmac.h | 2 + 3 files changed, 87 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +79 -0
@@ -168,6 +168,83 @@ static struct stmmac_pci_info loongson_gmac_pci_info = { .config = loongson_gmac_config, }; +static void loongson_gnet_fix_speed (void *priv,unsigned int speed,unsigned int mode) +{ +struct net_device *ndev =dev_get_drvdata (priv); +struct stmmac_priv *ptr =netdev_priv (ndev); + +/* The controller and PHY don't work well together. +* We need to use the PS bit to check if the controller's status +* is correct and reset PHY if necessary. +*/ +if (speed ==SPEED_1000 ) +if (readl (ptr->ioaddr +MAC_CTRL_REG ) & (1 <<15 )/* PS */ ) +phy_restart_aneg (ndev->phydev); +} + +static int loongson_gnet_data (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat) +{ +loongson_default_data (pdev, plat); + + plat->multicast_filter_bins =256 ; + + plat->mdio_bus_data->phy_mask =0xfffffffb ; + + plat->phy_addr =2 ; + plat->phy_interface =PHY_INTERFACE_MODE_INTERNAL ; + + plat->bsp_priv = &pdev->dev; + plat->fix_mac_speed = loongson_gnet_fix_speed; + + plat->dma_cfg->pbl =32 ; + plat->dma_cfg->pblx8 = true; + + plat->clk_ref_rate =125000000 ; + plat->clk_ptp_rate =125000000 ; + +return 0 ; +} + +static int loongson_gnet_config (struct pci_dev *pdev, +struct plat_stmmacenet_data *plat, +struct stmmac_resources *res, +struct device_node *np) +{ +int ret; +u32 version =readl (res->addr +GMAC_VERSION ); + +switch (version &0xff ) { +case DWLGMAC_CORE_1_00 : + ret =loongson_dwmac_config_multi_msi (pdev, plat, res, np,8 ); +break ; +default : + ret =loongson_dwmac_config_legacy (pdev, plat, res, np); +break ; + } + +switch (pdev->revision) { +case 0x00 : + plat->flags |= +FIELD_PREP (STMMAC_FLAG_DISABLE_HALF_DUPLEX ,1 ) | +FIELD_PREP (STMMAC_FLAG_DISABLE_FORCE_1000 ,1 ); +break ; +case 0x01 : + plat->flags |= +FIELD_PREP (STMMAC_FLAG_DISABLE_HALF_DUPLEX ,1 ); +break ; +default : +break ; + } + +return ret; +} + +static struct stmmac_pci_info loongson_gnet_pci_info = { + .setup = loongson_gnet_data, + .config = loongson_gnet_config, +}; +static int loongson_dwmac_probe (struct pci_dev *pdev,const struct pci_device_id *id) {
@@ -318,9 +395,11 @@ static SIMPLE_DEV_PM_OPS(loongson_dwmac_pm_ops, loongson_dwmac_suspend, loongson_dwmac_resume);#define PCI_DEVICE_ID_LOONGSON_GMAC 0x7a03 +#define PCI_DEVICE_ID_LOONGSON_GNET 0x7a13static const struct pci_device_id loongson_dwmac_id_table[] = { {PCI_DEVICE_DATA (LOONGSON ,GMAC , &loongson_gmac_pci_info) }, + {PCI_DEVICE_DATA (LOONGSON ,GNET , &loongson_gnet_pci_info) }, {} };MODULE_DEVICE_TABLE (pci, loongson_dwmac_id_table);
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +6 -0
@@ -410,6 +410,12 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev,return 0 ; } +if (FIELD_GET (STMMAC_FLAG_DISABLE_FORCE_1000 , priv->plat->flags)) { +if (cmd->base.speed ==SPEED_1000 && + cmd->base.autoneg !=AUTONEG_ENABLE ) +return -EOPNOTSUPP ; + } +return phylink_ethtool_ksettings_set (priv->phylink, cmd); }
include/linux/stmmac.h +2 -0
@@ -222,6 +222,8 @@ struct dwmac4_addrs {#define STMMAC_FLAG_EN_TX_LPI_CLOCKGATING BIT(11)#define STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY BIT(12)#define STMMAC_FLAG_HAS_LGMAC BIT(13) +#define STMMAC_FLAG_DISABLE_HALF_DUPLEX BIT(14) +#define STMMAC_FLAG_DISABLE_FORCE_1000 BIT(15)struct plat_stmmacenet_data {int bus_id;
Signature · 1 line
2.31.4
PATCH v6 8/9 net: stmmac: dwmac-loongson: Disable flow control for GMAC
In reply to Yanteng SiLoongson GMAC does not support Flow Control feature. Set flags to disable it.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- include/linux/stmmac.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +2 -0
@@ -160,6 +160,8 @@ static int loongson_gmac_config(struct pci_dev *pdev,break ; } + plat->flags |=FIELD_PREP (STMMAC_FLAG_DISABLE_FLOW_CONTROL ,1 ); +return ret; }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -3
@@ -1236,9 +1236,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv)xpcs_get_interfaces (priv->hw->xpcs, priv->phylink_config.supported_interfaces); - priv->phylink_config.mac_capabilities =MAC_ASYM_PAUSE |MAC_SYM_PAUSE | -MAC_10FD |MAC_100FD | -MAC_1000FD ; + priv->phylink_config.mac_capabilities =MAC_10FD |MAC_100FD |MAC_1000FD ; +if (!FIELD_GET (STMMAC_FLAG_DISABLE_FLOW_CONTROL , priv->plat->flags)) + priv->phylink_config.mac_capabilities |=MAC_ASYM_PAUSE |MAC_SYM_PAUSE ;stmmac_set_half_duplex (priv);
include/linux/stmmac.h +1 -0
@@ -224,6 +224,7 @@ struct dwmac4_addrs {#define STMMAC_FLAG_HAS_LGMAC BIT(13)#define STMMAC_FLAG_DISABLE_HALF_DUPLEX BIT(14)#define STMMAC_FLAG_DISABLE_FORCE_1000 BIT(15) +#define STMMAC_FLAG_DISABLE_FLOW_CONTROL BIT(16)struct plat_stmmacenet_data {int bus_id;
Signature · 1 line
2.31.4
PATCH v6 9/9 net: stmmac: Disable coe for some Loongson GNET
In reply to Yanteng SiSome chips of Loongson GNET does not support coe, so disable them.
--- drivers/net/ethernet/stmicro/stmmac/hwif.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/stmicro/stmmac/hwif.c +5 -0
@@ -73,6 +73,11 @@ static int stmmac_dwmac1_quirks(struct stmmac_priv *priv) mac->desc = &ndesc_ops; } +if (priv->synopsys_id ==DWLGMAC_CORE_1_00 ) { + priv->plat->tx_coe =0 ; + priv->plat->rx_coe =STMMAC_RX_COE_NONE ; + } +stmmac_dwmac_mode_quirk (priv);return 0 ; }
Signature · 1 line
2.31.4
Hi Yanteng
Quoted 23 lines · Yanteng Si
v6:
* Refer to Serge's suggestion:
- Add new platform feature flag:include/linux/stmmac.h: +#define STMMAC_FLAG_HAS_LGMAC BIT(13)- Add the IRQs macros specific to the Loongson Multi-channels GMAC:
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h: +#define DMA_INTR_ENA_NIE_LOONGSON 0x00060000 /* Normal Loongson Tx/Rx Summary */ #define DMA_INTR_ENA_NIE 0x00010000 /* Normal Summary */ ...- Drop all of redundant changes that don't require the prototypes being converted to accepting the
stmmac_privpointer.* Refer to andrew's suggestion:
- Drop white space changes.
- break patch up into lots of smaller parts.
Some small patches have been put into another series as a preparation see <https://lore.kernel.org/loongarch/[email protected]/T/#t>
Quoted 4 lines
*note* : This series of patches relies on the three small patches above.
* others
- Dropirq_flagschanges.
- Changed patch order.
Thanks for submitting the updated series. I'll have a closer look at it on the next week.
-Serge(y)
Quoted 48 lines
v4 -> v5:
* Remove an ugly and useless patch (fix channel number).
* Remove the non-standard dma64 driver code, and also remove the HWIF entries, since the associated custom callbacks no longer exist.
* Refer to Serge's suggestion: Update thedwmac1000_dma.cto support the multi-DMA-channels controller setup.See:
v4: <https://lore.kernel.org/loongarch/[email protected]/>
v3: <https://lore.kernel.org/loongarch/[email protected]/>
v2: <https://lore.kernel.org/loongarch/[email protected]/>
v1: <https://lore.kernel.org/loongarch/[email protected]/>Yanteng Si (9):
net: stmmac: Passstmmac_privand chan in some callbacks
net: stmmac: dwmac-loongson: Refactor code forloongson_dwmac_probe()
net: stmmac: dwmac-loongson: Add full PCI support
net: stmmac: Add multi-channel supports
net: stmmac: Add Loongson-specific register definitions
net: stmmac: dwmac-loongson: Add MSI support
net: stmmac: dwmac-loongson: Add GNET support
net: stmmac: dwmac-loongson: Disable flow control for GMAC
net: stmmac: Disable coe for some Loongson GNETdrivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../ethernet/stmicro/stmmac/dwmac-loongson.c | 296 ++++++++++++++---- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 61 +++- .../ethernet/stmicro/stmmac/dwmac100_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 47 ++- .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 65 ++-- .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 8 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 11 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +- include/linux/stmmac.h | 4 + 14 files changed, 413 insertions(+), 107 deletions(-)Signature · 1 line
2.31.4
Quoted 26 lines · Serge Semin
Hi Yanteng
Quoted 23 lines · Yanteng Si
v6:
* Refer to Serge's suggestion:
- Add new platform feature flag:include/linux/stmmac.h: +#define STMMAC_FLAG_HAS_LGMAC BIT(13)- Add the IRQs macros specific to the Loongson Multi-channels GMAC:
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h: +#define DMA_INTR_ENA_NIE_LOONGSON 0x00060000 /* Normal Loongson Tx/Rx Summary */ #define DMA_INTR_ENA_NIE 0x00010000 /* Normal Summary */ ...- Drop all of redundant changes that don't require the prototypes being converted to accepting the
stmmac_privpointer.* Refer to andrew's suggestion:
- Drop white space changes.
- break patch up into lots of smaller parts.
Some small patches have been put into another series as a preparation see <https://lore.kernel.org/loongarch/[email protected]/T/#t>
Quoted 6 lines
Quoted 4 lines
*note* : This series of patches relies on the three small patches above.
* others
- Dropirq_flagschanges.
- Changed patch order.Thanks for submitting the updated series. I'll have a closer look at it on the next week.
I have prepared a new patch version and will CC you soon, so you can go straight
to the v7.
Thank,
Yanteng
Quoted 50 lines
-Serge(y)
Quoted 47 lines
v4 -> v5:
* Remove an ugly and useless patch (fix channel number).
* Remove the non-standard dma64 driver code, and also remove the HWIF entries, since the associated custom callbacks no longer exist.
* Refer to Serge's suggestion: Update thedwmac1000_dma.cto support the multi-DMA-channels controller setup.See:
v4: <https://lore.kernel.org/loongarch/[email protected]/>
v3: <https://lore.kernel.org/loongarch/[email protected]/>
v2: <https://lore.kernel.org/loongarch/[email protected]/>
v1: <https://lore.kernel.org/loongarch/[email protected]/>Yanteng Si (9):
net: stmmac: Passstmmac_privand chan in some callbacks
net: stmmac: dwmac-loongson: Refactor code forloongson_dwmac_probe()
net: stmmac: dwmac-loongson: Add full PCI support
net: stmmac: Add multi-channel supports
net: stmmac: Add Loongson-specific register definitions
net: stmmac: dwmac-loongson: Add MSI support
net: stmmac: dwmac-loongson: Add GNET support
net: stmmac: dwmac-loongson: Disable flow control for GMAC
net: stmmac: Disable coe for some Loongson GNETdrivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../ethernet/stmicro/stmmac/dwmac-loongson.c | 296 ++++++++++++++---- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 61 +++- .../ethernet/stmicro/stmmac/dwmac100_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 47 ++- .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 65 ++-- .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 8 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 11 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +- include/linux/stmmac.h | 4 + 14 files changed, 413 insertions(+), 107 deletions(-)Signature · 1 line
2.31.4
Quoted 31 lines · Yanteng Si
Quoted 29 lines · Serge Semin
Hi Yanteng
Quoted 26 lines · Yanteng Si
v6:
* Refer to Serge's suggestion:
- Add new platform feature flag:include/linux/stmmac.h: +#define STMMAC_FLAG_HAS_LGMAC BIT(13)- Add the IRQs macros specific to the Loongson Multi-channels GMAC:
drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h: +#define DMA_INTR_ENA_NIE_LOONGSON 0x00060000 /* Normal Loongson Tx/Rx Summary */ #define DMA_INTR_ENA_NIE 0x00010000 /* Normal Summary */ ...- Drop all of redundant changes that don't require the prototypes being converted to accepting the
stmmac_privpointer.* Refer to andrew's suggestion:
- Drop white space changes.
- break patch up into lots of smaller parts.
Some small patches have been put into another series as a preparation see <https://lore.kernel.org/loongarch/[email protected]/T/#t>
*note* : This series of patches relies on the three small patches above.
* others
- Dropirq_flagschanges.
- Changed patch order.
Quoted 8 lines
Quoted 2 lines
Thanks for submitting the updated series. I'll have a closer look at it on the next week.
I have prepared a new patch version and will CC you soon, so you can go straight
to the v7.
If you think you settled all the Andrew's comment, you can go ahead and submit v7. I'll look at it tomorrow.
-Serge(y)
Quoted 57 lines
Thank,
Yanteng
Quoted 50 lines
-Serge(y)
Quoted 47 lines
v4 -> v5:
* Remove an ugly and useless patch (fix channel number).
* Remove the non-standard dma64 driver code, and also remove the HWIF entries, since the associated custom callbacks no longer exist.
* Refer to Serge's suggestion: Update thedwmac1000_dma.cto support the multi-DMA-channels controller setup.See:
v4: <https://lore.kernel.org/loongarch/[email protected]/>
v3: <https://lore.kernel.org/loongarch/[email protected]/>
v2: <https://lore.kernel.org/loongarch/[email protected]/>
v1: <https://lore.kernel.org/loongarch/[email protected]/>Yanteng Si (9):
net: stmmac: Passstmmac_privand chan in some callbacks
net: stmmac: dwmac-loongson: Refactor code forloongson_dwmac_probe()
net: stmmac: dwmac-loongson: Add full PCI support
net: stmmac: Add multi-channel supports
net: stmmac: Add Loongson-specific register definitions
net: stmmac: dwmac-loongson: Add MSI support
net: stmmac: dwmac-loongson: Add GNET support
net: stmmac: dwmac-loongson: Disable flow control for GMAC
net: stmmac: Disable coe for some Loongson GNETdrivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../ethernet/stmicro/stmmac/dwmac-loongson.c | 296 ++++++++++++++---- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- .../ethernet/stmicro/stmmac/dwmac1000_dma.c | 61 +++- .../ethernet/stmicro/stmmac/dwmac100_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/dwmac_dma.h | 47 ++- .../net/ethernet/stmicro/stmmac/dwmac_lib.c | 65 ++-- .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 8 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 11 +- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +- include/linux/stmmac.h | 4 + 14 files changed, 413 insertions(+), 107 deletions(-)Signature · 1 line
2.31.4
Jakub Kicinski
maintainerQuoted 1 line · On Wed, 13 Dec 2023 18:12:22 +0800 Yanteng Si wrote:
[PATCH v6 0/9] stmmac: Add Loongson platform support
Please use --subject-prefix="PATCH net-next vN" to indicate that the patches are for the networking tree.
Unfortunately they do not apply so you'll have to rebase and resend.
Signature · 1 line
pw-bot: cr
Jakub Kicinski
maintainerQuoted 7 lines · On Thu, 14 Dec 2023 11:09:01 -0800 Jakub Kicinski wrote:
Quoted 1 line · On Wed, 13 Dec 2023 18:12:22 +0800 Yanteng Si wrote:
[PATCH v6 0/9] stmmac: Add Loongson platform support
Please use --subject-prefix="PATCH net-next vN" to indicate that the patches are for the networking tree.
Unfortunately they do not apply so you'll have to rebase and resend.
But perhaps wait for Serge's comments before reposting.