Add proper register definitions, macros and clock functions required
for I2C driver to be developed.



Signed-off-by: Javier Martin <javier.mar...@vista-silicon.com>
--
diff --git a/cpu/arm926ejs/mx27/generic.c b/cpu/arm926ejs/mx27/generic.c
index 808371f..540ef0c 100644
--- a/cpu/arm926ejs/mx27/generic.c
+++ b/cpu/arm926ejs/mx27/generic.c
@@ -22,11 +22,21 @@
 #include <div64.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include <asm/arch/asm-offsets.h>
 #include <asm/arch/imx-regs.h>
 #ifdef CONFIG_MXC_MMC
 #include <asm/arch/mxcmmc.h>
 #endif

+int imx_get_revision(void)
+{
+       ulong val;
+
+       val = readl(SYSCTRL_CID);
+
+       return (int)(val >> 28);
+}
+
 /*
  *  get the system pll clock in Hz
  *
@@ -152,6 +162,19 @@ ulong imx_get_perclk4(void)
        return imx_decode_perclk(((readl(&pll->pcdr1) >> 24) & 0x3f) + 1);
 }

+ulong imx_get_ipgclk(void)
+{
+       ulong rate, ipg_pdf;
+
+       if (imx_get_revision() >= CHIP_REV_2_0)
+               return imx_get_ahbclk();
+       else
+               ipg_pdf = (readl(CSCR) >> 8) & 1;
+
+       rate = imx_get_ahbclk();
+       return rate / (ipg_pdf + 1);
+}
+
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo (void)
 {
diff --git a/include/asm-arm/arch-mx27/asm-offsets.h 
b/include/asm-arm/arch-mx27/asm-offsets.h
index 497afe5..cdecef6 100644
--- a/include/asm-arm/arch-mx27/asm-offsets.h
+++ b/include/asm-arm/arch-mx27/asm-offsets.h
@@ -14,3 +14,5 @@
 #define ESDCTL1_ROF    0x08
 #define ESDCFG1_ROF    0x0C
 #define ESDMISC_ROF    0x10
+#define SYSCTRL_CID    0x10027800
+#define CHIP_REV_2_0           0x01
diff --git a/include/asm-arm/arch-mx27/imx-regs.h 
b/include/asm-arm/arch-mx27/imx-regs.h
index d36a6da..2b89b4e 100644
--- a/include/asm-arm/arch-mx27/imx-regs.h
+++ b/include/asm-arm/arch-mx27/imx-regs.h
@@ -206,6 +206,10 @@ struct iim_regs {
 };
 #endif

+#define __REG(x)     (*((volatile u32 *)(x)))
+#define __REG16(x)   (*((volatile u16 *)(x)))
+#define __REG8(x)    (*((volatile u8 *)(x)))
+
 #define IMX_IO_BASE            0x10000000

 #define IMX_AIPI1_BASE         (0x00000 + IMX_IO_BASE)
--
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to