diff options
author | Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> | 2010-02-15 13:03:33 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-02-15 13:03:33 -0500 |
commit | c8c99699bd25d8b238ba75d2530d1be90e3c39ea (patch) | |
tree | 50d4b5fa730c3f1a77c96ebb4abd7593c0fcb7e0 /arch/arm/mach-omap2/mcbsp.c | |
parent | 8ea3200f1de1c3d8f3c884a704107fb1e7449547 (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-omap2/mcbsp.c')
-rw-r--r-- | arch/arm/mach-omap2/mcbsp.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index 4b6e5157520f..d601f9405d11 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
@@ -65,9 +65,11 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = { | |||
65 | }, | 65 | }, |
66 | }; | 66 | }; |
67 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) | 67 | #define OMAP2420_MCBSP_PDATA_SZ ARRAY_SIZE(omap2420_mcbsp_pdata) |
68 | #define OMAP2420_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) | ||
68 | #else | 69 | #else |
69 | #define omap2420_mcbsp_pdata NULL | 70 | #define omap2420_mcbsp_pdata NULL |
70 | #define OMAP2420_MCBSP_PDATA_SZ 0 | 71 | #define OMAP2420_MCBSP_PDATA_SZ 0 |
72 | #define OMAP2420_MCBSP_REG_NUM 0 | ||
71 | #endif | 73 | #endif |
72 | 74 | ||
73 | #ifdef CONFIG_ARCH_OMAP2430 | 75 | #ifdef CONFIG_ARCH_OMAP2430 |
@@ -114,9 +116,11 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = { | |||
114 | }, | 116 | }, |
115 | }; | 117 | }; |
116 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) | 118 | #define OMAP2430_MCBSP_PDATA_SZ ARRAY_SIZE(omap2430_mcbsp_pdata) |
119 | #define OMAP2430_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) | ||
117 | #else | 120 | #else |
118 | #define omap2430_mcbsp_pdata NULL | 121 | #define omap2430_mcbsp_pdata NULL |
119 | #define OMAP2430_MCBSP_PDATA_SZ 0 | 122 | #define OMAP2430_MCBSP_PDATA_SZ 0 |
123 | #define OMAP2430_MCBSP_REG_NUM 0 | ||
120 | #endif | 124 | #endif |
121 | 125 | ||
122 | #ifdef CONFIG_ARCH_OMAP3 | 126 | #ifdef CONFIG_ARCH_OMAP3 |
@@ -168,9 +172,11 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = { | |||
168 | }, | 172 | }, |
169 | }; | 173 | }; |
170 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) | 174 | #define OMAP34XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap34xx_mcbsp_pdata) |
175 | #define OMAP34XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) | ||
171 | #else | 176 | #else |
172 | #define omap34xx_mcbsp_pdata NULL | 177 | #define omap34xx_mcbsp_pdata NULL |
173 | #define OMAP34XX_MCBSP_PDATA_SZ 0 | 178 | #define OMAP34XX_MCBSP_PDATA_SZ 0 |
179 | #define OMAP34XX_MCBSP_REG_NUM 0 | ||
174 | #endif | 180 | #endif |
175 | 181 | ||
176 | static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = { | 182 | static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = { |
@@ -208,17 +214,23 @@ static struct omap_mcbsp_platform_data omap44xx_mcbsp_pdata[] = { | |||
208 | }, | 214 | }, |
209 | }; | 215 | }; |
210 | #define OMAP44XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap44xx_mcbsp_pdata) | 216 | #define OMAP44XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap44xx_mcbsp_pdata) |
217 | #define OMAP44XX_MCBSP_REG_NUM (OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1) | ||
211 | 218 | ||
212 | static int __init omap2_mcbsp_init(void) | 219 | static int __init omap2_mcbsp_init(void) |
213 | { | 220 | { |
214 | if (cpu_is_omap2420()) | 221 | if (cpu_is_omap2420()) { |
215 | omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ; | 222 | omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ; |
216 | if (cpu_is_omap2430()) | 223 | omap_mcbsp_cache_size = OMAP2420_MCBSP_REG_NUM * sizeof(u16); |
224 | } else if (cpu_is_omap2430()) { | ||
217 | omap_mcbsp_count = OMAP2430_MCBSP_PDATA_SZ; | 225 | omap_mcbsp_count = OMAP2430_MCBSP_PDATA_SZ; |
218 | if (cpu_is_omap34xx()) | 226 | omap_mcbsp_cache_size = OMAP2430_MCBSP_REG_NUM * sizeof(u32); |
227 | } else if (cpu_is_omap34xx()) { | ||
219 | omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ; | 228 | omap_mcbsp_count = OMAP34XX_MCBSP_PDATA_SZ; |
220 | if (cpu_is_omap44xx()) | 229 | omap_mcbsp_cache_size = OMAP34XX_MCBSP_REG_NUM * sizeof(u32); |
230 | } else if (cpu_is_omap44xx()) { | ||
221 | omap_mcbsp_count = OMAP44XX_MCBSP_PDATA_SZ; | 231 | omap_mcbsp_count = OMAP44XX_MCBSP_PDATA_SZ; |
232 | omap_mcbsp_cache_size = OMAP44XX_MCBSP_REG_NUM * sizeof(u32); | ||
233 | } | ||
222 | 234 | ||
223 | mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), | 235 | mcbsp_ptr = kzalloc(omap_mcbsp_count * sizeof(struct omap_mcbsp *), |
224 | GFP_KERNEL); | 236 | GFP_KERNEL); |