From e6ce6a3069e2a83c0343d6de8656aee95c6b49f3 Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Tue, 15 May 2012 18:11:39 -0700 Subject: ARM: tegra: Modify tegra_apb functions Make tegra_apb_readl() , tegra_apb_writel() T20 only Bug 950116 Change-Id: I75601bebaee14ed2e217a16c0e46fb2910c421c8 Signed-off-by: Prashant Malani Reviewed-on: http://git-master/r/102712 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Laxman Dewangan Reviewed-by: Jon Mayo --- arch/arm/mach-tegra/apbio.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'arch/arm/mach-tegra/apbio.c') diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c index e227331c2f0f..ad280d3b0840 100644 --- a/arch/arm/mach-tegra/apbio.c +++ b/arch/arm/mach-tegra/apbio.c @@ -30,7 +30,7 @@ static DEFINE_MUTEX(tegra_apb_dma_lock); -#ifdef CONFIG_TEGRA_SYSTEM_DMA +#if defined(CONFIG_TEGRA_SYSTEM_DMA) && defined(CONFIG_ARCH_TEGRA_2x_SOC) static struct tegra_dma_channel *tegra_apb_dma; static u32 *tegra_apb_bb; static dma_addr_t tegra_apb_bb_phys; @@ -121,17 +121,6 @@ static inline void apb_writel(u32 value, unsigned long offset) mutex_unlock(&tegra_apb_dma_lock); } -#else -static inline u32 apb_readl(unsigned long offset) -{ - return readl(IO_TO_VIRT(offset)); -} - -static inline void apb_writel(u32 value, unsigned long offset) -{ - writel(value, IO_TO_VIRT(offset)); -} -#endif u32 tegra_apb_readl(unsigned long offset) { @@ -142,10 +131,11 @@ void tegra_apb_writel(u32 value, unsigned long offset) { apb_writel(value, offset); } +#endif static int tegra_init_apb_dma(void) { -#ifdef CONFIG_TEGRA_SYSTEM_DMA +#if defined(CONFIG_TEGRA_SYSTEM_DMA) && defined(CONFIG_ARCH_TEGRA_2x_SOC) tegra_apb_dma = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT | TEGRA_DMA_SHARED, "apbio"); if (!tegra_apb_dma) { -- cgit v1.2.3 From 1ad8d05518658c4cec95652de3bd020057162635 Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Date: Fri, 18 May 2012 16:16:37 +0530 Subject: arm: tegra: apbdmaio: Add dma_sync* calls Add dma_sync* calls to make memory coherent between CPU and Device. Bug 983988 Change-Id: I40c514e01130762a12833c3ab7e0613f984870c6 Signed-off-by: Pradeep Kumar Reviewed-on: http://git-master/r/103336 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Laxman Dewangan GVS: Gerrit_Virtual_Submit --- arch/arm/mach-tegra/apbio.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/arm/mach-tegra/apbio.c') diff --git a/arch/arm/mach-tegra/apbio.c b/arch/arm/mach-tegra/apbio.c index ad280d3b0840..5f3944993804 100644 --- a/arch/arm/mach-tegra/apbio.c +++ b/arch/arm/mach-tegra/apbio.c @@ -68,6 +68,8 @@ static inline u32 apb_readl(unsigned long offset) req.source_wrap = 4; req.req_sel = 0; req.size = 4; + dma_sync_single_for_device(NULL, tegra_apb_bb_phys, + sizeof(u32), DMA_FROM_DEVICE); INIT_COMPLETION(tegra_apb_wait); @@ -81,6 +83,8 @@ static inline u32 apb_readl(unsigned long offset) *(u32 *)tegra_apb_bb = 0; } + dma_sync_single_for_cpu(NULL, tegra_apb_bb_phys, + sizeof(u32), DMA_FROM_DEVICE); mutex_unlock(&tegra_apb_dma_lock); return *((u32 *)tegra_apb_bb); } @@ -97,6 +101,8 @@ static inline void apb_writel(u32 value, unsigned long offset) } mutex_lock(&tegra_apb_dma_lock); + dma_sync_single_for_cpu(NULL, tegra_apb_bb_phys, + sizeof(u32), DMA_TO_DEVICE); *((u32 *)tegra_apb_bb) = value; req.complete = apb_dma_complete; req.to_memory = 0; @@ -111,6 +117,8 @@ static inline void apb_writel(u32 value, unsigned long offset) INIT_COMPLETION(tegra_apb_wait); + dma_sync_single_for_device(NULL, tegra_apb_bb_phys, + sizeof(u32), DMA_TO_DEVICE); tegra_dma_enqueue_req(tegra_apb_dma, &req); ret = wait_for_completion_timeout(&tegra_apb_wait, -- cgit v1.2.3