summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-04-21 09:28:36 -0500
committerWolfgang Denk <wd@denx.de>2008-04-24 15:42:35 +0200
commit022f12163595b9a55380c6d77c3119b93d6a9a4b (patch)
tree12e45edf11ffbfc0028a6dbf436bae23c2229827 /include/common.h
parent0aa88c82667b9241107d7a0248c341db877e7e76 (diff)
85xx: Round up frequency calculations to get reasonable output
eg. because of rounding error we can get 799Mhz instead of 800Mhz. Introduced DIV_ROUND_UP and roundup taken from linux kernel. Signed-off-by: Dejan Minic <minic@freescale.com> Signed-off-by: Srikanth Srinivasan <srikanth.srinivasan@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Acked-by: Andy Fleming <afleming@freescale.com>
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index aea181e2ab..11b7d31c45 100644
--- a/include/common.h
+++ b/include/common.h
@@ -670,6 +670,9 @@ void inline show_boot_progress (int val);
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+
/* Multicore arch functions */
#ifdef CONFIG_MP
int cpu_status(int nr);