Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp102131rdb; Thu, 25 Jan 2024 09:20:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFo6pUwUKutCOtpPc3WM47fiR4w9iOFk0se4HSHUdb4kAaUWG5PAJdnVHlbAZjm4U84SC1K X-Received: by 2002:a17:90a:d482:b0:290:f4f:d0be with SMTP id s2-20020a17090ad48200b002900f4fd0bemr873361pju.88.1706203233960; Thu, 25 Jan 2024 09:20:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706203233; cv=pass; d=google.com; s=arc-20160816; b=VtDFvuVDqxSF02TMHWiGwnrkywufYswawWV0e9jTyXSbsJcX830J4U0sUne3UeLG7t vQn+AaAxidp4QtUOLjuX8m0gvGawpubi9O4/0/NMIucVqIcA2GHoyySzGkcBmCfeFJax pShqs4T7PsEJWoA6QtbwT3xCNJEUOChGKUT3tA19sB9rXpnsNGPIRVifOWvbiRgdYyYy /+GwcT3VBxZQnUOYvk2x/06YXMnNK0x8SccgAIYYwcTTBoJgUsjL3XL7LU+ssOYMolEA udDMVB0IfWqH7/1zOa4DOho0tZUbAFCkZAQ+daIAt0MNcywEtvx8V8VxU171Q8wzwVVZ z7tQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=M3w/v9oEuYlkPL4C5kh7T1VxbhDjpPY1oFMPL7Ii+tg=; fh=QgHLhp72rHPC/UjSP6wR4LHEHzGXQnn3ndrJBIyWWW0=; b=iL/AGT/+XvI97sCFZBJ2NCfzgZvongtDmh1FtnqptqIGGxl++JyRm7d6iKRyVBxGTk P7BB5cceypKnSSXy/b/Om9mpytgDeHeUIsgaIGPW0ErtaHF5QsPscJaioLS3pZadpNX/ LU8f2keHVKSe+Ed+28ElMGatFvVdmQKIDE7DG8rtJAO5Nn+T+9GAOiZ+bvzD3khhdyA9 cnFNI9IJw8paOCWEg2uIddJl8e8Y3rKVL6rfiNDC785zoSYyaag3j+uBXgzhiuPzYYlr SxPQuKvPbUBJvxXgcY6k35PppqEMrWyVKQFUKpGo657BS6t84UskmTqqoAcdFiBJAaXI vh2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TLymDIki; 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-39025-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39025-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n14-20020a17090aab8e00b0029079ae51c2si1610403pjq.147.2024.01.25.09.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 09:20:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39025-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TLymDIki; 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-39025-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39025-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F0D7E28BB31 for ; Thu, 25 Jan 2024 17:19:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DBFD131737; Thu, 25 Jan 2024 17:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="TLymDIki" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (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 DA067131E2C for ; Thu, 25 Jan 2024 17:18:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706203125; cv=none; b=Jaq8L7EGw1c8ofhikrDzoIOo7k8IIk6V1wDWXA800AzPZjSrQUKAmXVbOJQdVSDR1BLQ3HMjSl45RvzhHNr7gVf6toBEUapKvtDVK2JuKfRFo8ssaNZmiawdATDcUGrQP4ApDFxAZOtPqqKt2eNmmqq9MHcuVFtMr2YpBuaoUuw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706203125; c=relaxed/simple; bh=sF05Yy+d5ZaxIGAlWjRsAJJDf8Q9jJLY3pcKpcNli+I=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=G0Sljsw/SvK+CRyeDXGl2rVKjcFFBAAn6sv0ctwF0M5h/0cgSwwPpwWjUWkL6k0jjbNtMSUmHiqCqoCbwnu66ZNsBcctD25gmYrD8xL5teNK7HVqqoaRVXyMkBSw+VbyPVK1vMpMhK+V8O/NiBkslQNgkDMUkGKf7wfdwBfKmPk= 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=TLymDIki; arc=none smtp.client-ip=217.70.183.200 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 9362920003; Thu, 25 Jan 2024 17:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706203115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=M3w/v9oEuYlkPL4C5kh7T1VxbhDjpPY1oFMPL7Ii+tg=; b=TLymDIkiKJiBhJzkLiN12QBT7u1FHgvghk103/R4JrrlkXq220kOYkho7k6V6QnW8UYRcI GRzm3FPVbO1h46mQwSqJT+qWV6TOc9X8LmaklPnnsrU5GI6OYzGQMfyIJrPMiRfO+nbsFf 8piTxBJGnoVzusL13EhQofWSNV5HcJOOhIXSU7ZCmKR3mSaMUf89nLvDa/oLQvsgIOh0PD 56sx5qChrNmwIou6OVgKOaHWjE10xZQE08koPG/Xu+f4GdV1HM5IQzslN3x7LbHyiUIGEk aJdLsDyXTdyQnqMpxttPwztAwaQTdmLrxdHnP0obqUoS+x3U4VuXGr/o2aU9zQ== From: Thomas Richard To: vkoul@kernel.org, kishon@kernel.org Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, gregory.clement@bootlin.com, thomas.petazzoni@bootlin.com, theo.lebrun@bootlin.com, u-kumar1@ti.com, Thomas Richard Subject: [PATCH] phy: ti: gmii-sel: add resume support Date: Thu, 25 Jan 2024 18:17:54 +0100 Message-Id: <20240125171754.773909-1-thomas.richard@bootlin.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: thomas.richard@bootlin.com The resume callback restores the submode of each PHY. It uses the submode stored in struct phy_gmii_sel_phy_priv (variable phy_if_mode). The submode was saved by the set_mode PHY operation. Signed-off-by: Thomas Richard --- drivers/phy/ti/phy-gmii-sel.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c index 555b323f45da..c62790937313 100644 --- a/drivers/phy/ti/phy-gmii-sel.c +++ b/drivers/phy/ti/phy-gmii-sel.c @@ -491,11 +491,35 @@ static int phy_gmii_sel_probe(struct platform_device *pdev) return 0; } +static int phy_gmii_sel_resume_noirq(struct device *dev) +{ + struct phy_gmii_sel_priv *priv = dev_get_drvdata(dev); + struct phy_gmii_sel_phy_priv *if_phys = priv->if_phys; + int ret, i; + + for (i = 0; i < priv->num_ports; i++) { + if (if_phys[i].phy_if_mode) { + ret = phy_gmii_sel_mode(if_phys[i].if_phy, + PHY_MODE_ETHERNET, if_phys[i].phy_if_mode); + if (ret) { + dev_err(dev, "port%u: restore mode fail %d\n", + if_phys[i].if_phy->id, ret); + return ret; + } + } + } + + return 0; +} + +static DEFINE_NOIRQ_DEV_PM_OPS(phy_gmii_sel_pm_ops, NULL, phy_gmii_sel_resume_noirq); + static struct platform_driver phy_gmii_sel_driver = { .probe = phy_gmii_sel_probe, .driver = { .name = "phy-gmii-sel", .of_match_table = phy_gmii_sel_id_table, + .pm = pm_sleep_ptr(&phy_gmii_sel_pm_ops), }, }; module_platform_driver(phy_gmii_sel_driver); -- 2.39.2