[U-Boot] [PATCH 2/2] nios2: Split timer code into timer.c
Thomas Chou
thomas at wytron.com.tw
Mon Sep 7 10:00:07 CEST 2015
Hi Marek,
On 09/04/2015 05:51 PM, Marek Vasut wrote
> diff --git a/arch/nios2/cpu/timer.c b/arch/nios2/cpu/timer.c
> new file mode 100644
> index 0000000..006b19b
> --- /dev/null
> +++ b/arch/nios2/cpu/timer.c
> @@ -0,0 +1,69 @@
> +/*
> + * (C) Copyright 2000-2002
> + * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> + *
> + * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
> + * Scott McNutt <smcnutt at psyent.com>
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <asm/nios2.h>
> +#include <asm/types.h>
> +#include <asm/io.h>
> +
> +struct nios_timer {
> + u32 status; /* Timer status reg */
> + u32 control; /* Timer control reg */
> + u32 periodl; /* Timeout period low */
> + u32 periodh; /* Timeout period high */
> + u32 snapl; /* Snapshot low */
> + u32 snaph; /* Snapshot high */
> +};
> +
> +/* status register */
> +#define NIOS_TIMER_TO (1 << 0) /* Timeout */
> +#define NIOS_TIMER_RUN (1 << 1) /* Timer running */
> +
> +/* control register */
> +#define NIOS_TIMER_ITO (1 << 0) /* Timeout int ena */
> +#define NIOS_TIMER_CONT (1 << 1) /* Continuous mode */
> +#define NIOS_TIMER_START (1 << 2) /* Start timer */
> +#define NIOS_TIMER_STOP (1 << 3) /* Stop timer */
> +
> +#if defined(CONFIG_SYS_TIMER_BASE) && !defined(CONFIG_SYS_TIMER_IRQ)
> +#error CONFIG_SYS_TIMER_IRQ not defined (see documentation)
> +#endif
Since the timer interrupt is removed, there is no need to perform the check.
Best regards,
Thomas Chou
More information about the U-Boot
mailing list