Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp650382rdb; Fri, 26 Jan 2024 06:52:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGBNJYTL8cePrJLihjPi/QR/PWGHIqSAmOH6IfZY1zP9lzpWITxHCkB7aZBaCl4DZQONIM/ X-Received: by 2002:a05:600c:5111:b0:40e:4278:81f3 with SMTP id o17-20020a05600c511100b0040e427881f3mr707215wms.50.1706280742688; Fri, 26 Jan 2024 06:52:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706280742; cv=pass; d=google.com; s=arc-20160816; b=z7eO0aKzFZsGIHj2X6o/If+9gAbKpx7AegNjafOS2j1rbQE9MOYwp1L5EaC6Be3vN4 8YpW8d+Adlo9RKKIDmZiWRVINngqt8l8LjcaaGyUhmm5F4laCvpaZx6fQlSB7K8OVYq4 GGt04IEG9mIxGBoTqisC+xGPzYfApWkFVTGgv3kIcg5uYak4Oqem7wVySgkOb4aPzl0f EA9CVYjTMwj8UWekkqoKyNs7E8+IFyxzdL7hCghamLFZAl+Mc5Y2Qexv4GlDOR3jLvDs 6snEHc2ejkhzsgNFbxKg3RVifC5jvqppXIzglzAnus9Dh1tCdF6sDYq4DqqknSMq/V2k kF6w== 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=CVpiN82f3zCgJBhjbVDcCVvrfuyt97XnSCcK895Im2c=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=M6QSxRV//nBSG0IWAwZvyz9e+rrl0YyA9HJNe2Tx5gbbqKphSGQlK6Jnqx0D++MKme 7qY4K7VRZj1NDLn3v6KsdSYdTpv7lBZh7XqcUgHHHSyD84JwIT0BpRCcDs7XthQkgjUk npT8vu5c+KmA16KbO+e86dce+JpjPegxtwbwX+tCNH56HmXOaa/owhBXxJN/TpYmBrlZ QY9v/iRtFj1sOmrvEreBP5ZkF4UJJv6NBOQOzeBlmZ8K7elAzpsMJLO9PgLHK0605xQc yCIP3Xus9Dz1ZAF77Xi5Mii5UYqEGJs2j2X7/C0b4J/HWuASJnUG7yECmcG5W1kBhlwu 49JQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=px9ryNFe; 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-40210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40210-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g15-20020a056402090f00b0055a748b0999si710639edz.544.2024.01.26.06.52.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:52:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=px9ryNFe; 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-40210-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40210-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 E48AC1F29B73 for ; Fri, 26 Jan 2024 14:41:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F85920B38; Fri, 26 Jan 2024 14:38:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="px9ryNFe" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 DB234208B4; Fri, 26 Jan 2024 14:38:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279887; cv=none; b=XJmRgnmx4OpPcx46he0qEvhq0cxBZH38HVjr37cocaUKqvIeJ9718btaaAE1rtfeCzvNjz/9A651umS1eeeatl1GJVmvhfvC5Jh2a89udb8yL2mpGgxc7sio+4x30P1HNJqo0Yn/qAabG7Wc+urx3cHo+/HtbYhVNy0b1IsDYwg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279887; c=relaxed/simple; bh=h2doF4pJz4p0ih3lMwW5gETWtTTVip38zl0Ov4IjGUg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ON0MT8T+gBnJ/RAn9EaRc2ZPs7Sut8TTvGpOEHQpq8Isj+dMvuCZnj2LCuW4bEpYHx3jYzdKB9XAMBGq/2S+1gkiveJgMzVgrNzBB6HPmwW/QJcHGuIxIOpb7r2/mhW0F0weDw927fGMMFw53SKMjt6VFd7u5z3EXT7VzO6hPOo= 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=px9ryNFe; arc=none smtp.client-ip=217.70.183.194 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 7820340002; Fri, 26 Jan 2024 14:38:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706279883; 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=CVpiN82f3zCgJBhjbVDcCVvrfuyt97XnSCcK895Im2c=; b=px9ryNFeMKXk7pLDO4zGLrbwm1wFyczUEnneQAqKIGrfrjUr0+iMPzdZD+DSV/HhXrvm4G Fj1B8tCtWRGRW9DuVLvzyERry+/UxdW35d2Tr/ggp3DZ1rxqWE1eMQUqk5NxQjFM8dBjC+ 8+amNhn/yVYUw7L5O08ZdgK2KphlobFp7MFg80hmoByGkwjZoZk/NtBcG8Gr5Bvcaean4e AXUbYFu+M0ut3S5yy10oXWkhUct5mfK+afGgbgLhwuOiLEVanQ0odHEqvHhyNmZnsuetnc wfpKolkCxyymi9vJJX3XORHm0S3nzL3YyKhImRqtzDRbj5yYn8E/9+mk2T1Rcw== From: Thomas Richard Date: Fri, 26 Jan 2024 15:36:53 +0100 Subject: [PATCH v2 11/15] 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-v2-11-8e4f7d228ec2@bootlin.com> References: <20240102-j7200-pcie-s2r-v2-0-8e4f7d228ec2@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v2-0-8e4f7d228ec2@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