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: 201590 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp490579dyb; Thu, 15 Feb 2024 07:51:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVxUzStSIDAf9tgY74Q5fRsG9FnzmW1p8sJ6Mp2GyQxRMJ856hyAmJfPWgtmgD1Tu2LVYc1hDN4+kAT4TvmrsnXGdBAEQ== X-Google-Smtp-Source: AGHT+IGszX2hg5bSjrdszUiR/p3Y0QbHtvovA97YWpx7PvvoI7cxM2VeZhvyRAd2r1UrCBBYG6Ts X-Received: by 2002:a05:6a00:3d44:b0:6e0:a026:913 with SMTP id lp4-20020a056a003d4400b006e0a0260913mr2640081pfb.12.1708012292247; Thu, 15 Feb 2024 07:51:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708012292; cv=pass; d=google.com; s=arc-20160816; b=i4AByhDtGqwasgh4MoEtkTY4HV4Jb8E6mKvNzCCFvUvTF+YDIszzvoQBBoCHEorrTo HFKcJzqSUIGkSngCGQ94OeMAXL6BnZfAEJ1oQLsa8JUv3D6/H9p2bFA/87jl693JtGEs DzIjoNlAWfrYDr0jjLLKEkB11BfVEiSgqSCToky05+bgWz4lLR4ToScrZs022jAS271s RpBGgipSzgFCIbbobj4fZ0FHP2ha4iyQYFOjJfdfVEf0GY1oL2n5uXX7fcvs0778qdhL viczXopypPxP59a7GCeti5IiYeezxf727B0T2x9PSWRXC2rDGBYfQVJ+h0PmdJWV2hN5 MqLw== ARC-Message-Signature: i=2; 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=elGcazR3RAYdE1WwV1YDwOp1CVUqVY3SVp9Rpe8awS8=; fh=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=EZElNdoVwVSbWn/NmJwmlUYSZQVszdr/+pGIARAAgMdrZZCH30UjXM8oP8IRFydxD3 clHm4OWV54lLf0ztJB86x7qphg0o2oGuziISh2r29cjKOY5V1d5T99fz3jmq7lPOLwiS B4okfHbTi0fSp2BHAgIpMTcbhbcXRQ+FZxDc567xGe5cWKmHly50F/QXPFoB2cVBe08Z aLgf80TE4TKUGldNRtIY93U6pRf9x+lCSG97jX3EdiQxpYNBcIxMM3AKHp/2/aVU7p3d chrm1qRdeFO/SEEsW0r32QwgXmjLyaWVZ3ERq9l8FJIUNpXC/H4+b5xeJWjNAlQWpOyW w8zw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hxT15fox; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67156-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s18-20020a639252000000b005dc7c05e470si1283411pgn.590.2024.02.15.07.51.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:51:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=hxT15fox; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67156-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id CD0A2B2B5F3 for ; Thu, 15 Feb 2024 15:21:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AC9A135A59; Thu, 15 Feb 2024 15:18:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="hxT15fox" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 3ADD613472D; Thu, 15 Feb 2024 15:18:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010293; cv=none; b=DMaamLEk1wGc7gaMYCALjKQOy+mdh7vnE4bTF5gzxP+Ht0u0deOmkDPbKVPflLep+g0dxF2NeA9ldGZysVl87ZgrB+3FLYMT1I3Bcr2+ICMt9AJwisMLkANeNjywdcGqZsKABq5HVPng5twicPkUvkZX32YaCt03wmedjNlGOi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010293; c=relaxed/simple; bh=0rF0ydUKx8DNLmpqL/zl2WtbHYCxIoALNzEdbFbOyKA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LprEVNhoYTP7bJoC3VGuj2dpYC65/PAVL7dbbpSax1KsK1RcFvmc0Vg58U3msOuHAVvBKy1vsihpTyaEWlreFrKbXw+F+/nNG0ypCSx3lS1A8jkEVcqlgiE3j0Iu4CqPMLRY602pzAWriFklPV2C/S8TzvI0aMSh0e4KODM7hmo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=hxT15fox; arc=none smtp.client-ip=217.70.183.193 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 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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=C5=84?= =?utf-8?q?ski?= , 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790980697284166642 X-GMAIL-MSGID: 1790980697284166642 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);