netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Feiyang Chen <chenfeiyang@loongson.cn>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, peppe.cavallaro@st.com,
	alexandre.torgue@foss.st.com, joabreu@synopsys.com,
	chenhuacai@loongson.cn, dongbiao@loongson.cn,
	loongson-kernel@lists.loongnix.cn, netdev@vger.kernel.org,
	loongarch@lists.linux.dev, chris.chenfeiyang@gmail.com
Subject: Re: [PATCH v3 13/16] net: stmmac: dwmac-loongson: Add 64-bit DMA and multi-vector support
Date: Thu, 3 Aug 2023 15:20:49 +0100	[thread overview]
Message-ID: <ZMu3wTCzffo1EgNY@shell.armlinux.org.uk> (raw)
In-Reply-To: <48ceed6b5d7b32c2e46b79fa597466b9212f745e.1691047285.git.chenfeiyang@loongson.cn>

On Thu, Aug 03, 2023 at 07:30:34PM +0800, Feiyang Chen wrote:
> Set 64-Bit DMA for specific versions. Request allocation for multi-
> vector interrupts for DWLGMAC_CORE_1_00. If it fails, fallback to
> request allocation for single interrupts.
> 
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> ---
>  .../ethernet/stmicro/stmmac/dwmac-loongson.c  | 83 ++++++++++++++++++-
>  1 file changed, 81 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index c7790f73fe18..18bca996e1cb 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -6,11 +6,15 @@
>  #include <linux/pci.h>
>  #include <linux/dmi.h>
>  #include <linux/device.h>
> +#include <linux/interrupt.h>
>  #include <linux/of_irq.h>
> +#include "dwmac1000.h"
>  #include "stmmac.h"
>  
>  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);
>  };
>  
>  static void loongson_default_data(struct pci_dev *pdev,
> @@ -66,14 +70,54 @@ 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)
> +{
> +	u32 version = readl(res->addr + GMAC_VERSION);
> +
> +	switch (version & 0xff) {
> +	case DWLGMAC_CORE_1_00:
> +		plat->multi_msi_en = 1;
> +		plat->rx_queues_to_use = 8;
> +		plat->tx_queues_to_use = 8;
> +		plat->fix_channel_num = true;
> +		break;
> +	case DWMAC_CORE_3_50:
> +	case DWMAC_CORE_3_70:
> +		if (version & 0x00008000) {
> +			plat->host_dma_width = 64;
> +			plat->dma_cfg->dma64 = true;
> +		}
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	plat->dma_reset_times = 5;
> +
> +	return 0;
> +}
> +
>  static struct stmmac_pci_info loongson_gmac_pci_info = {
>  	.setup = loongson_gmac_data,
> +	.config = loongson_gmac_config,
>  };
>  
> +static u32 get_irq_type(struct device_node *np)
> +{
> +	struct of_phandle_args oirq;
> +
> +	if (np && of_irq_parse_one(np, 0, &oirq) == 0 && oirq.args_count == 2)
> +		return oirq.args[1];
> +
> +	return IRQF_TRIGGER_RISING;
> +}
> +

I do wish that there was some IRQ maintainer I could bounce this over to
for them to comment on, because I don't believe that this should be
necessary in any driver - the irq subsystem should configure the IRQ
accordingly before the driver is probed.

But since I don't know that code, and can't be bothered at this point
to read through it and DT yet again, I don't feel qualified to comment
on this...

Maybe someone else can be bothered to comment on it...

If not, then I suppose it will have to do as-is, and maybe someone at
a later date can fix it if it needs fixing.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2023-08-03 14:21 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 11:28 [PATCH v3 00/16] stmmac: Add Loongson platform support Feiyang Chen
2023-08-03 11:28 ` [PATCH v3 01/16] net: stmmac: Pass stmmac_priv and chan in some callbacks Feiyang Chen
2023-08-03 11:28 ` [PATCH v3 02/16] net: stmmac: dwmac1000: Allow platforms to choose some register offsets Feiyang Chen
2023-08-03 11:28 ` [PATCH v3 03/16] net: stmmac: dwmac1000: Add multi-channel support Feiyang Chen
2023-08-03 11:29 ` [PATCH v3 04/16] net: stmmac: dwmac1000: Add 64-bit DMA support Feiyang Chen
2023-08-03 11:29 ` [PATCH v3 05/16] net: stmmac: dwmac1000: Add Loongson register definitions Feiyang Chen
2023-08-03 11:29 ` [PATCH v3 06/16] net: stmmac: dwmac1000: Fix channel numbers for Loongson Feiyang Chen
2023-08-03 11:29 ` [PATCH v3 07/16] net: stmmac: dwmac1000: Add multiple retries for DMA reset Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 08/16] net: stmmac: dwmac1000: Allow platforms to set control value Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 09/16] net: stmmac: Allow platforms to set irq_flags Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 10/16] net: stmmac: Add Loongson HWIF entry Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 11/16] net: stmmac: dwmac-loongson: Refactor code for loongson_dwmac_probe() Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 12/16] net: stmmac: dwmac-loongson: Add LS7A support Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 13/16] net: stmmac: dwmac-loongson: Add 64-bit DMA and multi-vector support Feiyang Chen
2023-08-03 14:20   ` Russell King (Oracle) [this message]
2023-08-03 15:42     ` Andrew Lunn
2023-08-03 11:30 ` [PATCH v3 14/16] net: stmmac: dwmac-loongson: Disable flow control for GMAC Feiyang Chen
2023-08-04 17:28   ` Jose Abreu
2023-08-05  6:15     ` Feiyang Chen
2023-08-04 20:38   ` Russell King (Oracle)
2023-08-05  6:15     ` Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 15/16] net: stmmac: dwmac-loongson: Use single queue " Feiyang Chen
2023-08-03 11:30 ` [PATCH v3 16/16] net: stmmac: dwmac-loongson: Add GNET support Feiyang Chen
2023-08-04 17:25 ` [PATCH v3 00/16] stmmac: Add Loongson platform support Jose Abreu
2023-08-05  6:14   ` Feiyang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMu3wTCzffo1EgNY@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=chenfeiyang@loongson.cn \
    --cc=chenhuacai@loongson.cn \
    --cc=chris.chenfeiyang@gmail.com \
    --cc=dongbiao@loongson.cn \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=loongarch@lists.linux.dev \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).