• Finn Thain's avatar
    m68k: atari: Convert to clocksource API · 26ccd2d3
    Finn Thain authored
    Add a platform clocksource by adapting the existing arch_gettimeoffset
    implementation.
    
    Normally the MFP timer C interrupt flag would be used to check for
    timer counter wrap-around. Unfortunately, that flag gets cleared by the
    MFP itself (due to automatic End-of-Interrupt mode). This means that
    mfp_timer_c_handler() and atari_read_clk() must race when accounting
    for counter wrap-around.
    
    That problem is avoided by effectively stopping the clock when it might
    otherwise jump backwards (due to interrupt latency). Note that this may
    affect clock accuracy.
    
    After the timer interrupt is asserted, wait for the counter to be
    reloaded so that atari_read_clk() will not see the intermediate state
    as that would cause the clock to jump backwards.
    Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
    Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
    Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    26ccd2d3
time.c 8.32 KB