From patchwork Mon Jan 8 22:10:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jolly Shah X-Patchwork-Id: 10150701 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51FE3601BE for ; Mon, 8 Jan 2018 22:22:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44F1E2851D for ; Mon, 8 Jan 2018 22:22:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 397AC287D3; Mon, 8 Jan 2018 22:22:46 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 900F92851D for ; Mon, 8 Jan 2018 22:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=C16qIbE2KxU5bFM8rNE/pNyrAvQlXJ+DMZt1K6hBlXk=; b=FelSHC/yWf1Oos zk+TfAVBaSjb9MVZq90SoYKddD0bpQXoE8yhLMGKl3atGn1jeVEGdxFhM6B+yIZcixuwMi/DZAVHr wnC8VfVm9Lh7Rdrjpd9VQr+yjJZNapI82NM5uyaiyAYfSOkd4PRJxOWfdJ+ltfQdu20zufeOXpYlL +6xJicqBW9ZUAnnj72VnfkL8OMNyAAFQVS3S/JW7WL7iJaX68uNW0G5HLcB6plYbNnJuFGc6L5A/n HibrTbqmKbXuT6zP7Gy56MXcOzXuhkvS1e2d1jpnJqmBY94Kqbx0BkevJYS2+UrfSM3Ytt9Y2ijnN yTrpFeUoxbiNB2G2q0Vw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYfdm-0004TZ-Ct; Mon, 08 Jan 2018 22:11:34 +0000 Received: from mail-by2nam03on0071.outbound.protection.outlook.com ([104.47.42.71] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYfdh-0004Qr-V8 for linux-arm-kernel@lists.infradead.org; Mon, 08 Jan 2018 22:11:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=61oW1ma0jYDchx0jMjMFDQbE83j12ZuXZC62FKOgsjU=; b=oYBbTRUcn75u3+j5QUrbIvHthnEr9eH6nYHG3nKr1QYg1A9xv2nCfMyADGPeUWXV71R4fM3tmqpZWzWutYWK52m2yw1+qviuwl3ki4bezMO9kn4Z9mX/mQj5Ppu+2g7m4QvwftU0EH55uNYcdPaYSBOtGrKsAGkgAccrq5mz130= Received: from SN4PR0201CA0054.namprd02.prod.outlook.com (10.171.31.144) by MWHPR02MB3390.namprd02.prod.outlook.com (10.164.187.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Mon, 8 Jan 2018 22:11:14 +0000 Received: from BL2NAM02FT041.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::206) by SN4PR0201CA0054.outlook.office365.com (2603:10b6:803:20::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Mon, 8 Jan 2018 22:11:14 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT041.mail.protection.outlook.com (10.152.77.122) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 8 Jan 2018 22:11:13 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1eYfdR-0000WA-3M; Mon, 08 Jan 2018 14:11:13 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eYfdR-0004V3-0g; Mon, 08 Jan 2018 14:11:13 -0800 Received: from [172.19.2.91] (helo=xsjjollys50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eYfdQ-0004Uu-Kd; Mon, 08 Jan 2018 14:11:12 -0800 From: Jolly Shah To: , , , , , , , Subject: [RFC PATCH] drivers: soc: xilinx: Add ZynqMP PM driver Date: Mon, 8 Jan 2018 14:10:44 -0800 Message-ID: <1515449444-5274-1-git-send-email-jollys@xilinx.com> X-Mailer: git-send-email 2.7.4 X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23582.004 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(39380400002)(376002)(346002)(2980300002)(438002)(199004)(189003)(50226002)(50466002)(48376002)(356003)(110136005)(9786002)(8936002)(54906003)(77096006)(16586007)(8676002)(63266004)(47776003)(316002)(107886003)(4326008)(6636002)(81166006)(36756003)(5660300001)(2906002)(6666003)(59450400001)(39060400002)(106466001)(72206003)(7696005)(2201001)(106002)(478600001)(81156014)(305945005)(36386004)(51416003)(107986001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB3390; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT041; 1:b328g9W8enFVNao5uNPAzYahwWZp18hBAqXRMJMTEvHmBsa5RYDA/IIfLWA98pf934jyBuPXvCEKOPcMDKR917NO7owFGHZ1OhaBvt0ol4IcEplYMkp6y6pCdSrBMB3H MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a45809f9-6f07-49fb-5cfb-08d556e4bb81 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:MWHPR02MB3390; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3390; 3:VieVKcdJQC3epkRDYRGhVoksy0jM/UY/HOD8+pzbhzP734IL7oFrPKQasutThYlHVs4vGE9QlaQsZNJV8L8Dog9w+R9ApEu2wvs0vBwuxYmeaeD1xT7CNoJUsgkDyathqHnL4V6Tv8AUVw0ezns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oUoXMqpjZrI2IWg5NzYAxEsO/VGZOUTGMg9MGo/kHueBJx4+rWRabZJLzLNl5ZpigaNELXMtDP/Cj6KQ2vFRmTQ+uAIMmUdiRUukoer+3udTCd10xmZeY2GzXzbYZwDFTzEEuOzNey2CWvqlRpElyXBjtWy/4cTwXmhilfO+X5/zDsABP4fEt7b5R9VKjrY2lyDlKYgL7oKbw0f4ZzO+HUjxDPQqJ66UPXStbmczRezfEl5Uru3XKHIphbLe5DdrVtrIzRY191QtRWxjwVz0iveFZOXTp8bnulIQ/7IVUUTVpM X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93004095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR02MB3390; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR02MB3390; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB3390; 4:ncBIz49zNM/szc1mNAskmA6qTpp5CZQRMrJZpouGFdXjuDBBzieBYtOuObJ5e8s/jVr7v6br+Cu8BmVINWJw0p3f+XZOv5xpg6jdCX7mMxmVUmjH+n3Ddy4/4VR2IIcetw0wexAKIZfLU8cnfy+s8AXugN5C9ibYcyocIzBwNnIq6PLgzL4IMbYBqq6Q1Lf+lsC5kCMG7VCtTKOpHzTY6kYsL+++9s8oMJugVJxuxNv9FVaXVYyOaeNzwAjmG24z5odGLgx+GZYsnSS/gny3YPmeP/UiRAtaWcKa8wSzni5NBjtup6O6zfAheDHI5O3a X-Forefront-PRVS: 054642504A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR02MB3390; 23:v5/FtpEoJCsKuQ5f9+ew9ew9XKJV9zqZ9KVYGx+2C?=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QzmBm2R3GSpf3JTgGraZZ4NtwuSK5yYEG44GO7S4ROyYagA6SjxCqg9jBW1IR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2018 22:11:13.7861 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a45809f9-6f07-49fb-5cfb-08d556e4bb81 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.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3390 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180108_141130_013812_ED4116AD X-CRM114-Status: GOOD ( 13.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jolly Shah , Rajan Vaja , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add ZynqMP PM driver. PM driver provides power management support for ZynqMP. Signed-off-by: Jolly Shah Signed-off-by: Rajan Vaja --- .../bindings/soc/xilinx/xlnx,zynqmp-pm.txt | 15 ++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/xilinx/Kconfig | 4 + drivers/soc/xilinx/Makefile | 4 + drivers/soc/xilinx/zynqmp/Kconfig | 15 ++ drivers/soc/xilinx/zynqmp/Makefile | 1 + drivers/soc/xilinx/zynqmp/pm.c | 265 +++++++++++++++++++++ 8 files changed, 306 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/xilinx/xlnx,zynqmp-pm.txt create mode 100644 drivers/soc/xilinx/Kconfig create mode 100644 drivers/soc/xilinx/Makefile create mode 100644 drivers/soc/xilinx/zynqmp/Kconfig create mode 100644 drivers/soc/xilinx/zynqmp/Makefile create mode 100644 drivers/soc/xilinx/zynqmp/pm.c diff --git a/Documentation/devicetree/bindings/soc/xilinx/xlnx,zynqmp-pm.txt b/Documentation/devicetree/bindings/soc/xilinx/xlnx,zynqmp-pm.txt new file mode 100644 index 0000000..9cfb40d --- /dev/null +++ b/Documentation/devicetree/bindings/soc/xilinx/xlnx,zynqmp-pm.txt @@ -0,0 +1,15 @@ +Xilinx Zynq MPSoC Power Management Device Tree Bindings + +The zynqmp-pm node describes the power management configurations. + +Required properties: + - compatible : Must contain: "xlnx,zynqmp-pm" + - interrupt-parent : Interrupt controller the interrupt is routed through + - interrupts : Interrupt specifier + +Examples: + zynqmp-firmware { + compatible = "xlnx,zynqmp-pm"; + interrupt-parent = <&gic>; + interrupts = <0 35 4>; + }; diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index fc9e980..c07b4a8 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -16,6 +16,7 @@ source "drivers/soc/tegra/Kconfig" source "drivers/soc/ti/Kconfig" source "drivers/soc/ux500/Kconfig" source "drivers/soc/versatile/Kconfig" +source "drivers/soc/xilinx/Kconfig" source "drivers/soc/zte/Kconfig" endmenu diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index deecb16..abb019a 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ +obj-$(CONFIG_ARCH_ZYNQMP) += xilinx/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_ARCH_U8500) += ux500/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ diff --git a/drivers/soc/xilinx/Kconfig b/drivers/soc/xilinx/Kconfig new file mode 100644 index 0000000..190add7 --- /dev/null +++ b/drivers/soc/xilinx/Kconfig @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Kconfig for Xilinx SoCs + +source "drivers/soc/xilinx/zynqmp/Kconfig" diff --git a/drivers/soc/xilinx/Makefile b/drivers/soc/xilinx/Makefile new file mode 100644 index 0000000..bc9d560 --- /dev/null +++ b/drivers/soc/xilinx/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Makefile for Xilinx SoCs + +obj-$(CONFIG_ARCH_ZYNQMP) += zynqmp/ diff --git a/drivers/soc/xilinx/zynqmp/Kconfig b/drivers/soc/xilinx/zynqmp/Kconfig new file mode 100644 index 0000000..d3c784d --- /dev/null +++ b/drivers/soc/xilinx/zynqmp/Kconfig @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Kconfig for Xilinx zynqmp SoC +# +menu "Zynq MPSoC SoC Drivers" + depends on ARCH_ZYNQMP + + +config ZYNQMP_PM + bool "Enable Xilinx Zynq MPSoC Power Management" + depends on PM + help + Say yes to enable power management support for + ZyqnMP SoC. In doubt, say N. + +endmenu diff --git a/drivers/soc/xilinx/zynqmp/Makefile b/drivers/soc/xilinx/zynqmp/Makefile new file mode 100644 index 0000000..98034f7 --- /dev/null +++ b/drivers/soc/xilinx/zynqmp/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ZYNQMP_PM) += pm.o diff --git a/drivers/soc/xilinx/zynqmp/pm.c b/drivers/soc/xilinx/zynqmp/pm.c new file mode 100644 index 0000000..7178fb5 --- /dev/null +++ b/drivers/soc/xilinx/zynqmp/pm.c @@ -0,0 +1,265 @@ +/* + * Xilinx Zynq MPSoC Power Management + * + * Copyright (C) 2014-2017 Xilinx, Inc. + * + * Davorin Mista + * Jolly Shah + * Rajan Vaja + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "zynqmp_pm" + +/** + * struct zynqmp_pm_work_struct - Wrapper for struct work_struct + * @callback_work: Work structure + * @args: Callback arguments + */ +struct zynqmp_pm_work_struct { + struct work_struct callback_work; + u32 args[CB_ARG_CNT]; +}; + +static struct zynqmp_pm_work_struct *zynqmp_pm_init_suspend_work; + +enum pm_suspend_mode { + PM_SUSPEND_MODE_STD, + PM_SUSPEND_MODE_POWER_OFF, +}; + +#define PM_SUSPEND_MODE_FIRST PM_SUSPEND_MODE_STD + +static const char *const suspend_modes[] = { + [PM_SUSPEND_MODE_STD] = "standard", + [PM_SUSPEND_MODE_POWER_OFF] = "power-off", +}; + +static enum pm_suspend_mode suspend_mode = PM_SUSPEND_MODE_STD; + +enum pm_api_cb_id { + PM_INIT_SUSPEND_CB = 30, + PM_ACKNOWLEDGE_CB, + PM_NOTIFY_CB, +}; + +static irqreturn_t zynqmp_pm_isr(int irq, void *data) +{ + u32 payload[CB_PAYLOAD_SIZE]; + const struct zynqmp_eemi_ops *eemi_ops = get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->get_callback_data) + return IRQ_NONE; + + eemi_ops->get_callback_data(payload); + + if (!payload[0]) + return IRQ_NONE; + + /* First element is callback API ID, others are callback arguments */ + if (payload[0] == PM_INIT_SUSPEND_CB) { + if (work_pending(&zynqmp_pm_init_suspend_work->callback_work)) + goto done; + + /* Copy callback arguments into work's structure */ + memcpy(zynqmp_pm_init_suspend_work->args, &payload[1], + sizeof(zynqmp_pm_init_suspend_work->args)); + + queue_work(system_unbound_wq, + &zynqmp_pm_init_suspend_work->callback_work); + } + +done: + return IRQ_HANDLED; +} + +static const struct of_device_id pm_of_match[] = { + { .compatible = "xlnx,zynqmp-pm", }, + { /* end of table */ }, +}; + +MODULE_DEVICE_TABLE(of, pm_of_match); + +/** + * zynqmp_pm_init_suspend_work_fn - Initialize suspend + * @work: Pointer to work_struct + * + * Bottom-half of PM callback IRQ handler. + */ +static void zynqmp_pm_init_suspend_work_fn(struct work_struct *work) +{ + struct zynqmp_pm_work_struct *pm_work = + container_of(work, struct zynqmp_pm_work_struct, callback_work); + + if (pm_work->args[0] == ZYNQMP_PM_SUSPEND_REASON_SYSTEM_SHUTDOWN) { + orderly_poweroff(true); + } else if (pm_work->args[0] == + ZYNQMP_PM_SUSPEND_REASON_POWER_UNIT_REQUEST) { + pm_suspend(PM_SUSPEND_MEM); + } else { + pr_err("%s Unsupported InitSuspendCb reason code %d.\n" + , __func__, pm_work->args[0]); + } +} + +static ssize_t suspend_mode_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + char *s = buf; + int md; + + for (md = PM_SUSPEND_MODE_FIRST; md < ARRAY_SIZE(suspend_modes); md++) + if (suspend_modes[md]) { + if (md == suspend_mode) + s += sprintf(s, "[%s] ", suspend_modes[md]); + else + s += sprintf(s, "%s ", suspend_modes[md]); + } + + /* Convert last space to newline */ + if (s != buf) + *(s - 1) = '\n'; + return (s - buf); +} + +static ssize_t suspend_mode_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + int md, ret = -EINVAL; + const struct zynqmp_eemi_ops *eemi_ops = get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->set_suspend_mode) + return ret; + + for (md = PM_SUSPEND_MODE_FIRST; md < ARRAY_SIZE(suspend_modes); md++) + if (suspend_modes[md] && + sysfs_streq(suspend_modes[md], buf)) { + ret = 0; + break; + } + + if (!ret && md != suspend_mode) { + ret = eemi_ops->set_suspend_mode(md); + if (likely(!ret)) + suspend_mode = md; + } + + return ret ? ret : count; +} + +static DEVICE_ATTR_RW(suspend_mode); + +/** + * zynqmp_pm_sysfs_init - Initialize PM driver sysfs interface + * @dev: Pointer to device structure + * + * Return: 0 on success, negative error code otherwise + */ +static int zynqmp_pm_sysfs_init(struct device *dev) +{ + return sysfs_create_file(&dev->kobj, &dev_attr_suspend_mode.attr); +} + +/** + * zynqmp_pm_probe - Probe existence of the PMU Firmware + * and initialize debugfs interface + * + * @pdev: Pointer to the platform_device structure + * + * Return: Returns 0 on success + * Negative error code otherwise + */ +static int zynqmp_pm_probe(struct platform_device *pdev) +{ + int ret, irq; + u32 pm_api_version; + const struct zynqmp_eemi_ops *eemi_ops = get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->get_api_version) + return -ENXIO; + + eemi_ops->get_api_version(&pm_api_version); + + /* Check PM API version number */ + if (pm_api_version != ZYNQMP_PM_VERSION) + return -ENODEV; + + irq = platform_get_irq(pdev, 0); + if (irq <= 0) + return -ENXIO; + + ret = request_irq(irq, zynqmp_pm_isr, IRQF_SHARED, DRIVER_NAME, pdev); + if (ret) { + dev_err(&pdev->dev, "request_irq '%d' failed with %d\n", + irq, ret); + return ret; + } + + zynqmp_pm_init_suspend_work = + devm_kzalloc(&pdev->dev, sizeof(struct zynqmp_pm_work_struct), + GFP_KERNEL); + if (!zynqmp_pm_init_suspend_work) { + ret = -ENOMEM; + goto error; + } + + INIT_WORK(&zynqmp_pm_init_suspend_work->callback_work, + zynqmp_pm_init_suspend_work_fn); + + ret = zynqmp_pm_sysfs_init(&pdev->dev); + if (ret) { + dev_err(&pdev->dev, "unable to initialize sysfs interface\n"); + goto error; + } + + dev_info(&pdev->dev, "Power management API v%d.%d\n", + ZYNQMP_PM_VERSION_MAJOR, ZYNQMP_PM_VERSION_MINOR); + + return 0; + +error: + free_irq(irq, 0); + return ret; +} + +static struct platform_driver zynqmp_pm_platform_driver = { + .probe = zynqmp_pm_probe, + .driver = { + .name = DRIVER_NAME, + .of_match_table = pm_of_match, + }, +}; +builtin_platform_driver(zynqmp_pm_platform_driver); + +/** + * zynqmp_pm_init - Notify PM firmware that initialization is completed + * + * Return: Status returned from the PM firmware + */ +static int __init zynqmp_pm_init(void) +{ + const struct zynqmp_eemi_ops *eemi_ops = get_eemi_ops(); + + if (!eemi_ops || !eemi_ops->init_finalize) + return -ENXIO; + + return eemi_ops->init_finalize(); +} + +late_initcall_sync(zynqmp_pm_init);