From patchwork Thu Feb 15 15:17:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Richard X-Patchwork-Id: 201539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp472951dyb; Thu, 15 Feb 2024 07:23:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWi/5qDPddcRuMNFuiTeYWikS8g31dAqSB4B9ETQqfb4x8KNOeqAJY9ymfeXqjFk5zQwQzuz0QTx6vsS+yHqEM6KMQ24Q== X-Google-Smtp-Source: AGHT+IFufa2JwOxdOH56Xt//rheHcq2tCtzoXvte3MglkV7Dh3VRyd+7QCiPVmSMdOeLXPNppAPy X-Received: by 2002:a25:b204:0:b0:dcc:76a0:503b with SMTP id i4-20020a25b204000000b00dcc76a0503bmr1700199ybj.13.1708010585071; Thu, 15 Feb 2024 07:23:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708010585; cv=pass; d=google.com; s=arc-20160816; b=mR0QvLp1dBHvwgbe4xnfroDMOvhf11IFnWQYYCaL8gGVVjkRqScPLZ6HrUCuxaJMjE FAvvDmGeTzpZMtGpKQl7ncUCZmEt2i8xGiRkIOw/ik41eJVaIjl1lxk3cW/zKk8qLmEt hRnC7Gk5cr1tIyVwmXBgkBl6ZJoy2cX11QCaN2uKEaLKcAKuGHU+0/ZWL/NQwZyGCMS+ RHx2GzFqm84T+MQFHOqYU8UQSBc3QKV35j/KrsC9/h2uqYKKUg74tPNpr+ZKWpxwGu6P gY/z8ao+LEovq4IkZFMOR1YXF7EEgIJOErREUfXzls67Tq4aUeNMxG+oUkMCn6+5yG7F qNDw== 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=Kd9Oz4mdVW+hDLej27Xfdp5hp9Tma/hgJ2XUMzL0uAo=; fh=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=q9+ESKaTB1F5jnSJOykaXAoQQ/ow3iq9nR6kwck3BeZBOgKHf1C2vYXY7pNN4kF+nz aQTjOxUIphSxJQWi0CxZaZoFwEBpqFgz6aSGKW4o3MWWFiemDH3B9ul0w+eZblnmUBDd kYGUfYN5WueNmLgjRDs0sNlc6Cw4YzXpn9gpFkIqYzwLwLKO7S85jROD+EYUgKx5xOUy PZT/JxqXxDKoRc9gE1VKi/rWKplMoF9xVJRcAFi8fkWw896OTEny/wTRLleB8QJAScCe DO+m4qTHwQ/4WR+g8UQmRpH8Sdz3SdLnq+jOT9jJ1ipzOx4RprhfYFbYE8/jM4BWqbiA 14UA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=cIygT0Q8; 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-67161-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67161-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y22-20020a05620a44d600b0078735a64841si1762631qkp.547.2024.02.15.07.23.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67161-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=cIygT0Q8; 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-67161-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67161-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C10561C20C91 for ; Thu, 15 Feb 2024 15:23:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7D31137C35; Thu, 15 Feb 2024 15:18:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cIygT0Q8" 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 B23DD13541A; Thu, 15 Feb 2024 15:18:15 +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=1708010298; cv=none; b=CXSFXOnwrfUElfTRuZAWNovgciBPge6DfToT7MfJHNCKtQm/lbZOcF8gTEs64lHauz0K0zx6kRvy/F3Xup5/IBed9KPrU5X8jSHcplCL+x1E7aghs2HXX3W7wUCicL8WRsuBZ/Br5aULUHGB6+9D14MNn1SHuEm7zuUPloxrhTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010298; c=relaxed/simple; bh=vN8vnshRL6hQY9u+MN7pyGYmpKbakAsxcQa8lsNHH2w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=prsepn0kM5FEafijwy9L/tiVTTa2FbTaxzytuyyavLUNop/s1sELiGKoOgD7xaM4wOm8HUZjIiL6AbSdfNRChT53JAmdjcAsueoDXj/wuRNSm9xK9FZOHoB9Jh3gwaFts2O6010KftMEBz7FN0REkMjJGIlnmaUQTzxM+gsPHSU= 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=cIygT0Q8; 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 E44B324000F; Thu, 15 Feb 2024 15:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708010294; 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=Kd9Oz4mdVW+hDLej27Xfdp5hp9Tma/hgJ2XUMzL0uAo=; b=cIygT0Q86qJunS1OuvA60AW3gXXgGTvGRVH9poRoSiiPPg8u5mfCYy01JrdkJJjFi3Z/W7 wUJFSoETTLyxg8dOjuQzdFcnP6saU1FJCTS6TcBxL+vG0B4z6/eY35QmcwH8nTFJ/LQQ4m VMRicW70D/N/8OyIr/+/JUsXVMkayOxyyquUQCYJqmnggQHMTjbF6M2Evo+oZ0PnMxpZ15 f1V4G1sZz0+SjCbWvg/4u2cP8tsV5/C2G5abtaoDiHVZ+rSqcvE/YG00sY07b8HhQLagy+ u9c/n3eiBkSMgy+5QxBVr4BtTZRIbvYxgLWrFCW9J6VZe+wju5PJOhrN81w3DA== From: Thomas Richard Date: Thu, 15 Feb 2024 16:17:58 +0100 Subject: [PATCH v3 13/18] 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 Message-Id: <20240102-j7200-pcie-s2r-v3-13-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: 1790978907200080935 X-GMAIL-MSGID: 1790978907200080935 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 b35fbc8a60e5..52cadca4c07b 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) { @@ -2869,10 +2868,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;