From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gregory CLEMENT Subject: [PATCH v3 06/14] ARM: mvebu: Low level functions to disable cache snooping Date: Mon, 14 Oct 2013 15:58:18 +0200 Message-ID: <1381759106-15004-7-git-send-email-gregory.clement@free-electrons.com> References: <1381759106-15004-1-git-send-email-gregory.clement@free-electrons.com> Return-path: Received: from top.free-electrons.com ([176.31.233.9]:60802 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756536Ab3JNN6t (ORCPT ); Mon, 14 Oct 2013 09:58:49 -0400 In-Reply-To: <1381759106-15004-1-git-send-email-gregory.clement@free-electrons.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Daniel Lezcano , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, lorenzo.pieralisi@arm.com, Jason Cooper , Andrew Lunn , Gregory CLEMENT Cc: Thomas Petazzoni , Ezequiel Garcia , Sebastian Hesselbarth , linux-arm-kernel@lists.infradead.org, Nicolas Pitre , Lior Amsalem , Maen Suleiman , Tawfik Bayouk , Shadi Ammouri , Eran Ben-Avi , Yehuda Yitschak , Nadav Haklai , Ike Pan , Dan Frazier , Leif Lindholm , Jon Masters , David Marlin When going to deep idle we need to disable the SoC snooping by "hand". Playing with the coherency fabric requires to use assembly code to be sure that the compiler doesn't reorder the instructions nor do wrong optimization. This function will be called by the low level (in assembly) part of the CPU idle functions. Signed-off-by: Gregory CLEMENT --- arch/arm/mach-mvebu/coherency_ll.S | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/coherency_ll.S b/arch/arm/mach-mvebu/coherency_ll.S index 1526b94..3fb426e 100644 --- a/arch/arm/mach-mvebu/coherency_ll.S +++ b/arch/arm/mach-mvebu/coherency_ll.S @@ -73,6 +73,28 @@ ENTRY(ll_set_cpu_coherent) mov pc, lr ENDPROC(ll_set_cpu_coherent) +/* + * r0: if r0==0 => physical addres, else virtual address + */ +ENTRY(armada_370_xp_disable_snoop_ena) + ldr r0, =(coherency_base) + ldr r0, [r0] + /* Enable SnoopEna - Exclusive */ + mrc 15, 0, r1, cr0, cr0, 5 + and r1, r1, #15 + mov r2, #(1 << 24) + lsl r2, r2, r1 + +1: + ldrex r1, [r0] + bic r1, r1, r2 + strex r3, r1, [r0] + cmp r3, #0 + bne 1b + + mov pc, lr +ENDPROC(armada_370_xp_disable_snoop_ena) + .align 2 3: - .long coherency_phys_base - . + .long coherency_phys_base - . -- 1.8.1.2