From: Frank Li <Frank.li@nxp.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wei Fang <wei.fang@nxp.com>, Shenwei Wang <shenwei.wang@nxp.com>,
Clark Wang <xiaoning.wang@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
imx@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH net-next 07/13] net: fec: fec_probe(): update quirk: bring IRQs in correct order
Date: Wed, 16 Oct 2024 22:15:43 -0400 [thread overview]
Message-ID: <ZxBzT2/SZFhgfPpW@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20241016-fec-cleanups-v1-7-de783bd15e6a@pengutronix.de>
On Wed, Oct 16, 2024 at 11:51:55PM +0200, Marc Kleine-Budde wrote:
> With i.MX8MQ and compatible SoCs, the order of the IRQs in the device
> tree is not optimal. The driver expects the first three IRQs to match
> their corresponding queue, while the last (fourth) IRQ is used for the
> PPS:
>
> - 1st IRQ: "int0": queue0 + other IRQs
> - 2nd IRQ: "int1": queue1
> - 3rd IRQ: "int2": queue2
> - 4th IRQ: "pps": pps
>
> However, the i.MX8MQ and compatible SoCs do not use the
> "interrupt-names" property and specify the IRQs in the wrong order:
>
> - 1st IRQ: queue1
> - 2nd IRQ: queue2
> - 3rd IRQ: queue0 + other IRQs
> - 4th IRQ: pps
why not fix dts?
Frank
>
> First rename the quirk from FEC_QUIRK_WAKEUP_FROM_INT2 to
> FEC_QUIRK_INT2_IS_MAIN_IRQ, to better reflect it's functionality.
>
> If the FEC_QUIRK_INT2_IS_MAIN_IRQ quirk is active, put the IRQs back
> in the correct order, this is done in fec_probe().
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> drivers/net/ethernet/freescale/fec.h | 24 ++++++++++++++++++++++--
> drivers/net/ethernet/freescale/fec_main.c | 18 +++++++++++-------
> 2 files changed, 33 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
> index 63744a86752540fcede7fc4c29865b2529492526..b0f1a3e28d5c8052be3a8a0fa18303a1df2bb5bd 100644
> --- a/drivers/net/ethernet/freescale/fec.h
> +++ b/drivers/net/ethernet/freescale/fec.h
> @@ -504,8 +504,28 @@ struct bufdesc_ex {
> */
> #define FEC_QUIRK_DELAYED_CLKS_SUPPORT (1 << 21)
>
> -/* i.MX8MQ SoC integration mix wakeup interrupt signal into "int2" interrupt line. */
> -#define FEC_QUIRK_WAKEUP_FROM_INT2 (1 << 22)
> +/* With i.MX8MQ and compatible SoCs, the order of the IRQs in the
> + * device tree is not optimal. The driver expects the first three IRQs
> + * to match their corresponding queue, while the last (fourth) IRQ is
> + * used for the PPS:
> + *
> + * - 1st IRQ: "int0": queue0 + other IRQs
> + * - 2nd IRQ: "int1": queue1
> + * - 3rd IRQ: "int2": queue2
> + * - 4th IRQ: "pps": pps
> + *
> + * However, the i.MX8MQ and compatible SoCs do not use the
> + * "interrupt-names" property and specify the IRQs in the wrong order:
> + *
> + * - 1st IRQ: queue1
> + * - 2nd IRQ: queue2
> + * - 3rd IRQ: queue0 + other IRQs
> + * - 4th IRQ: pps
> + *
> + * If the following quirk is active, put the IRQs back in the correct
> + * order, this is done in fec_probe().
> + */
> +#define FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ BIT(22)
>
> /* i.MX6Q adds pm_qos support */
> #define FEC_QUIRK_HAS_PMQOS BIT(23)
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index d948ed9810027d5fabe521dc3af2cf505dacd13e..f124ffe3619d82dc089f8494d33d2398e6f631fb 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -157,7 +157,7 @@ static const struct fec_devinfo fec_imx8mq_info = {
> FEC_QUIRK_ERR007885 | FEC_QUIRK_BUG_CAPTURE |
> FEC_QUIRK_HAS_RACC | FEC_QUIRK_HAS_COALESCE |
> FEC_QUIRK_CLEAR_SETUP_MII | FEC_QUIRK_HAS_MULTI_QUEUES |
> - FEC_QUIRK_HAS_EEE | FEC_QUIRK_WAKEUP_FROM_INT2 |
> + FEC_QUIRK_HAS_EEE | FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ |
> FEC_QUIRK_HAS_MDIO_C45,
> };
>
> @@ -4260,10 +4260,7 @@ static void fec_enet_get_wakeup_irq(struct platform_device *pdev)
> struct net_device *ndev = platform_get_drvdata(pdev);
> struct fec_enet_private *fep = netdev_priv(ndev);
>
> - if (fep->quirks & FEC_QUIRK_WAKEUP_FROM_INT2)
> - fep->wake_irq = fep->irq[2];
> - else
> - fep->wake_irq = fep->irq[0];
> + fep->wake_irq = fep->irq[0];
> }
>
> static int fec_enet_init_stop_mode(struct fec_enet_private *fep,
> @@ -4495,10 +4492,17 @@ fec_probe(struct platform_device *pdev)
> goto failed_init;
>
> for (i = 0; i < irq_cnt; i++) {
> - snprintf(irq_name, sizeof(irq_name), "int%d", i);
> + int irq_num;
> +
> + if (fep->quirks & FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ)
> + irq_num = (i + irq_cnt - 1) % irq_cnt;
> + else
> + irq_num = i;
> +
> + snprintf(irq_name, sizeof(irq_name), "int%d", irq_num);
> irq = platform_get_irq_byname_optional(pdev, irq_name);
> if (irq < 0)
> - irq = platform_get_irq(pdev, i);
> + irq = platform_get_irq(pdev, irq_num);
> if (irq < 0) {
> ret = irq;
> goto failed_irq;
>
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2024-10-17 2:15 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 21:51 [PATCH net-next 00/13] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 01/13] net: fec: fix typos found by codespell Marc Kleine-Budde
2024-10-17 1:31 ` Wei Fang
2024-10-17 1:52 ` Frank Li
2024-11-15 14:40 ` Csókás Bence
2024-10-16 21:51 ` [PATCH net-next 02/13] net: fec: struct fec_enet_private: remove obsolete comment Marc Kleine-Budde
2024-10-17 1:37 ` Wei Fang
2024-10-17 1:55 ` Frank Li
2024-10-17 6:53 ` Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 03/13] net: fec: add missing header files Marc Kleine-Budde
2024-10-17 1:40 ` Wei Fang
2024-10-17 1:56 ` Frank Li
2024-10-17 6:53 ` Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 04/13] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info Marc Kleine-Budde
2024-10-17 1:44 ` Wei Fang
2024-10-17 1:59 ` Frank Li
2024-10-17 6:54 ` Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 05/13] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED Marc Kleine-Budde
2024-10-17 1:47 ` Wei Fang
2024-10-17 2:05 ` Frank Li
2024-10-17 6:56 ` Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 06/13] net: fec: fec_restart(): make use of FEC_ECR_RESET Marc Kleine-Budde
2024-10-17 1:49 ` Wei Fang
2024-10-17 2:07 ` Frank Li
2024-10-17 6:56 ` Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 07/13] net: fec: fec_probe(): update quirk: bring IRQs in correct order Marc Kleine-Budde
2024-10-17 2:15 ` Frank Li [this message]
2024-10-17 6:13 ` Marc Kleine-Budde
2024-10-17 3:09 ` Wei Fang
2024-10-17 6:16 ` Marc Kleine-Budde
2024-10-17 7:43 ` Wei Fang
2024-10-17 10:21 ` Marc Kleine-Budde
2024-10-17 14:03 ` Frank Li
2024-10-17 14:21 ` Marc Kleine-Budde
2024-10-17 15:30 ` Frank Li
2024-10-18 9:16 ` Marc Kleine-Budde
2024-10-18 15:26 ` Frank Li
2024-10-16 21:51 ` [PATCH net-next 08/13] net: fec: fec_probe(): let IRQ name reflect its function Marc Kleine-Budde
2024-10-17 2:24 ` Frank Li
2024-10-17 3:12 ` Wei Fang
2024-10-16 21:51 ` [PATCH net-next 09/13] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue() Marc Kleine-Budde
2024-10-17 2:32 ` Frank Li
2024-10-17 7:02 ` Marc Kleine-Budde
2024-10-16 21:51 ` [PATCH net-next 10/13] net: fec: fec_enet_rx_queue(): replace open coded cast by skb_vlan_eth_hdr() Marc Kleine-Budde
2024-10-17 2:44 ` Frank Li
2024-10-17 7:04 ` Marc Kleine-Budde
2024-10-17 3:15 ` Wei Fang
2024-10-16 21:51 ` [PATCH net-next 11/13] net: fec: fec_enet_rx_queue(): reduce scope of data Marc Kleine-Budde
2024-10-17 2:49 ` Frank Li
2024-10-17 3:19 ` Wei Fang
2024-10-16 21:52 ` [PATCH net-next 12/13] net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag() Marc Kleine-Budde
2024-10-17 3:05 ` Frank Li
2024-10-17 7:05 ` Marc Kleine-Budde
2024-10-17 3:29 ` Wei Fang
2024-10-16 21:52 ` [PATCH net-next 13/13] net: fec: fec_enet_rx_queue(): factor out VLAN handling into separate function fec_enet_rx_vlan() Marc Kleine-Budde
2024-10-17 3:07 ` Frank Li
2024-10-17 3:33 ` Wei Fang
2024-10-17 7:09 ` Marc Kleine-Budde
2024-10-17 7:48 ` Wei Fang
2024-10-18 7:21 ` Marc Kleine-Budde
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=ZxBzT2/SZFhgfPpW@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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
all inboxes | Powered by JetHome®