omap: McBSP: Introduce caching in register write operations
[linux-2.6.git] / arch / arm / mach-omap2 / mcbsp.c
index 4b6e515..d601f94 100644 (file)
@@ -65,9 +65,11 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = {
        },
 };
 #define OMAP2420_MCBSP_PDATA_SZ                ARRAY_SIZE(omap2420_mcbsp_pdata)
+#define OMAP2420_MCBSP_REG_NUM         (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1)
 #else
 #define omap2420_mcbsp_pdata           NULL
 #define OMAP2420_MCBSP_PDATA_SZ                0
+#define OMAP2420_MCBSP_REG_NUM         0
 #endif
 
 #ifdef CONFIG_ARCH_OMAP2430
@@ -114,9 +116,11 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
        },
 };
 #define OMAP2430_MCBSP_PDATA_SZ                ARRAY_SIZE(omap2430_mcbsp_pdata)
+#define OMAP2430_MCBSP_REG_NUM         (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1)
 #else
 #define omap2430_mcbsp_pdata           NULL
 #define OMAP2430_MCBSP_PDATA_SZ                0
+#define OMAP2430_MCBSP_REG_NUM         0
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
@@ -168,9 +172,11 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
        },
 };
 #define OMAP34XX_MCBSP_PDATA_SZ                ARRAY_SIZE(omap34xx_mcbsp_pdata)
+#define OMAP34XX_MCBSP_REG_NUM         (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1)
 #else
 #define omap34xx_mcbsp_pdata           NULL
 #define OMAP34XX_MCBSP_PDATA_SZ                0
+#define OMAP34XX_MCBSP_REG_NUM         0
 #endif
 
 static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = {
@@ -208,17 +214,23 @@ static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = {
        },
 };
 #define OMAP44XX_MCBSP_PDATA_SZ                ARRAY_SIZE(omap44xx_mcbsp_pdata)
+#define OMAP44XX_MCBSP_REG_NUM         (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1)
 
 static int __init omap2_mcbsp_init(void)
 {
-       if (cpu_is_omap2420())
+       if (cpu_is_omap2420()) {
                omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ;
-       if (cpu_is_omap2430())
+               omap_mcbsp_cache_size = OMAP2420_MCBSP_REG_NUM * sizeof(u16);
+       } else if (cpu_is_omap2430()) {
                omap_mcbsp_count = OMAP2430_MCBSP_PDATA_SZ;
-       if (cpu_is_omap34xx())
+               omap_mcbsp_cache_size = OMAP2430_MCBSP_REG_NUM * sizeof(u32);
+       } else if (cpu_is_omap34xx()) {
                omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ;
-       if (cpu_is_omap44xx())
+               omap_mcbsp_cache_size = OMAP34XX_MCBSP_REG_NUM * sizeof(u32);
+       } else if (cpu_is_omap44xx()) {
                omap_mcbsp_count = OMAP44XX_MCBSP_PDATA_SZ;
+               omap_mcbsp_cache_size = OMAP44XX_MCBSP_REG_NUM * sizeof(u32);
+       }
 
        mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *),
                                                                GFP_KERNEL);