Re: [PATCH 1/3 v2] clocksource/drivers/fttmr010: Be stricter on IRQs

From: Cédric Le Goater
Date: Fri Sep 24 2021 - 09:56:42 EST

On 9/23/21 23:05, Linus Walleij wrote:
On Thu, Sep 23, 2021 at 10:11 PM Cédric Le Goater <clg@xxxxxxxx> wrote:

I think we should start by dropping all the AST2600 code which
is unused.

I don't see why, the hardware is there is it not?

The TMC34 register is different on the AST2600.

The only piece of code that makes sense is in ast2600_timer_interrupt() :
writel(0x1, fttmr010->base + TIMER_INTR_STATE);

which clears the status.

If you really insist on keeping the AST2600 support, then I would
rework a bit ast2600_timer_interrupt() : drop TIMER_1_INT_OVERFLOW
and may be use BIT(0) instead of TIMER_1_INT_MATCH1, since the
register layout is different.

There are 8 timers on the AST2600.



In my experience it is unwise to try to system manage the kernel,
decide what hardware gets exposed to the frameworks and which
does not.

There have been instances in the past where we have first said we don't
need another timer on the system (so it is "dark silicon") and later brought
it back because it has some upside.

For example for a while the Ux500 was using clksrc-dbx500-prcmu.c
exclusively because it was the only clocksource that would not stop
during sleep, and nomadik-mtu.c was unused. Then we invented a
way to grade the different clocksources and switch between them
before sleep, but tagging one of them with
CLOCK_SOURCE_SUSPEND_NONSTOP and giving them the right
rating, see commit bc0750e464d4.

This was good because nomadi-mtu.c has higher granularity and
higher frequency when the system is awake but clksrc-dbx500-prcmu.c
is always ticking, so each is used for different purposes.

Lesson learned: register all hardware with the timekeeping core and
let the kernel decide what timer to use at what point and for what.

Linus Walleij