From patchwork Wed Jan 31 08:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194582 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1751464dyb; Wed, 31 Jan 2024 00:43:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8VpyFkxdysbjyi1IZC90cCtpL1RP9jbp+duUsx4spToBjeFP9kkMd3+Bl5zj1yJGx2vyC X-Received: by 2002:a17:906:1b4b:b0:a2f:1650:a0fb with SMTP id p11-20020a1709061b4b00b00a2f1650a0fbmr555638ejg.66.1706690602938; Wed, 31 Jan 2024 00:43:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690602; cv=pass; d=google.com; s=arc-20160816; b=I+ba45nyPvF54431dXkJ/zfZyQOzac9DGKDXN+zt1Nhv4XAGXfdsOQA8JZ4LuH6iSZ 8VTdaLm0hDMN0jrrMzwO7dmoKdCs2nR4rASQXxhEm6hZxZpSUO1MKtUnLiXAaWM+7aZm 4AICaf+2ln6iaAY7DcJvOLk9X4ckwudtLcz1jicxvY8JYJWoSclZvLxuq6bSs5g3XLOz 8+H/brdlk9QT5t+6HkIuHXXPHXCI+1ah0ltsWOYFOCbWWi/NQCLkWLrMafvNJCrRv4OY xbdSbQH7Dy8B1SNJXWLV7z2uiMFiKGKHy6L2JmExIrqD8Q/I0vDaA50FBlKMZ/fbdAXy rzjg== 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=3nopmGlOYDibDD0J+/Hxx33H1qRqX0KJvglV4HoOWvw=; fh=QxcDr2Odk/hmRSkvc7XnYae7S5Gb0Ahg5S1OQ4a0v5w=; b=GkdJulCKscXpf/mPMaMu+5wYkGFmQWtgrWbfb8pPzh9qlkVxcL2cXZ5bk07tgN+GLR e9z1FRrRRXApI22Ig18AIA8Aa4pOMhjLhRDyiwfbV8u/aRqbDiYUstqWJL0YMX6E9ioE TS1sDRu77Sl6db0E+MhwY4NgShWHagdtxWWDkhKOS0/SPyOvo7yD0pkGTjAxVhobru+8 0wy/Fla/HlOZymP5JUB66+bJakWK2npPPTIdTTkvsg69D3yMi0wP1p/JrfaZiop/yEkC naxeRRW8a+GisaV2HAlEsid377uEF2d2aCYISQfBt1sXN9YD9OIYhpP1o3NahPWIlTU9 uRog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=a08gYhQR; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46019-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46019-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVUhDHU6jPdgSuK80XhpATOmfhIOgBjwpJqK7nIjah/o0AlqXztfw8hT2jvBstmNgGN/kes1WKHOGnSdv1/qwPMj8DcPg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h13-20020a17090619cd00b00a35e32fd8a6si2242363ejd.237.2024.01.31.00.43.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:43:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46019-ouuuleilei=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=@tuxon.dev header.s=google header.b=a08gYhQR; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46019-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46019-ouuuleilei=gmail.com@vger.kernel.org" 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 8C9061F248C4 for ; Wed, 31 Jan 2024 08:43:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FDC560885; Wed, 31 Jan 2024 08:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="a08gYhQR" Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (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 86BD460B9A for ; Wed, 31 Jan 2024 08:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690511; cv=none; b=BvjnylJTzPXQPpAtwqgcpqlYSNmKnGd5lGLN4WQSMbo5UxSD287E+mjMiAX09oYTH/VmTf40kMO3gbh2wRpyrs9k8ZAhr+iHQuPgbR8rBfXwKQWhJbbJbpjSAmxGnJZg2gs2i2rbYxcvnwnDLrGLhtB4JDIrQCEAhR7BHvMJqwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690511; c=relaxed/simple; bh=aaKf7z2xB1MNtfZ9vMqWh+Wx2jdR1MK9CRLol2unMF0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jX+CkPrM9rWzTv6ejjMPjopOp4hREWt7ZWP/Q0IkBZPIfK9hhmi2w7UykZdZlyJoBNl6FGOnvnYVsTVIwq/6GT0k8MrJrvfu6sD5BmY+1Yxfab7Y4EK59i04U4vXyXfiHISiZwTu0in1g29E7IWffuJ+HgJvpLcsWbMf+4dmo0o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=a08gYhQR; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2d0600551ebso14518321fa.2 for ; Wed, 31 Jan 2024 00:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690507; x=1707295307; 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=3nopmGlOYDibDD0J+/Hxx33H1qRqX0KJvglV4HoOWvw=; b=a08gYhQRlIgi/qUl044Zw3FcKBfxoHa6kVj6bphuS2MGkJ4DFPrA5WtlJW0b815jEj yNNwGWK+aydDHlUSOEA8m+rdv6R4Oz6nsAN3qLyrmcuSC5iyXvsO5Bjnslq2X/seI2WU GwiXz6rhsdd/VBbthhLOmqaREsCqZ3HmEg6YXiGJJfMglgpFD9VLfr2nHWuXgnCCbvSS kFncaSuNC9qQkBv6Clwqe7Vu3zjY3ID2FaJwvTikntRep5lxVzyQwFswkupI23g8Oju8 o/K1p0ggZ3lgm/V29aZAfL0x0BhSKpgod51d/4lh32ECWTTCpX5kO/KIcRuodHs+NDXC 3SvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690507; x=1707295307; 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=3nopmGlOYDibDD0J+/Hxx33H1qRqX0KJvglV4HoOWvw=; b=Jz8jbqlKEJ7S1Ij3qhd3VQ0kXbOeWWrU5djKy3ME+TLo1iaH7US0H2WshEwtffuEau aX3dvD0oLCbjQVaqcn8DXx86mjkhvPlwTDv2R/aMUkD3DEJ//E0z9TFezdv6umS+uYX5 r3NSfSZkL5Azr4AtwaR5M6nsC5uPQlH5mj4JEI9vYI8dIRqlS7xhXFmRgIFlb+QFGflK LRz3IdySdyeP+U1FjN5t06Wt1zN7pmgrT5HagKvtkJkn7mJBEA51Y5Ou2T5efKnjYF2Y bAO9z4HXx4w2Ih74ZkglhtRik7lx5VwM3A98lzwVqcml34zNyjKICFMF2imenHOc7gzZ P8vA== X-Gm-Message-State: AOJu0YwxwKATBcKbSgMQkzGwE6PEuWkMHeUN/2Cqcfr009dTKEZJXLtw H1mJe/K4bbjb7LWlBQlo00GM6/w+nqFtitwYvGRK5p3aacxCDsGCSg2TF00SHTs= X-Received: by 2002:a05:651c:1a0f:b0:2cf:1ae2:dca with SMTP id by15-20020a05651c1a0f00b002cf1ae20dcamr799228ljb.16.1706690507376; Wed, 31 Jan 2024 00:41:47 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVINZIQxSHU9/Pkq2gP08HOZi6sVlBy3aTiloaO6v4iewhrYb8NolbjvUFEnGcamkz60RVZQPaEpoCm25S2D3KtobY34/cC3J+5c2db68rdUesbukQ2PDk/yl+19cu49aAWhdPT214NeskIYewypZ4LhXQJHSxXq/0vNHL1pT7M9w85CYUbtVv36onuBy3h8fkBead3dgATf9weN0/9QrT37J4bi0WVVHFhY181GC00R0hhJDmS1u8wnX4mayOpbUrqzg3YginFPuCoOMzv0NMbTvYngQhtbm7KZv9ugPwHOQiC0L9OGfBkPk4agQmKusxS84Sr3ZowH7+8mR5yFucpvC3n4nnMtTKIUrPlsL3WH/Y3yIO381AzrqQ8JInMxQEBqVBW4De67HXsmJ4ghB7SRsN8LTvZ1DZiv1fJyEpxO6/t3zY= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:47 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 01/15] net: ravb: Let IP-specific receive function to interrogate descriptors Date: Wed, 31 Jan 2024 10:41:19 +0200 Message-Id: <20240131084133.1671440-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789594805335074473 X-GMAIL-MSGID: 1789594805335074473 From: Claudiu Beznea ravb_poll() initial code used to interrogate the first descriptor of the RX queue in case gPTP is false to determine if ravb_rx() should be called. This is done for non-gPTP IPs. For gPTP IPs the driver PTP-specific information was used to determine if receive function should be called. As every IP has its own receive function that interrogates the RX descriptors list in the same way the ravb_poll() was doing there is no need to double check this in ravb_poll(). Removing the code from ravb_poll() leads to a cleaner code. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - collected Sergey's tag Changes in v2: - addressed review comments and keep stale code out of this patch drivers/net/ethernet/renesas/ravb_main.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0e3731f50fc2..d371c4bed634 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1288,25 +1288,16 @@ static int ravb_poll(struct napi_struct *napi, int budget) struct net_device *ndev = napi->dev; struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; - bool gptp = info->gptp || info->ccc_gac; - struct ravb_rx_desc *desc; unsigned long flags; int q = napi - priv->napi; int mask = BIT(q); int quota = budget; - unsigned int entry; - if (!gptp) { - entry = priv->cur_rx[q] % priv->num_rx_ring[q]; - desc = &priv->gbeth_rx_ring[entry]; - } /* Processing RX Descriptor Ring */ /* Clear RX interrupt */ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); - if (gptp || desc->die_dt != DT_FEMPTY) { - if (ravb_rx(ndev, "a, q)) - goto out; - } + if (ravb_rx(ndev, "a, q)) + goto out; /* Processing TX Descriptor Ring */ spin_lock_irqsave(&priv->lock, flags); From patchwork Wed Jan 31 08:41:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1751668dyb; Wed, 31 Jan 2024 00:43:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHN27Z25HKO894DDztSSUkwy8AXsGYpNJlllM9vm2stuQqhyfos6qfajnz3GlCQmMnGTepC X-Received: by 2002:a17:906:d88:b0:a35:46d8:53ce with SMTP id m8-20020a1709060d8800b00a3546d853cemr637038eji.18.1706690639635; Wed, 31 Jan 2024 00:43:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690639; cv=pass; d=google.com; s=arc-20160816; b=VM91Huaq1HTT2Dj8ByR0N0AO1+VrmE5LL3bkRlXsEQaLwIAg90otAAMFYX0ElK3Alv JC/zc85qkyNAxdSmQRYhvMIudkFwuB2eW2YSaKlpIhE8UgoVeQku9jrzRLh+7IY0/8vQ 5lPef33OIIzr7bLJZ+24HF5hP/S1e+KVi7hBodU6+ZBlkqTtsnhS01FYPc08JIqXMFfK 59CcIsjFyXy2qL6QxF00wG54fuzyh6UFu6Z6kfMcThK+CGtP0jIlRp5CJvjiuSfOouU2 9yctfWRPYC9dE1qNf9nxxx+Kr25U7Gfz1dF6RUw0lRhmjLjL3aO+GAJu+yljqIlBj1lR n+WA== 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=TtbdQ2QcmkuWepYwSxBRl7Waeuw6uF2b5jWIwkLXEcg=; fh=oQf0TbQipqZ5f2cKWYQBXQhIdF2msuws9iWgSu1nhLI=; b=exV2pox95m0PKpsKY8Go45qPETjEHpozquCbNXLIEPBSQHZR84foZVkCVM6/iiMdAi pdD6GFVy4POKE7ls+Of87/RnXdsmV0uBJZyNxtnHT0zTYcBWe7uWtTGf/BbuuEoXvGV8 es2eKTeNfGtzNHK2k02aXoGlJOCPWfEl+h/v5FTjb39+wL+UAmL2tWdHW3gxK5lhCorJ Olr6OSED/AbflvYsusqw0Yz5irYHh2u27rLiVqH9Qd9veSPkXk0PJk/BqXBBxEP4Bcg7 QYiRkymKJj/As97zniDUndWe3Lz+Tag3dhdvOY6G0/tiMuB60YKxC1/cslSs5h9zojI7 9BWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=brNrM1Tq; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46020-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUQdUTM0AcDFl8mo/iHkqrEE95Y3B5k1TsZqJu7vN/PmDjF3Bdo1F0i6aFPG/dPyDqu4VLbDMRTalOS3wADvbo+papvmw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lr8-20020a170906fb8800b00a365ef1ac47si665855ejb.101.2024.01.31.00.43.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:43:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46020-ouuuleilei=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=@tuxon.dev header.s=google header.b=brNrM1Tq; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46020-ouuuleilei=gmail.com@vger.kernel.org" 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 16E881F23382 for ; Wed, 31 Jan 2024 08:43:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A088969D1D; Wed, 31 Jan 2024 08:41:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="brNrM1Tq" Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 DD9B361671 for ; Wed, 31 Jan 2024 08:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690512; cv=none; b=nuDbDY1RMuQRYY+PtF6iyC7hCueV+sU4VNCLk5FX8TtYErH4g47Yviy8dDaRp6L7R8Vks/kD5PNxDL4nSsXswT09JfmSI0wFA01WpH+U+SlBppIRytpDMjL5Tv16kmN6P4gsW1w7mTLugU1vOS0rhltrwuvA8WtReJV1lnYRP7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690512; c=relaxed/simple; bh=wv9pwCG0Owxu9SDT/z9arM+oZlxF2tOjU78JH/h+iBY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=McQhqYL5vh6dvSiVmvtZ+oDjd6h1RVO2SpudOuiGkXNLto5V9eq35GcxqvRw7nUcxLt8aptlma4Xp0Pi9pOpLvC53kY/djapKpFnJ7Ve+oBWitUVV2m7QnLiRcwJhhizXmhOY12Tof8ipHGtiGNP/m6inqJYXPnkWYh6O3Il45k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=brNrM1Tq; arc=none smtp.client-ip=209.85.208.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2cf1288097aso64960981fa.0 for ; Wed, 31 Jan 2024 00:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690509; x=1707295309; 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=TtbdQ2QcmkuWepYwSxBRl7Waeuw6uF2b5jWIwkLXEcg=; b=brNrM1TqmhZd+X92HtVahUWkw6XkVsdYAI1vesF5iseVga9UT/jECzuxqM5dmcQ8K2 jUOn+Tm3527cp3XDgLgDCtse1bACdErB6CM30fnuiUJW0KyToOkgRFE5bQ0Ku6bBUNob HlPYpkWA7g8f1uzV8mmgOJDMvVQAnBrsB3T4+CIKbuXo2yU6bXX6YfKswgUVmvp20gCb vXXQ89hOx4Wmjzl39df1Y5nOIEkjETS6hNrsfRSltqjHIuNWDSLkPRUOwwB+UrRCVBhb SCOv2DTTOz4tPJSMifSM4CqGEjyhJQyXvhX3wZzWEc8MRo1ON+2/lKzko/oa48BtdEed GuSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690509; x=1707295309; 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=TtbdQ2QcmkuWepYwSxBRl7Waeuw6uF2b5jWIwkLXEcg=; b=EWqaCe+5shclcNahoPY7VGGQU6RTFu/hvVwKmpaylYcZIJSIL6WokWILKIEGeWuPMa 9pVOfPtqvHUBknJC8B58GruLuKPDqWn5B9yaI+P58yro5hp1USlqqOdQB8npEp54Yw2+ 9mnrPydWH3XdH240ZCGhljgE1B7uGjh3S4vZyfkwhk7Ke7A1M4ObMnAKfEVERZHXs1y9 mNVmFHMhdyEfiQ977GEx66B+zAcSC7ssKOlBEXa/lMLGGVcTmJTvzppetMK2szv6AX/V FM2CtYgvXw+GPIzfYQeFLQGO48DW//cAp2VnF9DNVIKLE/klxbrDATI7aFT9jC+JcUC0 LhgQ== X-Gm-Message-State: AOJu0YzVJM8AW7CXwUaEwu9l9RqMuVkzXp9YXYM4ihcWKesA9EORmIUD MhhWi/BWKhrAXvMmqJF7KAQ/iIIKjKqmtkeJjH+FTfIBh1DYydReK7SY+NCQPEw= X-Received: by 2002:a2e:2a85:0:b0:2ce:e49:5b38 with SMTP id q127-20020a2e2a85000000b002ce0e495b38mr636065ljq.29.1706690508728; Wed, 31 Jan 2024 00:41:48 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWpIxpMV+B0SVPGEP4wtDINumQMK/LLVB2GFLs5sHROUSelIkRUpOwm8+jxO9yqMDu1rhdUKFZOIWEHHxTrWLhjZIIkux5q92ZWuuby5tfAk44UcB98B3+mZ41q+E/NWih0qsB6r1MLRfqlEDglg1HlImJsB/XZ3v4rupSLl1M0Fwf5y8ZN7lilFRxYQTFF4pZC3XtRGOKlFYyy7dhawBhMtLI3vPmq/C53VFSKZA+xFnq7SfAPsxVgphz93s3jw+N626IaTWgqIjBB1iL9TWICrNFPRJxi5hxIBC9HG0bFdF4+grLD6Xsc3vp1VQ8nJgLZW4e//A3C+OgqHCVHaJqGYeXGUJrDHFvIF6JHFPNE5E7HdZbKJZP1bCnWQSaXlybhtyY+WFMBlug0oJS5jJ6zOGwP7hSJgTueTDOUJcaUlECaV74= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:48 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 02/15] net: ravb: Rely on PM domain to enable gptp_clk Date: Wed, 31 Jan 2024 10:41:20 +0200 Message-Id: <20240131084133.1671440-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789594843973800214 X-GMAIL-MSGID: 1789594843973800214 From: Claudiu Beznea ravb_rzv2m_hw_info::gptp_ref_clk is enabled only for RZ/V2M. RZ/V2M is an ARM64-based device which selects power domains by default and CONFIG_PM. The RZ/V2M Ethernet DT node has proper power-domain binding available in device tree from the commit that added the Ethernet node. (4872ca1f92b0 ("arm64: dts: renesas: r9a09g011: Add ethernet nodes")). Power domain support was available in the rzg2l-cpg.c driver when the Ethernet DT node has been enabled in RZ/V2M device tree. (ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC")). Thus, remove the explicit clock enable for gptp_clk (and treat it as the other clocks are treated) as it is not needed and removing it doesn't break the ABI according to the above explanations. By removing the enable/disable operation from the driver we can add runtime PM support (which operates on clocks) w/o the need to handle the gptp_clk in the Ethernet driver functions like ravb_runtime_nop(). PM domain does all that is needed. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - collected tags drivers/net/ethernet/renesas/ravb_main.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index d371c4bed634..3181fa73aa32 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2780,7 +2780,6 @@ static int ravb_probe(struct platform_device *pdev) error = PTR_ERR(priv->gptp_clk); goto out_disable_refclk; } - clk_prepare_enable(priv->gptp_clk); } ndev->max_mtu = info->rx_max_buf_size - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); @@ -2800,13 +2799,13 @@ static int ravb_probe(struct platform_device *pdev) /* Set AVB config mode */ error = ravb_set_config_mode(ndev); if (error) - goto out_disable_gptp_clk; + goto out_disable_refclk; if (info->gptp || info->ccc_gac) { /* Set GTI value */ error = ravb_set_gti(ndev); if (error) - goto out_disable_gptp_clk; + goto out_disable_refclk; /* Request GTI loading */ ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); @@ -2826,7 +2825,7 @@ static int ravb_probe(struct platform_device *pdev) "Cannot allocate desc base address table (size %d bytes)\n", priv->desc_bat_size); error = -ENOMEM; - goto out_disable_gptp_clk; + goto out_disable_refclk; } for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++) priv->desc_bat[q].die_dt = DT_EOS; @@ -2889,8 +2888,6 @@ static int ravb_probe(struct platform_device *pdev) /* Stop PTP Clock driver */ if (info->ccc_gac) ravb_ptp_stop(ndev); -out_disable_gptp_clk: - clk_disable_unprepare(priv->gptp_clk); out_disable_refclk: clk_disable_unprepare(priv->refclk); out_release: @@ -2925,7 +2922,6 @@ static void ravb_remove(struct platform_device *pdev) ravb_set_opmode(ndev, CCC_OPC_RESET); - clk_disable_unprepare(priv->gptp_clk); clk_disable_unprepare(priv->refclk); pm_runtime_put_sync(&pdev->dev); From patchwork Wed Jan 31 08:41:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194584 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1751704dyb; Wed, 31 Jan 2024 00:44:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIipO+3Wt1giwINyllJjL3V/XEeahy1JHxRu5Sgbi3OdJI8Y26bkv1E7PWj3wsP7cz8K4P X-Received: by 2002:a17:906:807:b0:a31:88d4:9a4c with SMTP id e7-20020a170906080700b00a3188d49a4cmr609133ejd.22.1706690646239; Wed, 31 Jan 2024 00:44:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690646; cv=pass; d=google.com; s=arc-20160816; b=Hbi6K16YLJimtEF0tWJnU9DmI6OB6fi8ihJYNJ+29QiJCJiyI6NgRW9uk6vQUDYL63 wcLS19osTSYZG3ozEy5AHokmYdbKh8p2pt8tSpaig3wftngkIyL9mb4mZQzSNdCxuTdB ulWhkE/OdB4UuKbLk3n0hi3M2rIR8M1LB+cHjHH2ZfRnz0/JKpJa5C+uDnxxIYwn3N9Y xgwc06/PQbHM3UahCzgSap8cke+dID7VmJEBmnHHr5uh1VC7YLPS5uUPcUo84s1py8Tt 7yXocHmQKNMiRC3yd26lROdWahfJ8JEiy29RGZC7T9TE0gPakIz1W4wXKK2P9YJMMyl0 ONrw== 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=CaQ1tM25xxhSkLymulSrQ/sxhsU4Dz/iC9pZh2/7m5Y=; fh=EyJSKiiA9txwEsoAY3lXcoMO0fr/nNTokPLzT6xTBQg=; b=oEYZeYCa08wcaY7yvXs5xNx5V3uLZQ/OOnVs4yjx5D9j1dF8xndgNk+OIu8FTfquzg c/UhbHyjACp4GOwZohXLT20fOccZscSuUTX+64ow4NVuRv7UvPqPHDL8uc8ZzBRLnjqF GOrbYIlFpHkekP1yd5iBnR/WzJ9bE3cp8h4+JuVdkuygG/9FEqdVU7Sf2dKB05uVy0FW zVNfq6c+i4ZqwRnbphzVLwSXPCnX4nu7eqi5cmZwMYBnetPBrPifHxxJ0rreBp+gGsy1 9Ivjdhq6ou+f0PrTiydMlLv5KiTHcDS3za3YSuZHnfaSSpREwn2Yz/p0oF1S5/J8xp2y o+Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=T13fc2CK; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46021-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46021-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX6z+lih9XHNc7kZ1wcZzGo3xKwiG0u+33HFtHceG2qGtwZDw0PopI2GRonxHJGCr/3Zsb8QvSeRdCTiyynJJL1MjVQ5g== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lz24-20020a170906fb1800b00a30f18765bdsi5415136ejb.5.2024.01.31.00.44.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:44:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46021-ouuuleilei=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=@tuxon.dev header.s=google header.b=T13fc2CK; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46021-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46021-ouuuleilei=gmail.com@vger.kernel.org" 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 D693B1F24958 for ; Wed, 31 Jan 2024 08:44:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0595669D2F; Wed, 31 Jan 2024 08:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="T13fc2CK" 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 C6184605D8 for ; Wed, 31 Jan 2024 08:41:51 +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=1706690513; cv=none; b=D7Ze12THUMwZXtSmj80UFFfve+eVeYwSxr7qfscjp23FefLr2ymr0ZXsRMmYxhdm1ZtzOp9eJk1rpv3IBq+ZK93vYO5A90WXxbLtBn5wsvVmQc7JAUhFkPUtsvwTThBt+Z6MDjiFP8UodZgXCE5VHqJsLqNoqEeOcBAOnjopizg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690513; c=relaxed/simple; bh=DYWljhVkT6KFyv0smmpo8+LSYn9vUohjIj0Lmz3vjh0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JpuwDnVDkddOa+obF78mmTru9v9qCp4g+rsiDp0kJbXjnZf3BxZ2xqSobSx99+TU/J68g7K3TYh/dlCYUDtK2iUKtrA8ZceLjCzQiOnzPZDKDJZs4tdCKQcEXIxYPB1kVEPndPKV/5bUJAktnS64wn+HiHvwMc63Op2z0BFaXBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=T13fc2CK; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so5907816a12.0 for ; Wed, 31 Jan 2024 00:41:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690510; x=1707295310; 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=CaQ1tM25xxhSkLymulSrQ/sxhsU4Dz/iC9pZh2/7m5Y=; b=T13fc2CKmbKiLV8ntMXOuzMWiM9L3y+2eMYv1/FLeNzzWbbeFI3nFFeAypeFWngDzw /xHLmfPdbjANmPnXOp3YdwO0I63JgFxIq8O2MqVAe6fiyrdeB+YQ0FXv6+DY/e1NJ2lw 8kLhQ1v/Huhvu8faQm6YojoB1hzq1s8rPSP60dF6IF0BRVUjfNdtF3mf+x+m0IjFt6gn rk87Bj1GCNrtGns4Cdxr0Q+oRocuRpBrahh/FB2yCa7UFXUdvEKcs96527LY1DgBk6U+ YBw5iA0qQbebfA5B6uAIWiFo1vSONRrnsz/gQ9BFYojdAKMT3bvkoNO3iXAu0P+SzxJZ h9wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690510; x=1707295310; 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=CaQ1tM25xxhSkLymulSrQ/sxhsU4Dz/iC9pZh2/7m5Y=; b=XxUj8hTDi/wnXX4GFCmI1WbXQ15g1NQd2zZZlZ/jI8bMYJPyw2CXKgJ39aXGh3wffJ Vn1IU/fM+omIyRuD+2Tz0JaoMbhv32BoiKc354aihKMkXBrtSUasAwrk4PMpdvLBKDPQ HACljPZ8xl1FQH5GAsLJ13uc+WkfIOAPxqaxfgdBic1O7RxC2JjF8m/b8K58Gul8OMo6 G8dZndEsiouIx282N1hJPWFc+OSROwRUS8xumd6XSBKdf3p5pPWsPfkTHh3cPpAp9Wxx 0l6ejYXJvvmBQbmIqmryT7AzMNxmpqfwVRPMo6L5sw/X2PmqmEnOPwKhT2mt3tRr6bBv iaxA== X-Gm-Message-State: AOJu0YymoRxn/MduG9SOJ7TzAT2mq4iQnaGpVbnkyPaMzBxErq1P0AEu oaA6p2yTFXhB/2mg6aDBn1t6I1h8vrQLCkP4UozCAuA1Fkk2GW+NcWpEHax/V9U= X-Received: by 2002:a50:9f89:0:b0:55e:fdf3:d440 with SMTP id c9-20020a509f89000000b0055efdf3d440mr558641edf.39.1706690510118; Wed, 31 Jan 2024 00:41:50 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVILS4ofhnJK2GcMawFhlhzzqgG8pnSa60pPFIYUZoW3krIL0pxFlmGRFwyR8iEW5S079Dwnn/bWZdRqsDKI+8GvRuMC5EqTkagEnozBI9FsMSbGifRxz+Iqv553HiNp1XRnWZPSm5uiaWphDAjJDOVFQSP6awKxlX274xeUJKl+pwXuebiC18yjRxtWvdyYe2VWTs0Bf/zTFTWXdSzbCmDvmh2nUyko/y5knR1VeSTV4y183DNEc3+3gkIfwcoDBCtqGQe7emxO9/RH1vw3PXZ2D58TReRsiFAGCcp5NtObp9/Q8je6HKXD2CgOMOh5mqo7IR4RQ3YqA0U550qH0qdoYfD4wKuttguCN90vmuaXnbG4fUIxbINhP/bxx2m/T/gbTwgM82F/4ENbLvQhWXCOZORtSivIi9aJh1OLsNDlTB8jeg= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:49 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 03/15] net: ravb: Make reset controller support mandatory Date: Wed, 31 Jan 2024 10:41:21 +0200 Message-Id: <20240131084133.1671440-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789594851300836413 X-GMAIL-MSGID: 1789594851300836413 From: Claudiu Beznea On the RZ/G3S SoC the reset controller is mandatory for the IP to work. The device tree binding documentation for the ravb driver specifies that the resets are mandatory. Based on this, make the resets mandatory also in driver for all ravb devices. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Change in v5: - none Changes in v4: - select RESET_CONTROLLER - dropped Geert Rb as I changed the patch again according to his indication Changes in v3: - none Changes in v2: - collected tags drivers/net/ethernet/renesas/Kconfig | 1 + drivers/net/ethernet/renesas/ravb_main.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig index d6136fe5c206..b03fae7a0f72 100644 --- a/drivers/net/ethernet/renesas/Kconfig +++ b/drivers/net/ethernet/renesas/Kconfig @@ -34,6 +34,7 @@ config RAVB select MII select MDIO_BITBANG select PHYLIB + select RESET_CONTROLLER help Renesas Ethernet AVB device driver. diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 3181fa73aa32..fd431f1a0b98 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2645,7 +2645,7 @@ static int ravb_probe(struct platform_device *pdev) return -EINVAL; } - rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); if (IS_ERR(rstc)) return dev_err_probe(&pdev->dev, PTR_ERR(rstc), "failed to get cpg reset\n"); From patchwork Wed Jan 31 08:41:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1752014dyb; Wed, 31 Jan 2024 00:44:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXkVz9OeIY88fV+S5v5r5YSOOdsKUN2ZaFWCSTfdb575CEZFLLfMXYpviPLtIPUI7XBcSd X-Received: by 2002:a05:6a00:14d2:b0:6dd:8853:ada8 with SMTP id w18-20020a056a0014d200b006dd8853ada8mr1559699pfu.26.1706690698294; Wed, 31 Jan 2024 00:44:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690698; cv=pass; d=google.com; s=arc-20160816; b=cPkCdAnrRCzCymeIuKLF5Avu3Okfwz87/m0/lQllQOht3CeEegFdIWa2qxVO/PlOLF vWQK9irca2TMR/UVvQAbZNN8gLK5aeyWSPpp8y2iFALJvg3S0RU8eF6qExS0LK8lRoSO bYy+fgEkPCteZDle8U0dVNPkqoJfW+wRHfMD3ZSKRSMZrN+0ECJv1mtSluI97upU0Hyh /+GxRl9gAv2XJWMX1nJ7y6vE3dpf4tMPXOpGR4JrdD2U2H3CCY/3HeP3o19zDTfFMw5+ aOTYdVgpea3p83J8Ue5g+zQ6gQKvQhb3wi+hxMn3VfiCxOD09aaQZ0DMwjEU/F0ntED6 tlRA== 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=NJFy8U7M4bryV96Zq0jRThjn9Ebbq49lbecxpcNk9ss=; fh=0RB5KIDnljN1QV29mG7KnRxKb3k9nUQ5XxgZGvX9tHA=; b=vEqE1iWu6XVw/dA8rs/ZMFRgufK3Wl8AR+4bViO0fThuZiMh7ymTd/nJVssiGcCyfk lGPCnbdYwsV3icrZvF6QUvHEs2NhxQhLaj8qdgZZACZOCkROBUGYVrERFquq1Hkwa6jZ p/qEXdr85IKO/jA1wJimnl8zthLQ1JUQDZ/KcuvxPioWlCjYHAHVuEIF6LSbboEC2VPz 88zMJRtE72IUp0y0kgkDz23+DiLdVOVFgLtq34KFLqJ8DFhl1JIiuZeBIeu+RKpGpus0 v/Z9MFd7A1piJ9eaYmAN/AFalRM8C0UEkRngFXZenTf8NQkVjImCpdxFPxLbdFRFd3Z/ vcMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=m0W6mpSA; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46022-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46022-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWWJtsZA/Hj7CMWvu6SCWWRtVWjbT6xH8w3+7IQH4LK24tSMWLDvjcDZNWbvMwe5n3jUofYrX7/7rJpQtsWQVLGRAm75A== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gu5-20020a056a004e4500b006ddd08fa3d2si9042590pfb.247.2024.01.31.00.44.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:44:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46022-ouuuleilei=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=@tuxon.dev header.s=google header.b=m0W6mpSA; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46022-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46022-ouuuleilei=gmail.com@vger.kernel.org" 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 100292829DF for ; Wed, 31 Jan 2024 08:44:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C7B76DD12; Wed, 31 Jan 2024 08:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="m0W6mpSA" Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 34EF066B5F for ; Wed, 31 Jan 2024 08:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690515; cv=none; b=PJxX6koJ8bTSBbZg1mv68pMyO7MMn1dXql2pGSpJLVqbBY2HclZQJtifk6Q/egeNqGGsbtfKwgGcu0FlX1z4vrXMTJMe38bCQDMqoW3zIm4B8BdqhIWBKZaXSaXSmiPi2U2zlFqelqwnprArOEJ1yEzGmN7CiRS8tSSO8YRI3Qs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690515; c=relaxed/simple; bh=dklOpKsyY20gACcIKy4CcTI5WliooZ2yY0L9WV+xUdM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qqD4DeZmE0u6iECo8Kn0Q3cnLsjMABqXUd6PpfwoGjujZTqSKB+fQJZ6UMTYolZiH07vy50nWi0qltZXE3a35VQDjPu9oPa/TnEI+TzbEwcpSQ7DGnpFuljr2awg8T/vo1YSGaK2SpRPHAZoWdHTQU8yeInV7TpviBOE3YIOyQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=m0W6mpSA; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-55eee4a042eso4196446a12.0 for ; Wed, 31 Jan 2024 00:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690511; x=1707295311; 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=NJFy8U7M4bryV96Zq0jRThjn9Ebbq49lbecxpcNk9ss=; b=m0W6mpSAbEY1ButKbtsIumfUuDxjn0xYXCZNY6+zbpuDLKLoEM/OSCCpYJSey0e4+t SYSRYlKK15UcKLOM6/YBEsrj2rTSEiIOmHJcXJdAphJMNK0NFsD4YzTmZf5JJ9U/hU97 KiK0Ts6GHBnvQDDGdyExxVJ043zMcuT954tn6e7LT02Ik+b34wYKmix/rTV1E/0IQBsJ i0lf8jX2JTfwHrBDFiWZ3VhST6j3nGGD4fonaUybymQKS/q7XDjCPLqL2LpXhyXo3f0A PmOSy/v9ceQZ8JyfjSTZG5dqxKpuL2I4oyjxKXPFN/Ns0PzAh2PGFTzq+koyHUB/LTPj eUCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690511; x=1707295311; 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=NJFy8U7M4bryV96Zq0jRThjn9Ebbq49lbecxpcNk9ss=; b=bbUMxrIx1V+mh7+XidTvtUOeRSaIUlvOd/+/iscfHS64MT/R2pdgjuYOFCbgJBeECs 9KMj++/qNt0ZHXPOxYRjrNM2Wgrh967Yy4iz88nsxSPVzVyE80ljLQ+RSWeAcMWRKLAJ QwGliblQMhakDdxwRK3QovwYlAMSHy+hvrM2LeE7B14dF3ucR34N6asxKCbd27qJ1meK YTTG+y64cdt2+74NZVEpKLojpuL3jjfKsHtsBBC6YDmWqSUuUyX0LyxVCynk8sRnGvtz KZrp9ucOs4NEL4trQcXfbhln3NuIzonrjQ3qfvMlh3iWzTVnWd8XqL4pf/RPALrm4dNb XtyA== X-Gm-Message-State: AOJu0YzB0+SHshtem3r6kFqZ+W7Y5BNms/fmSdK7M8EgC8eZluxZveIv Z+UkJWsMULqx1kr/jNyR6v2ZaDZa903mgxrllHLhtTVzijU4fTQqWg4MYAw7Wmw= X-Received: by 2002:aa7:d897:0:b0:55f:28cd:bb42 with SMTP id u23-20020aa7d897000000b0055f28cdbb42mr592294edq.10.1706690511422; Wed, 31 Jan 2024 00:41:51 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV8slgI9Hwzsyh94xWW4P4Yqr9iv4C0VIpCYRduKf57Dtl4RRbiTtpnkv2ZwxvT68F6trj1TctScQGC1SDmZO6no2g/DwBJ2h16HKx9o5OceLICxeOWdL98irFE+qSvM9yn49kozVT0Vcu/aYBtFjGuF1RE6TH1OUrsgh+RJ+6HRBlCzeQTvx0AOv8U62lFdyz6cxiFddW3NIZonD2nPUddsaTMbfvHIJgH4fEnLkv0v+UxJSc72bK7SfdvaR9ciMdq5K+ZNu4fiXZLQV1J1ikakBeTy3sC9c8M7UD4qskc0n3ixJRdXWLNbtwgVRH6lvUJESHfyulsO1X3KnAgOKsY2rYIk1GitSOLyyI2hInYPK4T4oMggNp/6uaMn/OaAcFbTvtS1eFQp62WRD979AjzRPzPudN3VhT1ndqz+dHuNuW3mD0= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:51 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 04/15] net: ravb: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Date: Wed, 31 Jan 2024 10:41:22 +0200 Message-Id: <20240131084133.1671440-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789594906018770920 X-GMAIL-MSGID: 1789594906018770920 From: Claudiu Beznea SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now and require __maybe_unused protection against unused function warnings. The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows the compiler to see the functions, thus suppressing the warning. Thus drop the __maybe_unused markings. Reviewed-by: Sergey Shtylyov Reviewed-by: Geert Uytterhoeven Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - collected tags drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index fd431f1a0b98..7ced5db04f75 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2971,7 +2971,7 @@ static int ravb_wol_restore(struct net_device *ndev) return disable_irq_wake(priv->emac_irq); } -static int __maybe_unused ravb_suspend(struct device *dev) +static int ravb_suspend(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct ravb_private *priv = netdev_priv(ndev); @@ -2993,7 +2993,7 @@ static int __maybe_unused ravb_suspend(struct device *dev) return ret; } -static int __maybe_unused ravb_resume(struct device *dev) +static int ravb_resume(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct ravb_private *priv = netdev_priv(ndev); @@ -3052,7 +3052,7 @@ static int __maybe_unused ravb_resume(struct device *dev) return ret; } -static int __maybe_unused ravb_runtime_nop(struct device *dev) +static int ravb_runtime_nop(struct device *dev) { /* Runtime PM callback shared between ->runtime_suspend() * and ->runtime_resume(). Simply returns success. @@ -3065,8 +3065,8 @@ static int __maybe_unused ravb_runtime_nop(struct device *dev) } static const struct dev_pm_ops ravb_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(ravb_suspend, ravb_resume) - SET_RUNTIME_PM_OPS(ravb_runtime_nop, ravb_runtime_nop, NULL) + SYSTEM_SLEEP_PM_OPS(ravb_suspend, ravb_resume) + RUNTIME_PM_OPS(ravb_runtime_nop, ravb_runtime_nop, NULL) }; static struct platform_driver ravb_driver = { @@ -3074,7 +3074,7 @@ static struct platform_driver ravb_driver = { .remove_new = ravb_remove, .driver = { .name = "ravb", - .pm = &ravb_dev_pm_ops, + .pm = pm_ptr(&ravb_dev_pm_ops), .of_match_table = ravb_match_table, }, }; From patchwork Wed Jan 31 08:41:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194587 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1752032dyb; Wed, 31 Jan 2024 00:45:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6YaMam0B2O+0v6rbiGRzcaTeCAro93Hveg4udOIkdL+UaV+rsKT23NjvdOAUSTTwa4cog X-Received: by 2002:a17:906:364a:b0:a2e:70b4:28b0 with SMTP id r10-20020a170906364a00b00a2e70b428b0mr536538ejb.3.1706690700954; Wed, 31 Jan 2024 00:45:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690700; cv=pass; d=google.com; s=arc-20160816; b=Tn31ta3s7EUqmgAovhtGkfv8yzj5G04fiLDqmGDszVTyWg9XxV/og0KD+JuJ3FB0Et eS9mdtRa2i6hEB1g84vvAR43SLDJX8W0a0LX2Sb+yvPLKuG8+cmQzylgrDGBVs1g01Zu S9YQ+jcsNLiMcu6FIgmSbkHLFUYpI3eNQ9seKHZSopuIeb2ERhBnAPoZQOHZYezhs6Ol V7uu+qPAf4ui4yBq0gpowvjgh7XTLJ7+8q9gcnDUHShKClKTSHViNSRHalVyn4REfU8R OrP4GhwNVQoQqO+jqa0m6LGE5tfmlO5MYQdpWjcI+SEUoYmbrJ3fFTx3KhUHJBc6+8di 8CJg== 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=1vYE6VGGaC6dDiCeRDs1uRAAsGK/Jz27M4TajzPwZTU=; fh=4ZcY340riBz/9fGl1skqg8E9azctigUI1dA/ks5zNj0=; b=tjQGoypMiKaqGdEdiVyXzSblZRlR8Ll//NifgqdyzX1/wMaAw/O2ThvjluFg+wLFTT O/N0OxC1fEeUmXmWOxPrjjC6KXn8RxuRzo+mbCh+41KtivTgoDcuh5iypaIHckIjYdLV tTqBK/wJph7+a/9TEFYV69luhB/JcbijM+ltKBGqBOuLlnta66bgRVIyEzKfJ8Md+RcF aD49T2OSdKjee1H1Ogh8XveJjZUlVFc+qNHbnnPcTvhwbijYwUtkpLQ1FdHxillXpsRe /l1q2ajSSmz0tXQmVrk0cO45KHw+eYQdqaSkORGbuU+j/HMa8KCV0G/IY4eVF2U9BusO 6pGw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=qK9X4mmE; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46024-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46024-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVRT56vi1ACu3QU66Mk/l46PeDX0w6eZ6cz8mcUDnU1osGq0oU3oESLoCrexAQsM2tPFGD0iVVp7pjCwrg3D+u0S9SXOQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id jr1-20020a170906a98100b00a3595c69068si3350715ejb.445.2024.01.31.00.45.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:45:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46024-ouuuleilei=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=@tuxon.dev header.s=google header.b=qK9X4mmE; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46024-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46024-ouuuleilei=gmail.com@vger.kernel.org" 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 8FCC81F25CB4 for ; Wed, 31 Jan 2024 08:45:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BE986DD19; Wed, 31 Jan 2024 08:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="qK9X4mmE" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 7F4BB69953 for ; Wed, 31 Jan 2024 08:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690516; cv=none; b=ZspiNpqlV1MO4YQ0eBecTVmDmWyX8HS47/sI3fO2+SbpNF8Rj5TcfGK8jeJnt0ooui5d/a1o7gXvOWCW++ffHAYTIkDbYj1cy3+FgvJoNg4r1Rxh55hBp5SmZKWJXNMG1IL/2CH/eJKPg3KzeuhH/s5g85P70j1/bIkdnUQLuyQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690516; c=relaxed/simple; bh=F/pQ43TZd0yxTybIVFp9YQ1lJIzC8KcINVjpd5TwZSY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S5avkXc1GkguhdEbQrF6NPeRyab5aEKuq2/KeFl6l2Fa5onfETuTOlAnRzgbNzdWFPaRh1Pd+0w+fmBJ8k24xGdmgErv1BSDgmsKeJslJhkZiX8MxDvbq33pLKdaWUh3DcrhIy7iI2AlJsGUqMXme7rwSSalzcDM2/CT6Fh6e7E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=qK9X4mmE; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-55ef011e934so4243107a12.3 for ; Wed, 31 Jan 2024 00:41:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690512; x=1707295312; 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=1vYE6VGGaC6dDiCeRDs1uRAAsGK/Jz27M4TajzPwZTU=; b=qK9X4mmE5DLWMZWhaS9MWU+C2slURJijqI8YhKW/Q+vL34nR15YleS8d9UkD5vYNwO Dl0SXDQ3mQyHSj4ZEgq1M60xE9HTv1a2WKluPF9ykz+f0cbYWiFjST2lAnRVsSWLWN1U IFICrTWAI24bKUFDqHamoqngpLgPeEWK3T1b9pVqh9kuh5xg+jR5qmTjdiChL0CxOurm Crzqdf8HxOZaSe8ZcnBlSBupcU8Jjff0grup1QZPPq0yGZy8+4KBpMfEni3alSa4IdQk 73UDiT2pJmspsAkoC8hoCb22zfT84OFsVegPNR3wY4zaRBWHCvVWWVuLjjDaKlHaLBjL au8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690512; x=1707295312; 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=1vYE6VGGaC6dDiCeRDs1uRAAsGK/Jz27M4TajzPwZTU=; b=De5OxQ2WSzftTI0oCaD6QcAQY7rWcDsa4NOlBqcIRBOE/ugefLMeLklRzaj/la77BJ K0tsZpzXmMacxo2FSK+UpM6rS1LdTk+kSr+80yFd5Gv8NualjLHvWD0pg8b4D+NDEvi8 0b6obge6JHs33K0pr3l0Q3jLCinzBMZxceo8oKS1ZZVkN8e8aLRdOwaAmS033vSKb5Gs uaDY3GSN9QLmI1w4aTbMKXc23b4BWM6NheFhDjh7Z6BMxUs2lAw5VPfAJjlNAcHR+IW6 A8tEzFI9oANa1AWz/teE2qcPTSBbeAw5quRuyQvlyRWr9kre76sj3PuLEHDIpf9e9Yw3 8YTA== X-Gm-Message-State: AOJu0YwzwDB3FSWKIP4YPrj19bAO1msz+ccfLG7rIbMrir2GTM/1kUgu pDJZH0MgyIZkmOdU5Ui9pnzsZBkmQdJ1mt4kQQpG/JCfA3+hWYtkXEJ/DhFb7l8= X-Received: by 2002:a05:6402:64f:b0:55f:3cb:9cfa with SMTP id u15-20020a056402064f00b0055f03cb9cfamr628504edx.30.1706690512682; Wed, 31 Jan 2024 00:41:52 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCV5j7LOeqH5BmenUWvzCmo2qCBc9iYVyjhYr3FrubKe3iWE6KVctdP7hRDi8vvMV1Q+Z/GBABR1kHRE/19Feaj8Tv5TKj2vG+Y1h7Qg9GWhLxmuK4SOiiCd/fg6jwaqha6DLNmRN3B7cvztCS5qZY7GmEejRWlMPHS1cLsERSl0poDKOuR/jUa+JK041ZemacvNbKxy0yi9aq+MpyN3f2QfeUjTJHHkcP+gTeTEFQEQGCxLgm3sPl03aXZtF/pcb0mVL6FH0Kus3Jouon0yMqSlipCYQlqwZCRx138lUr2e9CO+mP3SSzBkvOGbfyyvrKeKqP7866Ux+DnkG6x5ZCiEOwZ4sp0hg8Trf3Hkn576aEDaxhOZcH4+GtV4+LXf7qVxNfvm7/hiD8YvVxjOImQOYVomJYQu+BmCtsi7zStfwy3cMxo= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:52 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 05/15] net: ravb: Use tabs instead of spaces Date: Wed, 31 Jan 2024 10:41:23 +0200 Message-Id: <20240131084133.1671440-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789594908283348407 X-GMAIL-MSGID: 1789594908283348407 From: Claudiu Beznea Use tabs instead of spaces in the ravb_set_rate_gbeth() function. This aligns with the coding style requirements. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - collected tags drivers/net/ethernet/renesas/ravb_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 7ced5db04f75..c05d4a2664eb 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -96,13 +96,13 @@ static void ravb_set_rate_gbeth(struct net_device *ndev) struct ravb_private *priv = netdev_priv(ndev); switch (priv->speed) { - case 10: /* 10BASE */ + case 10: /* 10BASE */ ravb_write(ndev, GBETH_GECMR_SPEED_10, GECMR); break; - case 100: /* 100BASE */ + case 100: /* 100BASE */ ravb_write(ndev, GBETH_GECMR_SPEED_100, GECMR); break; - case 1000: /* 1000BASE */ + case 1000: /* 1000BASE */ ravb_write(ndev, GBETH_GECMR_SPEED_1000, GECMR); break; } From patchwork Wed Jan 31 08:41:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1752220dyb; Wed, 31 Jan 2024 00:45:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFU0KilVu7GRKT/fAovE7FlciYSfMtSygGExKJIVPaID0Lbtx59sGh7H4nV72CFIHeR+fs9 X-Received: by 2002:a05:6402:5d85:b0:55e:b943:6277 with SMTP id if5-20020a0564025d8500b0055eb9436277mr573865edb.22.1706690729940; Wed, 31 Jan 2024 00:45:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690729; cv=pass; d=google.com; s=arc-20160816; b=vjUKont3HUeotnqYtTuacL17wmJ33Z3XofFlhaoi8scezpYLl1AnfIquQK5sZgAmoa j1eXmqn2Z9DjIUIfLi6Pn3jaEKikKmILdp7Wem5JdD4ixL2N4ykBsDJgU82jZppv4Ab5 StxP4A2UdD6d/CxBC07q37oyJFw/xzZyd9aqEzIc7FIPEPtH2EGnt0p4J5QwOAIPNkn6 FHZpZixcwaRyl4I4w65/he3MXbn1Ro09jKQVEQ78QyXHFOgTducX7DtGO1/8HOWt9bXJ l47/auwhs8j0vYfPsN3TaEehQnp73LgZWfDB2YlDXt7NXMcUBEt5AZtzy13Dv01+9jHJ FaNw== 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=itOIGVA3R7eyMhVQYhNOchTm4KKMCVx7yc0jtC14CEA=; fh=92HFfOiVS+JhQzZtsEcgyk/4HdMd334zJ5JFefrdxJg=; b=a2ZNuJvzTMFVEuwpTYsgc1UCHuUVgae8mknHjkUmCQQOkaAIWAZLZYE9PUmaMvLaKu GXaIjipzGxCuTAb7GV4Jc76zxV6yyByJ9onWROAuYT0y5oOP1NRocfq0pXkqzRc04KdA S23KklYsFbnwlAJc5IrlYxzpwcGw7pcad56C1OvqkUT5tvv9qodiv7iF5JUbk0rVqpy4 kTTMyJNptubpmY5uRuAlLaevev4PW8+gEs1/pkchYohb+p5HAkmqMWH5TgG5de35ZbxK ui5ig8SjMgWbzeeLiC85Almtd4zIkxswAgl8Hde4O1pb4VUe27D3VWIW8JUmm3mePzwF 6wog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=qXe4WuFF; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46025-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46025-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUQgPIERPtE/9Bv4stkPGOHH59KkEmIXdQwJUxTi/FlFMgVP7oc/LQ7MiuALEtmQ2RvSLxYtlKiuwPqZ4dN4Qt9Tr6VeA== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id fk5-20020a056402398500b0055cef76e489si5469912edb.84.2024.01.31.00.45.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:45:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46025-ouuuleilei=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=@tuxon.dev header.s=google header.b=qXe4WuFF; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46025-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46025-ouuuleilei=gmail.com@vger.kernel.org" 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 7504C1F26433 for ; Wed, 31 Jan 2024 08:45:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A2F274E18; Wed, 31 Jan 2024 08:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="qXe4WuFF" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 B330769978 for ; Wed, 31 Jan 2024 08:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690517; cv=none; b=t+U9wceKatsunF3hdtF8XiHS8WzmraXWo6KlPPSbPdKaVp3OnCh4MeplPsynhHLKQUGLC7Y+jjVJ6SHlxTO19yX7yEFwVeZeKAZFKZGj+zKv/iw8S0HFyStVWUfsymmsQFtDJMrzGI+obJRrpnyf9HwEOP+BH+l26oyfuM/Lses= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690517; c=relaxed/simple; bh=/PWJylbKKwrgWlPJgrOJpkH0IScCVBZN792i+Gp+2SI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G56ngFjUxmkVceiKZuccoaxV6S0Rzu+F4mpWiUlsSJpHfWfQy6ddQhpuBnZdSpE9izn10DDqcIYh8Z5ayQcNM7jH9VkYBb3TVa/JYPaDr+C5ySr3ZyaMIm74+ltsigoz/zcrIAOD7+cf4VZ2wo4QjSR8we0nuEiCZ6B6Ik1PPn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=qXe4WuFF; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-55f279dca99so3454918a12.3 for ; Wed, 31 Jan 2024 00:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690514; x=1707295314; 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=itOIGVA3R7eyMhVQYhNOchTm4KKMCVx7yc0jtC14CEA=; b=qXe4WuFF/jIibmNYjRzxdXnwE2P7yHJJUwh0IX/kXluVSkktU4EJ5YB9Yz1se12gyb qqFc3DLkPehoPlU47mcs99zFFlrafTGISMkBIdy5VnM/Yt2Tw7l+e4paoGzNC+1XJqOK Qpxomv8J8fUBNuoyfJkS6ZHYciSWPqrq2768P+qPTsD0gtGk6/NRveNghVVAw4lFL6j0 IznFAQTgtaWJI7emXI5XuG3xXTIJUi6LSjglhS3dqCg9XGQNSFmXS4Oa1rfIjw1E4tuQ mpcYWMVzDgMBzb8WnW13EDqVcDRmPxjgo2HOPpxKMZnWU5YQAxqGu0+pd7cT3P5KoHJX AktQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690514; x=1707295314; 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=itOIGVA3R7eyMhVQYhNOchTm4KKMCVx7yc0jtC14CEA=; b=ZDCalJllnGpsAwb7bSDx7qBiYFPOBDreNPMTUwtv+C7+iqABVWQGkDEOdjKG3mxtRX B2R/q14eKxs7m71PqyVXtZvffC0CMgcwa8OfrFzRBQhjB97s7qn5GZIRoN5AgNZy7iNN dVeSa9g344jK8eY/bD2MG/VGSayA4SpfNraz/u5QJuwu9zpvUF8Q646htjO+XfgFWkqI /PdNa5NI2hjZefZzjgKHjlnSEHoMTS7MZxWtmPwZLHVYISN+Y9/c9guuA5SfrvR0EwPS ml9oNxpL7uAuvGH2GXMzaaBmdimZYA2SHgqKpeurBHcQMWE538V15ABXhIRT+F04ZU4Q BWXg== X-Gm-Message-State: AOJu0YxhhpG5o1uey7zPoY8KA81WqHfgzADxFkaxjJuwiJGG2y/cFN5Y x+uAF5CaqwGNs6/ikAcbyxaW1P+WPwf4c/00OtdMWx3fENCgPtDBtnH0qEdthXk= X-Received: by 2002:aa7:d295:0:b0:55f:80e1:29 with SMTP id w21-20020aa7d295000000b0055f80e10029mr581032edq.1.1706690514031; Wed, 31 Jan 2024 00:41:54 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVOa7jtGLIUOzbqQlRyo7VdLl2vPSo50eXt1GVm+ze22BKVkK2vAwQy30mcxXXWsk49Buip2FgifGbUKUW2PKpUWqAxmUMuJPFTiP/vj858c1fKxX+GaV2MdSPu6afhocNYu6xXgCCFFiw4M1DsMKuRNOddHzMKyC5qi+5CIpPxIOMyp3owAsm1+BPXn9vsRO8g5KgLFhpp24J+2Y2u3sBBrS3KykLjVXlT6eql1dTjJvd94SsjGKMbSWYKQH4srHfakkrivvKiYVNO+P1dz6X1EblE1bzDg6z/0+eepILVQtQXUOrwHhJDQcx2SZHomtAyz6KtrGSXZt1JJA4I4KpO0mCro0agXucYU6V2IwqSddMpQN3Gl6gZU5hRusy7WnqkYW2K7ZecZ3spdSYslbfAjaGIWM3SVu1ccNtTTXlVgqR0U0A= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:53 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 06/15] net: ravb: Assert/de-assert reset on suspend/resume Date: Wed, 31 Jan 2024 10:41:24 +0200 Message-Id: <20240131084133.1671440-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789594938515764669 X-GMAIL-MSGID: 1789594938515764669 From: Claudiu Beznea RZ/G3S can go to deep sleep states where power to most of the SoC parts is off. When resuming from such a state, the Ethernet controller needs to be reinitialized. De-asserting the reset signal for it should also be done. Thus, add reset assert/de-assert on suspend/resume functions. On the resume function, the de-assert was not reverted in case of failures to give the user a chance to restore the interface (e.g., bringing down/up the interface) in case suspend/resume failed. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - collected tags Changes in v2: - fixed typos in patch description and subject - on ravb_suspend() assert the reset signal in case interface is down; due to this the Sergey's Rb tag was left aside in this version drivers/net/ethernet/renesas/ravb_main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index c05d4a2664eb..c2b65bdad13c 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2978,7 +2978,7 @@ static int ravb_suspend(struct device *dev) int ret; if (!netif_running(ndev)) - return 0; + goto reset_assert; netif_device_detach(ndev); @@ -2990,7 +2990,11 @@ static int ravb_suspend(struct device *dev) if (priv->info->ccc_gac) ravb_ptp_stop(ndev); - return ret; + if (priv->wol_enabled) + return ret; + +reset_assert: + return reset_control_assert(priv->rstc); } static int ravb_resume(struct device *dev) @@ -2998,7 +3002,11 @@ static int ravb_resume(struct device *dev) struct net_device *ndev = dev_get_drvdata(dev); struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; - int ret = 0; + int ret; + + ret = reset_control_deassert(priv->rstc); + if (ret) + return ret; /* If WoL is enabled set reset mode to rearm the WoL logic */ if (priv->wol_enabled) { From patchwork Wed Jan 31 08:41:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2073088dyb; Wed, 31 Jan 2024 10:16:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmbMEUf8PjCcQoIe5tZyTfglu3iKaGcEU77zbB6Qzz7d4vw35INRLSvIqkJPOkbC8pmrMa X-Received: by 2002:a05:6102:2909:b0:469:8ddc:bcf with SMTP id cz9-20020a056102290900b004698ddc0bcfmr1307873vsb.4.1706724971959; Wed, 31 Jan 2024 10:16:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706724971; cv=pass; d=google.com; s=arc-20160816; b=hEe4sFcPvoQm+2x/gwF6W5dEmx262rlp/O1oK2r7W36L3YV5W1462Pb+HYUA5DFDaV uOoRMzdbeRkmh+HvDCMaaigKPIHxpp30OsLPbAgEsqrr14+UhjF9liak68sLuqnLGKRL QjbMNIkT741Nh5TXakZU9JrXGfRdYiRMSQhbr2+hQ8B7IDWFaTXhpiIVEzdM+wWYI8wn /Kd9ooc/XNPMYzK6SNUWuqnEQndkn0iMcVQw5PsSz6kqOs6WUjGwzkXOE5iV8xi/wNj6 hyzuOFQc5oJ0q6VoiXwR9GoC36c5XIhEQZEJTkKQsw77pgvSJuxGRk9/muvFx76QcOty vvhg== 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=21CiIC3Re4xYSF3pmN76UhVGc5ntYa8GN7cTx6QHvzc=; fh=/Bj/N9XH/tBCh3HyvKlLloX/Brds8EZPlwWHSSDHF8w=; b=VIBVxXMyhTpuymtijXB4qlyYIDYdmbAtohTWUQzMBEIptiQLvQYOZrBvQVPDRw1MhP sRHDTRxM/VeEd+jM6MbC6AUl5NC6Hypux+PlYqnqIlPQcuUFBSTlrl2H+NVUyhSd2yDU sNdCr/FaK1V/L9dJJKBAroVax3jp0h2gIlw4tuf8cJ83zNCQDppUVfjItsINtgICijNK d4saRWapTpvdsvbEnCP5oPcaKbumu94hkqkaTzr1VSgB9s0kdgQc95SkC1lECEMkaKGE /xmOU+lwr5425PBKhgwOACSOSGlWCFBS742jEHZ3IzMJYoiMNmYC3HKErCI6LwDrzdRP Hc4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=fZ1HZKrF; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46027-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46027-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWS5zw4CoByu+gNiMoRYnf87JJPnVIvAEIidaZvKPnVNCqADCSNzS3Ds6maIZZ6FQAPNeoHA9wpz0jQ3PWRA3nun8nIHQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h37-20020a0561023da500b0046ca560d157si579360vsv.770.2024.01.31.10.16.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 10:16:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46027-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=fZ1HZKrF; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46027-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46027-ouuuleilei=gmail.com@vger.kernel.org" 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 78FB51C23293 for ; Wed, 31 Jan 2024 08:46:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37C0078B78; Wed, 31 Jan 2024 08:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="fZ1HZKrF" Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 535F069DE1 for ; Wed, 31 Jan 2024 08:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690520; cv=none; b=Fia/nGY0h9zokaO7LHJqQXDx5Dmrt6qxNpRJ5rliKBrDfYpY0q7n6r3SBI0fIiID2WRCLj4Q7Fldr+evRWJRRugWjj2witcm0qKgpbzWmu9nzWKmPoFJU7Ig5+HHDdrQUKKf9BWOIaHO7G5TWTJWABUn/n7LrhEYsuGo2Dd+/hA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690520; c=relaxed/simple; bh=Is0c9bbZxCn+5Ie2CiggMb3E43fx7P0CqT2K/j3UZX8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NdSjMT1TPPEjPDarA7Pi6iirA+hftqN81yjo5QroxEMaihlH0ZJZCp8DemkX//fyME00+aO9fQ+wxuPV+D28nUm+nI08eSWUSot46N1hKVbZ5oDW95g26gcv39Pu82amgomsGptMu6CaZhjjD47pwBaYKO5F0H76huiDhISP7tM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=fZ1HZKrF; arc=none smtp.client-ip=209.85.208.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2d057003864so23610141fa.3 for ; Wed, 31 Jan 2024 00:41:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690515; x=1707295315; 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=21CiIC3Re4xYSF3pmN76UhVGc5ntYa8GN7cTx6QHvzc=; b=fZ1HZKrF6wjrxPmHlDwh8Yu8NQ6C2EOmqwg6TLeBI5gCW7vJSGs7m8jAZ5/mumcxct CoXERaBM8qFYaAe7b7yZv3cOnIS1gPewhgA+b/xaqkflqtu3sQ3uhHskQFv+ovsE1ioC rzNpYk5S9LGiszOzYjPCR2uCnVOIxBalQBNTj8mzOVfWHQjK8jm790RURKYlklXgIwmJ o83ecksGHfPfEneQzp5RHckoOG1xlMsUBkgSUPzqLfTNbNpJ5AmhX7qxi83MfOVUl6Sa R5GASdgPfznSaV80yDw4mRMvLm0cRQlzydDuSLp461olZgKlvI8s+jhw0L1rFv1E9g8d qnUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690515; x=1707295315; 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=21CiIC3Re4xYSF3pmN76UhVGc5ntYa8GN7cTx6QHvzc=; b=JLjHRoblxbM5olWpU1U4tcL3MrUDYAilwHFOO94Xr0DRS/8xHriieJgWUSbX72ZaJ3 iOcUl3PoXLu4AWxjsl9AfzevHc+UjMENLX9omtDBWvktQmsv/3ghHMskqiOgNDQPnlHn JRFPwpTWQ2QBx9yiYywIAaHvlhAZ1nn4vic2qRvTODNaS66y7OHzaI0Ku5K/+QF9KcTN YliWxys90kNBJ52wAKPW7lxNsOoHizn6LDZxKffEhxCDDVGxlciYGXU1DpI2xyiF0ifa PxkNnVemHemZsUjQjeAjmLFwyY/zaYQ+F4FvgzmS+RXzPejTBswtw3hh7+oId8xHJGXG sojw== X-Gm-Message-State: AOJu0Yy9wSzj9K+OpW0ZrAmna44hj8QPrg8gv4tH/aVTtOsmR+EKecEZ kJAf7vpFv1CDrK9g7PsMpXdNlLaML8lNNWsulTy0VUynm6A/tUD/EGRgfrtGkCQ= X-Received: by 2002:a2e:b6cc:0:b0:2d0:55ce:63d5 with SMTP id m12-20020a2eb6cc000000b002d055ce63d5mr610639ljo.26.1706690515351; Wed, 31 Jan 2024 00:41:55 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXwbCelHuuEVd3jkGZb91vi+k/bn3K+Yms81FHit1cGJUnzwVUyxYoq66cNIuG/rUtYFlNfAMKT7n9kknSc4xE6jYnTRyVd75kU6uBLq4Z2Z95QyP31acE5kUc+8JfNHo1GfDHiglw3WbJtxXUjmUTJCemcGldFrzfRUdls+JkT6Gv8lLhIi5S+llfUFuhM9jbbq927RoMqY2ad3dQyAUtw74xrLFS3tNqIA6ApsBi28snEtGohHg7q9d5qwvwiSemZ8ppqEOIsMZbhqviFSk1g/XlO7JvngE7UV29FHolXlF9uOIWKTDpzaaUZPU2Hnnn/s0lj8W8lPSfH9InHfnRJo/BYys8T+4nqrWZ/rpj7wS68n6rJn0KhqzZA7qEBF4dKEgiupZxLtIaFptXTE4VRuRlbQClNLkUYCQBKJymDuaURtxQ= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:55 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 07/15] net: ravb: Move reference clock enable/disable on runtime PM APIs Date: Wed, 31 Jan 2024 10:41:25 +0200 Message-Id: <20240131084133.1671440-8-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789630844052236246 X-GMAIL-MSGID: 1789630844052236246 From: Claudiu Beznea Reference clock could be or not be part of the power domain. If it is part of the power domain, the power domain takes care of properly setting it. In case it is not part of the power domain and full runtime PM support is available in driver the clock will not be propertly disabled/enabled at runtime. For this, keep the prepare/unprepare operations in the driver's probe()/remove() functions and move the enable/disable in runtime PM functions. By doing this, the previous ravb_runtime_nop() function was renamed ravb_runtime_suspend() and the comment was removed. A proper runtime PM resume function was added (ravb_runtime_resume()). The current driver still don't need to make any register settings on runtime suspend/resume (as expressed in the removed comment) because, currently, pm_runtime_put_sync() is called on the driver remove function. This will be changed in the next commits (that extends the runtime PM support) such that proper register settings (along with runtime resume/suspend) will be done on ravb_open()/ravb_close(). Along with it, the other clock request operations were moved close to reference clock request and prepare to have all the clock requests specific code grouped together. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- Changes in v5: - fixed typos in patch description - improved patch description Changes in v4: - dropped tag Changes in v3: - squashed with patch 17/21 ("net: ravb: Keep clock request operations grouped together") from v2 - collected tags Changes in v2: - this patch is new and follows the recommendations proposed in the discussion of patch 08/13 ("net: ravb: Rely on PM domain to enable refclk") from v2 drivers/net/ethernet/renesas/ravb_main.c | 110 ++++++++++++----------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index c2b65bdad13c..e70c930840ce 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2664,11 +2664,6 @@ static int ravb_probe(struct platform_device *pdev) if (error) goto out_free_netdev; - pm_runtime_enable(&pdev->dev); - error = pm_runtime_resume_and_get(&pdev->dev); - if (error < 0) - goto out_rpm_disable; - if (info->multi_irqs) { if (info->err_mgmt_irqs) irq = platform_get_irq_byname(pdev, "dia"); @@ -2679,7 +2674,7 @@ static int ravb_probe(struct platform_device *pdev) } if (irq < 0) { error = irq; - goto out_release; + goto out_reset_assert; } ndev->irq = irq; @@ -2697,10 +2692,37 @@ static int ravb_probe(struct platform_device *pdev) priv->num_rx_ring[RAVB_NC] = NC_RX_RING_SIZE; } + priv->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(priv->clk)) { + error = PTR_ERR(priv->clk); + goto out_reset_assert; + } + + if (info->gptp_ref_clk) { + priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); + if (IS_ERR(priv->gptp_clk)) { + error = PTR_ERR(priv->gptp_clk); + goto out_reset_assert; + } + } + + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); + if (IS_ERR(priv->refclk)) { + error = PTR_ERR(priv->refclk); + goto out_reset_assert; + } + clk_prepare(priv->refclk); + + platform_set_drvdata(pdev, ndev); + pm_runtime_enable(&pdev->dev); + error = pm_runtime_resume_and_get(&pdev->dev); + if (error < 0) + goto out_rpm_disable; + priv->addr = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(priv->addr)) { error = PTR_ERR(priv->addr); - goto out_release; + goto out_rpm_put; } /* The Ether-specific entries in the device structure. */ @@ -2711,7 +2733,7 @@ static int ravb_probe(struct platform_device *pdev) error = of_get_phy_mode(np, &priv->phy_interface); if (error && error != -ENODEV) - goto out_release; + goto out_rpm_put; priv->no_avb_link = of_property_read_bool(np, "renesas,no-ether-link"); priv->avb_link_active_low = @@ -2724,14 +2746,14 @@ static int ravb_probe(struct platform_device *pdev) irq = platform_get_irq_byname(pdev, "ch24"); if (irq < 0) { error = irq; - goto out_release; + goto out_rpm_put; } priv->emac_irq = irq; for (i = 0; i < NUM_RX_QUEUE; i++) { irq = platform_get_irq_byname(pdev, ravb_rx_irqs[i]); if (irq < 0) { error = irq; - goto out_release; + goto out_rpm_put; } priv->rx_irqs[i] = irq; } @@ -2739,7 +2761,7 @@ static int ravb_probe(struct platform_device *pdev) irq = platform_get_irq_byname(pdev, ravb_tx_irqs[i]); if (irq < 0) { error = irq; - goto out_release; + goto out_rpm_put; } priv->tx_irqs[i] = irq; } @@ -2748,40 +2770,19 @@ static int ravb_probe(struct platform_device *pdev) irq = platform_get_irq_byname(pdev, "err_a"); if (irq < 0) { error = irq; - goto out_release; + goto out_rpm_put; } priv->erra_irq = irq; irq = platform_get_irq_byname(pdev, "mgmt_a"); if (irq < 0) { error = irq; - goto out_release; + goto out_rpm_put; } priv->mgmta_irq = irq; } } - priv->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(priv->clk)) { - error = PTR_ERR(priv->clk); - goto out_release; - } - - priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); - if (IS_ERR(priv->refclk)) { - error = PTR_ERR(priv->refclk); - goto out_release; - } - clk_prepare_enable(priv->refclk); - - if (info->gptp_ref_clk) { - priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); - if (IS_ERR(priv->gptp_clk)) { - error = PTR_ERR(priv->gptp_clk); - goto out_disable_refclk; - } - } - ndev->max_mtu = info->rx_max_buf_size - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); ndev->min_mtu = ETH_MIN_MTU; @@ -2799,13 +2800,13 @@ static int ravb_probe(struct platform_device *pdev) /* Set AVB config mode */ error = ravb_set_config_mode(ndev); if (error) - goto out_disable_refclk; + goto out_rpm_put; if (info->gptp || info->ccc_gac) { /* Set GTI value */ error = ravb_set_gti(ndev); if (error) - goto out_disable_refclk; + goto out_rpm_put; /* Request GTI loading */ ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); @@ -2825,7 +2826,7 @@ static int ravb_probe(struct platform_device *pdev) "Cannot allocate desc base address table (size %d bytes)\n", priv->desc_bat_size); error = -ENOMEM; - goto out_disable_refclk; + goto out_rpm_put; } for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++) priv->desc_bat[q].die_dt = DT_EOS; @@ -2871,8 +2872,6 @@ static int ravb_probe(struct platform_device *pdev) netdev_info(ndev, "Base address at %#x, %pM, IRQ %d.\n", (u32)ndev->base_addr, ndev->dev_addr, ndev->irq); - platform_set_drvdata(pdev, ndev); - return 0; out_napi_del: @@ -2888,12 +2887,12 @@ static int ravb_probe(struct platform_device *pdev) /* Stop PTP Clock driver */ if (info->ccc_gac) ravb_ptp_stop(ndev); -out_disable_refclk: - clk_disable_unprepare(priv->refclk); -out_release: +out_rpm_put: pm_runtime_put(&pdev->dev); out_rpm_disable: pm_runtime_disable(&pdev->dev); + clk_unprepare(priv->refclk); +out_reset_assert: reset_control_assert(rstc); out_free_netdev: free_netdev(ndev); @@ -2922,10 +2921,9 @@ static void ravb_remove(struct platform_device *pdev) ravb_set_opmode(ndev, CCC_OPC_RESET); - clk_disable_unprepare(priv->refclk); - pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); + clk_unprepare(priv->refclk); reset_control_assert(priv->rstc); free_netdev(ndev); platform_set_drvdata(pdev, NULL); @@ -3060,21 +3058,27 @@ static int ravb_resume(struct device *dev) return ret; } -static int ravb_runtime_nop(struct device *dev) +static int ravb_runtime_suspend(struct device *dev) { - /* Runtime PM callback shared between ->runtime_suspend() - * and ->runtime_resume(). Simply returns success. - * - * This driver re-initializes all registers after - * pm_runtime_get_sync() anyway so there is no need - * to save and restore registers here. - */ + struct net_device *ndev = dev_get_drvdata(dev); + struct ravb_private *priv = netdev_priv(ndev); + + clk_disable(priv->refclk); + return 0; } +static int ravb_runtime_resume(struct device *dev) +{ + struct net_device *ndev = dev_get_drvdata(dev); + struct ravb_private *priv = netdev_priv(ndev); + + return clk_enable(priv->refclk); +} + static const struct dev_pm_ops ravb_dev_pm_ops = { SYSTEM_SLEEP_PM_OPS(ravb_suspend, ravb_resume) - RUNTIME_PM_OPS(ravb_runtime_nop, ravb_runtime_nop, NULL) + RUNTIME_PM_OPS(ravb_runtime_suspend, ravb_runtime_resume, NULL) }; static struct platform_driver ravb_driver = { From patchwork Wed Jan 31 08:41:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp2035458dyb; Wed, 31 Jan 2024 09:15:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IEICuoxpw2MxAFuOh7xM9jevIGZpuQZrTBmHanhr7AUMmcK0mp94iDQap76I1ta0yQVKgml X-Received: by 2002:a9d:7d19:0:b0:6e0:f9c6:8a19 with SMTP id v25-20020a9d7d19000000b006e0f9c68a19mr2076223otn.32.1706721308888; Wed, 31 Jan 2024 09:15:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706721308; cv=pass; d=google.com; s=arc-20160816; b=A7JPFmygaG4L84wv68XkoeD+ChN7Nfo1QbOIBBnGckSeqk6pQ9VFV+MrosyI4qRjB7 JLUvk+jRJfnX5jyc4utJJ5Vi4dCGKqDaUdhwduwguLWSvMGj4R20W0TuYNUfv22exPnd xep3qEZQM6w5iXJ00wtGij/DI22tFyou2Xp4Kpn9TjlgnXbPTIahQp2EyCxQMoIDYM78 TaB4AxLkDwcBSKCzQndJcqzTrocUU9zBgyHEiiQJMR2MLgeE+7ERGvSG9dbpRiXkx2IB X/TDgUFxMCjbzCy6h06lsg4gumA0H2MqwuPsn6eCWhjiL0rzBEAwsN2OvuL8TcNGiqxI AmkA== 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=nQCfrFSxrrf9tRO6HJcq+akjVQCNk3tk3vQzaskg9t8=; fh=IXafZKPnW69d4yf4m6LQU9SlLpVz+wfA+Z6eP+qyog8=; b=tb2O5uQBgp14AH+L57szheRl/jV80QkdI4Oaww3XkxLlfRBwx9oXl2kEG8GLBNHqXD 9Ys7e8+552N8Pa7Z2Rpo0AW1hou3E+/s28psipVV0ajwLbfe5VZ52YQhrmkAJlMbdhky gfP7Q5tKo6TGkOij7VUp3uJyIsfzKVKNjvlveYIkjtzA8c/cxySHmvnfJompK3ZSgyr5 ad4nXRyxZsCGM1rvX3lToO1ptnJ7lZCthqYeEYNX0gMIj61HKRweeK68QOMS8wXL8HR0 iMGJAmlPT/4NUejc5tPWdrgqkHo7P1mN7DUiTT4BfnExGOu6NINXj4EmUTyHdyDdDdKW D5fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=aWxkgMYt; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46029-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46029-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWoYJoE52cX2hdcI6/MG6Jbvbu9XFoYS/4crq32UBVVvTH4ny3IlZCX289DCxTKdIhPuwSossz055LM70Rd22dr6L5p0w== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f12-20020ac859cc000000b0042a721fb14asi5253942qtf.84.2024.01.31.09.15.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 09:15:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46029-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=aWxkgMYt; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46029-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46029-ouuuleilei=gmail.com@vger.kernel.org" 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 69DDF1C268EF for ; Wed, 31 Jan 2024 08:47:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D7D079DC4; Wed, 31 Jan 2024 08:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="aWxkgMYt" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 006966EB5C for ; Wed, 31 Jan 2024 08:41:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690521; cv=none; b=Jl201Duy3ndJRvg4skJBkvL76m51OVqoFhQY1cvoIOr8FSyxTAC8kTmLaeWOa0QtkT8cZlwqE1zZeUtCPFO/ly+DmpwwB7leUFe1iPAiy8w14+vT8XCwG0nXA6PC2KXnhGSKODueYaNrf2Qvt5qVw5J89FKIeONNXmI33xCValw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690521; c=relaxed/simple; bh=aLlMQy8HZ3Uodd7EYAzkrNQyWPQI2JPqu4nG0FzkUGE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Cv/GexdyXE052gOiXnAH2I7grhyTQ1GgMEGHagcFKBg5q7JIfXXZFjGhqhuL5luctr/fjhPKIQi8FNCLldYGLYPUcuXhFQnGLG8449/0x4yZJ55c+OW92K2cMiP0Yag0Q7DyhGxXMFFEqaUFvimDMoIxE+WwkTtDPlihnezMh7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=aWxkgMYt; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55eed368b0bso1309973a12.0 for ; Wed, 31 Jan 2024 00:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690518; x=1707295318; 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=nQCfrFSxrrf9tRO6HJcq+akjVQCNk3tk3vQzaskg9t8=; b=aWxkgMYtVswfmajGy8LMr8yIBEy2/fiC/NfYkxiDIFG7/PCuJXF8b60My06Y8kzefE D5Zz8cr0/A4tzST4FRWnB32gBFY3El9OK0hycQXmgFxuBrHfpCoz6eZhJ7Pgvj5JHhmO IymlO2KXMEHSKPGvhN1T/8m1zepAgMYjMBFyW90EZvQv0AFNfPySrg2fX2Iys9ketwde mTUM7O0D/E5jy3IgoXEx/ici9sUZff7Vyqh++OToD4JBtem1sBSggARD9ctK7hkZ0eQV cA4eZct+eUK56UdIUrKfRKYp1BicfopTMAp2p6SpnnqNECyEeIq94fYXyGgvFyLFTM3p Hy9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690518; x=1707295318; 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=nQCfrFSxrrf9tRO6HJcq+akjVQCNk3tk3vQzaskg9t8=; b=Nsw51PH9VHGljNFVimZQChVp3aciNifcHGdLVmLUzOmP15bVZluE2dFE8MBtLIKLjG RBdbZe3WuSCsWpvXcGY7EJHdY5++Zbgbdli/3HN9Nr5UeEMUl3A/49xUUggLr0aiHlwo IIO8bhOKAmxQtxWCJNIA/upp2NlMc+P8INDibRoRxQy55otiDHOz8N7MXzn7YtTzV7d5 3UmHJ25NfyRRfPbRbUmls8G5jWINFmOt3FgKmCRiBsnQvTPYwIPnoXt1EP/1ef7UDZL9 G3C5j8/DNDmembgLNWcGEuE/KWubyif5YbWgmmOwpYH6so6DVebyt3Mc/MJHLcziVyJ6 Wz5g== X-Gm-Message-State: AOJu0YxTux7b52dRuscaMl/Y7Z5hAqpp61fXTs/qTwMoHBo7cxjw3mLp 0VHK0ashdZtO/vlXV6szKj3Y3qhd9Q/55lMD2qmWxqQqSzkC/Wq3aKk5BshS6Jk= X-Received: by 2002:a50:8d54:0:b0:55d:71d7:31c5 with SMTP id t20-20020a508d54000000b0055d71d731c5mr947757edt.6.1706690518298; Wed, 31 Jan 2024 00:41:58 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW+fQSw5vPHy6jQbwiRMhmeUpgOaDIs3EZEsRstr6oQ56ilGrJP5dHob+V3YWhuc6t70LJ4sRzNaIRgR4cTmvR0CVyV2aO3qDPvfw8DZBWV0Yt7xZk/aPtjzPgstdLd71FwOGn644TvJh08hVHzpIot+gY5PMyhPdX3iWftXafslOSLbYY/zGATXTlVTjXPTpEPUxBZ3Q4qsneBd7EzqTvSCu0K0hsSVByS2lkY+uofDGreeAM5VR1x60DmJBx3x8fWPDtKeCA7nmlWLvUIuHO7rwlQso3pwWrZ5Jh7kpfFUZcF2MZW1GXC0dBjVXo6PwczjTWpl4u5iQV38vXx81HDWhBw62D1h9n3pIn9wSQNJGGQA3KbegUxSLBBUHa+EG9H0el5zDDizdo74JijFfDldGhpb3bNvV+WisJozn4ccc4ggTg= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:57 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 09/15] net: ravb: Split GTI computation and set operations Date: Wed, 31 Jan 2024 10:41:27 +0200 Message-Id: <20240131084133.1671440-10-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789627003183376032 X-GMAIL-MSGID: 1789627003183376032 From: Claudiu Beznea ravb_set_gti() was computing the value of GTI based on the reference clock rate and then applied it to register. This was done on the driver's probe function. In order to implement runtime PM for all IP variants (as some IP variants switches to reset mode (and thus the registers content is lost) when module standby is configured through clock APIs) the GTI setup was split in 2 parts: one computing the value of the GTI register (done in the driver's probe function) and one applying the computed value to register (done in the driver's ndo_open API). Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - collected tags Changes in v3: - fixed typos in patch description - use u64 instead of uint64_t - remove ravb_wait() for setting GCCR.LTI Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb.h | 2 + drivers/net/ethernet/renesas/ravb_main.c | 96 ++++++++++++------------ 2 files changed, 52 insertions(+), 46 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index e3506888cca6..268ccfafe7aa 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1102,6 +1102,8 @@ struct ravb_private { const struct ravb_hw_info *info; struct reset_control *rstc; + + u32 gti_tiv; }; static inline u32 ravb_read(struct net_device *ndev, enum ravb_reg reg) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index f9297224e527..0f7b1d503618 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1756,6 +1756,50 @@ static const struct ethtool_ops ravb_ethtool_ops = { .set_wol = ravb_set_wol, }; +static void ravb_set_gti(struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + const struct ravb_hw_info *info = priv->info; + + if (!(info->gptp || info->ccc_gac)) + return; + + ravb_write(ndev, priv->gti_tiv, GTI); + + /* Request GTI loading */ + ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); +} + +static int ravb_compute_gti(struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + const struct ravb_hw_info *info = priv->info; + struct device *dev = ndev->dev.parent; + unsigned long rate; + u64 inc; + + if (!(info->gptp || info->ccc_gac)) + return 0; + + if (info->gptp_ref_clk) + rate = clk_get_rate(priv->gptp_clk); + else + rate = clk_get_rate(priv->clk); + if (!rate) + return -EINVAL; + + inc = div64_ul(1000000000ULL << 20, rate); + + if (inc < GTI_TIV_MIN || inc > GTI_TIV_MAX) { + dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n", + inc, GTI_TIV_MIN, GTI_TIV_MAX); + return -EINVAL; + } + priv->gti_tiv = inc; + + return 0; +} + /* Network device open function for Ethernet AVB */ static int ravb_open(struct net_device *ndev) { @@ -1773,6 +1817,8 @@ static int ravb_open(struct net_device *ndev) goto out_napi_off; ravb_emac_init(ndev); + ravb_set_gti(ndev); + /* Initialise PTP Clock driver */ if (info->gptp) ravb_ptp_init(ndev, priv->pdev); @@ -2464,34 +2510,6 @@ static const struct of_device_id ravb_match_table[] = { }; MODULE_DEVICE_TABLE(of, ravb_match_table); -static int ravb_set_gti(struct net_device *ndev) -{ - struct ravb_private *priv = netdev_priv(ndev); - const struct ravb_hw_info *info = priv->info; - struct device *dev = ndev->dev.parent; - unsigned long rate; - uint64_t inc; - - if (info->gptp_ref_clk) - rate = clk_get_rate(priv->gptp_clk); - else - rate = clk_get_rate(priv->clk); - if (!rate) - return -EINVAL; - - inc = div64_ul(1000000000ULL << 20, rate); - - if (inc < GTI_TIV_MIN || inc > GTI_TIV_MAX) { - dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n", - inc, GTI_TIV_MIN, GTI_TIV_MAX); - return -EINVAL; - } - - ravb_write(ndev, inc, GTI); - - return 0; -} - static int ravb_set_config_mode(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); @@ -2763,15 +2781,9 @@ static int ravb_probe(struct platform_device *pdev) if (error) goto out_rpm_put; - if (info->gptp || info->ccc_gac) { - /* Set GTI value */ - error = ravb_set_gti(ndev); - if (error) - goto out_rpm_put; - - /* Request GTI loading */ - ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); - } + error = ravb_compute_gti(ndev); + if (error) + goto out_rpm_put; if (info->internal_delay) { ravb_parse_delay_mode(np, ndev); @@ -2984,15 +2996,7 @@ static int ravb_resume(struct device *dev) if (ret) return ret; - if (info->gptp || info->ccc_gac) { - /* Set GTI value */ - ret = ravb_set_gti(ndev); - if (ret) - return ret; - - /* Request GTI loading */ - ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); - } + ravb_set_gti(ndev); if (info->internal_delay) ravb_set_delay_mode(ndev); From patchwork Wed Jan 31 08:41:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 195341 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp172801dyb; Thu, 1 Feb 2024 06:05:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaN676DgM8/7AsrIQbvMv8XvHyYu2mH/QJ0lFY0UzepkOhc7wmmaoTsjC2TLto3EDH8jR0 X-Received: by 2002:a05:6830:4121:b0:6e2:7941:f633 with SMTP id w33-20020a056830412100b006e27941f633mr550922ott.2.1706796309398; Thu, 01 Feb 2024 06:05:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706796309; cv=pass; d=google.com; s=arc-20160816; b=NGYg1mh4x9tj+DdCMU5yeNIlxUIi0tkx1FMVLqdLPR8RC/UYRk/40mOvqD/PGiFgYy NODocKnlZ+lNaEr07zyerPbTLPWmnS1EzhOlfX5dHhNXwbNQSM60Sdv7Y4k6zpluksdq uF2betGww32Is1OqaCyV6xVdfdpn7tWQY2Tjp2JW+50IOc5YynUWpEQuDk4vxoN/09Di hrmLVftSGsprDoS6gJSWXcrEX1s7JKfv3VTrtcFBcpegm+5kKlsh3jF3a8A+LZjM8fty BZmk7WgKpYVV0jp0TfS8YAgrLnUI28/wDpsKY780CisANfDSd8ycuTOTWzcmOALVRItT 15Mg== 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=GOBNXx2ouuErkvp20qBEr9vbTwPM99kJ0Yx6JPusU6c=; fh=IMYM0MRYy0tm4yF3zVLyIT/LUVG3E0cGIsUL/XSurSk=; b=gylv40k443DlX/Flgm/InP6yUpRQdB4fXA5iiw8BKG4XVW7SbAuNZi7jz8SZ+7Hrod +PstzfbRo66JV6/fCKrwReThsUHQlMBJvAa1kUGZVdg9PK1xtz7ioVGzXNXG/kAprsxB 8ArRUIpz3MbWtN6zF3PxKdo3dXnQUBQBOpJ+EKx15D9//3lvTU0q7l7xFQ6OqEgrZGrg 0awZp/0ztNCrot5IM/+rEu1m+bG6U5VntLKWyFgk/wKg983RwzUjRGWYLAOwGh+mx9RU zoGcpVizu0Kyahkj2EzQTl9/WEHNkPAMkIWWNRvzXFIcNj61LyrWYXVbvPC7oko0uMpr x4UQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=WB5gRiGg; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46031-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46031-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUerCxUqKpZnPjS2T+ZRyuLNZD/LWibqlLcWpIWmeq402LRBQNX27ulph1ox6gIVUncquLmXTK3LWMFy6jgIqsDaTtsWg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dd12-20020a056102568c00b0046b31989ce9si1634179vsb.196.2024.02.01.06.05.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 06:05:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46031-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=WB5gRiGg; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46031-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46031-ouuuleilei=gmail.com@vger.kernel.org" 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 96F981C270CE for ; Wed, 31 Jan 2024 08:47:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D2CC60BAD; Wed, 31 Jan 2024 08:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="WB5gRiGg" Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 A413F69951 for ; Wed, 31 Jan 2024 08:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690523; cv=none; b=eItYkEEHGS84dEtQ/me0caaAnAr80Fe+BB3rc4JF86rwM0FTjrz2FPOlvY22sdBwSNbslDU6KflfAUDBR4cnADEL40ale0rkQV1cbvjYvUTs8zRPdUASFWAAFTRQ1mtIlKiRMJ00gr/SMMM9f6iXqgSd8a4odpRc7Y2TGtgSFYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690523; c=relaxed/simple; bh=Tl9EE4rSqsLaclcX/s9TRCT5vjw2U2y2/W8A3V/zf38=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=REof9bQ0ZfIY+LHk+d/aQQUHIF8o8jBQcX+R6mlxO2YW9PEkcPu9WiOx5N9nFmkDCNuegR3ccf8LLPcAjvO4VODHkopwyP0MWVRp8nA/IVx9ta+y0ASDL4m9hXw/AjuCgQjGMX+iRrZkDvY1It0lANJKKrW8QaTOJeMfl1ZNMiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=WB5gRiGg; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2cf2adac1ccso57059101fa.3 for ; Wed, 31 Jan 2024 00:42:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690520; x=1707295320; 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=GOBNXx2ouuErkvp20qBEr9vbTwPM99kJ0Yx6JPusU6c=; b=WB5gRiGgOfX3jqysJlbDF7pEMokYyqw7/f/swlQSaBM2boFD4xdJmaV7+xsSIYfWtz Ga2rDrPAj9t9JX2IX/QinsNv14b9yLfsNP/SS4c0/IoePJKnQ54JfkJkuohipk2WZzbM P9QSn7KnKyTcks+H9XNCihEz8krvXoefmk3t3xxzJk10Lf0baqxfEK8Ck/rws0gwgEiu EddRL/j/CMRex436gGklNA8Emy4DqWwcBjjRE6HyQWJYS4BTnltlg7AjwfDE5q2NQg5l e0hUHgt49GjC9pBpfp13xyNbfv4tVudYqzP3/QFzv+jzBHvk7wOJndEw5TLLLpepaFOi yyLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690520; x=1707295320; 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=GOBNXx2ouuErkvp20qBEr9vbTwPM99kJ0Yx6JPusU6c=; b=ZRtgHQ4GKwfEv/zJ8pcXfusz5hTGdb997QHsRKul5RGT5lYrhNGeiupQqWo91z1kEA RH4nNZo8y4Wiy9M8/qbv1YBTuN9Eg/rP88RUH9oFv0ZzQ8x1JV1EpJ3AEfqo8u9w4Jbw 3DB/yGL5Yr0qLl2zPJwRROEQlyIIxmsp+E2yCLvHUQimTA0oII/KZ0Bvt94HTs/mp9va ZeRzjTpfBed68/TcgwSH5PeMUjTC5DiYqV3MO/tslo6cDmPUG60RdPQRaVE1XEUBbExx GJGdTNopCK0fBd2b559q55AaPFGgcfbSxtFQoYHgzF9J3OyQ/uo21t0fsHg9hg9B57Mt HQ0w== X-Gm-Message-State: AOJu0YyAYy/1LtpUZ5JSt59a0Q5WNYieEogWHK8zN4LJVZQNHZNzWMHc 61VTKHa1p27/6dzPtNnW7s2IoEidwpqOaarJ7MqdZml0n+saCof2Jesq+bA7ufE= X-Received: by 2002:a2e:a687:0:b0:2ce:19d:2118 with SMTP id q7-20020a2ea687000000b002ce019d2118mr516799lje.6.1706690519652; Wed, 31 Jan 2024 00:41:59 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCX5OZwG3k4GNd39QHlTcc5E9v6eJdTIABspjil8bPAO7sdAtLA+9npvhHYSz2JSgV0riKTS6KTUQagdYE53HoRbW7qcXIUhi/uGIePJDGKlwdJ38B6etmmx6f5q/B0o3FTZ2CNOSqwWgoVmx30vGw/b/QlpTc10Rw4O12+KMefjkk/pYqKdGfnpIeI9DNHj7xo3aCZdSLpBmCPQdLPidfLQoLpVghAId5Aifu51bmfH2lCLUnsh8+PtVA/kwEL1p2fi87aSjr5hCw1SnTaGfPV51fh4i7MIpHJ92c3cJpln1ABEktaNg4KO+uhOMIBWYQ4GA1bj54yUnb7MkivTn/ujMSp3e4+eqz213PpguBBkS4EdgL6QLPT5A3gMihr+qvCAyE/CdouoZXC4xRDfnBPCdyxxi9mq3vnca8gQyksVVvITnHA= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:41:59 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 10/15] net: ravb: Move delay mode set in the driver's ndo_open API Date: Wed, 31 Jan 2024 10:41:28 +0200 Message-Id: <20240131084133.1671440-11-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789705646901893465 X-GMAIL-MSGID: 1789705646901893465 From: Claudiu Beznea Delay parsing and setting were done in the driver's probe API. As some IP variants switch to reset mode (and thus the register contents is lost) when setting clocks (due to module standby functionality) to be able to implement runtime PM keep the delay parsing in the driver's probe function and move the delay applying function to the driver's ndo_open API. Along with it, ravb_parse_delay_mode() function was moved close to ravb_set_delay_mode() function to have the delay specific code in the same place. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - fixed typos in patch description - improved patch description Changes in v4: - collected tags Changes in v3: - fixed typos in patch description Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 107 ++++++++++++----------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0f7b1d503618..e5805e0d8e13 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1800,6 +1800,59 @@ static int ravb_compute_gti(struct net_device *ndev) return 0; } +/* Set tx and rx clock internal delay modes */ +static void ravb_parse_delay_mode(struct device_node *np, struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + bool explicit_delay = false; + u32 delay; + + if (!priv->info->internal_delay) + return; + + if (!of_property_read_u32(np, "rx-internal-delay-ps", &delay)) { + /* Valid values are 0 and 1800, according to DT bindings */ + priv->rxcidm = !!delay; + explicit_delay = true; + } + if (!of_property_read_u32(np, "tx-internal-delay-ps", &delay)) { + /* Valid values are 0 and 2000, according to DT bindings */ + priv->txcidm = !!delay; + explicit_delay = true; + } + + if (explicit_delay) + return; + + /* Fall back to legacy rgmii-*id behavior */ + if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || + priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) { + priv->rxcidm = 1; + priv->rgmii_override = 1; + } + + if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || + priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) { + priv->txcidm = 1; + priv->rgmii_override = 1; + } +} + +static void ravb_set_delay_mode(struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + u32 set = 0; + + if (!priv->info->internal_delay) + return; + + if (priv->rxcidm) + set |= APSR_RDM; + if (priv->txcidm) + set |= APSR_TDM; + ravb_modify(ndev, APSR, APSR_RDM | APSR_TDM, set); +} + /* Network device open function for Ethernet AVB */ static int ravb_open(struct net_device *ndev) { @@ -1811,6 +1864,8 @@ static int ravb_open(struct net_device *ndev) if (info->nc_queues) napi_enable(&priv->napi[RAVB_NC]); + ravb_set_delay_mode(ndev); + /* Device init */ error = ravb_dmac_init(ndev); if (error) @@ -2531,41 +2586,6 @@ static int ravb_set_config_mode(struct net_device *ndev) return error; } -/* Set tx and rx clock internal delay modes */ -static void ravb_parse_delay_mode(struct device_node *np, struct net_device *ndev) -{ - struct ravb_private *priv = netdev_priv(ndev); - bool explicit_delay = false; - u32 delay; - - if (!of_property_read_u32(np, "rx-internal-delay-ps", &delay)) { - /* Valid values are 0 and 1800, according to DT bindings */ - priv->rxcidm = !!delay; - explicit_delay = true; - } - if (!of_property_read_u32(np, "tx-internal-delay-ps", &delay)) { - /* Valid values are 0 and 2000, according to DT bindings */ - priv->txcidm = !!delay; - explicit_delay = true; - } - - if (explicit_delay) - return; - - /* Fall back to legacy rgmii-*id behavior */ - if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || - priv->phy_interface == PHY_INTERFACE_MODE_RGMII_RXID) { - priv->rxcidm = 1; - priv->rgmii_override = 1; - } - - if (priv->phy_interface == PHY_INTERFACE_MODE_RGMII_ID || - priv->phy_interface == PHY_INTERFACE_MODE_RGMII_TXID) { - priv->txcidm = 1; - priv->rgmii_override = 1; - } -} - static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name, const char *ch, int *irq, irq_handler_t handler) { @@ -2650,18 +2670,6 @@ static int ravb_setup_irqs(struct ravb_private *priv) return ravb_setup_irq(priv, "ch19", "ch19:tx_nc", &irq, ravb_nc_interrupt); } -static void ravb_set_delay_mode(struct net_device *ndev) -{ - struct ravb_private *priv = netdev_priv(ndev); - u32 set = 0; - - if (priv->rxcidm) - set |= APSR_RDM; - if (priv->txcidm) - set |= APSR_TDM; - ravb_modify(ndev, APSR, APSR_RDM | APSR_TDM, set); -} - static int ravb_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -2785,10 +2793,7 @@ static int ravb_probe(struct platform_device *pdev) if (error) goto out_rpm_put; - if (info->internal_delay) { - ravb_parse_delay_mode(np, ndev); - ravb_set_delay_mode(ndev); - } + ravb_parse_delay_mode(np, ndev); /* Allocate descriptor base address table */ priv->desc_bat_size = sizeof(struct ravb_desc) * DBAT_ENTRY_NUM; From patchwork Wed Jan 31 08:41:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 194828 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1986302dyb; Wed, 31 Jan 2024 08:01:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFkDziRj4kUi/qZ12Qn3xirzCyY7J1xeTQG9yiP807dTUVi346oJY6atwiu8QMcCvli/mG0 X-Received: by 2002:a17:903:130d:b0:1d8:fc65:b601 with SMTP id iy13-20020a170903130d00b001d8fc65b601mr2175585plb.38.1706716870765; Wed, 31 Jan 2024 08:01:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706716870; cv=pass; d=google.com; s=arc-20160816; b=RQnSx8y3xT1BSdYOdSE5mqfCtIOEHoIWGkX6IT6LYeR3qLE3JZwLpTc6+Q098lOu9j DvXdGntFMgvMWG8s0ox7c5rNn8v7GDgw/zwFsp7XUPbQkoEwvnEq2EtDCF6pkQTTeRD9 ioWxNr0+YbXjaoK17hIfIXqby5gdp1tN1W1x25YAkW4b1d1W4Nt9W2QVrRsntRFuy6cU lC6lxyGnrzmPNrKMCnEXnT2bWBVWOpzu4RcEHJWL1ILbWSuM79Ph3aMHOqopDZsr9fCX ANGCbEsdFkaRDHGTkhwa/AmjP1AeR9vV2FlG4qX25ASN7dwml4Z3aFOb8Eh3grDVuE1C 6xig== 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=j4P3NNUndOj/U3jAxOrkBuhZxASPQ1uf/KZV1iCgPUY=; fh=is/kz6uDkbVucI8yYZyY46Eo2gG+bq6ExgY4pO4JLK0=; b=sDEQBpbPSENMsj996GNs9kv9WIV6quo2r7U1wL+Hfo1YaeZvhoDTF2tDsUvn148sY+ YA2DYzDpJ1XR8wSTbuwzFJAnqn1WVLUHbqNlrl+bGIWw85RZSNOMwur+El6eRtOZbZUc NJAKEyYVrPc1vEgwetw9SUcnsMMOBHlD0wnxzNCV/18pSI3ESnFsyWV/gBhmLYXpwFGw ZHoGh3dJX7L6l/Wyai5ajDo9Dgm+nN6ksy6CHE/Jfx4wVvE4O8TmR3n6fGwDb5Filfcn Vlaal/hOn3F+yVVv3wiFuBVMwm6HabWGqhOnthMc77GKcS4Imwp7Bmh1LGR2aD5oLrcD PlZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=bm4NH0oE; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46035-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46035-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX3pQEtb1ASuspEru51AZT/C0gan8732gCtw1UQRYAYsF6iGjPG43y6CdzBNeIIPIgvE5HfYvF9CPsPQKaBpMYyfLt1AA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bi4-20020a170902bf0400b001d4e7ad3810si9763477plb.604.2024.01.31.08.01.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:01:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46035-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=bm4NH0oE; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46035-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46035-ouuuleilei=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 28676B21898 for ; Wed, 31 Jan 2024 08:49:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB3C960869; Wed, 31 Jan 2024 08:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="bm4NH0oE" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 43E8779DB5 for ; Wed, 31 Jan 2024 08:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690529; cv=none; b=ictFAi5eFM29qBlFZ67vFnQ2WUqWOJWHecS/Kmttkxvkq0ViHse6GQsHgmDUZGSrli3RsqbsVyS0uFUOfFAOU453s7H918CmpTtkqodhKUBVwRhzGjVdXlA0fFb0Vdcb36Ceo+bvv3GC+ORXQMrHZDMCShrT9gUIsjFEQG8Rz9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690529; c=relaxed/simple; bh=SMFD2wooseUV4EjGWpE317D8OQSKSM0pSKR/g7N9T7Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iPc4aagCLyrPGBHDet7nkfLTiNTfXjHMqmVTPhni442KyGBHBhfZKf3BMzttRT6MKEiHpvm63EntYLo/XN/+7be+1vlBkA9zEtdMVz3lM2myfMJJQ9imxWmIWXtViFyiajhPO9QAnm94ZZte6mCptWWQQes5xC6lmilUmwZH7I0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=bm4NH0oE; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2cf3ed3b917so58437281fa.1 for ; Wed, 31 Jan 2024 00:42:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690524; x=1707295324; 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=j4P3NNUndOj/U3jAxOrkBuhZxASPQ1uf/KZV1iCgPUY=; b=bm4NH0oE3y+H9/a12wqU+uye9zHea82rWi2hXLGjmXTE90aKKQGz5iBzMb7Bml1pl7 8TCnUoR0OZFKI7kOH1sVXf2016yzi9OZQVYG2ZduWATZDLKuGvYgobtzttSDxnGEeUhX DWqL1IQLgqyjbZLY4HDr/kZw82rDBJ0GxPCWPCtBaKAGHqwhRRTzCx1j6eZuNFEDyUmG 6n3XwhNjWUaNHF12LwQucO+ne/gcpTtbOXBpFLehSvbTNNEVYn5nu8QQVZXhENYVjUEL ACmNMVKQrVOGcyMX00ZXCTHkNgKqEwvasQK8+BZ6ZNTq9kkBxMQXiV0FiDyoRNeHxs21 6gIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690524; x=1707295324; 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=j4P3NNUndOj/U3jAxOrkBuhZxASPQ1uf/KZV1iCgPUY=; b=dHn4q16qRUgG7oLLAkqwmH3hULJnoXlR2u/jilGh+JhbfYQQJIjhVJOT8M+3LCzTx3 MmaHPEgw3/JCuMRXBq3GaCqagjgb41BuPAzP23pe9zrfX8y7vqt/W/3MsF9fjXKU/6qt uVrY7EaziDjSz09+2lAqwzIdCl6ZDrZSG0g1Yt4UFGrT8pcUyavq+ECQO/+eoJosQ0QX bhk+9hgq46D6gKI4/y4iaS/uim7sl2zBfNeG0L0LGJ9TxfAdP5OHoPd6klxeN7EpDPaN MTSlkH0BkyrUmP3FnKWsMeu++l6qJ0MnxubKClDtFF3KTTRrL2nc1TK2A6Qnj3+RQGhx 5PCg== X-Gm-Message-State: AOJu0YwyQdqCYc8lb34eVpYsrDGQcY/JiCiA8CJDwYx2b6f8C9ByHAxY Utr4ckDDn3Y14yUCYQYqeeLxcXzZQarqXTZtxKZ/1nIn1NwOCf+/4qaEVdcSUoU= X-Received: by 2002:a05:651c:221c:b0:2d0:604d:fda6 with SMTP id y28-20020a05651c221c00b002d0604dfda6mr814787ljq.44.1706690523545; Wed, 31 Jan 2024 00:42:03 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXrqLJw9JLWNup24eFLJBtSBvdaq8f/dNVorTAyKDfd5NoIXrdnwnkl6AVlqcBGvNUakV7rbez6nz+Prdy4WZr+QWhdnok1VXiZcPDWFsT1c0QE06g++9XfhA7XqGDqPiGw7SfgxTS6NIP5tjnraa8j3W8I0xeeU2w9K/uYk687RzKWp2OYlhHjBJqCzQ7fE92V4BJJDbTgUYv3YfsvtyXCn3TTElv00VCSgEsDNJDn1fVg2aYLxSDaNWaaeKH8j5Dht2RXCZxYCApPb9LJPU6Utqg9QNwozTFSEJB1kQBdztPmccL4l4x602pGASxZYku8GMg8K6Xuw07THbDX0GK4wb6yqY3/RcxaqxlbsUH+Py4PNDWL5eA18CXk4xZPmylN5quXnNu6tHbrIckKvI7c4tFkvbgGDVVJkEe0XVA80yW4DIw= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:42:03 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 13/15] net: ravb: Set config mode in ndo_open and reset mode in ndo_close Date: Wed, 31 Jan 2024 10:41:31 +0200 Message-Id: <20240131084133.1671440-14-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789622348354630683 X-GMAIL-MSGID: 1789622348354630683 From: Claudiu Beznea As some IP variants switch to reset mode (and thus the register contents is lost) when setting clocks (due to module standby functionality) to be able to implement runtime PM and save more power, set the IP's operating mode to reset at the end of the probe. Along with it, in the ndo_open API the IP will be switched to configuration, then operation mode. In the ndo_close API, the IP will be switched back to reset mode. This allows implementing runtime PM and, along with it, save more power when the IP is not used. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - fixed typos in patch description - collected tags Changes in v4: - set config mode before reading mac address Changes in v3: - fixed typos in patch description - in ravb_probe() switch the hardware to reset mode just after phy initialization Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 78 ++++++++++++++---------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 54099fef946e..0dab98ea615a 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1756,6 +1756,27 @@ static const struct ethtool_ops ravb_ethtool_ops = { .set_wol = ravb_set_wol, }; +static int ravb_set_config_mode(struct net_device *ndev) +{ + struct ravb_private *priv = netdev_priv(ndev); + const struct ravb_hw_info *info = priv->info; + int error; + + if (info->gptp) { + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); + if (error) + return error; + /* Set CSEL value */ + ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB); + } else if (info->ccc_gac) { + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB); + } else { + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); + } + + return error; +} + static void ravb_set_gti(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); @@ -1864,13 +1885,19 @@ static int ravb_open(struct net_device *ndev) if (info->nc_queues) napi_enable(&priv->napi[RAVB_NC]); + /* Set AVB config mode */ + error = ravb_set_config_mode(ndev); + if (error) + goto out_napi_off; + ravb_set_delay_mode(ndev); ravb_write(ndev, priv->desc_bat_dma, DBAT); /* Device init */ error = ravb_dmac_init(ndev); if (error) - goto out_napi_off; + goto out_set_reset; + ravb_emac_init(ndev); ravb_set_gti(ndev); @@ -1893,6 +1920,8 @@ static int ravb_open(struct net_device *ndev) if (info->gptp || info->ccc_gac) ravb_ptp_stop(ndev); ravb_stop_dma(ndev); +out_set_reset: + ravb_set_opmode(ndev, CCC_OPC_RESET); out_napi_off: if (info->nc_queues) napi_disable(&priv->napi[RAVB_NC]); @@ -2236,7 +2265,8 @@ static int ravb_close(struct net_device *ndev) if (info->nc_queues) ravb_ring_free(ndev, RAVB_NC); - return 0; + /* Set reset mode. */ + return ravb_set_opmode(ndev, CCC_OPC_RESET); } static int ravb_hwtstamp_get(struct net_device *ndev, struct ifreq *req) @@ -2566,27 +2596,6 @@ static const struct of_device_id ravb_match_table[] = { }; MODULE_DEVICE_TABLE(of, ravb_match_table); -static int ravb_set_config_mode(struct net_device *ndev) -{ - struct ravb_private *priv = netdev_priv(ndev); - const struct ravb_hw_info *info = priv->info; - int error; - - if (info->gptp) { - error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); - if (error) - return error; - /* Set CSEL value */ - ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB); - } else if (info->ccc_gac) { - error = ravb_set_opmode(ndev, CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB); - } else { - error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); - } - - return error; -} - static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name, const char *ch, int *irq, irq_handler_t handler) { @@ -2785,11 +2794,6 @@ static int ravb_probe(struct platform_device *pdev) ndev->netdev_ops = &ravb_netdev_ops; ndev->ethtool_ops = &ravb_ethtool_ops; - /* Set AVB config mode */ - error = ravb_set_config_mode(ndev); - if (error) - goto out_rpm_put; - error = ravb_compute_gti(ndev); if (error) goto out_rpm_put; @@ -2816,6 +2820,11 @@ static int ravb_probe(struct platform_device *pdev) /* Debug message level */ priv->msg_enable = RAVB_DEF_MSG_ENABLE; + /* Set config mode as this is needed for PHY initialization. */ + error = ravb_set_opmode(ndev, CCC_OPC_CONFIG); + if (error) + goto out_rpm_put; + /* Read and set MAC address */ ravb_read_mac_address(np, ndev); if (!is_valid_ether_addr(ndev->dev_addr)) { @@ -2828,9 +2837,14 @@ static int ravb_probe(struct platform_device *pdev) error = ravb_mdio_init(priv); if (error) { dev_err(&pdev->dev, "failed to initialize MDIO\n"); - goto out_dma_free; + goto out_reset_mode; } + /* Undo previous switch to config opmode. */ + error = ravb_set_opmode(ndev, CCC_OPC_RESET); + if (error) + goto out_mdio_release; + netif_napi_add(ndev, &priv->napi[RAVB_BE], ravb_poll); if (info->nc_queues) netif_napi_add(ndev, &priv->napi[RAVB_NC], ravb_poll); @@ -2853,8 +2867,10 @@ static int ravb_probe(struct platform_device *pdev) netif_napi_del(&priv->napi[RAVB_NC]); netif_napi_del(&priv->napi[RAVB_BE]); +out_mdio_release: ravb_mdio_release(priv); -out_dma_free: +out_reset_mode: + ravb_set_opmode(ndev, CCC_OPC_RESET); dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, priv->desc_bat_dma); out_rpm_put: @@ -2885,8 +2901,6 @@ static void ravb_remove(struct platform_device *pdev) dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, priv->desc_bat_dma); - ravb_set_opmode(ndev, CCC_OPC_RESET); - pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); clk_unprepare(priv->refclk); From patchwork Wed Jan 31 08:41:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 195702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp291602dyc; Fri, 2 Feb 2024 00:46:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCM/YHebuZc3ITB/eKnoG6w7ffVd9pTygIAqCA/G7Ey0ExP1cHsPP0IG/ll1+FEIUhmTSa X-Received: by 2002:aa7:d1ce:0:b0:55f:c940:a949 with SMTP id g14-20020aa7d1ce000000b0055fc940a949mr2214221edp.13.1706863588505; Fri, 02 Feb 2024 00:46:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706863588; cv=pass; d=google.com; s=arc-20160816; b=PMsCrVjm1zsMqP7UH+230sRWiBVR0ihKkPXXeCyPbS5lPetsX6ryFSqK0OD+c72PXN TfDyMrmD2aqnVVQDI4zOmbXUMDEu74kFlYv2Pd9ciGaeOOwBlEtH95G0cxsSyOkkGTtp fNqQouBaaEMj6OgqQ2ys8HJiQqQCr7YDxnsuoBM0bjYwyJv9YqNkEiQRIfZevg9HZoBc k1CnKeGfh7k3MVpm+c7J1fWo2SZE2qvWkUFZK2+PwPQWAOWgux0iS3gPI3CIHI6aOQp9 VgqpxEJYVzoRFFNm4i6wcb1GTiZ3bQad3l1KLJnxm1Zl0GiV1q3PF02Ayr2pWyjiKnYE oJgw== 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=E1XrNomjmra/GM8RS/lknacwokF475kMeMhwWZ3EcPk=; fh=tpVTtq6z8ivP4dLU3cPy/1uIlFTBM+gWqxw2YyHx3O4=; b=i81pbI5n3PMR5l80jfLZF0RIE3U4nXngPJA3vEesKIOKbpWPi74sfEyFPteCxYYP+7 ztriyMf/GHFx1c7u6SdSwTo9OIx1ZxpXCeqW46YFNKJxk+3ofX3x8WwqLtx4dVW1mcay o1k7DNv0eB+fRVZq8LvG2Yd+qH73lDZLXCrhsJ0RiirAWbv1w5SEC3McsimAriAMGFtv 2aZDGODbdw7JKuakrEsGIwpln/WTucXfSA3TAMTLnkXPMT/0nuiXwX7vzDE9HBOvmZHd BMRXlbtPzIPcayyilOt0URhay49KTdFzoqcg/oi1FwKS4zHtQ65kgkL5nOl1PDF3/1f/ mJAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=IpHUfG7v; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46036-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46036-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVwuqbkm3KO9LkrPOlv7In/2pkAVqN0sUD+G91y9qMSZAB7UXsAAq+SpRvTiflnzJco5jriaV3nTlYf44PbRdR4k/umKg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m17-20020a056402511100b0055feca55a18si466734edd.673.2024.02.02.00.46.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:46:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46036-ouuuleilei=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=@tuxon.dev header.s=google header.b=IpHUfG7v; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46036-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46036-ouuuleilei=gmail.com@vger.kernel.org" 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 B88071F2AB24 for ; Wed, 31 Jan 2024 08:49:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FBF380BE9; Wed, 31 Jan 2024 08:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="IpHUfG7v" Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 E69D17B3EC for ; Wed, 31 Jan 2024 08:42:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690529; cv=none; b=rCtPGcc/NTF5KjCbfzUR9QFGL0i1F01gM319E+2rEVvMLYh95s38bxlm4a8XjWE9Wll4I5STB8oKz+L+xIeTNi+/aezfNS06qc7FHpi/HxlfLg8GeRJKvfIOyJgyJOmq0hQEIz8SosUm197GxQiqb7DG+VwLxtOi/5MK3bXsFB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690529; c=relaxed/simple; bh=M4XElsAbkAPToo3ZEnKBpvLmehS5jEZzhlJpMuxS2lc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cImx18yFzDOUk+YCRPUqINz5U4qCwgJXBeMuEPdk54yWO7ke+wO/Fc46Nr/jM1V1s6JwkqYmIj4v8wuOZGGFF2N7COruj9zx9b1Yr/dKy5T4TubxODiGm8kKeWmsskxeF6/xn+MedPVvHqRwLhpWbsZrt6wC7emYlzkNgBrZvRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=IpHUfG7v; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-557dcb0f870so5325172a12.2 for ; Wed, 31 Jan 2024 00:42:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690526; x=1707295326; 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=E1XrNomjmra/GM8RS/lknacwokF475kMeMhwWZ3EcPk=; b=IpHUfG7vGrYoMGri/XmbloOWvDcKQ9AFzDYOQ92wu4KCpW1cbM2Px27HrdVYIJd+Eq zHLXboJ+ZgY/cRoPLGoKEHiymO2GtyH9RJkdHWzVo050pyjLp434PA7uQp3kf6RNLLbX uaL14BScifZSILXbfD2M0fKUvvodRjAB5Qsv+S3Vab4tKL7tgqMJWwOO/AJsQ5kxvIrA gYE8nOo/BCrlmVU15EKn/iEBtGpRJidIa+h3spZQNZFZ4CJQ6lv8LSkzSZqkep8FgXwf lgJJZuuYBONWGxdrPHdtVy6U4xY53qFUJTDnk0fYHTWY078LMZFVoTBUoOOUA5mdSs+o rs9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690526; x=1707295326; 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=E1XrNomjmra/GM8RS/lknacwokF475kMeMhwWZ3EcPk=; b=SNNVW8ZFEGHZwKWXlGOsw4/2B7bii2XhrKWLKWFXHgw1fbiVqb2Uk7xGUA7R5LQ2eT AzUtx5RmxUT7BzbC0qLMfQPJFS+IUG9bTDRmdMo3b4B8s6Pdvwv5V1W1Q0kEp7CjDQF+ Okp8KB7faQ/YpfuzIW763XfrZFj0ScI3imW6VMrlAlcPRyM0xB9+6Om5f+tuIUdI3Vho lgd4sTd9OqerVbRenH2jpH3Th0I/NVermkwp9bO6/kwaP3Wq38iy8p/BI00z9Q/r+vm2 8djo56rLEg2tJQSU+v1DCd1aR5AUUAG3efnu7C7VBZcuU/VzA0hfygp1BFy5g40IZq7X rWDw== X-Gm-Message-State: AOJu0YwBawJVdum893GHHtzIo93SkpiZ/aE44Ccpc3HJnJr9uqOcu9tz FBRL2i2jRcMyx5mv52XzhGgmEFgLMt7fTxp4Cbndt+8awMwdLVjOuQMvL4tPsJc= X-Received: by 2002:a05:6402:1cad:b0:55f:82b:2da3 with SMTP id cz13-20020a0564021cad00b0055f082b2da3mr561401edb.22.1706690525968; Wed, 31 Jan 2024 00:42:05 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXIkeN+/q/7fkLe7PzMiRTrGGYp00Bgy3bQ1jPEuKPEBJVX0h37D/hMWLvhlSkSi/f13QSgf+r+BRMOgXxH2a6200kHM1DYhsUJAYuPrh+rbrACpP24O0qT5nlfxcDfkhTSEYigBHk9WPIqNVGzy9itC6VRSD6ZM1TfbPIlUSq3J48kjLfI4HMJy0NaWMPPtGVnHq8NwXx8klz1JZY0Q3wBlpSgklAgzL1FuUmw9Dk+JQnTPWmfWMRX4x6r5HlVt1p4uNCk2AwybR+1C1+9FID1AXV+1CbZiZQhaYKIfgfSUJXhmrQHcocU6CSpuKjHJENER11RspvZ3awkm5ws8gSx+02Joy+fx4+IfcaVqF2QmJ8kX2UsBRZQXPGQYRlqCKdibrNBG1lMKzAyZkHH6xN444BHhbTPURQnrRaOj4AcTId80Hw= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:42:05 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 14/15] net: ravb: Simplify ravb_suspend() Date: Wed, 31 Jan 2024 10:41:32 +0200 Message-Id: <20240131084133.1671440-15-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789776194068455513 X-GMAIL-MSGID: 1789776194068455513 From: Claudiu Beznea As ravb_close() contains now the call to ravb_ptp_stop() for both ccc_gac and gPTP aware platforms, there is no need to keep the separate call in ravb_suspend(). Instead, move it to ravb_wol_setup(). In this way the resulting code is cleaner. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - fixed typos in patch description - collected tags Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0dab98ea615a..661236affa5b 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2929,6 +2929,9 @@ static int ravb_wol_setup(struct net_device *ndev) /* Enable MagicPacket */ ravb_modify(ndev, ECMR, ECMR_MPDE, ECMR_MPDE); + if (priv->info->ccc_gac) + ravb_ptp_stop(ndev); + return enable_irq_wake(priv->emac_irq); } @@ -2961,14 +2964,10 @@ static int ravb_suspend(struct device *dev) netif_device_detach(ndev); if (priv->wol_enabled) - ret = ravb_wol_setup(ndev); - else - ret = ravb_close(ndev); + return ravb_wol_setup(ndev); - if (priv->info->ccc_gac) - ravb_ptp_stop(ndev); - - if (priv->wol_enabled) + ret = ravb_close(ndev); + if (ret) return ret; reset_assert: From patchwork Wed Jan 31 08:41:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 195701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp291583dyc; Fri, 2 Feb 2024 00:46:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXHjem5LX3doYK1vVOynhCDL2Lb7y3fcLYoBBtDs9SrabCbsl3iiMzZPmkRcX+iRq8T+iw X-Received: by 2002:a17:906:b0c:b0:a36:cd7c:9229 with SMTP id u12-20020a1709060b0c00b00a36cd7c9229mr2277576ejg.37.1706863586335; Fri, 02 Feb 2024 00:46:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706863586; cv=pass; d=google.com; s=arc-20160816; b=YWE7aI0z5CIQwA0m+/wzTusbuQO+oTOKJfy9bBeEm38H6I7T6R5Hw8atnxQjl7wDsM BunPqbZ2pz+ikqInKzOMHpkTVDcSjHtLS+nwMQaoQXBbUT4i+0kSp9kHdlsZ1zai3kPq Lbb+YpBEoKmpPjVgoqpCHVdf9oLG6iaHAfIoFf9xF2KL1RxhSmO9Ei3CU5La1MucAcId gIQxt7WXz812thGwyI2mt81pqzwvu/5hEUz2YEfY7fGa8Hyiib6PfrkFt9JFPrI2yTES BmdHBnr3r9OdyqDPuO2BlHW3vBSJM78b1BYp8Sodi32yCbl4ysqVftkcJPM20sPzLxOG ArmA== 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=jBX8tkoIGR61lIZo86EimVQm/t/fqsSustUrCgWT/u8=; fh=2UkeoPHf85ukratBrPpz1Vcsz1B9x0SNKahEqNn8OKA=; b=GrX6xFQrkXEzrZJPT55udSPw4DEEcJNMG9IWRcANFe5w/9kOrpPi1guVO+PGLnRK4y APqVddwYRfkhsuWdb4CsX2fW4XG0b3fHDlrKqz42TtIPC+DohRRU9x2zExI9/HtxSMM5 KwO9dp3wpba06e9vEX8n4mboZDB5GKBFGdHmYxEE/527/v7Y5yzxoqO2PU/wTKG/wGUv aEoIi8ZPvaC8u6nuifrdF3RxboPSF5WlAZPHZ5NsOM9fZppmFRO7Mn8P8QSanZSRt6r1 M/wHbLFWovDwD7Ckm/Zl/zBLYfxzZmmBxJWQIwJBYMAA+e/3E3RrBPksGuz7+WFqFcYK WpWQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=djfqqTDn; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46037-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46037-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXNzKFhWsAiVddunRTgY09C2bOvE45ohJ2vabFhoVrdg/VOUo+JHh0YB0KZIswWMk6ZKBKZEP4h5NcxKls/ddN65Styxg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f13-20020a170906560d00b00a371defbd71si76581ejq.906.2024.02.02.00.46.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 00:46:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46037-ouuuleilei=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=@tuxon.dev header.s=google header.b=djfqqTDn; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-46037-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46037-ouuuleilei=gmail.com@vger.kernel.org" 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 BADCA1F2AE24 for ; Wed, 31 Jan 2024 08:49:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C56080BFD; Wed, 31 Jan 2024 08:42:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="djfqqTDn" Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 094857BB0F for ; Wed, 31 Jan 2024 08:42:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690531; cv=none; b=coOHJCMG4RoH3829oVFSldW5atFilh+uYgRKWu6MiC06jtR8dx9wr5Oo4AZ7ayWxtpq8+mr2+1RP7SaphlfK/xBG+EUGMwAdzeF92IFa2EZDgNNJMSHd9Pfoop0EklxS3XkJhIZDMRPPInlC+8zTffhErpLYhnd2dZzTFQ+qtVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706690531; c=relaxed/simple; bh=WfssnXglDOxvPIQ881a3cyhpT+Q6juxzbfkgOXoITAs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vFxsGiD3wWu4/rzhIx7U/VQtRrFCCe0frg2kAGTn+bNcwYMjbSwAXX6nMdbre5AP1FhReP5ryn3yYyxMJ1yAjv/GcPiFZ+qEE60TycJZ9ZIpq97oJb97kl0DJ6ze72Ka+7JaLcparHI5RGQeY5ihyRKWxsFrcNqeyObXzj5k14w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=djfqqTDn; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-55f2b0c5ae9so2788691a12.2 for ; Wed, 31 Jan 2024 00:42:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706690527; x=1707295327; 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=jBX8tkoIGR61lIZo86EimVQm/t/fqsSustUrCgWT/u8=; b=djfqqTDn7y3VRP2bpuhyzGm/rVDZ97/sQXKzf1cCxpgzrpkQ563YnBkC/ILWiCq5TU K66AdcGkUUeOCafM7dzgze6uP1xmB3DQ0z0QrfVCHNel1lAl+FMAm1yDSPLEHLYk+YtR JOQN2cyi+M6rWSlizvbWYrL/bu6bBq6YCOXOFLmv37mvewZ5IXsbqqmx9wfDw9xlrz6a cHk7h2mOLSBOOrWfmxTFkl/fVF6DExmkeICh5gKVudlniEEYEBAhKwG4ok6Bkq/4k8SD 9F5ZynX1KdkwdUFd6FBxbTrXRdB4YcCDi4jns3PBvQxdUOYQJnVVTBS8e1fd8dK6OLQb xSuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706690527; x=1707295327; 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=jBX8tkoIGR61lIZo86EimVQm/t/fqsSustUrCgWT/u8=; b=VCahGt0PwjAl9BOtmPtPb2jMkeIBOfWg/yZ2mKuw2kXXo19J6SLZaKkjl3CgZrTnzl fIsBLTsoTZQ/MvfSEgm+7BMVoPZ3j49c44S1vfsLT65DCdJLQz68zSNKFkp1CG4v1QwB evR6GAxn/ZA2wOQ6OzKCkJuvWULSim3RuXQPpsyTrH/ipANhxlTDzDHWpG26LyFKcfRK TBAzld709HCUo4riF6yLbiW86G6f/C86dv1YMuhS+MD+cmoN80XO0F6P+XNYVkmsCKiI a8EsQAikW4oFYoL+mgirvVIbVx+1W+4g1ldwZJqlBzploZFLIKK5Z4RX98IXLmJrxZ7B w0Ng== X-Gm-Message-State: AOJu0YxpCohxqRISYrciTGHgUMXoWNCRdISmvv1kPUfBS+dblajme9c5 WczuKn7lakxjG+H3hKA22nJxWT9lXrq84CaP3ze96pADR7eu10P5yom/ZfNA/Ec= X-Received: by 2002:a05:6402:ca3:b0:55f:6b5a:6310 with SMTP id cn3-20020a0564020ca300b0055f6b5a6310mr526532edb.33.1706690527359; Wed, 31 Jan 2024 00:42:07 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUj9A6JryuTEC/GJvCzjlvGXsHqucq7yAlwoC3FuaYE4ZR6bPhrBiy7YkBu2VgTH9sX5DKKTdyA82C5fc8TDoNnKNNNsbaFV9eG2gf2fLyWjC+UIa+MY8jck33SpF4f3f1w6OkzUUYR3/rcXZ9lKRq5St844j8pX468KStrj+j3O3Q7m4mnUA3Cgyx6jkx5xYy4afFm5at6VZ+i0ve0gTCFO2XphAkUqm1r70SxrsM+2eXeT1kITr9IyiqeKWALqEGF3MGpqRSIhVWbk3tYrcZhAudIj2T8NKjXt1/ots8H40cP7PJxCYxzPbykt+B4evpDX9ywLwKKDjVKOLAASc5uODthJmEIDeWdn3QDBEHZ9pDErNauNgjfVmM8sZmUGV6u7s7SPDkGqovHkqkII7G01nuzG5Eg4ca9i7D85kyVK96/osU= Received: from claudiu-X670E-Pro-RS.. ([82.78.167.87]) by smtp.gmail.com with ESMTPSA id cq16-20020a056402221000b0055f02661ae2sm2863630edb.78.2024.01.31.00.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:42:07 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH net-next v5 15/15] net: ravb: Simplify ravb_resume() Date: Wed, 31 Jan 2024 10:41:33 +0200 Message-Id: <20240131084133.1671440-16-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.com> References: <20240131084133.1671440-1-claudiu.beznea.uj@bp.renesas.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: 1789776191997253432 X-GMAIL-MSGID: 1789776191997253432 From: Claudiu Beznea Remove explicit calls to functions that are called by ravb_open(). There is no need to have them doubled now that the ravb_open() already contains what is needed for the interface configuration. Along with it, configurations needed by PTP were moved to ravb_wol_restore(). With this, code in ravb_resume() becomes simpler. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v5: - none Changes in v4: - none Changes in v3: - fixed typos in patch description - collected tags Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 58 ++++++++++-------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 661236affa5b..9521cd054274 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2939,6 +2939,20 @@ static int ravb_wol_restore(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; + int error; + + /* Set reset mode to rearm the WoL logic. */ + error = ravb_set_opmode(ndev, CCC_OPC_RESET); + if (error) + return error; + + /* Set AVB config mode. */ + error = ravb_set_config_mode(ndev); + if (error) + return error; + + if (priv->info->ccc_gac) + ravb_ptp_init(ndev, priv->pdev); if (info->nc_queues) napi_enable(&priv->napi[RAVB_NC]); @@ -2978,53 +2992,29 @@ static int ravb_resume(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct ravb_private *priv = netdev_priv(ndev); - const struct ravb_hw_info *info = priv->info; int ret; ret = reset_control_deassert(priv->rstc); if (ret) return ret; - /* If WoL is enabled set reset mode to rearm the WoL logic */ + if (!netif_running(ndev)) + return 0; + + /* If WoL is enabled restore the interface. */ if (priv->wol_enabled) { - ret = ravb_set_opmode(ndev, CCC_OPC_RESET); + ret = ravb_wol_restore(ndev); if (ret) return ret; } - /* All register have been reset to default values. - * Restore all registers which where setup at probe time and - * reopen device if it was running before system suspended. - */ - - /* Set AVB config mode */ - ret = ravb_set_config_mode(ndev); - if (ret) + /* Reopening the interface will restore the device to the working state. */ + ret = ravb_open(ndev); + if (ret < 0) return ret; - ravb_set_gti(ndev); - - if (info->internal_delay) - ravb_set_delay_mode(ndev); - - /* Restore descriptor base address table */ - ravb_write(ndev, priv->desc_bat_dma, DBAT); - - if (priv->info->ccc_gac) - ravb_ptp_init(ndev, priv->pdev); - - if (netif_running(ndev)) { - if (priv->wol_enabled) { - ret = ravb_wol_restore(ndev); - if (ret) - return ret; - } - ret = ravb_open(ndev); - if (ret < 0) - return ret; - ravb_set_rx_mode(ndev); - netif_device_attach(ndev); - } + ravb_set_rx_mode(ndev); + netif_device_attach(ndev); return ret; }