Skip to contentSkip to conversation

nios2: Set CONFIG_SYS_HZ to 1000 all nios2 boards.

PATCH New Scott McNutt 2 participants 5 messages Mar 31, 2010 – Apr 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nios2: Set CONFIG_SYS_HZ to 1000 all nios2 boards.

CONFIG_SYS_HZ was being calculated (incorrectly) in nios2 configuration headers. Updated comments to accurately describe timebase macros.

---
 include/configs/EP1C20.h  |   14 ++++++++------
 include/configs/EP1S10.h  |   14 ++++++++------
 include/configs/EP1S40.h  |   14 ++++++++------
 include/configs/PCI5441.h |   14 ++++++++------
 include/configs/PK1C20.h  |   14 ++++++++------
 5 files changed, 40 insertions(+), 30 deletions(-)
include/configs/EP1C20.h +8 -6
index dc82e54..3920d35 100644
@@ -124,14 +124,16 @@
  * TIMEBASE --
  *
  * The high res timer defaults to 1 msec. Since it includes the period
- * registers, we can slow it down to 10 msec using TMRCNT. If the default
- * period is acceptable, TMRCNT can be left undefined.
+ * registers, the interrupt frequency can be reduced using TMRCNT.
+ * If the default period is acceptable, TMRCNT can be left undefined.
+ * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
+#define CONFIG_SYS_HZ			1000	/* Always 1000 */
 #define CONFIG_SYS_NIOS_TMRBASE	0x02120820	/* Tick timer base addr */
-#define CONFIG_SYS_NIOS_TMRIRQ		3		/* Timer IRQ num	*/
-#define CONFIG_SYS_NIOS_TMRMS		10		/* 10 msec per tick	*/
-#define CONFIG_SYS_NIOS_TMRCNT (CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
-#define CONFIG_SYS_HZ		(CONFIG_SYS_CLK_FREQ/(CONFIG_SYS_NIOS_TMRCNT + 1))
+#define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num	*/
+#define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period (msec)*/
+#define CONFIG_SYS_NIOS_TMRCNT \
+		(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
 
 /*------------------------------------------------------------------------
  * STATUS LED -- Provides a simple blinking led. For Nios2 each board
include/configs/EP1S10.h +8 -6
index 498f26d..bfbf8c1 100644
@@ -119,14 +119,16 @@
  * TIMEBASE --
  *
  * The high res timer defaults to 1 msec. Since it includes the period
- * registers, we can slow it down to 10 msec using TMRCNT. If the default
- * period is acceptable, TMRCNT can be left undefined.
+ * registers, the interrupt frequency can be reduced using TMRCNT.
+ * If the default period is acceptable, TMRCNT can be left undefined.
+ * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
+#define CONFIG_SYS_HZ			1000	/* Always 1000 */
 #define CONFIG_SYS_NIOS_TMRBASE	0x02120820	/* Tick timer base addr */
-#define CONFIG_SYS_NIOS_TMRIRQ		3		/* Timer IRQ num	*/
-#define CONFIG_SYS_NIOS_TMRMS		10		/* 10 msec per tick	*/
-#define CONFIG_SYS_NIOS_TMRCNT (CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
-#define CONFIG_SYS_HZ		(CONFIG_SYS_CLK_FREQ/(CONFIG_SYS_NIOS_TMRCNT + 1))
+#define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
+#define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period (msec)*/
+#define CONFIG_SYS_NIOS_TMRCNT \
+		(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
 
 /*------------------------------------------------------------------------
  * STATUS LED -- Provides a simple blinking led. For Nios2 each board
include/configs/EP1S40.h +8 -6
index 4ad65d8..4d905fe 100644
@@ -119,14 +119,16 @@
  * TIMEBASE --
  *
  * The high res timer defaults to 1 msec. Since it includes the period
- * registers, we can slow it down to 10 msec using TMRCNT. If the default
- * period is acceptable, TMRCNT can be left undefined.
+ * registers, the interrupt frequency can be reduced using TMRCNT.
+ * If the default period is acceptable, TMRCNT can be left undefined.
+ * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
+#define CONFIG_SYS_HZ			1000	/* Always 1000 */
 #define CONFIG_SYS_NIOS_TMRBASE	0x02120820	/* Tick timer base addr */
-#define CONFIG_SYS_NIOS_TMRIRQ		3		/* Timer IRQ num	*/
-#define CONFIG_SYS_NIOS_TMRMS		10		/* 10 msec per tick	*/
-#define CONFIG_SYS_NIOS_TMRCNT (CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
-#define CONFIG_SYS_HZ		(CONFIG_SYS_CLK_FREQ/(CONFIG_SYS_NIOS_TMRCNT + 1))
+#define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
+#define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period (msec) */
+#define CONFIG_SYS_NIOS_TMRCNT \
+		(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
 
 /*------------------------------------------------------------------------
  * STATUS LED -- Provides a simple blinking led. For Nios2 each board
include/configs/PCI5441.h +8 -6
index d06b7f8..c60a9f7 100644
@@ -114,14 +114,16 @@
  * TIMEBASE --
  *
  * The high res timer defaults to 1 msec. Since it includes the period
- * registers, we can slow it down to 10 msec using TMRCNT. If the default
- * period is acceptable, TMRCNT can be left undefined.
+ * registers, the interrupt frequency can be reduced using TMRCNT.
+ * If the default period is acceptable, TMRCNT can be left undefined.
+ * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
+#define CONFIG_SYS_HZ			1000	/* Always 1000 */
 #define CONFIG_SYS_NIOS_TMRBASE	0x00920860	/* Tick timer base addr	*/
-#define CONFIG_SYS_NIOS_TMRIRQ		3		/* Timer IRQ num	*/
-#define CONFIG_SYS_NIOS_TMRMS		10		/* 10 msec per tick	*/
-#define CONFIG_SYS_NIOS_TMRCNT	(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
-#define	CONFIG_SYS_HZ		(CONFIG_SYS_CLK_FREQ/(CONFIG_SYS_NIOS_TMRCNT + 1))
+#define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
+#define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period (msec)*/
+#define CONFIG_SYS_NIOS_TMRCNT \
+		(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
 
 
 /*
include/configs/PK1C20.h +8 -6
index 165dde0..874c20b 100644
@@ -124,14 +124,16 @@
  * TIMEBASE --
  *
  * The high res timer defaults to 1 msec. Since it includes the period
- * registers, we can slow it down to 10 msec using TMRCNT. If the default
- * period is acceptable, TMRCNT can be left undefined.
+ * registers, the interrupt frequency can be reduced using TMRCNT.
+ * If the default period is acceptable, TMRCNT can be left undefined.
+ * TMRMS represents the desired mecs per tick (msecs per interrupt).
  *----------------------------------------------------------------------*/
+#define CONFIG_SYS_HZ			1000	/* Always 1000 */
 #define CONFIG_SYS_NIOS_TMRBASE	0x02120820	/* Tick timer base addr */
-#define CONFIG_SYS_NIOS_TMRIRQ		3		/* Timer IRQ num	*/
-#define CONFIG_SYS_NIOS_TMRMS		10		/* 10 msec per tick	*/
-#define CONFIG_SYS_NIOS_TMRCNT (CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
-#define CONFIG_SYS_HZ		(CONFIG_SYS_CLK_FREQ/(CONFIG_SYS_NIOS_TMRCNT + 1))
+#define CONFIG_SYS_NIOS_TMRIRQ		3	/* Timer IRQ num */
+#define CONFIG_SYS_NIOS_TMRMS		10	/* Desired period */
+#define CONFIG_SYS_NIOS_TMRCNT \
+		(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_CLK_FREQ/1000))
 
 /*------------------------------------------------------------------------
  * STATUS LED -- Provides a simple blinking led. For Nios2 each board
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 nios2: Set CONFIG_SYS_HZ to 1000 all nios2 boards.

Quoted 11 lines · Scott McNutt

CONFIG_SYS_HZ was being calculated (incorrectly) in nios2 configuration headers. Updated comments to accurately describe timebase macros.

---
 include/configs/EP1C20.h  |   14 ++++++++------
 include/configs/EP1S10.h  |   14 ++++++++------
 include/configs/EP1S40.h  |   14 ++++++++------
 include/configs/PCI5441.h |   14 ++++++++------
 include/configs/PK1C20.h  |   14 ++++++++------
 5 files changed, 40 insertions(+), 30 deletions(-)

This is the next "nice" patch around altera boards. If you do the same changes (because of the same reason) in 5 files it points me that something is wrong. Please create one generic nios2 file and move there these common macros. Look at ppc405/440 which use that style.

Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#2 lore raw

PATCH 1/1 nios2: Set CONFIG_SYS_HZ to 1000 all nios2 boards.

Quoted 14 lines · Michal Simek
Quoted 4 lines · Scott McNutt

CONFIG_SYS_HZ was being calculated (incorrectly) in nios2
configuration
headers. Updated comments to accurately describe timebase macros.

Quoted 8 lines
---
 include/configs/EP1C20.h  |   14 ++++++++------
 include/configs/EP1S10.h  |   14 ++++++++------
 include/configs/EP1S40.h  |   14 ++++++++------
 include/configs/PCI5441.h |   14 ++++++++------
 include/configs/PK1C20.h  |   14 ++++++++------
 5 files changed, 40 insertions(+), 30 deletions(-)
Quoted 1 line

This is the next "nice" patch around altera boards.

Agreed.

Quoted 3 lines

If you do the same
changes (because of the same reason) in 5 files it points me that something is wrong.

IMO, it is inefficient, not wrong. But only because each of these boards worked fine ... until some things changed externally ... that required a common resolution.

Quoted 2 lines

Please create one generic nios2 file and move there these common macros. Look at ppc405/440 which use that style.

It would indeed be more efficient -- perhaps a common header for the Altera boards when time permits.

Regards,
--Scott

#3 lore raw

PATCH 1/1 nios2: Set CONFIG_SYS_HZ to 1000 all nios2 boards.

Quoted 19 lines · Scott McNutt
Quoted 14 lines · Michal Simek
Quoted 4 lines · Scott McNutt

CONFIG_SYS_HZ was being calculated (incorrectly) in nios2
configuration
headers. Updated comments to accurately describe timebase macros.

Quoted 8 lines
---
 include/configs/EP1C20.h  |   14 ++++++++------
 include/configs/EP1S10.h  |   14 ++++++++------
 include/configs/EP1S40.h  |   14 ++++++++------
 include/configs/PCI5441.h |   14 ++++++++------
 include/configs/PK1C20.h  |   14 ++++++++------
 5 files changed, 40 insertions(+), 30 deletions(-)
Quoted 1 line

This is the next "nice" patch around altera boards.

Quoted 8 lines

Agreed.

Quoted 2 lines

If you do the same changes (because of the same reason) in 5 files it points me that something is wrong.

IMO, it is inefficient, not wrong. But only because each of these boards worked fine ... until some things changed externally ... that required a common resolution.

I don't have anything against the purpose that patch because fix the real issue. I have just problem with that style of doing it.

I am really not sure what you mean by "until some things changed externally"!

Quoted 6 lines
Quoted 3 lines

Please create one generic nios2 file and move there these common macros. Look at ppc405/440 which use that style.

It would indeed be more efficient -- perhaps a common header for the Altera boards when time permits.

:-) It is not just to be more efficient.
1. Save u-boot size
2. If is only one place where it is defined than you don't need to spend time to fix all boards which are very similar. It is more bug-free solution.

Regards,
Michal

Quoted 4 lines

Regards,
--Scott

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#4 lore raw

PATCH 1/1 nios2: Set CONFIG_SYS_HZ to 1000 all nios2 boards.

Michal,

Quoted 8 lines
Quoted 2 lines

It would indeed be more efficient -- perhaps a common header for the Altera boards when time permits.

:-) It is not just to be more efficient.
1. Save u-boot size
2. If is only one place where it is defined than you don't need to spend time to fix all boards which are very similar. It is more bug-free solution.

Exactly! That's what I meant by "more efficient." Efficiency of size, efficiency of effort. I'm confident that we are in complete agreement.

Best Regards,
--Scott