aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/mcbsp.c
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>2010-02-15 13:03:33 -0500
committerTony Lindgren <tony@atomide.com>2010-02-15 13:03:33 -0500
commitc8c99699bd25d8b238ba75d2530d1be90e3c39ea (patch)
tree50d4b5fa730c3f1a77c96ebb4abd7593c0fcb7e0 /arch/arm/mach-omap1/mcbsp.c
parent8ea3200f1de1c3d8f3c884a704107fb1e7449547 (diff)
omap: McBSP: Introduce caching in register write operations
Determine cache size required per McBSP port at init time, based on processor type running on. Allocate space for storing cached copies of McBSP register values at port request. Modify omap_msbcp_write() function to update the cache with every register write operation. Modify omap_mcbsp_read() to support reading from cache or hardware. Update MCBSP_READ() macro for modified omap_mcbsp_read() function API. Introduce a new macro that reads from the cache. Tested on OMAP1510 based Amstrad Delta using linux-omap for-next, commit fb7380d70e041e4b3892f6b19dff7efb609d15a4 (2.6.33-rc3+ dated 2010-01-11). Compile-tested with: omap_perseus2_730_defconfig, omap_generic_1610_defconfig, omap_generic_2420_defconfig, omap_2430sdp_defconfig, omap_3430sdp_defconfig, omap_4430sdp_defconfig with CONFIG_OMAP_MCBSP=y selected. Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Acked-by: Jarkko Nikula <jhnikula@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/mcbsp.c')
-rw-r--r--arch/arm/mach-omap1/mcbsp.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/arm/mach-omap1/mcbsp.c b/arch/arm/mach-omap1/mcbsp.c
index 6bddce104ee9..f9a5cf750b59 100644
--- a/arch/arm/mach-omap1/mcbsp.c
+++ b/arch/arm/mach-omap1/mcbsp.c
@@ -99,9 +99,11 @@ static struct omap_mcbsp_platform_data omap7xx_mcbsp_pdata[] = {
99 }, 99 },
100}; 100};
101#define OMAP7XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap7xx_mcbsp_pdata) 101#define OMAP7XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap7xx_mcbsp_pdata)
102#define OMAP7XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_XCERH / sizeof(u16) + 1)
102#else 103#else
103#define omap7xx_mcbsp_pdata NULL 104#define omap7xx_mcbsp_pdata NULL
104#define OMAP7XX_MCBSP_PDATA_SZ 0 105#define OMAP7XX_MCBSP_PDATA_SZ 0
106#define OMAP7XX_MCBSP_REG_NUM 0
105#endif 107#endif
106 108
107#ifdef CONFIG_ARCH_OMAP15XX 109#ifdef CONFIG_ARCH_OMAP15XX
@@ -132,9 +134,11 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
132 }, 134 },
133}; 135};
134#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata) 136#define OMAP15XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap15xx_mcbsp_pdata)
137#define OMAP15XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_XCERH / sizeof(u16) + 1)
135#else 138#else
136#define omap15xx_mcbsp_pdata NULL 139#define omap15xx_mcbsp_pdata NULL
137#define OMAP15XX_MCBSP_PDATA_SZ 0 140#define OMAP15XX_MCBSP_PDATA_SZ 0
141#define OMAP15XX_MCBSP_REG_NUM 0
138#endif 142#endif
139 143
140#ifdef CONFIG_ARCH_OMAP16XX 144#ifdef CONFIG_ARCH_OMAP16XX
@@ -165,19 +169,25 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
165 }, 169 },
166}; 170};
167#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata) 171#define OMAP16XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap16xx_mcbsp_pdata)
172#define OMAP16XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_XCERH / sizeof(u16) + 1)
168#else 173#else
169#define omap16xx_mcbsp_pdata NULL 174#define omap16xx_mcbsp_pdata NULL
170#define OMAP16XX_MCBSP_PDATA_SZ 0 175#define OMAP16XX_MCBSP_PDATA_SZ 0
176#define OMAP16XX_MCBSP_REG_NUM 0
171#endif 177#endif
172 178
173int __init omap1_mcbsp_init(void) 179int __init omap1_mcbsp_init(void)
174{ 180{
175 if (cpu_is_omap7xx()) 181 if (cpu_is_omap7xx()) {
176 omap_mcbsp_count = OMAP7XX_MCBSP_PDATA_SZ; 182 omap_mcbsp_count = OMAP7XX_MCBSP_PDATA_SZ;
177 if (cpu_is_omap15xx()) 183 omap_mcbsp_cache_size = OMAP7XX_MCBSP_REG_NUM * sizeof(u16);
184 } else if (cpu_is_omap15xx()) {
178 omap_mcbsp_count = OMAP15XX_MCBSP_PDATA_SZ; 185 omap_mcbsp_count = OMAP15XX_MCBSP_PDATA_SZ;
179 if (cpu_is_omap16xx()) 186 omap_mcbsp_cache_size = OMAP15XX_MCBSP_REG_NUM * sizeof(u16);
187 } else if (cpu_is_omap16xx()) {
180 omap_mcbsp_count = OMAP16XX_MCBSP_PDATA_SZ; 188 omap_mcbsp_count = OMAP16XX_MCBSP_PDATA_SZ;
189 omap_mcbsp_cache_size = OMAP16XX_MCBSP_REG_NUM * sizeof(u16);
190 }
181 191
182 mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), 192 mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *),
183 GFP_KERNEL); 193 GFP_KERNEL);