From patchwork Fri Aug 12 08:30:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 3427 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 24D3823F41 for ; Fri, 12 Aug 2011 08:51:12 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id E79C2A18769 for ; Fri, 12 Aug 2011 08:51:11 +0000 (UTC) Received: by mail-qy0-f173.google.com with SMTP id 31so257333qyk.11 for ; Fri, 12 Aug 2011 01:51:11 -0700 (PDT) Received: by 10.224.209.195 with SMTP id gh3mr400211qab.134.1313139071701; Fri, 12 Aug 2011 01:51:11 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.190.71 with SMTP id dh7cs141996qcb; Fri, 12 Aug 2011 01:51:11 -0700 (PDT) Received: from mr.google.com ([10.14.188.139]) by 10.14.188.139 with SMTP id a11mr191777een.16.1313139071362 (num_hops = 1); Fri, 12 Aug 2011 01:51:11 -0700 (PDT) Received: by 10.14.188.139 with SMTP id a11mr142376een.16.1313139070846; Fri, 12 Aug 2011 01:51:10 -0700 (PDT) Received: from eu1sys200aog117.obsmtp.com (eu1sys200aog117.obsmtp.com [207.126.144.143]) by mx.google.com with SMTP id c58si2023291eeb.51.2011.08.12.01.51.07 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Aug 2011 01:51:10 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.143; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.143 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKTkTpeygpPZH2yS4ufoqSvcKZy+JCeKDw@postini.com; Fri, 12 Aug 2011 08:51:10 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D20E4306; Fri, 12 Aug 2011 08:33:00 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id C38CE1EE4; Fri, 12 Aug 2011 08:30:13 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id C36EEA8081; Fri, 12 Aug 2011 10:30:09 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 12 Aug 2011 10:30:13 +0200 From: Linus Walleij To: Samuel Ortiz , Cc: Lee Jones , Pawel Szyszuk , Linus Walleij Subject: [PATCH 19/23] mfd/db5500-prcmu: implement reset and cause Date: Fri, 12 Aug 2011 10:30:10 +0200 Message-ID: <1313137810-31213-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 From: Pawel Szyszuk This implements the reset accessor function so that the DB5500 PRCMU can reset the system, and the corresponding accessor to retrieve the cause of reset after a restart. Signed-off-by: Pawel Szyszuk Signed-off-by: Linus Walleij --- drivers/mfd/db5500-prcmu.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/mfd/db5500-prcmu.c b/drivers/mfd/db5500-prcmu.c index 35a7a0c..60bfda2 100644 --- a/drivers/mfd/db5500-prcmu.c +++ b/drivers/mfd/db5500-prcmu.c @@ -27,6 +27,8 @@ #include #include "dbx500-prcmu-regs.h" +#define PRCM_SW_RST_REASON (tcdm_base + 0xFF8) /* 2 bytes */ + #define _PRCM_MB_HEADER (tcdm_base + 0xFE8) #define PRCM_REQ_MB0_HEADER (_PRCM_MB_HEADER + 0x0) #define PRCM_REQ_MB1_HEADER (_PRCM_MB_HEADER + 0x1) @@ -957,6 +959,29 @@ int db5500_prcmu_set_display_clocks(void) return 0; } +/** + * db5500_prcmu_system_reset - System reset + * + * Saves the reset reason code and then sets the APE_SOFTRST register which + * fires an interrupt to fw + */ +void db5500_prcmu_system_reset(u16 reset_code) +{ + writew(reset_code, PRCM_SW_RST_REASON); + writel(1, PRCM_APE_SOFTRST); +} + +/** + * db5500_prcmu_get_reset_code - Retrieve SW reset reason code + * + * Retrieves the reset reason code stored by prcmu_system_reset() before + * last restart. + */ +u16 db5500_prcmu_get_reset_code(void) +{ + return readw(PRCM_SW_RST_REASON); +} + static void ack_dbb_wakeup(void) { unsigned long flags;