Re: [Patch net-next v3 05/13] net: dsa: microchip: ptp: enable interrupt for timestamping

Arun.Ramadoss
2022-12-12T10:14:09Z

Hi Christian,
Thanks for the comment.

On Fri, 2022-12-09 at 20:40 +0100, Christian Eggers wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> Hi Arun,
>
> On Friday, 9 December 2022, 08:24:29 CET, Arun Ramadoss wrote:
> > PTP Interrupt mask and status register differ from the global and
> > port
> > interrupt mechanism by two methods. One is that for global/port
> > interrupt enabling we have to clear the bit but for ptp interrupt
> > we
> > have to set the bit. And other is bit12:0 is reserved in ptp
> > interrupt
> > registers. This forced to not use the generic implementation of
> > global/port interrupt method routine. This patch implement the ptp
> > interrupt mechanism to read the timestamp register for sync,
> > pdelay_req
> > and pdelay_resp.
> >
> > Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
> >
> > +
> > + ret = request_threaded_irq(ptpmsg_irq->irq_num, NULL,
> > + ksz_ptp_msg_thread_fn,
> > + IRQF_ONESHOT |
> > IRQF_TRIGGER_FALLING,
>
> I assume that IRQF_TRIGGER_FALLING is not required here as nested
> interrupts are fired by
> software (withing having an edge / a level). Additionally I had to
> remove all existing
> occurrences of this flag in ksz_common.c in order to rid of
> persistent "timed out while
> polling for tx timestamp" messages which appeared randomly after some
> time of operation.
> I think that on i.MX6 I need to use level triggered interrupts
> instead of edge triggered
> ones. Additionally I think that such flags should be set in the
> device tree instead of
> the driver:
>
> https://stackoverflow.com/a/40051191

I will remove IRQF_TRIGGER_FALLING from the ksz_ptp.c in next patch
version. To remove the flag in ksz_common.c, I will send bug fix patch
separately.

>
>
> > + if (ret)
> > + goto out;
> > + }
> > +
> > + return 0;
> > +
> > +out:
> > + while (n--)
> > + irq_dispose_mapping(port->ptpmsg_irq[n].irq_num);
> > +
> > + return ret;
> > +}
> >
> >
>
>
>
>