mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/3] clocksource: add ARM AMBA SP804 support
Date: Mon, 11 Feb 2013 10:46:54 +0100	[thread overview]
Message-ID: <20130211094654.GV1906@pengutronix.de> (raw)
In-Reply-To: <1360512157-22161-1-git-send-email-plagnioj@jcrosoft.com>

On Sun, Feb 10, 2013 at 05:02:35PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/clocksource/Kconfig      |    4 ++
>  drivers/clocksource/Makefile     |    1 +
>  drivers/clocksource/amba-sp804.c |   89 ++++++++++++++++++++++++++++++++++++++
>  3 files changed, 94 insertions(+)
>  create mode 100644 drivers/clocksource/amba-sp804.c
> 
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 09acdd7..3f27cf2 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -1,3 +1,7 @@
> +config AMBA_SP804
> +	bool
> +	depends on ARM_AMBA
> +
>  config ARM_SMP_TWD
>  	bool
>  	depends on ARM && CPU_V7
> diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
> index 92d7c13..b0bc8bd 100644
> --- a/drivers/clocksource/Makefile
> +++ b/drivers/clocksource/Makefile
> @@ -1,3 +1,4 @@
> +obj-$(CONFIG_AMBA_SP804) += amba-sp804.o
>  obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o
>  obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o
>  obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
> diff --git a/drivers/clocksource/amba-sp804.c b/drivers/clocksource/amba-sp804.c
> new file mode 100644
> index 0000000..bb6facc
> --- /dev/null
> +++ b/drivers/clocksource/amba-sp804.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
> + *
> + * Under GPL v2
> + */
> +#include <common.h>
> +#include <init.h>
> +#include <clock.h>
> +#include <io.h>
> +#include <driver.h>
> +#include <errno.h>
> +#include <linux/amba/bus.h>
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +
> +#include <asm/hardware/arm_timer.h>
> +
> +static __iomem void *sp804_base;
> +static struct clk *sp804_clk;
> +
> +static uint64_t sp804_read(void)
> +{
> +	return ~readl(sp804_base + TIMER_VALUE);
> +}
> +
> +static struct clocksource sp804_clksrc = {
> +	.read	= sp804_read,
> +	.shift	= 20,
> +	.mask	= CLOCKSOURCE_MASK(32),
> +};
> +
> +static int sp804_probe(struct amba_device *dev, const struct amba_id *id)
> +{
> +	u32 tick_rate;
> +	int ret;
> +

Since this is a single instance driver please protect this driver from
being probed twice:

	if (sp804_base)
		return -EBUSY;

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

  parent reply	other threads:[~2013-02-11  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-10 15:58 [PATCH 0/3] arm: add ARM Vexpress support Jean-Christophe PLAGNIOL-VILLARD
2013-02-10 16:02 ` [PATCH 1/3] clocksource: add ARM AMBA SP804 support Jean-Christophe PLAGNIOL-VILLARD
2013-02-10 16:02   ` [PATCH 2/3] arm: add macro cpu_is_xxx Jean-Christophe PLAGNIOL-VILLARD
2013-02-10 16:02   ` [PATCH 3/3] arm: add vexpress board support Jean-Christophe PLAGNIOL-VILLARD
2013-02-11  9:46   ` Sascha Hauer [this message]
2013-02-11 12:00 [PATCH 0/3 v2] arm: add ARM Vexpress support Jean-Christophe PLAGNIOL-VILLARD
2013-02-11 12:03 ` [PATCH 1/3] clocksource: add ARM AMBA SP804 support Jean-Christophe PLAGNIOL-VILLARD

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=20130211094654.GV1906@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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