Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp628899rdb; Mon, 15 Jan 2024 08:19:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOnzz2/lv11BO+V+Fpi3yXtydgpPKjaRm33vDZ3aOSFIG9VLNkmZ2c4qTMV5sE2FmtApMl X-Received: by 2002:a17:902:db04:b0:1d4:e575:5224 with SMTP id m4-20020a170902db0400b001d4e5755224mr8043180plx.122.1705335580617; Mon, 15 Jan 2024 08:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705335580; cv=none; d=google.com; s=arc-20160816; b=nN+sgVWEUearziiW7pC2mxw7B738yfmxtdIr+HA61nXqGX6/9Xz50xVbSIG5k2zBUY EJMvexTEcfuX+2YvV2fKRJ8ViiEVfM+XWTRscepQSD5L3hJgeh+rX8cVFGRngmoa5F4h +v4d9SyOQbnInUxDoWvt+ATdG1HlnzRIt+rOwFFSgmVgTn6J8BvujCPWOBYDXDQSd5yd p27RhskcLFau4AG3s6YIGgPrMBIVBwpa5HpyCTd+D2qZGLH1uqgjQq1P/yh4hGLcodS3 GJa11VGhH1enuUSd6yidPV8sSMOLy+kEZFnhR4jpZtD5HXXdnIzunCbabTY+lpp8xzPW 0FhA== 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=qficUP/hgylBwzfb8Z6WHapI52GIrCvvi9N3cV9r1KI=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=OkV2N4L4rx1x4/oG5VSuBg7pCPs3FXREBMfPrZ+dYCazU90fKZ7n8OrdfL/611m7xW WqGAS7doTEiPHqoJqBpsmoNI4byYTteQBDH3tXNUGi5yX0LJPhJcISLzqvrMGSenosgy MwKB1oY8InZBRyj7aoTv+R48r+HcPxEuL2E0UTOanjsJfEKntIUJRDgIJ2RnIzDEilQR u8Gfp1/n5ZJtGHnruODOsBGkvQ1ZGk2xHuHgNZlL2QNiw8kAHH5+tX+SjRGsJ+loUKO2 GFu0TJDVe2WeoXvwW9Q3tsZpAvSbs53XuMjTNCTHIHZbEO5MwDnoah4TzzT+b/sj1Hrp 5F6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VlZHKfcK; spf=pass (google.com: domain of linux-kernel+bounces-26243-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26243-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j5-20020a170902758500b001cc4aca5f5dsi8965671pll.636.2024.01.15.08.19.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 08:19:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26243-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VlZHKfcK; spf=pass (google.com: domain of linux-kernel+bounces-26243-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26243-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 44AEA282E69 for ; Mon, 15 Jan 2024 16:19:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A734199C9; Mon, 15 Jan 2024 16:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VlZHKfcK" 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 C9F5D18AF6; Mon, 15 Jan 2024 16:16:28 +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 00588C000A; Mon, 15 Jan 2024 16:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1705335387; 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=qficUP/hgylBwzfb8Z6WHapI52GIrCvvi9N3cV9r1KI=; b=VlZHKfcKFnDt9K9MqUnkndWkdLF8ma4Uy5h/hOicZhTcAm2XJqKOEwJoA4PWJN70o3Tq9K G5dd2JlULGUreMbvNFBibG+XjO27U9rRnWtOxJ3WN2JQ2+u2bYGDdtPot/lEmn2PxLHpk+ mpYUgbIC8p0y9ZtpLGHBMH4tZLeKqkqgpkNe4JKRDqiiIhp1uVgL5mw5aOvJwqL4s8x2lH qXG1hMLiTuEmMoNf+FpSZQyEiZrKt9CfhY0/ddvnsXvdYN5jK864ob2D9WhyB6+4rVhdtL h+M9kMAW0FRu7AeoixDskBlSq8cHG71Vvy2fQ3lLJVK9sIBkLY/nQcZQlnz1Xw== From: Thomas Richard Date: Mon, 15 Jan 2024 17:14:51 +0100 Subject: [PATCH 10/14] phy: cadence-torrent: remove noop_ops phy operations 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: 7bit Message-Id: <20240102-j7200-pcie-s2r-v1-10-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 Even if a phy is already configured, the phy operations are needed during resume stage, as the phy is in reset state. The noop_ops phy operations is removed to always have phy operations. The already_configured flag is checked at the begening of init, configure and poweron operations to keep the already_configured behaviour. Signed-off-by: Thomas Richard --- drivers/phy/cadence/phy-cadence-torrent.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index a1e9d06453e6..70413fca5776 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -1593,6 +1593,9 @@ static int cdns_torrent_dp_configure(struct phy *phy, struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(phy->dev.parent); int ret; + if (cdns_phy->already_configured) + return 0; + ret = cdns_torrent_dp_verify_config(inst, &opts->dp); if (ret) { dev_err(&phy->dev, "invalid params for phy configure\n"); @@ -1628,6 +1631,12 @@ static int cdns_torrent_phy_on(struct phy *phy) u32 read_val; int ret; + if (cdns_phy->already_configured) { + /* Give 5ms to 10ms delay for the PIPE clock to be stable */ + usleep_range(5000, 10000); + return 0; + } + if (cdns_phy->nsubnodes == 1) { /* Take the PHY lane group out of reset */ reset_control_deassert(inst->lnk_rst); @@ -2306,6 +2315,9 @@ static int cdns_torrent_phy_init(struct phy *phy) u32 num_regs; int i, j; + if (cdns_phy->already_configured) + return 0; + if (cdns_phy->nsubnodes > 1) { if (phy_type == TYPE_DP) return cdns_torrent_dp_multilink_init(cdns_phy, inst, phy); @@ -2443,19 +2455,6 @@ static const struct phy_ops cdns_torrent_phy_ops = { .owner = THIS_MODULE, }; -static int cdns_torrent_noop_phy_on(struct phy *phy) -{ - /* Give 5ms to 10ms delay for the PIPE clock to be stable */ - usleep_range(5000, 10000); - - return 0; -} - -static const struct phy_ops noop_ops = { - .power_on = cdns_torrent_noop_phy_on, - .owner = THIS_MODULE, -}; - static int cdns_torrent_phy_configure_multilink(struct cdns_torrent_phy *cdns_phy) { @@ -2870,10 +2869,7 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) of_property_read_u32(child, "cdns,ssc-mode", &cdns_phy->phys[node].ssc_mode); - if (!cdns_phy->already_configured) - gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); - else - gphy = devm_phy_create(dev, child, &noop_ops); + gphy = devm_phy_create(dev, child, &cdns_torrent_phy_ops); if (IS_ERR(gphy)) { ret = PTR_ERR(gphy); goto put_child; -- 2.39.2