From patchwork Thu Jul 17 15:56:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 4576471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 50C139F26C for ; Thu, 17 Jul 2014 15:59:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6AFE62018E for ; Thu, 17 Jul 2014 15:59:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7DFEE20122 for ; Thu, 17 Jul 2014 15:59:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X7o3q-0001f5-Uz; Thu, 17 Jul 2014 15:57:34 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X7o3h-0001Vh-1p for linux-arm-kernel@lists.infradead.org; Thu, 17 Jul 2014 15:57:25 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8V00B7D5MCVN00@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 17 Jul 2014 16:56:36 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-6b-53c7f2455395 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 6C.E1.19257.542F7C35; Thu, 17 Jul 2014 16:56:53 +0100 (BST) Received: from AMDC1227.digital.local ([106.116.147.199]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N8V008K55MQ6VC0@eusync2.samsung.com>; Thu, 17 Jul 2014 16:56:53 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 1/2] ARM: firmware: Introduce suspend and resume operations Date: Thu, 17 Jul 2014 17:56:10 +0200 Message-id: <1405612571-32598-2-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.9.3 In-reply-to: <1405612571-32598-1-git-send-email-t.figa@samsung.com> References: <1405612571-32598-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCLMWRmVeSWpSXmKPExsVy+t/xK7qun44HGxy7o27x/eEpVou/k46x Wzya/5jZonfBVTaLTY+vsVpc3jWHzWLG+X1MFrcv81qsPXKX3eLU9c9sFjemt7BarJ/xmsVi 1a4/jA68Hi3NPWwev39NYvRY9D3LY+esu+wem5fUe1w50cTq0dv8js2jb8sqRo/Pm+QCOKO4 bFJSczLLUov07RK4Mva//8xWsF+s4vLM1AbGzUJdjJwcEgImEtPnXWCBsMUkLtxbz9bFyMUh JLCUUeLOxm0sEE4fk8StwzsZQarYBNQkPjc8YgOxRQRUJT63LWAHKWIWmMUs8W3OBrCEsICf RHfvdqAGDg4WoKK1M/1AwrwCThJnjy1gg9gmJ9G77Q0ziM0p4Cxx6VYrE4gtBFRz9dQN9gmM vAsYGVYxiqaWJhcUJ6XnGukVJ+YWl+al6yXn525ihITs1x2MS49ZHWIU4GBU4uH9wXU8WIg1 say4MvcQowQHs5IIb/Z9oBBvSmJlVWpRfnxRaU5q8SFGJg5OqQbG6yz7viS6JFh/7Dh5/q02 64ItL1YGBe5wNEmuKlWb8/3j2Q0LPb1qdO05tLn26Jnt2SjO38yxarvlST7Dlz23+LeEyLTP 38T9euuq+I7rxifndi9adbFcliFp5VnGZyHrbgTLdmyZLzqpcq9OUEbKi4D77P94C+bwHymU e1iZfWwaR2z7lmQtJZbijERDLeai4kQAozzCljcCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140717_085725_238197_B3E8BCF5 X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -5.0 (-----) Cc: Kukjin Kim , Russell King - ARM Linux , Arnd Bergmann , Tomasz Figa , linux-kernel@vger.kernel.org, Tomasz Figa , acourbot@nvidia.com, Olof Johansson , swarren@nvidia.com, drake@endlessm.com, linux-arm-kernel@lists.infradead.org, Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch extends the firmware_ops structure with two new callbacks: .suspend() and .resume(). The former is intended to ask the firmware to save all its volatile state and suspend the system, without returning back to the kernel in between. The latter is to be called early by very low level platform suspend code after waking up to restore low level hardware state, which can't be restored in non-secure mode. While at it, outdated version of the structure is removed from the documentation and replaced with a reference to the header file. Signed-off-by: Tomasz Figa Acked-by: Alexandre Courbot --- Documentation/arm/firmware.txt | 28 +++++----------------------- arch/arm/include/asm/firmware.h | 8 ++++++++ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/Documentation/arm/firmware.txt b/Documentation/arm/firmware.txt index c2e468f..da6713a 100644 --- a/Documentation/arm/firmware.txt +++ b/Documentation/arm/firmware.txt @@ -7,32 +7,14 @@ world, which changes the way some things have to be initialized. This makes a need to provide an interface for such platforms to specify available firmware operations and call them when needed. -Firmware operations can be specified using struct firmware_ops - - struct firmware_ops { - /* - * Enters CPU idle mode - */ - int (*do_idle)(void); - /* - * Sets boot address of specified physical CPU - */ - int (*set_cpu_boot_addr)(int cpu, unsigned long boot_addr); - /* - * Boots specified physical CPU - */ - int (*cpu_boot)(int cpu); - /* - * Initializes L2 cache - */ - int (*l2x0_init)(void); - }; - -and then registered with register_firmware_ops function +Firmware operations can be specified by filling in a struct firmware_ops +with appropriate callbacks and then registering it with register_firmware_ops() +function. void register_firmware_ops(const struct firmware_ops *ops) -the ops pointer must be non-NULL. +The ops pointer must be non-NULL. More information about struct firmware_ops +and its members can be found in arch/arm/include/asm/firmware.h header. There is a default, empty set of operations provided, so there is no need to set anything if platform does not require firmware operations. diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h index 2c9f10d..5904f59 100644 --- a/arch/arm/include/asm/firmware.h +++ b/arch/arm/include/asm/firmware.h @@ -41,6 +41,14 @@ struct firmware_ops { * Initializes L2 cache */ int (*l2x0_init)(void); + /* + * Enter system-wide suspend. + */ + int (*suspend)(void); + /* + * Restore state of privileged hardware after system-wide suspend. + */ + int (*resume)(void); }; /* Global pointer for current firmware_ops structure, can't be NULL. */