From patchwork Thu Feb 15 15:17:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Richard X-Patchwork-Id: 13558807 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE39CC48BC4 for ; Thu, 15 Feb 2024 16:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6VSBLlLd3HOyApAIBPsQ6ps9w9RGUJg8hZRGJnD6W14=; b=dCpFrHecJE1bNk 6rSOYAMbzBVw4f94hZhjT10HcssZZE92xMBulGiZpV5Lend5CjR8aHOcq6BZ0C+oASlVxzy8yn5WU FmHN6FNiXUqC1xSm456tQ9O0iRX5P4ClthTTLNRc5M9lGnT1d9C5rav1DBqkxSQm+iMA79jfCBVcM BydHha2FqN4Nn9/r/+EyF7xAsTukKFem2IBDgVdwa81qX0dw8hpkCUKhc0xe9RIpQCooO8ku8BTgY 666KV6Nqot5qEuSSXG+wYLhQW26UAq0Mu+WDlKPEc+HRc5Oq9viLsneuNAH4WVxzDoriTG9rz5r/a OZZerCrAGvrthjGgAeow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raedW-0000000Gyrp-33HT; Thu, 15 Feb 2024 16:30:58 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1radV5-0000000Ggrf-0eFv; Thu, 15 Feb 2024 15:18:12 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8C55F240010; Thu, 15 Feb 2024 15:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708010289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=elGcazR3RAYdE1WwV1YDwOp1CVUqVY3SVp9Rpe8awS8=; b=hxT15foxAPdxrh9+jDZrsMZme2b4pSEQWPLGbELqJ7wHekbnDI4a/szJ/LLrGNVMRlaSiw 076ABYE/WZmzZMwjI3bycuJPack20ILG4yg725ztMdc5CLGRPzyWHCtY1zKp+4/3VHEhsB SRKDRfcJ4e7PDc0SNPOL5DehAGDQpTlBOPVJfwxDpK4dUIsvOuWZLjHxGw8oRUXPTuoGds VVaGdH6s2ZhGypPJZDxGJnOGgSJiO/ebirE1trq8DkcfdN8VOvRN7PbNr6vDC2FY7AVAXg vX4lNr7DwDKjfJiqYEZWBkqihZ7ZyoYTqVtaghUUkQGyyc1RBvJtUHZptjjzhw== From: Thomas Richard Date: Thu, 15 Feb 2024 16:17:54 +0100 Subject: [PATCH v3 09/18] phy: ti: phy-j721e-wiz: add resume support MIME-Version: 1.0 Message-Id: <20240102-j7200-pcie-s2r-v3-9-5c2e4a3fac1f@bootlin.com> References: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> To: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Tony Lindgren , Haojian Zhuang , Vignesh R , Aaro Koskinen , Janusz Krzysztofik , Andi Shyti , Peter Rosin , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-phy@lists.infradead.org, linux-pci@vger.kernel.org, gregory.clement@bootlin.com, theo.lebrun@bootlin.com, thomas.petazzoni@bootlin.com, u-kumar1@ti.com, Thomas Richard X-Mailer: b4 0.12.0 X-GND-Sasl: thomas.richard@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240215_071811_474039_01397B2D X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add resume support. It has been tested on J7200 SR1.0 and SR2.0. Based on the work of Théo Lebrun Signed-off-by: Thomas Richard --- drivers/phy/ti/phy-j721e-wiz.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 45c5a4e9cd12..cde38182e34c 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1660,12 +1660,41 @@ static void wiz_remove(struct platform_device *pdev) pm_runtime_disable(dev); } +static int wiz_resume_noirq(struct device *dev) +{ + struct device_node *node = dev->of_node; + struct wiz *wiz = dev_get_drvdata(dev); + int ret; + + /* Enable supplemental Control override if available */ + if (wiz->sup_legacy_clk_override) + regmap_field_write(wiz->sup_legacy_clk_override, 1); + + wiz_clock_init(wiz); + + ret = wiz_init(wiz); + if (ret) { + dev_err(dev, "WIZ initialization failed\n"); + goto err_wiz_init; + } + + return 0; + +err_wiz_init: + wiz_clock_cleanup(wiz, node); + + return ret; +} + +static DEFINE_NOIRQ_DEV_PM_OPS(wiz_pm_ops, NULL, wiz_resume_noirq); + static struct platform_driver wiz_driver = { .probe = wiz_probe, .remove_new = wiz_remove, .driver = { .name = "wiz", .of_match_table = wiz_id_table, + .pm = pm_sleep_ptr(&wiz_pm_ops), }, }; module_platform_driver(wiz_driver);