From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Mon, 7 Sep 2015 16:00:07 +0800 Subject: [U-Boot] [PATCH 2/2] nios2: Split timer code into timer.c In-Reply-To: <1441360276-4792-2-git-send-email-marex@denx.de> References: <1441360276-4792-1-git-send-email-marex@denx.de> <1441360276-4792-2-git-send-email-marex@denx.de> Message-ID: <55ED4407.2020101@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > + * Scott McNutt > + * > + * SPDX-License-Identifier: GPL-2.0+ > + */ > + > +#include > +#include > +#include > +#include > + > +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