All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: tglx@linutronix.de, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, tsbogend@alpha.franken.de,
	daniel.lezcano@linaro.org, paulburton@kernel.org,
	peterz@infradead.org, mail@birger-koblitz.de, bert@biot.com,
	john@phrozen.org, sander@svanheule.net,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	linux-mips@vger.kernel.org, ericwouds@gmail.com,
	Markus Stockhausen <markus.stockhausen@gmx.de>
Subject: Re: [PATCH v3 7/9] clocksource: realtek: Add timer driver for rtl-otto platforms
Date: Thu, 27 Jun 2024 13:17:07 +0200	[thread overview]
Message-ID: <20240627131707.3410b4d3@dellmb> (raw)
In-Reply-To: <20240627043317.3751996-8-chris.packham@alliedtelesis.co.nz>

On Thu, 27 Jun 2024 16:33:15 +1200
Chris Packham <chris.packham@alliedtelesis.co.nz> wrote:

> +/* Simple internal register functions */
> +static inline void rttm_set_counter(void __iomem *base, unsigned int counter)
> +{
> +	iowrite32(counter, base + RTTM_CNT);

These require #include <asm/io.h>

> +/* Aggregated control functions for kernel clock framework */
> +#define RTTM_DEBUG(base)			\
> +	pr_debug("------------- %d %p\n",	\
> +		 smp_processor_id(), base)

#include <linux/printk.h>

> +static irqreturn_t rttm_timer_interrupt(int irq, void *dev_id)
> +{
> +	struct clock_event_device *clkevt = dev_id;
> +	struct timer_of *to = to_timer_of(clkevt);
> +
> +	rttm_ack_irq(to->of_base.base);
> +	RTTM_DEBUG(to->of_base.base);
> +	clkevt->event_handler(clkevt);

Although you include "timer-of.h", which includes clockchips.h, please
do also explicit #include <linux/clockchips.h>

> +	rttm_set_period(to->of_base.base, RTTM_TICKS_PER_SEC / HZ);

HZ -> linux/jiffies.h, or maybe asm/param.h

> +static u64 rttm_read_clocksource(struct clocksource *cs)
> +{
> +	struct rttm_cs *rcs = container_of(cs, struct rttm_cs, cs);
> +
> +	return (u64)rttm_get_counter(rcs->to.of_base.base);

Redundant cast to u64.

> +	rttm_enable_timer(rcs->to.of_base.base, RTTM_CTRL_TIMER,
> +			  rcs->to.of_clk.rate / RTTM_TICKS_PER_SEC);

Is this correct? Sometimes it makes sense to use DIV_ROUND_CLOSEST, but
maybe not here.

> +static u64 notrace rttm_read_clock(void)
> +{
> +	return (u64)rttm_get_counter(rttm_cs.to.of_base.base);

Redundant cast to u64.

> +static int __init rttm_probe(struct device_node *np)
> +{
> +	int cpu, cpu_rollback;

unsigned int?

> +	struct timer_of *to;
> +	int clkidx = num_possible_cpus();

linux/cpumask.h, unsigned int

Marek

  reply	other threads:[~2024-06-27 11:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-27  4:33 [PATCH v3 0/9] mips: Support for RTL9302C Chris Packham
2024-06-27  4:33 ` [PATCH v3 1/9] mips: dts: realtek: use "serial" instead of "uart" in node name Chris Packham
2024-06-27 10:59   ` Marek Behún
2024-06-27  4:33 ` [PATCH v3 2/9] mips: dts: realtek: add device_type property to cpu node Chris Packham
2024-06-27 11:01   ` Marek Behún
2024-06-27  4:33 ` [PATCH v3 3/9] dt-bindings: vendor-prefixes: Add Cameo Communications Chris Packham
2024-06-27  7:39   ` Krzysztof Kozlowski
2024-06-27  4:33 ` [PATCH v3 4/9] dt-bindings: mips: realtek: Add rtl930x-soc compatible Chris Packham
2024-06-27  7:39   ` Krzysztof Kozlowski
2024-06-27  4:33 ` [PATCH v3 5/9] dt-bindings: timer: Add schema for realtek,otto-timer Chris Packham
2024-06-27  7:40   ` Krzysztof Kozlowski
2024-06-29 20:40   ` Sander Vanheule
2024-07-01  2:15     ` Chris Packham
2024-06-27  4:33 ` [PATCH v3 6/9] dt-bindings: interrupt-controller: realtek,rtl-intc: Add rtl9300-intc Chris Packham
2024-06-27  5:37   ` Rob Herring (Arm)
2024-06-27  7:41   ` Krzysztof Kozlowski
2024-06-30 22:12     ` Chris Packham
2024-07-01  3:02       ` Chris Packham
2024-06-27  4:33 ` [PATCH v3 7/9] clocksource: realtek: Add timer driver for rtl-otto platforms Chris Packham
2024-06-27 11:17   ` Marek Behún [this message]
2024-07-01  4:41     ` Chris Packham
2024-06-29 21:03   ` Sander Vanheule
2024-07-01  2:07     ` Chris Packham
2024-06-30  1:10   ` kernel test robot
2024-06-27  4:33 ` [PATCH v3 8/9] mips: generic: add fdt fixup for Realtek reference board Chris Packham
2024-06-27 11:19   ` Marek Behún
2024-06-27 17:48   ` Rob Herring
2024-06-30 22:39     ` Chris Packham
2024-06-27  4:33 ` [PATCH v3 9/9] mips: dts: realtek: Add RTL9302C board Chris Packham
2024-06-27 14:42 ` [PATCH v3 0/9] mips: Support for RTL9302C Rob Herring
2024-06-30 23:43   ` Chris Packham
2024-07-01  3:26     ` Chris Packham

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=20240627131707.3410b4d3@dellmb \
    --to=kabel@kernel.org \
    --cc=bert@biot.com \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ericwouds@gmail.com \
    --cc=john@phrozen.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=mail@birger-koblitz.de \
    --cc=markus.stockhausen@gmx.de \
    --cc=paulburton@kernel.org \
    --cc=peterz@infradead.org \
    --cc=robh@kernel.org \
    --cc=sander@svanheule.net \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.