Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933139AbcDLMtA (ORCPT ); Tue, 12 Apr 2016 08:49:00 -0400 Received: from mail-bl2nam02on0069.outbound.protection.outlook.com ([104.47.38.69]:48858 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932523AbcDLMs7 (ORCPT ); Tue, 12 Apr 2016 08:48:59 -0400 X-Greylist: delayed 1116 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Apr 2016 08:48:59 EDT Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Anurag Kumar Vulisha To: Alessandro Zummo , Alexandre Belloni , CC: Michal Simek , , , , Punnaiah Choudary Kalluri , Anirudha Sarangi , Srikanth Vemula , "Anurag Kumar Vulisha" Subject: [PATCH 1/3] RTC: Enable RTC switching to battery power when VCC_PSAUX is N/A Date: Tue, 12 Apr 2016 17:45:44 +0530 Message-ID: <1460463346-24923-1-git-send-email-anuragku@xilinx.com> X-Mailer: git-send-email 2.1.2 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22254.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(81166005)(2906002)(11100500001)(586003)(1096002)(36756003)(4001430100002)(52956003)(19580395003)(6806005)(19580405001)(63266004)(107886002)(50986999)(42186005)(106466001)(189998001)(1220700001)(36386004)(50466002)(33646002)(5001770100001)(5003940100001)(4326007)(103686003)(4001450100002)(46386002)(47776003)(50226001)(229853001)(48376002)(87936001)(92566002)(5008740100001)(90966002)(86362001)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2NAM02HT211;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3b8b590f-2f6f-4cee-9606-08d362cc3345 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501002);SRVR:BL2NAM02HT211; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(13018025)(13024025)(13017025)(13015025)(13023025)(3002001)(10201501046);SRVR:BL2NAM02HT211;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT211; X-Forefront-PRVS: 0910AAF391 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2016 12:15:56.0545 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT211 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1405 Lines: 42 In order to conserve battery energy, during the PS operation, it is expected that the supply for the battery-powered domain to be switched from the battery (VCC_PSBATT) to (VCC_PSAUX) and automatically be switched back to battery when VCC_PSAUX voltage drops below a limit, doing so prevents the logic within the battery-powered domain from functioning incorrectly. This patch enables that feature. Signed-off-by: Anurag Kumar Vulisha --- drivers/rtc/rtc-zynqmp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index 8b28762..6adb603 100644 --- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c @@ -45,6 +45,7 @@ #define RTC_INT_SEC BIT(0) #define RTC_INT_ALRM BIT(1) #define RTC_OSC_EN BIT(24) +#define RTC_BATT_EN BIT(31) #define RTC_CALIB_DEF 0x198233 #define RTC_CALIB_MASK 0x1FFFFF @@ -122,6 +123,13 @@ static int xlnx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) static void xlnx_init_rtc(struct xlnx_rtc_dev *xrtcdev, u32 calibval) { + u32 rtc_ctrl; + + /* Enable RTC switch to battery when VCC_PSAUX is not available */ + rtc_ctrl = readl(xrtcdev->reg_base + RTC_CTRL); + rtc_ctrl |= RTC_BATT_EN; + writel(rtc_ctrl, xrtcdev->reg_base + RTC_CTRL); + /* * Based on crystal freq of 33.330 KHz * set the seconds counter and enable, set fractions counter -- 2.1.2