mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Teresa Remmet <t.remmet@phytec.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 14/23] ARM: omap: dmtimer: Turn into a driver
Date: Mon, 17 Dec 2018 14:37:57 +0100	[thread overview]
Message-ID: <1545053877.6213.14.camel@phytec.de> (raw)
In-Reply-To: <20181214141730.26181-15-s.hauer@pengutronix.de>

Hello Sascha,

...

> diff --git a/arch/arm/mach-omap/dmtimer.c
> b/drivers/clocksource/timer-ti-dm.c
> similarity index 72%
> rename from arch/arm/mach-omap/dmtimer.c
> rename to drivers/clocksource/timer-ti-dm.c
> index e223b8cc8f..635b860cf9 100644
> --- a/arch/arm/mach-omap/dmtimer.c
> +++ b/drivers/clocksource/timer-ti-dm.c
> @@ -27,6 +27,7 @@
>   *
>   */
>  
> +#include <common.h>
>  #include <clock.h>
>  #include <init.h>
>  #include <io.h>
> @@ -55,7 +56,7 @@
>  #define TSICR			0x54
>  #define TCAR2			0x58
>  
> -static void *base = (void *)AM33XX_DMTIMER2_BASE;
> +static void *base;
>  
>  /**
>   * @brief Provide a simple counter read
> @@ -73,17 +74,20 @@ static struct clocksource dmtimer_cs = {
>  	.shift	= 10,
>  };
>  
> -/**
> - * @brief Initialize the Clock
> - *
> - * Enable dmtimer.
> - *
> - * @return result of @ref init_clock
> - */
> -static int dmtimer_init(void)
> +static int omap_dmtimer_probe(struct device_d *dev)
>  {
> +	struct resource *iores;
>  	u64 clk_speed;
>  
> +	/* one timer is enough */
> +	if (base)
> +		return 0;
> +
> +	iores = dev_request_mem_resource(dev, 0);
> +	if (IS_ERR(iores))
> +		return PTR_ERR(iores);
> +	base = IOMEM(iores->start);
> +
>  	clk_speed = am33xx_get_osc_clock();
>  	clk_speed *= 1000;
>  	dmtimer_cs.mult = clocksource_hz2mult(clk_speed,
> dmtimer_cs.shift);
> @@ -91,8 +95,27 @@ static int dmtimer_init(void)
>  	/* Enable counter */
>  	writel(0x3, base + TCLR);
>  
> -	return init_clock(&dmtimer_cs);
> +	init_clock(&dmtimer_cs);
> +
> +	return 0;

is there any reason why you always return 0 now?

Teresa

>  }
>  
> -/* Run me at boot time */
> -core_initcall(dmtimer_init);
> +static __maybe_unused struct of_device_id omap_dmtimer_dt_ids[] = {
> +	{
> +		.compatible = "ti,am335x-timer",
> +	}, {
> +		/* sentinel */
> +	}
> +};
> +
> +static struct driver_d omap_dmtimer_driver = {
> +	.name = "omap-dmtimer",
> +	.probe = omap_dmtimer_probe,
> +	.of_compatible = DRV_OF_COMPAT(omap_dmtimer_dt_ids),
> +};
> +
> +static int omap_dmtimer_init(void)
> +{
> +	return platform_driver_register(&omap_dmtimer_driver);
> +}
> +postcore_initcall(omap_dmtimer_init);

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-12-17 13:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 14:17 [PATCH 00/23] AM3517 support Sascha Hauer
2018-12-14 14:17 ` [PATCH 01/23] net: davinci-emac: fix buggy channel tear down Sascha Hauer
2018-12-14 14:17 ` [PATCH 02/23] net: davinci-emac: Add timeout to polling loop Sascha Hauer
2018-12-14 14:17 ` [PATCH 03/23] net: davinci-emac: switch to device tree support Sascha Hauer
2018-12-14 14:17 ` [PATCH 04/23] mci: omap: Improve error handling Sascha Hauer
2018-12-14 14:17 ` [PATCH 05/23] mci: omap: use IS_ENABLED() rather than #ifdef Sascha Hauer
2018-12-14 14:17 ` [PATCH 06/23] mtd: nand: omap: Use dev_dbg when a struct device * is available Sascha Hauer
2018-12-14 14:17 ` [PATCH 07/23] mtd: nand: omap: Fix hamming correct return values Sascha Hauer
2018-12-14 14:17 ` [PATCH 08/23] mtd: nand: omap: Disable subpage reads in hardware ecc mode Sascha Hauer
2018-12-14 14:17 ` [PATCH 09/23] mtd: nand: omap: remove unused function argument Sascha Hauer
2018-12-14 14:17 ` [PATCH 10/23] mtd: nand: omap: fix bch8_hw_romcode ecc layout Sascha Hauer
2018-12-14 14:17 ` [PATCH 11/23] mtd: nand: omap: set eccbytes correctly Sascha Hauer
2018-12-14 14:17 ` [PATCH 12/23] mtd: nand: omap: unbreak BCH8 support Sascha Hauer
2018-12-14 14:17 ` [PATCH 13/23] ARM: omap: Add missing include Sascha Hauer
2018-12-14 14:17 ` [PATCH 14/23] ARM: omap: dmtimer: Turn into a driver Sascha Hauer
2018-12-17 13:37   ` Teresa Remmet [this message]
2018-12-18  7:46     ` Sascha Hauer
2018-12-14 14:17 ` [PATCH 15/23] ARM: omap: 32ktimer: " Sascha Hauer
2018-12-14 14:17 ` [PATCH 16/23] ARM: omap: Add AM35XX support Sascha Hauer
2018-12-14 14:17 ` [PATCH 17/23] ARM: omap: enable am33xx_uart_soft_reset for AM35xx Sascha Hauer
2018-12-14 14:17 ` [PATCH 18/23] ARM: omap3: Add support for reset reason detection Sascha Hauer
2018-12-14 14:17 ` [PATCH 19/23] ARM: omap: Add AM3517 specific mux configuration Sascha Hauer
2018-12-14 14:17 ` [PATCH 20/23] ARM: omap: Add emif4 support for AM3517 Sascha Hauer
2018-12-14 14:17 ` [PATCH 21/23] ARM: omap: AM3517: Change default clock rate " Sascha Hauer
2018-12-14 14:17 ` [PATCH 22/23] ARM: omap: Add board support for WAGO pfc200 platform Sascha Hauer
2019-01-07 11:40   ` Heinrich.Toews
2019-01-07 11:46     ` Sascha Hauer
2018-12-14 14:17 ` [PATCH 23/23] ARM: omap: am33xx_defconfig: Enable more boards and rename Sascha Hauer
2018-12-14 16:22 ` [PATCH 00/23] AM3517 support Ladislav Michl
2018-12-14 19:32   ` Sascha Hauer

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=1545053877.6213.14.camel@phytec.de \
    --to=t.remmet@phytec.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox