Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp627815rdb; Mon, 15 Jan 2024 08:17:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXMBxhjDu6Hyt3NyI0aVisgr/0vh7vUGOcHNr7M4oEetF2Gw8ckFRbIeLLZXgtHmJ0vMoc X-Received: by 2002:a17:906:ff53:b0:a29:8f93:9e20 with SMTP id zo19-20020a170906ff5300b00a298f939e20mr1362316ejb.130.1705335460521; Mon, 15 Jan 2024 08:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705335460; cv=none; d=google.com; s=arc-20160816; b=HCK6GXRnkRH27W+LBTuHS8niereW4TC/qrcSKKhqoFq8RSbGqCiYMs7wxr+lPbVNK6 JPQtdmr4hEQ9VEko+MJ0Tj22I3MEpHAKkKMcxiLC4lCPR2avO2GNYnb3+MNMpxgblFRy YaNx8DqLGyncKjEH6pRH3hVRqVYn44/NUg1SWF5tuw8L8eE8QNSA1nee9guO5uiOyXQ6 r7QuVD8J+p63NjBSy/HGTEbuxzF1E2ADk+vYWpTX9pdOpWwWEy8QPV+pm+1uSncL9E1K jlFXbvdIEF9UKsNf0adnyIqqOPON7Dd9PuaqrUpPhDeOK/RE5WuE6StAASF69EMFoYpE +XSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=5sUS3vLWJetwrOxifoKHwojurtz05QQ0WVVV+b0as8c=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=kdSLQio6FsFuZWE5hZzv/PuBP9k4A+W6kXpRaXZteK3wzlCvyRHpGowPiAikvi2umc fmgN93wr7yb1BVe7vMBgGl43lrlr/BWuuAiLgEpcmG2OXwThC9UujBk2aqQmsxFvdcXQ kTgs9EsfgeTA8K2Vdk6kyeC52CHZBRG5dDdkXhuvX6euBcbNjfhQCBH50aB+19uGN+z5 j/kc+e62uhTVF3q5CvUNqn2ZibXyHWUoXJwfD/nflMnOJMtBZ66bgtx/5nca4gjbLDR7 80REvTAwfmBjdWa0Fv4t0ODQLgPfl6a8PKmP6tsUusJFbR6dakADHINea2MmhdVzx/QG bHAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=COOXp3qP; spf=pass (google.com: domain of linux-kernel+bounces-26236-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26236-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bj17-20020a170906b05100b00a2c3e53943fsi3748473ejb.220.2024.01.15.08.17.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 08:17:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26236-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=COOXp3qP; spf=pass (google.com: domain of linux-kernel+bounces-26236-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26236-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 345711F22B24 for ; Mon, 15 Jan 2024 16:17:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E2061805E; Mon, 15 Jan 2024 16:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="COOXp3qP" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1525D179BD; Mon, 15 Jan 2024 16:16:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 322DFC0008; Mon, 15 Jan 2024 16:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1705335382; 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=5sUS3vLWJetwrOxifoKHwojurtz05QQ0WVVV+b0as8c=; b=COOXp3qPdfsNX4WwaTj+W6tNhEJvjMWJwGpreYYsAzWHkD+A6UGJGtR6y0XvJRVUth+rs2 1gASrl5oLU9BrJ/J2UDxOXzPYx03q3SW8eLI+TtSKxG9C06QjLKmVsS5khzb3ZRbjvTjOi 0LH8AB+Uh+p8St2qxjjUc4GPijrgM5cK0qsEYAYs0yFtAl2NRy6aXsbXjmZJUAKhoy/JwA 2nMmfnm1FYFGQrlzibu6pz121m3l+m5C2Lyc2+WMMqyVY77aIttUeEwpzzSfk2qOJvNgLY qYRFtnhkloQNhaO9Tw9kjSKVn8hh8m1vhZseUUKfrl3wnB7AmJhciG9L9f7Aww== From: Thomas Richard Date: Mon, 15 Jan 2024 17:14:47 +0100 Subject: [PATCH 06/14] phy: ti: phy-j721e-wiz: add resume support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240102-j7200-pcie-s2r-v1-6-84e55da52400@bootlin.com> References: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@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 , Tom Joseph , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=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 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 | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c index 09f7edf16562..fac7070a9d6b 100644 --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -1666,12 +1666,51 @@ static void wiz_remove(struct platform_device *pdev) pm_runtime_disable(dev); } +#ifdef CONFIG_PM +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); + + ret = wiz_clock_init(wiz, node, false); + if (ret < 0) { + dev_warn(dev, "Failed to initialize clocks\n"); + goto err_get_sync; + } + + 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); + +err_get_sync: + + return ret; +} + +static const struct dev_pm_ops wiz_pm_ops = { + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, wiz_resume_noirq) +}; +#endif + static struct platform_driver wiz_driver = { .probe = wiz_probe, .remove_new = wiz_remove, .driver = { .name = "wiz", .of_match_table = wiz_id_table, + .pm = pm_ptr(&wiz_pm_ops), }, }; module_platform_driver(wiz_driver); -- 2.39.2