From patchwork Thu Feb 18 00:02:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 80139 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1I0AdYr013523 for ; Thu, 18 Feb 2010 00:10:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757994Ab0BRAK6 (ORCPT ); Wed, 17 Feb 2010 19:10:58 -0500 Received: from mail-yx0-f180.google.com ([209.85.210.180]:46192 "EHLO mail-yx0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757925Ab0BRAK5 (ORCPT ); Wed, 17 Feb 2010 19:10:57 -0500 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 18 Feb 2010 00:10:58 +0000 (UTC) X-Greylist: delayed 476 seconds by postgrey-1.27 at vger.kernel.org; Wed, 17 Feb 2010 19:10:37 EST Received: by mail-yx0-f180.google.com with SMTP id 10so535476yxe.33 for ; Wed, 17 Feb 2010 16:10:57 -0800 (PST) Received: by 10.101.148.5 with SMTP id a5mr7900895ano.190.1266451365960; Wed, 17 Feb 2010 16:02:45 -0800 (PST) Received: from localhost (c-24-118-212-219.hsd1.mn.comcast.net [24.118.212.219]) by mx.google.com with ESMTPS id 23sm2803648iwn.3.2010.02.17.16.02.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 17 Feb 2010 16:02:45 -0800 (PST) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Rajendra Nayak Subject: [PATCH 6/7] OMAP3: PM: add scratchpad locking function Date: Wed, 17 Feb 2010 18:02:29 -0600 Message-Id: <1266451350-4480-7-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.6 In-Reply-To: <1266451350-4480-1-git-send-email-khilman@deeprootsystems.com> References: <1266451350-4480-1-git-send-email-khilman@deeprootsystems.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index 22fcc14..12a8ba0 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S @@ -33,6 +33,8 @@ #include "prm.h" #include "sdrc.h" +#define SDRC_SCRATCHPAD_SEM_V 0xfa00291c + #define PM_PREPWSTST_CORE_V OMAP34XX_PRM_REGADDR(CORE_MOD, \ OMAP3430_PM_PREPWSTST) #define PM_PREPWSTST_CORE_P 0x48306AE8 @@ -57,6 +59,37 @@ #define SDRC_DLLA_STATUS_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_STATUS) #define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL) + .text +/* Function to aquire the semaphore in scratchpad */ +ENTRY(lock_scratchpad_sem) + stmfd sp!, {lr} @ save registers on stack +wait_sem: + mov r0,#1 + ldr r1, sdrc_scratchpad_sem +wait_loop: + ldr r2, [r1] @ load the lock value + cmp r2, r0 @ is the lock free ? + beq wait_loop @ not free... + swp r2, r0, [r1] @ semaphore free so lock it and proceed + cmp r2, r0 @ did we succeed ? + beq wait_sem @ no - try again + ldmfd sp!, {pc} @ restore regs and return +sdrc_scratchpad_sem: + .word SDRC_SCRATCHPAD_SEM_V +ENTRY(lock_scratchpad_sem_sz) + .word . - lock_scratchpad_sem + + .text +/* Function to release the scratchpad semaphore */ +ENTRY(unlock_scratchpad_sem) + stmfd sp!, {lr} @ save registers on stack + ldr r3, sdrc_scratchpad_sem + mov r2,#0 + str r2,[r3] + ldmfd sp!, {pc} @ restore regs and return +ENTRY(unlock_scratchpad_sem_sz) + .word . - unlock_scratchpad_sem + .text /* Function call to get the restore pointer for resume from OFF */ ENTRY(get_restore_pointer)