On Wed, Oct 16, 2024 at 11:51:56PM +0200, Marc Kleine-Budde wrote:
> The FEC IP core in the i.MX7 and newer SoCs has 4 IRQs. The first 3
> correspond to the 3 RX/TX queues, the 4th is for processing Pulses Per
> Second. In addition, the 1st IRQ handles the remaining IRQ sources of
> the IP core. They are all displayed with the same name in
> /proc/interrupts:
>
> | 208: 0 0 0 0 GICv3 150 Level 30be0000.ethernet
> | 209: 0 0 0 0 GICv3 151 Level 30be0000.ethernet
> | 210: 3898 0 0 0 GICv3 152 Level 30be0000.ethernet
> | 211: 0 0 0 0 GICv3 153 Level 30be0000.ethernet
>
> For easier debugging make the name of the IRQ reflect its function.
> Use the postfix "-RxTx" and the queue number for the first 3 IRQs, add
> "+misc" for the 1st IRQ. The postfix "-PPS" specifies the PPS IRQ.
>
> With this change /proc/interrupts looks like this:
>
> | 208: 2 0 0 0 GICv3 150 Level 30be0000.ethernet-RxTx1
> | 209: 0 0 0 0 GICv3 151 Level 30be0000.ethernet-RxTx2
> | 210: 3526 0 0 0 GICv3 152 Level 30be0000.ethernet-RxTx0+misc
> | 211: 0 0 0 0 GICv3 153 Level 30be0000.ethernet-PPS
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 9 ++++++++-
> drivers/net/ethernet/freescale/fec_ptp.c | 5 ++++-
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index f124ffe3619d82dc089f8494d33d2398e6f631fb..c8b2170735e599cd10492169ab32d0e20b28311b 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -4492,8 +4492,15 @@ fec_probe(struct platform_device *pdev)
> goto failed_init;
>
> for (i = 0; i < irq_cnt; i++) {
> + const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s-RxTx%d%s",
> + pdev->name, i, i == 0 ? "+misc" : "");
> int irq_num;
>
> + if (!dev_name) {
> + ret = -ENOMEM;
> + goto failed_irq;
> + }
> +
> if (fep->quirks & FEC_QUIRK_DT_IRQ2_IS_MAIN_IRQ)
> irq_num = (i + irq_cnt - 1) % irq_cnt;
> else
> @@ -4508,7 +4515,7 @@ fec_probe(struct platform_device *pdev)
> goto failed_irq;
> }
> ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt,
> - 0, pdev->name, ndev);
> + 0, dev_name, ndev);
> if (ret)
> goto failed_irq;
>
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> index 8722f623d9e47e385439f1cee8c677e2b95b236d..0ac89fed366a83bcbfc900ea4409f4e98c4e14da 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -749,8 +749,11 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
> * only the PTP_CLOCK_PPS clock events should stop
> */
> if (irq >= 0) {
> + const char *dev_name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
> + "%s-PPS", pdev->name);
> +
> ret = devm_request_irq(&pdev->dev, irq, fec_pps_interrupt,
> - 0, pdev->name, ndev);
> + 0, dev_name ? dev_name : pdev->name, ndev);
> if (ret < 0)
> dev_warn(&pdev->dev, "request for pps irq failed(%d)\n",
> ret);
>
> --
> 2.45.2
>
>