Reserve space inside omap_mcbsp structure for storing cached copies of McBSP register values. Modify the MCBSP_WRITE() macro to update the cache with every register write operation. Introduce a new macro that reads from the cache instead of hardware. Applies on top of patch 2 from this series: [PATCH v3 2/4] OMAP: McBSP: Prepare register read/write macros API for caching Tested on OMAP1510 based Amstrad Delta using linux-omap for-next, commit 4421752e331cfb1d942b47ffdb26e451a8da58a0. Compile-tested with omap_3430sdp_defconfig. Signed-off-by: Janusz Krzysztofik <jkrzyszt@xxxxxxxxxxxx> --- Tony, Since I was not sure what your primary concern was, I've prepared two alternative versions of patch 3/4. Please take this one as a base for further discussion if your primary concern was potentially dangerous #else clause. I've replaced it with #elif, that should be more future proof. Otherwise, have a look the other one (v5b). Thanks, Janusz --- git/arch/arm/plat-omap/include/plat/mcbsp.h.orig 2009-11-27 11:53:45.000000000 +0100 +++ git/arch/arm/plat-omap/include/plat/mcbsp.h 2009-12-05 03:37:21.000000000 +0100 @@ -415,6 +415,13 @@ struct omap_mcbsp { u16 max_tx_thres; u16 max_rx_thres; #endif +#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || \ + defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) + u16 reg_cache[OMAP_MCBSP_REG_XCERH / sizeof(u16) + 1]; +#elif defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ + defined(CONFIG_ARCH_OMAP4) + u32 reg_cache[OMAP_MCBSP_REG_RCCR / sizeof(u32) + 1]; +#endif }; extern struct omap_mcbsp **mcbsp_ptr; extern int omap_mcbsp_count; --- git/arch/arm/plat-omap/mcbsp.c.orig 2009-12-01 03:19:56.000000000 +0100 +++ git/arch/arm/plat-omap/mcbsp.c 2009-12-01 03:37:21.000000000 +0100 @@ -49,7 +49,12 @@ int omap_mcbsp_read(void __iomem *io_bas #define MCBSP_READ(mcbsp, reg) \ omap_mcbsp_read(mcbsp->io_base, OMAP_MCBSP_REG_##reg) #define MCBSP_WRITE(mcbsp, reg, val) \ - omap_mcbsp_write(mcbsp->io_base, OMAP_MCBSP_REG_##reg, val) + omap_mcbsp_write(mcbsp->io_base, OMAP_MCBSP_REG_##reg, \ + mcbsp->reg_cache[OMAP_MCBSP_REG_##reg / \ + sizeof(*mcbsp->reg_cache)] = val) +#define MCBSP_READ_CACHE(mcbsp, reg) \ + (mcbsp->reg_cache[OMAP_MCBSP_REG_##reg / \ + sizeof(*mcbsp->reg_cache)]) #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count) #define id_to_mcbsp_ptr(id) mcbsp_ptr[id]; -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html