From patchwork Tue Feb 13 21:39:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri Fedrau X-Patchwork-Id: 200667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp824499dyb; Tue, 13 Feb 2024 13:44:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVJaJx/y4Bu7boSEhJnqyjMSuZlX5m0DlQ5ChnTA627Xtk8B5BYgnFEAoUQfMzhGW8+/GUXzl9SC8kOrD05jQ5tjUIhwQ== X-Google-Smtp-Source: AGHT+IHeE7nYz1Je+2MF7T/bzpsVFhJ8BQn92qPXz0MJK1CWpKPqshtPgEuOqkKWbvjfJwj92if4 X-Received: by 2002:a2e:b603:0:b0:2d0:9a5c:622f with SMTP id r3-20020a2eb603000000b002d09a5c622fmr539692ljn.15.1707860650259; Tue, 13 Feb 2024 13:44:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707860650; cv=pass; d=google.com; s=arc-20160816; b=MTzkZr2jBrUbW2A3xz3zZVRTRTHMWCUzJnC++kf8UF3S4kj013LXrtZMzRO33QJRTW 6gtJ46gGCiLPXCImanfgdAlh7eKjo6CsQZTkFM7Weg9eJJhk0mgSYZMGfTMqN6Wx2SHT MnrLrh6C/pFluPjh9DIFfT8D2y09az6GnwzPQ7VzuRPXji44LBHIjP2ihVG8NQKXJOfq WW0Ko35HiJRbcyMxjd4+iXlMTebAGrgpaP4ClazBRe5kOiYXDZqDKqRAKDPOasyt8sSS ump+UN9294GHlsKSRJYIrm5mCS2WofMmzUX7naEwlzJ9gXAgXhXsIv/8Zydp6/1zlMLI +Yyw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zhBVbpbbNuAZsJD1zsfWWGeNA5wuPbJ+/FGELo9o7pw=; fh=Fpj0URBn5aDgt6DIhZuPkvIbvfzh8x2vCDnsb1CcK/4=; b=yf4GN+S3bvdy1PkeaGT8fIO+y0DtYOzWXKQYB+OSensNiybxcGYGsDRJVNF1eDdntz xCJGq1Fbpt7s3aX+PVxWOOFHFN5t6KvXZ7uzwCtx1Ssrg6y9uoVBExOsrzs5EReLYlFc jRD2RDOoIFvTpmG1T5glmHRzmrF6672I0PV0ILGdkMk2UeKv9gBKcO/OLwCd6utaqC9P pTsd08eHotavVo5TuFDAMe/iq2r1ZyuxQizaU59r8+i6vpKsEufBan+b8gXwQk75OUuH F4pj6n/1oMbCJLU3box3YEveEXADdxyYrySFWJZrZ2KAKN9lfU1OtdKLJVJJcI1u5qF7 YG8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a7Q9Vabi; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-64359-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64359-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=2; AJvYcCUQ+JBPmkK533AHP1WEBoUK73EYet6J3ZpSlclIsbx0R/HpvuP+8j8A34CwvTRhkSyQcaFGf6fqyNZqOuVhQoMAqBPR4A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z17-20020a05640235d100b005610bb92e81si4388776edc.637.2024.02.13.13.44.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:44:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64359-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a7Q9Vabi; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-64359-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64359-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 D71591F21898 for ; Tue, 13 Feb 2024 21:44:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B999C63511; Tue, 13 Feb 2024 21:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a7Q9Vabi" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4110963405; Tue, 13 Feb 2024 21:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860435; cv=none; b=u6vpkYuf2Sh8qSHlaNETos6n4HDiZs47FyR+FOewikKUA/U8bjG0FKZx3QN+im3d05lHCvzky7YHlWVpg0alXNsM/HxsEZDaJg4jlJxu+hWAV4b0ASwwG+2fbtXgR+Tz6MG9dmgE8opA1R+45LvENygyU5ujMfF30t4fqvi0mtI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707860435; c=relaxed/simple; bh=gF3/8s9rdHbLqFLOpYOvq2ihfs6x9vepRDOvp4fgqQw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PApg1x0XdD5n9pE/YI/YaumCMv1+IXibBEEv9Py0BtOUGRUp0j7/jTGhFlreb0GaDYh0miy8M6y8x5LYysiphHVg4B119Hy7ssnpL6OPy9WwEzCfv3OCVor2rp6TmhfSBmuR7yBrkF80HvD+d+v7ycbUKSdGgD2qYWhiHjHxgQ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a7Q9Vabi; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-562092d8135so1109671a12.3; Tue, 13 Feb 2024 13:40:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707860431; x=1708465231; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zhBVbpbbNuAZsJD1zsfWWGeNA5wuPbJ+/FGELo9o7pw=; b=a7Q9VabitixcH+zk4fDn9LsKDHooTy4AYI6Fh2AQF05wI65gGDz0P78s6mvCmkw3Dk YIELNJevD/NxRjDwPLQrXZMpDFwbaIloexm09+XDu+rdJbDC49XX09IKX7rKS0/r3bso ob4X3JWV+BAcycXSYkFGMQFXsclGN2b1zzh6MMaS0f6J9XMZGoO0A7esjwVLQrKqluwa DkRClwkMI5TXN7i2NCGH6nliFsQI/UwPlziGOPt+RMyHcjg7niy+QXX9By1sYGC8Vnh4 x2cOus+2aL00uuTB6XeEpi1X2SySff4zy9uLRFZqKvpN9RuYsIchLyNPNzMY3UqYVM4v 4a7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707860431; x=1708465231; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zhBVbpbbNuAZsJD1zsfWWGeNA5wuPbJ+/FGELo9o7pw=; b=o1X6buqKvmXLjf6sfMKuovj6HFfxW+DJEo8+K+67QiTG0QQSG3UJTUSMNnEkZwebMX R0MIR875eR228JaAa1OQDJzLCV2cKy0i6ir+SxJQbdWhMb/xsmeAcPNki40hooVdmd5z juocjrN/KDZCzV+/nPCWtZnNgcwnXADSyj/iAhtgMfiYORxRvJTIZYjyd9bWE1uH9Nss be7QdHYaO++vjFnuz95NmPrhuXtRlrHwEVGE1lhIYW9xpcUdrb3jzZjGJ/hwbLlGWTd/ ZU+Y05LgxdexXF+LF1hIHRoDTXkIRc0E1K7/us7mtRlHsnpY+u1dNbxI71qEOCVi9a6H C6aQ== X-Forwarded-Encrypted: i=1; AJvYcCX3GIetEPbe6ps5ACpADNcv9obDfMy4/0mzFLCUd73a/RzgqabKetOK0IhkVk1ghY3YiJGThxFQW8UT2sw8wVe1x9oWJR8rp5G97UoeQC1Avip6YO30+pT7qiZVd+CRTHAeiCCY X-Gm-Message-State: AOJu0Yx/t5v3ozirJy8HBXXWjDqiX6omnwhaziktsGWazasBRd3Cj2Lf jsxTWVQohKtaH8uuA+bEVJPaMO0wOsvtZFuxOfXMssLvfHS/rBKR X-Received: by 2002:aa7:d40f:0:b0:561:347f:ec5e with SMTP id z15-20020aa7d40f000000b00561347fec5emr658984edq.32.1707860431349; Tue, 13 Feb 2024 13:40:31 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV14mgLi7UAldNfOM7ldyU+z5AKMxT9vIVRrtCfdDFhRce6x/g8zjelO2mDlObMgoiw2QVv0jLgEDSRUaBnRR3oarP/ik89IPGODjEg9L1HliXXwcIe9Ney9T6Jd7DNVDaVgxpFgntrAOtXUkt9n6vwQdRLA/rgRLywrM1muX3te+s45fBqjyrHJG4I/eJrobXpYbeQFHf2xDr7b4HOrvJ8V35dzkFyFeYcUHn49YjLougZpBjLZN1Lr6iWTwxNYLlP3dyxiCOzTN9cw+h//FemK+uPhR05mSYv4kX1z66ddbmKdtOCBhl4GCZMLs+vmDUDJr7co25b8O1LJz61mHFDkAk= Received: from debian.fritz.box ([93.184.186.109]) by smtp.gmail.com with ESMTPSA id k23-20020a05640212d700b005612987a525sm4003913edx.89.2024.02.13.13.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 13:40:31 -0800 (PST) From: Dimitri Fedrau To: Cc: Dimitri Fedrau , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 net-next 07/14] net: phy: marvell-88q2xxx: add suspend / resume ops Date: Tue, 13 Feb 2024 22:39:46 +0100 Message-Id: <20240213213955.178762-8-dima.fedrau@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240213213955.178762-1-dima.fedrau@gmail.com> References: <20240213213955.178762-1-dima.fedrau@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790821689120640368 X-GMAIL-MSGID: 1790821689120640368 Add suspend/resume ops for Marvell 88Q2xxx devices. Reviewed-by: Andrew Lunn Signed-off-by: Dimitri Fedrau --- drivers/net/phy/marvell-88q2xxx.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/phy/marvell-88q2xxx.c b/drivers/net/phy/marvell-88q2xxx.c index 7c7517af346b..8b8275552014 100644 --- a/drivers/net/phy/marvell-88q2xxx.c +++ b/drivers/net/phy/marvell-88q2xxx.c @@ -461,6 +461,38 @@ static irqreturn_t mv88q2xxx_handle_interrupt(struct phy_device *phydev) return IRQ_HANDLED; } +static int mv88q2xxx_suspend(struct phy_device *phydev) +{ + int ret; + + /* Disable PHY interrupts */ + if (phy_interrupt_is_valid(phydev)) { + phydev->interrupts = PHY_INTERRUPT_DISABLED; + ret = mv88q2xxx_config_intr(phydev); + if (ret) + return ret; + } + + return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); +} + +static int mv88q2xxx_resume(struct phy_device *phydev) +{ + int ret; + + /* Enable PHY interrupts */ + if (phy_interrupt_is_valid(phydev)) { + phydev->interrupts = PHY_INTERRUPT_ENABLED; + ret = mv88q2xxx_config_intr(phydev); + if (ret) + return ret; + } + + return phy_clear_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, + MDIO_CTRL1_LPOWER); +} + static int mv88q222x_soft_reset(struct phy_device *phydev) { int ret; @@ -566,6 +598,8 @@ static struct phy_driver mv88q2xxx_driver[] = { .set_loopback = genphy_c45_loopback, .get_sqi = mv88q2xxx_get_sqi, .get_sqi_max = mv88q2xxx_get_sqi_max, + .suspend = mv88q2xxx_suspend, + .resume = mv88q2xxx_resume, }, };