From: Stephan Linz <linz@mazet.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Nios: timer with variable period; POST preparation
Date: Fri, 13 Feb 2004 09:45:05 +0100 [thread overview]
Message-ID: <04021309450508.00467@pcj86> (raw)
Hi all,
Hi Scott,
here are two small patches I need for my upcoming new Nios board support.
Scott, could you check-up the patches at your DK1C20 board and note Wolfgang
and me so we can put it into CVS ? -- thanks.
1/2 tick timer supports variable (programmable) periods (min. 1 ms tick)
2/2 some small preparation for upcoming POST support for Nios arch
--
Best regards,
Stephan Linz
-------------- next part --------------
* Patch by Stephan Linz, 12 Feb 2004
- add support for NIOS timer with variable period preload counter value
-------------- next part --------------
diff -purN -x CVS u-boot-20040210cvs/cpu/nios/interrupts.c u-boot-20040210cvs-timer_varper/cpu/nios/interrupts.c
--- u-boot-20040210cvs/cpu/nios/interrupts.c 2004-01-03 19:43:49.000000000 +0000
+++ u-boot-20040210cvs-timer_varper/cpu/nios/interrupts.c 2004-02-12 22:32:37.000000000 +0000
@@ -128,6 +128,10 @@ int interrupt_init (void)
tmr->control &= ~NIOS_TIMER_ITO;
tmr->control |= NIOS_TIMER_STOP;
+#if defined(CFG_NIOS_TMRCNT)
+ tmr->periodl = CFG_NIOS_TMRCNT & 0xffff;
+ tmr->periodh = (CFG_NIOS_TMRCNT >> 16) & 0xffff;
+#endif
#endif
for (vec=0; vec<64; vec++ ) {
diff -purN -x CVS u-boot-20040210cvs/doc/README.nios u-boot-20040210cvs-timer_varper/doc/README.nios
--- u-boot-20040210cvs/doc/README.nios 2004-02-09 23:12:25.000000000 +0000
+++ u-boot-20040210cvs-timer_varper/doc/README.nios 2004-02-12 22:42:32.000000000 +0000
@@ -100,6 +100,9 @@ CFG_NIOS_TMRIRQ -- the interrupt request
CFG_NIOS_TMRMS -- the period of the timer in milliseconds.
+CFG_NIOS_TMRCNT -- the preloadable counter value for the timer if it has
+ no fixed period.
+
CFG_NIOS_ASMIBASE -- the base address of the ASMI peripheral.
(standard-32: na_asmi_base).
diff -purN -x CVS u-boot-20040210cvs/include/configs/DK1C20.h u-boot-20040210cvs-timer_varper/include/configs/DK1C20.h
--- u-boot-20040210cvs/include/configs/DK1C20.h 2004-02-09 23:12:25.000000000 +0000
+++ u-boot-20040210cvs-timer_varper/include/configs/DK1C20.h 2004-02-12 22:38:49.000000000 +0000
@@ -146,17 +146,60 @@
#if (CFG_NIOS_CPU_TICK_TIMER == 0)
-#error *** CFG_ERROR: tick timer@TIMER0 not supported, expand your config.h
+#define CFG_NIOS_TMRBASE CFG_NIOS_CPU_TIMER0 /* TIMER0 as tick */
+#define CFG_NIOS_TMRIRQ CFG_NIOS_CPU_TIMER0_IRQ
+
+#if (CFG_NIOS_CPU_TIMER0_FP == 1) /* fixed period */
+
+#if (CFG_NIOS_CPU_TIMER0_PER >= CFG_HZ)
+#define CFG_NIOS_TMRMS (CFG_NIOS_CPU_TIMER0_PER / CFG_HZ)
+#else
+#error *** CFG_ERROR: you have to use a timer periode greater than CFG_HZ
+#endif
+
+#undef CFG_NIOS_TMRCNT /* no preloadable counter value */
+
+#elif (CFG_NIOS_CPU_TIMER0_FP == 0) /* variable period */
+
+#if (CFG_HZ <= 1000)
+#define CFG_NIOS_TMRMS (1000 / CFG_HZ)
+#else
+#error *** CFG_ERROR: sorry, CFG_HZ have to be less than 1000
+#endif
+
+#define CFG_NIOS_TMRCNT (CONFIG_SYS_CLK_FREQ / CFG_HZ)
+
+#else
+#error *** CFG_ERROR: you have to define CFG_NIOS_CPU_TIMER0_FP correct
+#endif
#elif (CFG_NIOS_CPU_TICK_TIMER == 1)
#define CFG_NIOS_TMRBASE CFG_NIOS_CPU_TIMER1 /* TIMER1 as tick */
#define CFG_NIOS_TMRIRQ CFG_NIOS_CPU_TIMER1_IRQ
+#if (CFG_NIOS_CPU_TIMER1_FP == 1) /* fixed period */
+
#if (CFG_NIOS_CPU_TIMER1_PER >= CFG_HZ)
#define CFG_NIOS_TMRMS (CFG_NIOS_CPU_TIMER1_PER / CFG_HZ)
#else
-#error *** CFG_ERROR: you have to use a timer periode of more than CFG_HZ
+#error *** CFG_ERROR: you have to use a timer periode greater than CFG_HZ
+#endif
+
+#undef CFG_NIOS_TMRCNT /* no preloadable counter value */
+
+#elif (CFG_NIOS_CPU_TIMER1_FP == 0) /* variable period */
+
+#if (CFG_HZ <= 1000)
+#define CFG_NIOS_TMRMS (1000 / CFG_HZ)
+#else
+#error *** CFG_ERROR: sorry, CFG_HZ have to be less than 1000
+#endif
+
+#define CFG_NIOS_TMRCNT (CONFIG_SYS_CLK_FREQ / CFG_HZ)
+
+#else
+#error *** CFG_ERROR: you have to define CFG_NIOS_CPU_TIMER1_FP correct
#endif
#endif /* CFG_NIOS_CPU_TICK_TIMER */
diff -purN -x CVS u-boot-20040210cvs/include/configs/DK1S10.h u-boot-20040210cvs-timer_varper/include/configs/DK1S10.h
--- u-boot-20040210cvs/include/configs/DK1S10.h 2004-02-09 23:12:26.000000000 +0000
+++ u-boot-20040210cvs-timer_varper/include/configs/DK1S10.h 2004-02-12 22:36:27.000000000 +0000
@@ -168,10 +168,28 @@
#define CFG_NIOS_TMRBASE CFG_NIOS_CPU_TIMER0 /* TIMER0 as tick */
#define CFG_NIOS_TMRIRQ CFG_NIOS_CPU_TIMER0_IRQ
+#if (CFG_NIOS_CPU_TIMER0_FP == 1) /* fixed period */
+
#if (CFG_NIOS_CPU_TIMER0_PER >= CFG_HZ)
#define CFG_NIOS_TMRMS (CFG_NIOS_CPU_TIMER0_PER / CFG_HZ)
#else
-#error *** CFG_ERROR: you have to use a timer periode of more than CFG_HZ
+#error *** CFG_ERROR: you have to use a timer periode greater than CFG_HZ
+#endif
+
+#undef CFG_NIOS_TMRCNT /* no preloadable counter value */
+
+#elif (CFG_NIOS_CPU_TIMER0_FP == 0) /* variable period */
+
+#if (CFG_HZ <= 1000)
+#define CFG_NIOS_TMRMS (1000 / CFG_HZ)
+#else
+#error *** CFG_ERROR: sorry, CFG_HZ have to be less than 1000
+#endif
+
+#define CFG_NIOS_TMRCNT (CONFIG_SYS_CLK_FREQ / CFG_HZ)
+
+#else
+#error *** CFG_ERROR: you have to define CFG_NIOS_CPU_TIMER0_FP correct
#endif
#elif (CFG_NIOS_CPU_TICK_TIMER == 1)
@@ -179,10 +197,28 @@
#define CFG_NIOS_TMRBASE CFG_NIOS_CPU_TIMER1 /* TIMER1 as tick */
#define CFG_NIOS_TMRIRQ CFG_NIOS_CPU_TIMER1_IRQ
+#if (CFG_NIOS_CPU_TIMER1_FP == 1) /* fixed period */
+
#if (CFG_NIOS_CPU_TIMER1_PER >= CFG_HZ)
#define CFG_NIOS_TMRMS (CFG_NIOS_CPU_TIMER1_PER / CFG_HZ)
#else
-#error *** CFG_ERROR: you have to use a timer periode of more than CFG_HZ
+#error *** CFG_ERROR: you have to use a timer periode greater than CFG_HZ
+#endif
+
+#undef CFG_NIOS_TMRCNT /* no preloadable counter value */
+
+#elif (CFG_NIOS_CPU_TIMER1_FP == 0) /* variable period */
+
+#if (CFG_HZ <= 1000)
+#define CFG_NIOS_TMRMS (1000 / CFG_HZ)
+#else
+#error *** CFG_ERROR: sorry, CFG_HZ have to be less than 1000
+#endif
+
+#define CFG_NIOS_TMRCNT (CONFIG_SYS_CLK_FREQ / CFG_HZ)
+
+#else
+#error *** CFG_ERROR: you have to define CFG_NIOS_CPU_TIMER1_FP correct
#endif
#endif /* CFG_NIOS_CPU_TICK_TIMER */
-------------- next part --------------
* Patch by Stephan Linz, 12 Feb 2004
- prepare POST framework support for NIOS targets
-------------- next part --------------
diff -purN -x CVS u-boot-20040210cvs-timer_varper/include/asm-nios/cache.h u-boot-20040210cvs-prepare_post/include/asm-nios/cache.h
--- u-boot-20040210cvs-timer_varper/include/asm-nios/cache.h 1970-01-01 00:00:00.000000000 +0000
+++ u-boot-20040210cvs-prepare_post/include/asm-nios/cache.h 2004-02-12 23:18:00.000000000 +0000
@@ -0,0 +1 @@
+/*FIXME: Implement this! */
diff -purN -x CVS u-boot-20040210cvs-timer_varper/include/asm-nios/global_data.h u-boot-20040210cvs-prepare_post/include/asm-nios/global_data.h
--- u-boot-20040210cvs-timer_varper/include/asm-nios/global_data.h 2003-10-10 10:05:43.000000000 +0000
+++ u-boot-20040210cvs-prepare_post/include/asm-nios/global_data.h 2004-02-12 23:18:00.000000000 +0000
@@ -34,6 +34,10 @@ typedef struct global_data {
unsigned long reloc_off; /* Relocation Offset */
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid */
+#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
+ unsigned long post_log_word; /* Record POST activities */
+ unsigned long post_init_f_time; /* When post_init_f started */
+#endif
void **jt; /* Standalone app jump table */
} gd_t;
next reply other threads:[~2004-02-13 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-13 8:45 Stephan Linz [this message]
2004-02-23 21:17 ` [U-Boot-Users] [PATCH] Nios: timer with variable period; POST preparation Wolfgang Denk
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=04021309450508.00467@pcj86 \
--to=linz@mazet.de \
--cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.