> On 12 Sep 2016, at 10:15, Richard Cochran <richardcoch...@gmail.com> wrote: > > On Fri, Sep 09, 2016 at 10:42:15PM +0100, Kieran Tyrrell wrote: >> @@ -5638,17 +5638,29 @@ static void igb_tsync_interrupt(struct igb_adapter >> *adapter) >> } >> >> if (tsicr & TSINTR_TT0) { >> - spin_lock(&adapter->tmreg_lock); >> - ts = timespec64_add(adapter->perout[0].start, >> - adapter->perout[0].period); >> - /* u32 conversion of tv_sec is safe until y2106 */ >> - wr32(E1000_TRGTTIML0, ts.tv_nsec); >> - wr32(E1000_TRGTTIMH0, (u32)ts.tv_sec); >> - tsauxc = rd32(E1000_TSAUXC); >> - tsauxc |= TSAUXC_EN_TT0; >> - wr32(E1000_TSAUXC, tsauxc); >> - adapter->perout[0].start = ts; >> - spin_unlock(&adapter->tmreg_lock); >> + if (adapter->timer_enabled) { >> + /* disable timer */ >> + spin_lock(&adapter->tmreg_lock); >> + igb_tt0_timer_enable(adapter, false); >> + spin_unlock(&adapter->tmreg_lock); >> + event.type = PTP_CLOCK_ALARM; >> + event.index = 0; >> + ptp_clock_event(adapter->ptp_clock, &event); > > The functional interface between the PHC layer and the driver should > allow an immediate reprogramming of the HW's interrupt control > registers, don't you think?
I’m not sure I understand your point here. I would say that the PHC layer should be abstracted from the driver, as we can’t make any assumptions about the hardware. For example on the i210 we must disable the interrupts and/or TT0 before the interrupt handler acknowledges the interrupt, but on other hardware (STM32F4 iirc) the driver could actually leave interrupts enabled as the timer will only trigger when the compare value is EQUAL to the system time (not <=). On these systems it would be very useful for the driver to be able to enable/disable interrupts in the timer_settime() function, so the compare register(s) can be set, interrupts enabled, the current time and interrupt status read, to check if the compare time was set in time (and if it was set too late, fire the timer immediately). Also on hardware with only a 32bit timer register (where the ‘seconds’ or high nanosecond bits are maintained in the driver) the driver must enable and disable interrupts depending on counter rollovers etc. But maybe I have misunderstood your point… Thanks, Kieran. ------------------------------------------------------------------------------ _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel