Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: nikita.shubin@maquefel.me
Cc: "Hartley Sweeten" <hsweeten@visionengravers.com>,
	"Lennert Buytenhek" <kernel@wantstofly.org>,
	"Alexander Sverdlin" <alexander.sverdlin@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Lukasz Majewski" <lukma@denx.de>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Alessandro Zummo" <a.zummo@towertech.it>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Wim Van Sebroeck" <wim@linux-watchdog.org>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Mark Brown" <broonie@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Damien Le Moal" <dlemoal@kernel.org>,
	"Sergey Shtylyov" <s.shtylyov@omp.ru>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Olof Johansson" <olof@lixom.net>,
	soc@kernel.org, "Liam Girdwood" <lgirdwood@gmail.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Michael Peters" <mpeters@embeddedts.com>,
	"Kris Bahnsen" <kris@embeddedts.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-pwm@vger.kernel.org,
	linux-spi@vger.kernel.org, netdev@vger.kernel.org,
	dmaengine@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-ide@vger.kernel.org, linux-input@vger.kernel.org,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH v3 09/42] clocksource: ep93xx: Add driver for Cirrus Logic EP93xx
Date: Fri, 21 Jul 2023 18:58:55 +0300	[thread overview]
Message-ID: <ZLqrPw933NOv1J8v@smile.fi.intel.com> (raw)
In-Reply-To: <20230605-ep93xx-v3-9-3d63a5f1103e@maquefel.me>

On Thu, Jul 20, 2023 at 02:29:09PM +0300, Nikita Shubin via B4 Relay wrote:
> From: Nikita Shubin <nikita.shubin@maquefel.me>
> 
> This us a rewrite of EP93xx timer driver in
> arch/arm/mach-ep93xx/timer-ep93xx.c trying to do everything
> the device tree way:
> 
> - Make every IO-access relative to a base address and dynamic
>   so we can do a dynamic ioremap and get going.
> - Find register range and interrupt from the device tree.

...

+ bits.h

> +#include <linux/clockchips.h>
> +#include <linux/clocksource.h>
> +#include <linux/init.h>
> +#include <linux/interrupt.h>
> +#include <linux/io.h>
> +#include <linux/io-64-nonatomic-lo-hi.h>
> +#include <linux/irq.h>
> +#include <linux/kernel.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/sched_clock.h>

...

> +/*************************************************************************

Won't you marc it as a DOC: section?

> + * Timer handling for EP93xx
> + *************************************************************************
> + * The ep93xx has four internal timers.  Timers 1, 2 (both 16 bit) and
> + * 3 (32 bit) count down at 508 kHz, are self-reloading, and can generate
> + * an interrupt on underflow.  Timer 4 (40 bit) counts down at 983.04 kHz,
> + * is free-running, and can't generate interrupts.
> + *
> + * The 508 kHz timers are ideal for use for the timer interrupt, as the
> + * most common values of HZ divide 508 kHz nicely.  We pick the 32 bit
> + * timer (timer 3) to get as long sleep intervals as possible when using
> + * CONFIG_NO_HZ.
> + *
> + * The higher clock rate of timer 4 makes it a better choice than the
> + * other timers for use as clock source and for sched_clock(), providing
> + * a stable 40 bit time base.
> + *************************************************************************
> + */

...

> +/*
> + * This read-only register contains the low word of the time stamp debug timer
> + * ( Timer4). When this register is read, the high byte of the Timer4 counter is

One too many spaces.

> + * saved in the Timer4ValueHigh register.
> + */

...

> +static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id)
> +{
> +	struct ep93xx_tcu *tcu = ep93xx_tcu;
> +	struct clock_event_device *evt = dev_id;
> +
> +	/* Writing any value clears the timer interrupt */
> +	writel(1, tcu->base + EP93XX_TIMER3_CLEAR);

Would 0 suffice?

> +	evt->event_handler(evt);
> +
> +	return IRQ_HANDLED;
> +}

...

> +static int __init ep93xx_timer_of_init(struct device_node *np)
> +{
> +	int irq;
> +	unsigned long flags = IRQF_TIMER | IRQF_IRQPOLL;
> +	struct ep93xx_tcu *tcu;
> +	int ret;
> +
> +	tcu = kzalloc(sizeof(*tcu), GFP_KERNEL);
> +	if (!tcu)
> +		return -ENOMEM;
> +
> +	tcu->base = of_iomap(np, 0);

fwnode_iomap()?
See below why it might make sense.

> +	if (!tcu->base) {

> +		pr_err("Can't remap registers\n");

First of all, you may utilize pr_fmt().
Second, you may add %pOF for better user experience.

> +		ret = -ENXIO;
> +		goto out_free;
> +	}

> +	irq = irq_of_parse_and_map(np, 0);

fwnode_irq_get() which is better in terms of error handling.

> +	if (irq == 0)
> +		irq = -EINVAL;
> +	if (irq < 0) {

> +		pr_err("EP93XX Timer Can't parse IRQ %d", irq);

As per above.

> +		goto out_free;
> +	}

...

> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-07-22 17:11 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 11:29 [PATCH v3 00/42] ep93xx device tree conversion Nikita Shubin via B4 Relay
2023-07-20  8:54 ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 01/42] gpio: ep93xx: split device in multiple Nikita Shubin via B4 Relay
2023-07-20 14:51   ` Bartosz Golaszewski
2023-07-21 13:18   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 02/42] dt-bindings: clock: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-20 23:20   ` Stephen Boyd
2023-07-21 13:58   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 03/42] clk: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-07-20 23:27   ` Stephen Boyd
2023-07-21 13:46     ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 04/42] dt-bindings: pinctrl: Add " Nikita Shubin via B4 Relay
2023-07-21 14:01   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 05/42] pinctrl: add a Cirrus ep93xx SoC pin controller Nikita Shubin via B4 Relay
2023-07-21 15:30   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 06/42] dt-bindings: soc: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-21 14:04   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 07/42] soc: Add SoC driver for Cirrus ep93xx Nikita Shubin via B4 Relay
2023-07-21 14:13   ` Andy Shevchenko
2023-11-11 21:33     ` Alexander Sverdlin
2023-11-13 10:19       ` Andy Shevchenko
2023-07-21 14:22   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 08/42] dt-bindings: timers: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 09/42] clocksource: ep93xx: Add driver for Cirrus Logic EP93xx Nikita Shubin via B4 Relay
2023-07-21 15:58   ` Andy Shevchenko [this message]
2023-07-20 11:29 ` [PATCH v3 10/42] dt-bindings: rtc: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-21 14:07   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 11/42] rtc: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 12/42] dt-bindings: watchdog: Add Cirrus EP93x Nikita Shubin via B4 Relay
2023-07-20 13:28   ` Guenter Roeck
2023-07-21 14:08   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 13/42] watchdog: ep93xx: add DT support for Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-20  8:54   ` Alexander Sverdlin
2023-07-20 13:29   ` Guenter Roeck
2023-07-20 11:29 ` [PATCH v3 14/42] power: reset: Add a driver for the ep93xx reset Nikita Shubin via B4 Relay
2023-07-21 16:37   ` Andy Shevchenko
2023-11-11 18:18     ` Alexander Sverdlin
2023-11-13  9:59       ` Andy Shevchenko
2023-11-13 10:04         ` Alexander Sverdlin
2023-11-13 10:07     ` Alexander Sverdlin
2023-11-13 10:22       ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 15/42] dt-bindings: pwm: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 16/42] pwm: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 17/42] dt-bindings: spi: Add " Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 18/42] spi: ep93xx: add DT support for " Nikita Shubin via B4 Relay
2023-07-21 16:42   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 19/42] dt-bindings: net: Add " Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 20/42] net: cirrus: add DT support for " Nikita Shubin via B4 Relay
2023-07-21 16:32   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 21/42] dt-bindings: dma: Add " Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 22/42] dma: cirrus: add DT support for " Nikita Shubin via B4 Relay
2023-07-21 16:20   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 23/42] dt-bindings: mtd: Add ts7200 nand-controller Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 24/42] mtd: nand: add support for ts72xx Nikita Shubin via B4 Relay
2023-07-21 16:27   ` Andy Shevchenko
2023-07-24  7:09     ` Miquel Raynal
2023-07-20 11:29 ` [PATCH v3 25/42] dt-bindings: ata: Add Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 26/42] ata: pata_ep93xx: add device tree support Nikita Shubin via B4 Relay
2023-07-20  9:45   ` Sergey Shtylyov
2023-07-20 11:29 ` [PATCH v3 27/42] dt-bindings: input: Add Cirrus EP93xx keypad Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 28/42] input: keypad: ep93xx: add DT support for Cirrus EP93xx Nikita Shubin via B4 Relay
2023-07-20 17:17   ` Dmitry Torokhov
2023-07-21 16:12   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 29/42] dt-bindings: rtc: Add ST M48T86 Nikita Shubin via B4 Relay
2023-07-21 14:10   ` Krzysztof Kozlowski
2023-08-23 10:16   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 30/42] rtc: m48t86: add DT support for m48t86 Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 31/42] dt-bindings: wdt: Add ts72xx Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 32/42] wdt: ts72xx: add DT support for ts72xx Nikita Shubin via B4 Relay
2023-07-20 13:30   ` Guenter Roeck
2023-07-20 11:29 ` [PATCH v3 33/42] gpio: ep93xx: add DT support for gpio-ep93xx Nikita Shubin via B4 Relay
2023-07-20 14:49   ` Bartosz Golaszewski
2023-07-20 11:29 ` [PATCH v3 34/42] ARM: dts: add Cirrus EP93XX SoC .dtsi Nikita Shubin via B4 Relay
2023-07-21 14:12   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 35/42] ARM: dts: ep93xx: add ts7250 board Nikita Shubin via B4 Relay
2023-07-21 14:15   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 36/42] ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 37/42] pwm: ep93xx: drop legacy pinctrl Nikita Shubin via B4 Relay
2023-07-28  8:23   ` Thierry Reding
2023-07-20 11:29 ` [PATCH v3 38/42] ata: pata_ep93xx: remove legacy pinctrl use Nikita Shubin via B4 Relay
2023-07-20  9:40   ` Sergey Shtylyov
2023-07-21  1:28   ` Damien Le Moal
2023-07-21 14:16   ` Andy Shevchenko
2023-07-20 11:29 ` [PATCH v3 39/42] ARM: ep93xx: delete all boardfiles Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 40/42] ARM: ep93xx: soc: drop defines Nikita Shubin via B4 Relay
2023-07-20 11:29 ` [PATCH v3 41/42] ARM: dts: ep93xx: Add EDB9302 DT Nikita Shubin via B4 Relay
2023-07-21 14:16   ` Krzysztof Kozlowski
2023-07-20 11:29 ` [PATCH v3 42/42] ASoC: cirrus: edb93xx: Delete driver Nikita Shubin via B4 Relay
2023-07-20 12:36   ` Mark Brown
2023-07-20 16:44 ` [PATCH v3 00/42] ep93xx device tree conversion Jakub Kicinski
2023-07-21 14:25 ` Krzysztof Kozlowski

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=ZLqrPw933NOv1J8v@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=alexander.sverdlin@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=edumazet@google.com \
    --cc=hsweeten@visionengravers.com \
    --cc=kernel@wantstofly.org \
    --cc=kris@embeddedts.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=linux@roeck-us.net \
    --cc=lukma@denx.de \
    --cc=miquel.raynal@bootlin.com \
    --cc=mpeters@embeddedts.com \
    --cc=mturquette@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikita.shubin@maquefel.me \
    --cc=olof@lixom.net \
    --cc=pabeni@redhat.com \
    --cc=perex@perex.cz \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=s.shtylyov@omp.ru \
    --cc=sboyd@kernel.org \
    --cc=soc@kernel.org \
    --cc=sre@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vigneshr@ti.com \
    --cc=vkoul@kernel.org \
    --cc=wim@linux-watchdog.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