From patchwork Tue Sep 3 16:44:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russ Dill X-Patchwork-Id: 2853346 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B1B13C0AB5 for ; Tue, 3 Sep 2013 16:44:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1016204EA for ; Tue, 3 Sep 2013 16:44:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C114204FC for ; Tue, 3 Sep 2013 16:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759485Ab3ICQod (ORCPT ); Tue, 3 Sep 2013 12:44:33 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:53538 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757068Ab3ICQoc (ORCPT ); Tue, 3 Sep 2013 12:44:32 -0400 Received: by mail-pb0-f54.google.com with SMTP id ro12so6209212pbb.41 for ; Tue, 03 Sep 2013 09:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pe6AjgYBDfyd9Yk0uxhjp7kT3U0ohsHdxBrYJWbLWv8=; b=Z306fq6lhzZ9U03mFnmrlTGaM9xSvME3Wgz5ZbUpUE6VdVHsihOtpjVy+qbvU2uFam z8VSRL9dPP1Fs+Faa1cPIyAHeKP4nxdVQ8qdG77Vc7ENyJyBz6+MuMsO0FeMJBOXqbzP 6alG+8zQLLPKXWNq6JM6lWch3p+deJOepTE8LGobK4xjz6aaOISP0FUk13lhCReLB3ne xvAZhO7sS1YneBqNo6fLqArUb2nZyZ8enerIKnaz5Fn95K5SJlJU2xH5E0tLAlk0ocnh vjhYQpC6wwNHz4JkbGa10sbHh2hiLTXO0CRH9CNmUpUIk7tm93cyvTh9rrlF6sAMGyM/ SyHA== X-Received: by 10.66.155.102 with SMTP id vv6mr33361666pab.89.1378226672533; Tue, 03 Sep 2013 09:44:32 -0700 (PDT) Received: from localhost (pool-108-13-119-108.lsanca.fios.verizon.net. [108.13.119.108]) by mx.google.com with ESMTPSA id ef10sm25157845pac.1.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Sep 2013 09:44:32 -0700 (PDT) From: Russ Dill To: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org, Philipp Zabel , Shawn Guo , Grant Likely , mans@mansr.com Subject: [RFC 2/4] ARM: SRAM: Add macro for generating SRAM resume trampoline Date: Tue, 3 Sep 2013 09:44:23 -0700 Message-Id: <1378226665-27090-3-git-send-email-Russ.Dill@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1378226665-27090-1-git-send-email-Russ.Dill@ti.com> References: <1378226665-27090-1-git-send-email-Russ.Dill@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a helper that generates a short snippet of code that loads the stack pointer and calls a c (or asm) function. The code gets placed into a SRAM section for loading into SRAM. Signed-off-by: Russ Dill --- arch/arm/include/asm/suspend.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/include/asm/suspend.h b/arch/arm/include/asm/suspend.h index cd20029..d23d004 100644 --- a/arch/arm/include/asm/suspend.h +++ b/arch/arm/include/asm/suspend.h @@ -9,4 +9,18 @@ struct sleep_save_sp { extern void cpu_resume(void); extern int cpu_suspend(unsigned long, int (*)(unsigned long)); +/* + * Generate a SRAM trampoline for resume. + * @proc: SoC, should match argument used with SRAM_SECTIONS(). + * @func: C or asm function to call at resume. + * @stack: Stack to use before calling func. + */ +#define ARM_SRAM_RESUME(proc, func, stack) \ +void __naked __noreturn __sram_##proc proc##_resume_trampoline(void) \ +{ \ + __asm__ __volatile__("mov sp, %0" : : "r"((stack)) : "sp"); \ + func(); \ +} + + #endif