From patchwork Thu Feb 14 11:24:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 10812495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 456C71399 for ; Thu, 14 Feb 2019 11:24:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32D2D2D860 for ; Thu, 14 Feb 2019 11:24:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26EC52D8AF; Thu, 14 Feb 2019 11:24:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0F992D89F for ; Thu, 14 Feb 2019 11:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389976AbfBNLYL (ORCPT ); Thu, 14 Feb 2019 06:24:11 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:62836 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389603AbfBNLYK (ORCPT ); Thu, 14 Feb 2019 06:24:10 -0500 X-IronPort-AV: E=Sophos;i="5.58,368,1544511600"; d="scan'208";a="26269337" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Feb 2019 04:24:09 -0700 Received: from NAM05-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.76.105) with Microsoft SMTP Server (TLS) id 14.3.352.0; Thu, 14 Feb 2019 04:24:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector1-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Td+MnSdr7EaUVSktSV1JUfvVbhtyqhDSiopXPUuFB68=; b=iPDScGTcrI2FHS/B4awgc/kt1630d/KrajqfPHl04OHFxaWYU0zGyDpBMzqRFULT05vEB/k2e6BwT17DHGbUi6YVRSOr3QOsk+uVtVCQ58U9Ovq/qUGHsSrAaWIBfCnHPOQLcODkROqcuJfZ87NxFMkwKovQJMZ+2cjcDmY42wM= Received: from MWHPR11MB1920.namprd11.prod.outlook.com (10.175.54.19) by MWHPR11MB1661.namprd11.prod.outlook.com (10.172.55.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.24; Thu, 14 Feb 2019 11:24:07 +0000 Received: from MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::d917:8496:9d53:1f55]) by MWHPR11MB1920.namprd11.prod.outlook.com ([fe80::d917:8496:9d53:1f55%9]) with mapi id 15.20.1622.016; Thu, 14 Feb 2019 11:24:07 +0000 From: To: , , , , , CC: , , , , Subject: [PATCH 1/3] power: reset: at91-poweroff: add RTT wakeup capability Thread-Topic: [PATCH 1/3] power: reset: at91-poweroff: add RTT wakeup capability Thread-Index: AQHUxFfM+pYGXoQlZ0u8Bc2PaN4VYg== Date: Thu, 14 Feb 2019 11:24:07 +0000 Message-ID: <1550143407-26109-2-git-send-email-claudiu.beznea@microchip.com> References: <1550143407-26109-1-git-send-email-claudiu.beznea@microchip.com> In-Reply-To: <1550143407-26109-1-git-send-email-claudiu.beznea@microchip.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0102CA0104.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::45) To MWHPR11MB1920.namprd11.prod.outlook.com (2603:10b6:300:110::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Claudiu.Beznea@microchip.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-originating-ip: [213.233.85.122] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0a23d251-2e34-4513-2d9d-08d6926eee8d x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600110)(711020)(4605077)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:MWHPR11MB1661; x-ms-traffictypediagnostic: MWHPR11MB1661: x-microsoft-exchange-diagnostics: =?iso-8859-1?q?1=3BMWHPR11MB1661=3B23=3A4y?= =?iso-8859-1?q?I689/pdumiUOE0YzzMEIjdfu05KIbyCg537CheGRY0FacJsGQpjfOlgn3WC7?= =?iso-8859-1?q?oTJAUtBkMTa84psiq0jDaa575wfVUJlhZVo8a8xUAXY+ckYA4pYSDjcDL8n2?= =?iso-8859-1?q?UuuFOsWXVpmAGJBynv5FMb+SyCVlJLXd2zDaqcl26PAGdwK7uotNAhqQZc1+?= =?iso-8859-1?q?rcQdfHoq/UBHGckFz3TdJtWGlIong6bAxfyH4WMgc10OHxOyC8jDI74f+EzJ?= =?iso-8859-1?q?E+lvWiOmOMnj7PJk9YO892E9Dnd6/sk/+Ut+7J4whUKZo0W9/EtlrBaB8WmE?= =?iso-8859-1?q?cSOhfnaMctu4tFJ1Z7jBjLVeWSh2fxyLIw/7n26RDtk+MRwp9OA9B7DyTAKy?= =?iso-8859-1?q?AgzFEm58HgUjaemj72iFcBk3CMvObCfSFu6eC5pl3W0wYrDPIRtsuRpYSCym?= =?iso-8859-1?q?+perCgQ86fkzG4cdvPZ0uZ+E/WE3ZQhc4bXe68L6qT6TR6kx29YPV8gZVOb4?= =?iso-8859-1?q?dL6p0QipJvjj4lwFgFjttrzeHQE3lJrswRVKoC5vzFvS3QktQYcQ0T5El4mj?= =?iso-8859-1?q?HPsz8EfZ9m4kWyKcIraqXlVt9JkC3UEd7bOZYDYjcxuLdu7imi/NVOBnV2zQ?= =?iso-8859-1?q?O1Id8WJPO0x6rwOw1zA6kOk6XQC0DKTugTUlaN6EuqZJ2frpkKuTB42UFpvk?= =?iso-8859-1?q?5Dsjn238cWPpG6vcnuaSrxKadef1y72OXPXbyiRlaPSP/ZZxWz7bkjy2RViP?= =?iso-8859-1?q?SRoyeT7TWjBasDLu9rPGezwK8de5SO4Ox4jLCkmuIf5FdtocDBn8wDydQcqj?= =?iso-8859-1?q?TSKbr74nF34/vkw40XsDlGoqgyXs1YZazO6wl+MpYDcBpV2DdyrFm62bb1xR?= =?iso-8859-1?q?urQ6ImM7Uul6YaxSQSiaTmsI9MpFtpmFy1PpsNqh++MSkA+l9r+420lgKPhw?= =?iso-8859-1?q?qZ9s2T/YWIWuTix4Cf8L+qcgkRLketLQYdUVQ58dGBcM7LxrSg174VqUYTmX?= =?iso-8859-1?q?l5S41SKtpwIQVvZHVoyJW+tVfqmIw6E+DgEnIQ3gBXUV4HchhxCOK4aIfO8K?= =?iso-8859-1?q?NGhyvsO7sXd5Kxt28h1UN2p9lDQQJrYsYyXb+NrMSlnhzGbBxS6SMjtaENoJ?= =?iso-8859-1?q?Z5Y+cSb/ApklSXFObaIy3oBuRQ7G98h6z1VUmlkwiKgyOUths6bP8NkwncuR?= =?iso-8859-1?q?eMHNADAA27d5WK/Kkc6c1sIeVRaYsSfpJFvNO2FKKK9EBGj3apyYSHsPbTeU?= =?iso-8859-1?q?mtOlqIP6vPBbPpNQSFaMcsb7BvC7ztt1chmg=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09480768F8 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(376002)(136003)(346002)(396003)(39860400002)(199004)(189003)(68736007)(446003)(54906003)(386003)(105586002)(6506007)(106356001)(486006)(71190400001)(99286004)(71200400001)(478600001)(76176011)(36756003)(11346002)(72206003)(6436002)(110136005)(107886003)(2616005)(476003)(4326008)(97736004)(86362001)(316002)(6512007)(53936002)(2906002)(2501003)(256004)(6486002)(305945005)(186003)(81156014)(50226002)(81166006)(66066001)(7736002)(8936002)(102836004)(52116002)(14454004)(3846002)(26005)(25786009)(6116002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR11MB1661;H:MWHPR11MB1920.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microchip.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: wIhA3CQWxDBiMG4dPgsNwDGpmJcbeE5SMXjzQ/0vgUmhhjdf/7mSN9BNCElBH8ybV/j0m6b3lw9BIS5FNrJ3ygBSgr2lJoDakhDkiVMCCm5T7uWS7MQ+I8HP/3jk3dFsvAc/fPRVO3/y7y3hrwhA48z0EgR9q9vS8itgb8JHjGqSr/tlx3VarPkbhlXt3jMqbNbxxVvQxgbP5YX7fXU+AH4wCrYT/Qgv/kyWO/yLmrNmYiH4qwcAo2UvD++sy3t7j3heV9z3rP965+qV7i7kh9B2teNLF/ZF6bJlZQep93vjOmG++vSPIIZ8mCm0t0vNdrEY1wxJbJe1XCA8896LIkcaFHDaiWCkiligc1c/4DfzQWHErbfDGEM6uDfhE3GTKqLRKPmd1CUI27VVU3/SBZTIJYO3T9wVtKJp7vqH2lE= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0a23d251-2e34-4513-2d9d-08d6926eee8d X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Feb 2019 11:24:01.2347 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1661 X-OriginatorOrg: microchip.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Claudiu Beznea Add RTT wakeup capability. Signed-off-by: Claudiu Beznea Acked-by: Nicolas Ferre --- drivers/power/reset/at91-sama5d2_shdwc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index 2b686c55b717..0747e0cdf350 100644 --- a/drivers/power/reset/at91-sama5d2_shdwc.c +++ b/drivers/power/reset/at91-sama5d2_shdwc.c @@ -57,15 +57,21 @@ #define SHDW_WK_PIN(reg, cfg) ((reg) & AT91_SHDW_WKUPIS((cfg)->wkup_pin_input)) #define SHDW_RTCWK(reg, cfg) (((reg) >> ((cfg)->sr_rtcwk_shift)) & 0x1) +#define SHDW_RTTWK(reg, cfg) (((reg) >> ((cfg)->sr_rttwk_shift)) & 0x1) #define SHDW_RTCWKEN(cfg) (1 << ((cfg)->mr_rtcwk_shift)) +#define SHDW_RTTWKEN(cfg) (1 << ((cfg)->mr_rttwk_shift)) #define DBC_PERIOD_US(x) DIV_ROUND_UP_ULL((1000000 * (x)), \ SLOW_CLOCK_FREQ) +#define SHDW_CFG_NOT_USED (32) + struct shdwc_config { u8 wkup_pin_input; u8 mr_rtcwk_shift; + u8 mr_rttwk_shift; u8 sr_rtcwk_shift; + u8 sr_rttwk_shift; }; struct shdwc { @@ -104,6 +110,8 @@ static void __init at91_wakeup_status(struct platform_device *pdev) reason = "WKUP pin"; else if (SHDW_RTCWK(reg, shdw->cfg)) reason = "RTC"; + else if (SHDW_RTTWK(reg, shdw->cfg)) + reason = "RTT"; pr_info("AT91: Wake-Up source: %s\n", reason); } @@ -221,6 +229,9 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev) if (of_property_read_bool(np, "atmel,wakeup-rtc-timer")) mode |= SHDW_RTCWKEN(shdw->cfg); + if (of_property_read_bool(np, "atmel,wakeup-rtt-timer")) + mode |= SHDW_RTTWKEN(shdw->cfg); + dev_dbg(&pdev->dev, "%s: mode = %#x\n", __func__, mode); writel(mode, shdw->shdwc_base + AT91_SHDW_MR); @@ -231,7 +242,10 @@ static void at91_shdwc_dt_configure(struct platform_device *pdev) static const struct shdwc_config sama5d2_shdwc_config = { .wkup_pin_input = 0, .mr_rtcwk_shift = 17, + .mr_rttwk_shift = SHDW_CFG_NOT_USED, .sr_rtcwk_shift = 5, + .sr_rttwk_shift = SHDW_CFG_NOT_USED, +}; }; static const struct of_device_id at91_shdwc_of_match[] = {