mediatek: Refactor to sharing code among similar SOCs

This patch refactor cbmem and timer code which will be reused among
similar SOCs.

BUG=b:80501386
BRANCH=none
TEST=the refactored code works fine on the new platform (with the rest
     of the patches applied) and Elm platform

Change-Id: I397ebdc0c97c7616bd547022d2ce2a8f08f3c232
Signed-off-by: Tristan Shieh <tristan.shieh@mediatek.com>
Reviewed-on: https://review.coreboot.org/26881
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/mediatek/mt8173/cbmem.c b/src/soc/mediatek/mt8173/cbmem.c
index 1967a2c..31ea1bae 100644
--- a/src/soc/mediatek/mt8173/cbmem.c
+++ b/src/soc/mediatek/mt8173/cbmem.c
@@ -19,7 +19,9 @@
 #include <symbols.h>
 #include <soc/emi.h>
 
+#define MAX_DRAM_ADDRESS ((uintptr_t)4 * GiB)
+
 void *cbmem_top(void)
 {
-	return (void *)min((uintptr_t)_dram + sdram_size(), (uintptr_t)4 * GiB);
+	return (void *)min((uintptr_t)_dram + sdram_size(), MAX_DRAM_ADDRESS);
 }