Devicetree
 help / color / mirror / Atom feed
From: Caleb James DeLisle <cjd@cjdns.fr>
To: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>,
	linux-mips@vger.kernel.org
Cc: conor+dt@kernel.org, daniel.lezcano@kernel.org,
	devicetree@vger.kernel.org, krzk+dt@kernel.org,
	linux-kernel@vger.kernel.org, naseefkm@gmail.com,
	robh@kernel.org, tglx@kernel.org, grandmaster@al2klimov.de
Subject: Re: [PATCH v7 0/5] clocksource/timer-econet-en751221: Support irq number per timer
Date: Wed, 12 Aug 2026 21:32:08 +0200	[thread overview]
Message-ID: <f98f17aa-0f95-4b03-9f95-385e8af762df@cjdns.fr> (raw)
In-Reply-To: <4917ef30-0ed9-4c5a-8516-1033b5f02fdc@oss.qualcomm.com>


On 12/08/2026 10:26, Daniel Lezcano wrote:
> On 7/31/26 14:02, Caleb James DeLisle wrote:
>> This timer appears on both the EcoNet EN751221 (34Kc) and on the
>> EN751627 / EN7528 (1004Kc) SoCs. On the 34Kc the interrupt controller
>> uses a percpu interrupt while on the others it uses an individual
>> IRQ number for each CPU timer. Add support for EN751627 and EN7528.
>> Add support for IRQ number for each CPU timer under the
>> econet,en751627-timer compatible.
>>
>> Changes since v6:
>> * Rebase to tip/timers/core (base-commit below)
>
> Got this:
>
> In file included from 
> /home/dlezcano/Work/src/linux/timers/include/asm-generic/bug.h:31,
>                  from 
> /home/dlezcano/Work/src/linux/timers/arch/arm64/include/asm/bug.h:26,
>                  from 
> /home/dlezcano/Work/src/linux/timers/arch/arm64/include/asm/pgtable.h:8,
>                  from 
> /home/dlezcano/Work/src/linux/timers/include/linux/pgtable.h:6,
>                  from 
> /home/dlezcano/Work/src/linux/timers/arch/arm64/include/asm/io.h:12,
>                  from 
> /home/dlezcano/Work/src/linux/timers/include/linux/io.h:12,
>                  from 
> /home/dlezcano/Work/src/linux/timers/drivers/clocksource/timer-econet-en751221.c:8:
> /home/dlezcano/Work/src/linux/timers/drivers/clocksource/timer-econet-en751221.c: 
> In function ‘timer_init’:
> /home/dlezcano/Work/src/linux/timers/include/linux/kern_levels.h:5:25: 
> warning: format ‘%d’ expects argument of type ‘int’, but argument 3 
> has type ‘long unsigned int’ [-Wformat=]
>     5 | #define KERN_SOH        "\001"          /* ASCII Start Of 
> Header */
>       |                         ^~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/printk.h:483:25: 
> note: in definition of macro ‘printk_index_wrap’
>   483 |                 _p_func(_fmt, ##__VA_ARGS__);         \
>       |                         ^~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/printk.h:554:9: 
> note: in expansion of macro ‘printk’
>   554 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>       |         ^~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/kern_levels.h:11:25: 
> note: in expansion of macro ‘KERN_SOH’
>    11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
>       |                         ^~~~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/printk.h:554:16: 
> note: in expansion of macro ‘KERN_ERR’
>   554 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>       |                ^~~~~~~~
> /home/dlezcano/Work/src/linux/timers/drivers/clocksource/timer-econet-en751221.c:201:17: 
> note: in expansion of macro ‘pr_err’
>   201 |                 pr_err("%pOFn: Too many IRQs max %d got %d\n", 
> np,
>       |                 ^~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/kern_levels.h:5:25: 
> warning: format ‘%d’ expects argument of type ‘int’, but argument 3 
> has type ‘long unsigned int’ [-Wformat=]
>     5 | #define KERN_SOH        "\001"          /* ASCII Start Of 
> Header */
>       |                         ^~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/printk.h:483:25: 
> note: in definition of macro ‘printk_index_wrap’
>   483 |                 _p_func(_fmt, ##__VA_ARGS__);         \
>       |                         ^~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/printk.h:554:9: 
> note: in expansion of macro ‘printk’
>   554 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>       |         ^~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/kern_levels.h:11:25: 
> note: in expansion of macro ‘KERN_SOH’
>    11 | #define KERN_ERR        KERN_SOH "3"    /* error conditions */
>       |                         ^~~~~~~~
> /home/dlezcano/Work/src/linux/timers/include/linux/printk.h:554:16: 
> note: in expansion of macro ‘KERN_ERR’
>   554 |         printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>       |                ^~~~~~~~
> /home/dlezcano/Work/src/linux/timers/drivers/clocksource/timer-econet-en751221.c:206:17: 
> note: in expansion of macro ‘pr_err’
>   206 |                 pr_err("%pOFn: Too many regs: max %d got 
> %d\n", np,
>       |                 ^~~~~~
>

I gather you must have built this on a 64 bit machine, so the size_t of 
ARRAY_SIZE() is a uint64_t (?)

I just double-checked building it for MIPS 24Kc GCC and it all passes. 
This is a built-in CPU timer for EcoNet MIPS SoCs. Those were all 32 bit 
and they're not making any more of them so we don't need to worry about 
a future 64 bit port.

But I'm not that knowledgeable in best practices, perhaps its expected 
to compile on 64 bit? Or perhaps I should forbid 64 bit in the Kconfig? 
There is no way to get CONFIG_ECONET and 64 bit, but through 
TEST_COMPILE I suppose it is.

Any suggestions would be appreciated.

Thanks,

Caleb


>
>> Changes since v5:
>> * Integrate patch fix refcount leak from:
>> Link: 
>> https://lore.kernel.org/linux-mips/20260526184105.18962-3-grandmaster@al2klimov.de/
>> * NULL econet_timer.membase after unmapping
>> * NULL check dev->event_handler in case clockevents_config_and_register
>>    failed to fully register.
>> * v5: 
>> https://lore.kernel.org/linux-mips/20260516233943.49502-1-cjd@cjdns.fr/
>>
>> Changes from v4:
>> * Fixed incorrect compatible in DT schema
>> * Bracing in out_irq_free if statement
>> * I did not move cpuhp_setup_state past the point of no return
>> * v4: 
>> https://lore.kernel.org/linux-mips/20260516215720.4160831-1-cjd@cjdns.fr
>>
>> Changes from v3:
>> * off-by-one in out_irq_free
>> * Gracefully fail if too many address resources are provided in the DT
>> * Allow fewer actual timers than num_possible_cpus, as long as they
>> never start
>> * v3: 
>> https://lore.kernel.org/linux-mips/20260516182648.3987792-1-cjd@cjdns.fr
>>
>> v3 note:
>>
>> I decided to take this patchset in a slightly different direction from
>> v2. There is a certain amount of initialization that once it has run,
>> it cannot be reverted in case of error. The original driver init was a
>> mixture of revertible and non-revertible code which made it too easy
>> for code which is designed with best practices in mind to in fact
>> introduce a bug. Therefore I start by making the init process more
>> legible but without any business logic changes, then fix a race
>> condition by keeping IRQ disabled until after cevt is setup, then
>> finally add non-percpu IRQ support.
>>
>> * v2: 
>> https://lore.kernel.org/linux-mips/20260514000601.3430262-1-cjd@cjdns.fr
>>
>> Changes from v1:
>> * Split changes over 3 refactoring patches + main patch
>> * Remove driver discussion from dt commit message
>> * v1: 
>> https://lore.kernel.org/linux-mips/20260416175101.958073-1-cjd@cjdns.fr/
>>
>>
>> Alexander A. Klimov (1):
>>    clocksource/timer-econet-en751221: fix refcount leak
>>
>> Caleb James DeLisle (4):
>>    dt-bindings: timer: econet: Update EN751627 for multi-IRQ
>>    clocksource/timer-econet-en751221: Init teardown on error if possible
>>    clocksource/timer-econet-en751221: Disable IRQ until cevt registered
>>    clocksource/timer-econet-en751221: Support EN751627 without percpu 
>> IRQ
>>
>>   .../bindings/timer/econet,en751221-timer.yaml |  31 +--
>>   drivers/clocksource/timer-econet-en751221.c   | 181 ++++++++++++++----
>>   2 files changed, 159 insertions(+), 53 deletions(-)
>>
>>
>> base-commit: ecc330e3096173f433659aa64ab3674d0d48440e
>
>

  reply	other threads:[~2026-08-12 19:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 12:02 [PATCH v7 0/5] clocksource/timer-econet-en751221: Support irq number per timer Caleb James DeLisle
2026-07-31 12:02 ` [PATCH v7 1/5] clocksource/timer-econet-en751221: fix refcount leak Caleb James DeLisle
2026-07-31 12:13   ` sashiko-bot
2026-07-31 12:02 ` [PATCH v7 2/5] dt-bindings: timer: econet: Update EN751627 for multi-IRQ Caleb James DeLisle
2026-07-31 12:02 ` [PATCH v7 3/5] clocksource/timer-econet-en751221: Init teardown on error if possible Caleb James DeLisle
2026-07-31 12:14   ` sashiko-bot
2026-07-31 12:02 ` [PATCH v7 4/5] clocksource/timer-econet-en751221: Disable IRQ until cevt registered Caleb James DeLisle
2026-07-31 12:16   ` sashiko-bot
2026-07-31 12:02 ` [PATCH v7 5/5] clocksource/timer-econet-en751221: Support EN751627 without percpu IRQ Caleb James DeLisle
2026-07-31 12:17   ` sashiko-bot
2026-08-12  8:26 ` [PATCH v7 0/5] clocksource/timer-econet-en751221: Support irq number per timer Daniel Lezcano
2026-08-12 19:32   ` Caleb James DeLisle [this message]
2026-09-18 14:07     ` Daniel Lezcano
2026-09-18 15:30       ` Caleb James DeLisle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f98f17aa-0f95-4b03-9f95-385e8af762df@cjdns.fr \
    --to=cjd@cjdns.fr \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grandmaster@al2klimov.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=naseefkm@gmail.com \
    --cc=robh@kernel.org \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox