From patchwork Tue Jan 23 12:58:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 191469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp902353dyi; Wed, 24 Jan 2024 02:46:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDRLs2n4aIQ81fouoiwGmjFrKX2q6vLlzw0fxRwv+ZsGNJU+3PbKkyTNuhGEObVsOc54BR X-Received: by 2002:a05:6512:1085:b0:50e:2742:aa6a with SMTP id j5-20020a056512108500b0050e2742aa6amr3866791lfg.97.1706093185857; Wed, 24 Jan 2024 02:46:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706093185; cv=pass; d=google.com; s=arc-20160816; b=eyWBSziG79OPKmDHWKlLOubTpbUpv8yjAdAVCCMWapUpqa96Ob8ch5SoxLS2LkLsKh e23bxBPoDeM8Gx7KLrVrnmCOWiUOCpQOgbOvGx12oMZaPtcJuU6jIAbdzQtQ2s0TBQWi g0WxUXWhgYNkCX73qS7oEokgwOvoLBlFsS6L+HWtufw4APm27nXrxyCdiRXi6OyU35cz s61GHBsq4c496kroZ7FXCE6JJHjvyn+IwgNKRYCGUY36MA1CP/EL2CdYXzRPH0EM+MfX KrRhTFEHN6+qo2Ktp+QwQin6s8xZs4Ox8A3I88Ysfg7gpgDhmCRldx5RceyErlsiirPq vX8w== 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=AGSrAGs5vLhtdiutZlV1QBydinRii8oVG9Wb9alDR6M=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=gm7P8vvZv7UPF0QhtUqPHUwQfs/+Hhsyo5iVAt3meV/Jq13Xuts7ZZpq1YCFgcMZhR Olf4v1BsHjzmH0LjmhhPlucDaZAI6ZFSNB60j3yrMGtyV1DP+V2VmmDa0WoC7m7JUkA1 mQb2LNCF/Jkm/RmNC2IJlr0Tyf+wGHfnnL31e+ASJgkp8X6yng+GejYATsNhxLPFBui/ fPSacwxGRJffvdF2UDLnyaTBp3yl+lGl0gG6rga2G5XHDGIq49FgNyDf+c5Fz4ADK9Gk tUfGB3aDiLXek3pZg0rrHAOsNoh34p/XOwPChX2liYuPQsGM8dwv/t1dD6f1zPlxaQCv d3yg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=fAnmwnkk; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35290-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35290-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b2-20020a170906490200b00a2d5d738fcdsi10521585ejq.54.2024.01.24.02.46.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 02:46:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35290-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=fAnmwnkk; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35290-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35290-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 EE08C1F26F6A for ; Tue, 23 Jan 2024 13:01:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A47A85FB8F; Tue, 23 Jan 2024 12:59:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="fAnmwnkk" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 0F1885F543 for ; Tue, 23 Jan 2024 12:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014776; cv=none; b=burfFEIgXzt8ELIATkAqSigrZhrpVe23RonUZltbLOestY+YU0FeIMroYlcPSKbSBvm7HQpXtJKFr53Ilat0SUKtXl+pfFdNLE9MzZgAsn+oho/byQaILY0khiIppHQKxSx8iXOMJJ2GhrBfQKKPKSKQlzACbqvd+DN5IloWtrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014776; c=relaxed/simple; bh=3iydeaPekcZvfbPjBaC8P9XUqRfDRobrZRsArje/jRg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JeokMza/e8bUtaQ+w8vzPQT0ERK+CBC5Jbavz6Jjzntr7rKqszX/vJ2c9Uzq5r6nM0kxvMjbg8BGpS5DNyB9R8RrZS5Fy0MZTTdyDqhfOnIymIIYMrSYSjOG8wA/SISzMhhFahXIpR/wc4OdHXr0ZC4Y6sLz4rTqP+jSl/lQMDg= 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=fAnmwnkk; arc=none smtp.client-ip=209.85.128.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-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40e87d07c07so54199025e9.1 for ; Tue, 23 Jan 2024 04:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014773; x=1706619573; 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=AGSrAGs5vLhtdiutZlV1QBydinRii8oVG9Wb9alDR6M=; b=fAnmwnkk0gGC5S3ZhF7RakJgZESQzFM+MiwXol6mxarNWGtGkzEJnS0MqQ2T7x4ddR FOFiNQL1ILlxNvh/5Xm5s4WOTFpOE7wjgnHVTTIiVLk/ril038q52povPMUqJiw/g8An zFwh1zqGJS89v5+9fdwLI+Fpxk1LGeB3bzWftVFBbHPSfxsAn+CYXefQ4bJuud4AAVcs 2kSQreGu09jPcExur/U4zWvZyrlosgFjRyl59q8OrDtsF7pLbQ3VCX396taLQgXeHzaL nONiAzHmJuqx7RkATgb9Fe3LUFAjZxl7/styHll7vMskFBy/MBegmExrAeUGRkMOyLz0 eg3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014773; x=1706619573; 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=AGSrAGs5vLhtdiutZlV1QBydinRii8oVG9Wb9alDR6M=; b=LoOKA/xIArEU9jxyICu4pHcyT2GV29csfUWhWjQV/Gqp5U5zNP6LScVpGvHsTODj97 lMnBAuYVt6STKVPvrv9xNNPYYaXLCKIKETYwMT5vypMm1PofZU6KEnmNV5Nnk95Dzt2K Xb58Xt1BFgQ4PG3ovp8dMUDcU7vAdFbnHE5V3TfrHpcKzyUMYOe+bd5cX9e/eywih/BV ZzlkKowPF8/nTTRxZ5t9aakXS+GIt4Y1fbFIp38Mharvt6UAg4NHvb3UukZ7WDaIhT8Y 6FXQMXUbmC8EgOo0sgLm+Wl3kN18Soooihkse41vdjBh3CTborEXu22jfMugKqpHPVrT kHpw== X-Gm-Message-State: AOJu0YxjJTHOYCVyqT5zq5dxVx9zdaP+0vdfhFxrHWU7iPs+unU05JpR 5hxoCfyga4/KqBeEBLQNgP8HjxU1eCxq/e1Jtn8XMS3+Mj8ql5r7pQpVt0hMWZw= X-Received: by 2002:a05:600c:5027:b0:40e:4870:d2a4 with SMTP id n39-20020a05600c502700b0040e4870d2a4mr130345wmr.59.1706014773264; Tue, 23 Jan 2024 04:59:33 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:32 -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 v4 01/15] net: ravb: Let IP-specific receive function to interrogate descriptors Date: Tue, 23 Jan 2024 14:58:15 +0200 Message-Id: <20240123125829.3970325-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788968368239392449 X-GMAIL-MSGID: 1788968368239392449 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 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 8649b3e90edb..921f645a7218 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 Tue Jan 23 12:58:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 191491 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp920038dyi; Wed, 24 Jan 2024 03:23:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHebf1dnKlUlrB3RF8adk0DFowP9WSRaSAuuP0nja3ooDOtPGTyVkqYd6uHZf0bYbVHS0yO X-Received: by 2002:a17:90a:6fe2:b0:28d:2a72:546f with SMTP id e89-20020a17090a6fe200b0028d2a72546fmr3877693pjk.70.1706095385719; Wed, 24 Jan 2024 03:23:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095385; cv=pass; d=google.com; s=arc-20160816; b=eiCiefSatO+p17PWupyw48tGqp9NIAQe6I3dhVKCzvWiEWX9P59kK4HkgTgJ83iGBM pNZKFEPbArRxAgRF1BpgvB6gfRSpczHQw+4Txub3bEoAfea+L1nHPcQvJBKzwI1As/L5 MggX+ULaPPmnnlg12DQCslvNDOMbsODzN+r2XmQGqc4DUswcdCQNBdu8Jup35unrCVnm 9/y16Z/P/5LMMwhAgSrQRecoq2rkD4l4gHRyEqB2GGeov4tI0znXvhSFoddFIWIvgpwV zVFQ8YMoAMqHb1SOBIJ5NO7IVGu22CUGWVEB4xu2ugsfRSoqjyl9ltzg1ctAGEKtwNpx HrSg== 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=Fu1OoD2WTtLNepo9qF+sp6H3mVig2UJn6Is7b5DZCbg=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=d/kxC5eVhcbF/YBcbxdt9fWFzvERxSi9h7N6hH47vXFEn9nppIETqtViJd4EM6qUe0 FzXXaXXs+Dgql6L3YiqGqNU+Vq/d0ZCAEgfe5eJjBSBtTPCg6JAp2Ue12n6b8mLN5ug8 j8vZo5zwSnzOWd9O5BWH46qlLBjgUICzR2xKt14D4mh2F8+QoAlnE14Ci3lNg/ZQl/mU ei5EDdmf5IZPAcq6AfN0jRDKu8x8MvGCLkxYpJcirSw8bXrG6BUIfNGsYZL40GJBdrqa LgDAyMpL88lf/7EEDMRDdW/y91MnnajxSEU5dW3XQalaE/GDdDCShV6TWAtzDSFJrAfE X5vg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=ZLtD6fei; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35292-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35292-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s18-20020a17090aa11200b0028cf6318076si11368704pjp.98.2024.01.24.03.23.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35292-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=ZLtD6fei; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35292-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35292-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 10B5D28FE74 for ; Tue, 23 Jan 2024 13:01:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E58D05FEEE; Tue, 23 Jan 2024 12:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="ZLtD6fei" Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.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 18C585F549 for ; Tue, 23 Jan 2024 12:59:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014777; cv=none; b=s+NzdiSAzpC5+OdZA1eGld3AjBj2z5wGyecDuuTEARNwycuvk8WLw851apkg+L+3/tqJ/TPy7xlXdSLY3tcM6lXbGMJ+HbICQYcn2nw5e0p1pZ9ckyK7M/t1BguldKnrODuBgVtTXAOIh59d0VlAu60DTCDc5Xd1KhoVtKT2QG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014777; c=relaxed/simple; bh=RUARXouDDyL8sNyIiDfa6P6mjzbYSnHZWR+e8Fo7oYY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tyMPGjaQoxuF8Ht445mrkqZn/UByFxPzRg5UhXx5a9CZOl7nINNeltvN0/2c5HCZsE43QOBWO+r5d2C2+DXDow4SxUU5tO6M5JZy1h4UxILYFfrDsMcwmHEQJG3CvF24tfeTVfNBjVn29WowVnnG0g/aKCdT/RnZ6lBu0HOVkvs= 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=ZLtD6fei; arc=none smtp.client-ip=209.85.221.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-wr1-f46.google.com with SMTP id ffacd0b85a97d-339237092dcso3043950f8f.3 for ; Tue, 23 Jan 2024 04:59:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014774; x=1706619574; 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=Fu1OoD2WTtLNepo9qF+sp6H3mVig2UJn6Is7b5DZCbg=; b=ZLtD6feiP3tECRxtfz+GD1DfCaHUO0Dq0LOdb81+BPrlaHdsM/Vb+c2Co2ebARMAYF uSxl29Hl/TDu10bhtD3IDB+sNyzLNG3fTy8AgeW1+2tjdk92o/j3aC2NwYQkjMyTOWIs JTiLeW89KuMdAkRh7ka1RAackT4Z8kELnv0HC+Fi809a5RZ7D9ZwVoS9T3Wvb5G3+Vow Qff3zmEX3Ghb5IdnlfQG5xt8zqDWnVuBN0QGx2ekLvHlINI2l+WLwy8eIgHiBT1Mcv+o QkgP7GQDZe3KeevnNBoLqrT5R+QBfE0FJOO2COjdrV5KFd+Z0h6Wmu3Ej9ZWwOYXaBJA HvRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014774; x=1706619574; 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=Fu1OoD2WTtLNepo9qF+sp6H3mVig2UJn6Is7b5DZCbg=; b=tcphRfkLLuY0JQhJlTtoZK9auQDFASHHyChESxaoE4C/57HLoOA0dnXelXg0wmiOO4 QcUJrEO8TH83qhSecfeG9ju2McDW28F4ox2V2dt5ifzc/h4l3M7Xbhg0Soeq7R5ex+xY +LTXGUJGIRnrwvGUYbCSENOD2IAgIt67zFQ8bY+Ol+cyJAnJrKKa2YN6ira2S77OkZvJ L9IZ2cfaskizHusPBnnEkZMbvPQfJC/9K+zb+v/IUDwVuiDGLliVn+HWBk90Zcfc1nww VseOJaLuWx2aac0ibM5MzonMnjOsV2cvOAoqtwaX5XbmG+Z/mlmOf0GMxy1pTHVRXPIf EL6g== X-Gm-Message-State: AOJu0Ywv74lx5mcsqbMso7IwgB3FLVakPVUSlqo3rCfzYpgHnznVsJ3d ntpRNY7OxCJ5VugzFnmSbxYmGw1w+PES6ZSh0LgKzkxGyC2PdLYFrvcBPegeCFxlDe8qiyTPDQJ 9 X-Received: by 2002:a05:600c:35ca:b0:40e:c2b8:ad3c with SMTP id r10-20020a05600c35ca00b0040ec2b8ad3cmr112266wmq.32.1706014774502; Tue, 23 Jan 2024 04:59:34 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:34 -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 v4 02/15] net: ravb: Rely on PM domain to enable gptp_clk Date: Tue, 23 Jan 2024 14:58:16 +0200 Message-Id: <20240123125829.3970325-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788970675141557715 X-GMAIL-MSGID: 1788970675141557715 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 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 921f645a7218..636da4f558f8 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 Tue Jan 23 12:58:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 192044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1589085dyi; Thu, 25 Jan 2024 04:07:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGN+r0KqEfRKqXc1iU11xwox1dzcFX6IHI8bj6hv5iPQ/o/+hbMsXMhkQZYAq1eoBqEOFVc X-Received: by 2002:a17:902:a616:b0:1d7:6f71:42f with SMTP id u22-20020a170902a61600b001d76f71042fmr848345plq.137.1706184428849; Thu, 25 Jan 2024 04:07:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706184428; cv=pass; d=google.com; s=arc-20160816; b=l883YGh2KM3ZIEAoe2YvFsQKfvbkalXwNMlahZvQ6e4caBRXCHY9sFs/Q+F113WqZ1 EwFL5iE+mCe/I5iOt3WOIQaLbQHj4YIcY7ESDwG++9M4rKoBjiECgz2BIlcFDdkEJDl1 jOfrwh62qprqLSpE6jZAdvxymIbzEOoLRas0PVmiYvgFI/NYkhpJH66QtrWTeHvfgUAn isc6v7fvZ6j57HRjJ9q9b/EJokw3+tTyERJrzLFbhyUazbkkdhEF8HpvKvG3pZ+6PkXe xA15jFlexcCOmcBqOs7ZdIvpThlKt6CkpKUq0/d4bDvJbSuHIMcvf89Q9eW1jsykfJIH xBVA== 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=YQVKGToeNaPe1F035XCNIF5gNVWAFGIwMD7/cf8Gc4w=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=cZBjckwpeuZIPKYpFU1ZLJuqB5mbjKqzjN8KQHhJR6vNIMli4fHadPLl4YA/MvIDql i1KAJqIbSill9g4OvS3LIuIZOKY2Z5TfmkoduzP46c2a6vD5DHV8LqjnssbsI7z3fKPb /2FIBf+zrQI3KYvAPSO/S9L90qSVeSlzfvdfWknRqPLYt8rSP3Wvk7fXIr13xBZJlf+S 0GpfNT/Yt7G4aJz6r0opPSb67cqMigC0xbMC+046vpzlq/FF9BlgExjYCljRjva2qM8G DGBn/g9t/j/FSmI1+pUpgqptUHNHroIpfCNcQXU4IUuPMXvpdrkbXp3faW63eVpYEXca ctqw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=LYUpW+br; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35293-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35293-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ba12-20020a170902720c00b001d7080998d1si12628047plb.412.2024.01.25.04.07.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 04:07:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35293-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=LYUpW+br; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35293-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35293-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 55A1828B620 for ; Tue, 23 Jan 2024 13:01:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FEBF60241; Tue, 23 Jan 2024 12:59:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="LYUpW+br" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 759285F56E for ; Tue, 23 Jan 2024 12:59:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014779; cv=none; b=QcAs/aldW93uj+WNnPSuCntfGfWYYuAgSeB5hjLnbncipRrqoEa73innVOUAzTbUCDmSJ4YKRzgRUCT4B3Ghhe72yfZa0tXy7O036pU3gKLMyYjuOi+zau6ddp8weo02cmuCkKXUk4z0KP7Blx5eIzV7iI+3CB+Ssqmgu0p2fI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014779; c=relaxed/simple; bh=aQEUzVmBmgrV4xyXQ2IY7U2P3nF6SC9PEWGu5NpN9FI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uVEr4gxJ0B+8872/yJ6f9Hp/4xeGADTJvRY+AezThFIti1y2bfeRnt9nq9Q7RN2uebEIWPnU4QY4q0avkFbJTGFaJ3v0HNm7VKeWLkZKFSl41p3/JXuX8BSTMDykaWRQYQXWKV778Chr5x2fcb9vwqsWzP8wRNELaZ9cglf+4Xc= 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=LYUpW+br; arc=none smtp.client-ip=209.85.128.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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40e60e137aaso47440945e9.0 for ; Tue, 23 Jan 2024 04:59:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014776; x=1706619576; 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=YQVKGToeNaPe1F035XCNIF5gNVWAFGIwMD7/cf8Gc4w=; b=LYUpW+brANXsIeLV/iryRFZrZ3AXT3VuvjUPLmhEGXcqwRoYaQBFXYTE1bEPjGPIt0 3VqN933n87RdPdiBF4PpE5n4w4aUYFlc73R4xNyNdlWHOiy8rT9V6zz1ZD0Ck6d4crhk TKAB43Ac9EqRq+RtgycUxm9a/vHxnqcr63vA71Zsu51aWpy7bDVP4lpwXXbanDyXX1UF rXWMP5ZY7YlSBL/jZH2o4DN2pkJ9mC4ge3g1zoWnpjijwj65swaNtrnFzydE3LyTXr7E B0ehBP/XyYYAMKzRBfeTsLLfrS45RlPcw3wVAUzO6IihpiokUrl/wXoZa0t2Oc+/VqKy 9PAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014776; x=1706619576; 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=YQVKGToeNaPe1F035XCNIF5gNVWAFGIwMD7/cf8Gc4w=; b=n8KkZGSId/EbAZXIIG6qa4puVe8mCLssYT3mpAMJo+wV0iPbV3965Bfk4xdpvG5tul 90wSB7UWCjsXgJwgh3gmxLxoYneCjkjBy3D/xQW4FzvAeD6c9zDixsCRXPm0pbnpaaHO W7Hz6WomUO7o/iRXLJsayrVgWzeLhedwj6ESPQrvS9Uz6wsuaD8qEtvRWW9eZAJwpKfP MCCyZe2Umdl9YcqWc44tIt+oG8e2+cBvgYQsB/c/cCBX6xIoP2Zgsg8/7QfJaTAHHJKU xehMxKzmXXoLQHsJSyqABTRN5eHXKQZTfxgek4rw5Xe3ldUCNPL6pjzD9UJXVOfYP8ih K3Uw== X-Gm-Message-State: AOJu0YyXO3PVZXJ5hcHRr+SONMVmFf1iM93yyYXKI8wak32YYGEAbKdV sykWKgi9WXVa94aJcD3qvyUISqP7tOSzQmQpdR8jtGQdwcQX2RN+bMTcEdkzQQk= X-Received: by 2002:a05:600c:91e:b0:40e:96df:35de with SMTP id m30-20020a05600c091e00b0040e96df35demr551360wmp.86.1706014775872; Tue, 23 Jan 2024 04:59:35 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:35 -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 v4 03/15] net: ravb: Make reset controller support mandatory Date: Tue, 23 Jan 2024 14:58:17 +0200 Message-Id: <20240123125829.3970325-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789064043698199900 X-GMAIL-MSGID: 1789064043698199900 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 --- 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 636da4f558f8..65b084778b93 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 Tue Jan 23 12:58:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 191495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp921668dyi; Wed, 24 Jan 2024 03:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEuRIC+HiMTzr9iWeVHbILimiY68vGgG1VZHAsRjWvCsWQ0t89eT4dNgGBTNVQsUBVzZ8KR X-Received: by 2002:a9d:7981:0:b0:6dd:f08f:44a7 with SMTP id h1-20020a9d7981000000b006ddf08f44a7mr1486616otm.8.1706095615499; Wed, 24 Jan 2024 03:26:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095615; cv=pass; d=google.com; s=arc-20160816; b=OLMsNkOyIMKA0CYCNj3Y9jb37BWPE8dFN04yhhL1fuo0SQ3gRhD/t3GqmCKNG/WfO4 1gMJbHf1+2pUDtwQCy+KPs91tj7CHClFH4+BWEe2pRj7Rw/Gjg8qj7I3m7PVoJEkeWuj G4rTaI1TR9mXO1+uGnDrVWMHs/vA02gGv09z0HADN/MvWTy+oq8UrT/uX6s5Wg94Bt4K 09fYokanxVdOCa9XDR1+orbrppFnBkzTYbKn7LG5RHijOaTBNci2ik0KcVr/tRz0551z Eubtzx4OXKlwf7iENg56mKc0B7r+4gOcORgMmmf1x9WVIpYV6EK22I+mLmDEipGlKRkJ EQmw== 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=8pkNsgorlOGjO2MgWb/dT6E51SlKpQ9V2ft0OBIasSE=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=TYdlcPIJetRo7krXOcZGNoYxSGGixSo06nGGITWmAhMq0Pnrru5Tq01yjC8fMPJYNC Gr4ws62VMja/ZSluzo6/CGQA51/R231j2BqvtRbEVlBM7ip5yC/hPdQ5uGKIoq4fKHyi 2Fr1+3z7bHn5W925tzy8UzffhEAiy8KUqnt2lxOO2lXeolVCWKiCbusemRvIEEZkGFLN BzcgIWs3XGWTo4hDOJ5P165XJp25l5/U3Z7gv7Z9wq5WeUGohNA6XNHBDKNouiQCHY6j 4SDN1PvB/lkkWMFD4zXIiPlPaE3Rq8IJ0EmwzF2raacQm4KGsm8pERcpIUk2zgyDyG/y U4EQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=myfLVAq1; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35294-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35294-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bs71-20020a63284a000000b005ce4d72996fsi1967632pgb.353.2024.01.24.03.26.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:26:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35294-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=myfLVAq1; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35294-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35294-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 733C5290AD3 for ; Tue, 23 Jan 2024 13:02:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 256E2604AE; Tue, 23 Jan 2024 12:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="myfLVAq1" Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 C8C245F867 for ; Tue, 23 Jan 2024 12:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014781; cv=none; b=fva4rIGrd+FPfywS/spqMgSmkqkBoFBHsXa71hT+i1fq1cOiJq5n/BYEAxedJqLNC2Ua7B3iVKcTTHxhZMz1rz0HrkDoqLpvg+eeUFAXIFjODg4wn7tqUWI2ohLmLRGPqsIh+Essydr+J63BnnJtnsfKSWCCPtcvGW3fu0GJszc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014781; c=relaxed/simple; bh=dRyt6tWlbiKqoIJh66DiSSuXinFPKcVAZdUgI40W4Tc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cVfxx3XmEd5vnf9SjxC8YRS6/ek4YV5Z7jd7SEQcIfRr1qioSYjKewP/cRaXAlY5TIBxy1yF9NxJOQFVVViFlmNlyPr4CKJSoOY6CahDustb2x7qjmNb9qdKnV50aSwgD6GfEGsVGJ3hFLVIrEwXuphKkcz7hIzLy9Mz5SL/7OI= 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=myfLVAq1; arc=none smtp.client-ip=209.85.128.52 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-wm1-f52.google.com with SMTP id 5b1f17b1804b1-40e7065b692so46617735e9.3 for ; Tue, 23 Jan 2024 04:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014777; x=1706619577; 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=8pkNsgorlOGjO2MgWb/dT6E51SlKpQ9V2ft0OBIasSE=; b=myfLVAq1GSzrsIPignzEqKZyx4XfxUBYnJg+wgXt9As14Qg19xDU4hdgR4KmKcaCK4 lNvIzXFakDO0S+kYB+f8lGMT+XBgMO0ehgbygVQkMW/PXoxbRmj8HRFtohyDZWJRCfiS 9pkZClJvLLQG7Y6rbwimFZI9scQjX2AipL73F5h6qs6UO/WmV8GrwCuiw/KE0momw09o 7sGcoXAjAl61c54MI60wrB2RnaJiKp6VisA4e5co9VibeX9VdZ4QnjJEwWbN5WhWwKRi NBuGoXbiTAteEr0OZS8BnXr4T80HoiSkLurJuAU+KKq6x81M2WU22Vqjw8x84RN8+0fK cjLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014777; x=1706619577; 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=8pkNsgorlOGjO2MgWb/dT6E51SlKpQ9V2ft0OBIasSE=; b=W8msXe4EaK+VxvJv8NalMHUT3iZL8vegJeGBolXcdUeE9ltu+pw+Vx1vdY4GbotObe Kn/T6UR9pEWuKHg1jg6kyO+9hKT0RtsryEY1BZLc7GWcfI5NoZeZ3+OwldfBWrlKA4SD ZLnf6JrLSe1093lM4jMgJv3rZDa9Skdm7YPHGTI1ePbSW+EyfMniONVhEAV1JnMVsRWS E2pM2pSTIX2RPM0Qs05+4qnLIoBWdmqotNs0/SAj/cRph0V3AzbiMfMAr7eQsrPxsJWN bRLIqOYuq5Smg0mj3QJvAkiDTrv1eNG4qV0yiCg3zw2r4wX4mttKNdQzmV4uLccemxgB MfPw== X-Gm-Message-State: AOJu0Yz+HFG42JTXw0D8E5T5MPgybxNu8/rdoNfe8G9NIEhzQKt8xiyq 1f39jqT4Vl8U7SiyFu7hhEvVNgxuiioBG21y/zZyD4m5hwb1nK9kU78R6AdksgM= X-Received: by 2002:a05:600c:1e84:b0:40e:4395:bc4a with SMTP id be4-20020a05600c1e8400b0040e4395bc4amr111242wmb.67.1706014777163; Tue, 23 Jan 2024 04:59:37 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:36 -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 v4 04/15] net: ravb: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Date: Tue, 23 Jan 2024 14:58:18 +0200 Message-Id: <20240123125829.3970325-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788970915947248710 X-GMAIL-MSGID: 1788970915947248710 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 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 65b084778b93..d054d1405cec 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 Tue Jan 23 12:58: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: 192006 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1567454dyi; Thu, 25 Jan 2024 03:21:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2492EQQchn4rdersqf5PazqfuAlftWmdFmLWM5q9liaUdOdRlsnmQ/oh/Ojfhb49JE8eT X-Received: by 2002:a17:906:3751:b0:a31:1414:8d8 with SMTP id e17-20020a170906375100b00a31141408d8mr246022ejc.136.1706181711541; Thu, 25 Jan 2024 03:21:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706181711; cv=pass; d=google.com; s=arc-20160816; b=to5c1oi6DW3/YFGrK+P2HsL2e29JWg1Zrm2GYcLwFMezaaOAFnAH6szjH/44kBtFZc snhH6tx5vb9vveMApDnr50N0ezp3GqmUlccc3XQk/l1EFoNHt6Nm8nUozr1jFeigX8GX YMTXyulgBIKIJmazZtKOZORDPOkvF6rAtdlyajFGJWFuujNTQd8uszWB7XY578M+1aUm EX9fO9yspFAXg6e3ZZjfl/rahOSUVfGT1Pos+QWNZlvavNhK8a3Yw3asQBmkKULGSVn6 W0AypsM69glCAcMOzYJEYWvig9TrKRyeSwgFh6lcfU4vCezYlCSri98SeKLYZ20C39sQ xDQg== 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=puI8SNnunhmOcoJT+z8Q27MsKtmovJKKV09skkr2C8U=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=tl0dKXh4tV7BbamQ3BOK+7haiGAPJlKMvbz7FhqliAXEg0GkKT0YaC5Qmv5Gh7kJc+ 5Ok1NQqf92c3XmkOGKOfTO9JYGjOnFkyFcv98gixBeOIsHKjXSJD7IHshykhskovWozX 5aNXLHrnkE0FX5VNZgF6RZ/OQrdGqUOziHZlTmpKIwUNkXw36frUCsOqIyms3G6TbtAs XCpHFSZkwHzm9vkGf1JvPQQtZADWAQDlYJRidfl4LK9fxM1rJYcx5C39vCjUQsxcwV0Z qeSfZctgiCp5vS+t7kPz+m/MykHHVT94oXFNtYtrB9OGEjP+5y7YXmashExafFaq38G3 T61g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=JXk7pOBJ; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35295-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35295-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y23-20020a170906071700b00a314dbca1f9si885584ejb.932.2024.01.25.03.21.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:21:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35295-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=JXk7pOBJ; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35295-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35295-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 C41081F28215 for ; Tue, 23 Jan 2024 13:02:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3504C604B0; Tue, 23 Jan 2024 12:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="JXk7pOBJ" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 F05395FDAE for ; Tue, 23 Jan 2024 12:59:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014781; cv=none; b=YES2+4YHAn5Cd1t8C6bMUKycwEf71hZjiCI+sQQb/TnSLuI8IXzMxLmVObVE2xobwRT071pBP1djqswrxI/AP5H3qj0MGJypy1v4TC2ZBY+KRyPwSIyUpRwkYj43M9pkDH4omThPXj6Fumt7VQqPUWmfWMcoDH2gTzCg3aoW9Fg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014781; c=relaxed/simple; bh=kAEoXOplVy5YWA3sBqf12QFlLVQhI4EiSxiILtHkle0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KEkmhl+h/5/N/PS1j7ftSf2PvXt+ZCpNM6hE9XfkiK5M80SwVdTTnhVZRlUi1ZxrprGSHcovvsQAHuvOqmQlPRWWCsHVin3liF8KkE26W4zOGfhnbygPbZ3Bvwd6lBGVSoLqEN51GLwRHodfvk8rw0PW/8yulXGQKTTy12VHgFk= 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=JXk7pOBJ; arc=none smtp.client-ip=209.85.128.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-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40e72a567eeso51319765e9.0 for ; Tue, 23 Jan 2024 04:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014778; x=1706619578; 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=puI8SNnunhmOcoJT+z8Q27MsKtmovJKKV09skkr2C8U=; b=JXk7pOBJdHeuCsBSkLiiUaOaaDjgQpUj5lg+5t3xin6EbtzFj+e6NvBi2/8q23bD// WNZj0BSHcr23MPad0jisNp99NIEcPDlGOf8MdrG/aep56qSPQ26p5iEOkE2FK3qUpM/b tIcwmc4Z9aqWEK2Bi9Uzsv7WcNxVrBe8EDnWBnz7z9UbcBTA7iDZg/e/4EmHUxlAzknD 2TD3O6erJ32BOTtAqeiUKLHu5TFH8bgY0nnYvSvtf/L05h0oD9NrEUbViI8SuX1Ue0Kp Hc8wLl8af3HzkZUJY4qBQF330j7U2KiRYWwmkjE6gBZyFVeEx/Dp3BsutsdMLrspIN+C 5WVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014778; x=1706619578; 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=puI8SNnunhmOcoJT+z8Q27MsKtmovJKKV09skkr2C8U=; b=QPWwHmrNtZL9AMENlw9omQgC+Bd6RXeX+b79CadRK92sonhPvVItzAjW0q1q59AEx8 /H42Z1xNJnFjcuXyoKmgqKzfSQWM0IS+6wK5RFS4a95S9UjIOaZQrIG3IK5LXoM7qb2t Z9wiQgRzSTfjyLVgeQYHx6WuAbf7CdegUpF3j4UUFebOUrRD2HEJGPGedJp+xdDW1s7o 7D6o5l3JB+pVNvtfMECs8sVHVebXV2kt8+auCQCt2T/Is5Px8O7CNNhJKyP9Qwydkw1Y 9H4SOUNVPkgdGiA9g1Ncg3nOF/RwI+ip2+kD6YEwz7XReNaEJI8SGJhCHBxV1oUldsFO SXWA== X-Gm-Message-State: AOJu0YygZZZbu1fvGZGOx2qaBcK2P9zIJoLeil/yQlOKO06wG9n3aLqF kerNwtJtvhMHypwjyzYzoZIA5frbMSA/E+7KC5KTBfINExnUux4P8s8uLK32qXs= X-Received: by 2002:a05:600c:5204:b0:40e:8e61:3202 with SMTP id fb4-20020a05600c520400b0040e8e613202mr266529wmb.148.1706014778411; Tue, 23 Jan 2024 04:59:38 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:38 -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 v4 05/15] net: ravb: Use tabs instead of spaces Date: Tue, 23 Jan 2024 14:58:19 +0200 Message-Id: <20240123125829.3970325-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789061194311363483 X-GMAIL-MSGID: 1789061194311363483 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 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 d054d1405cec..0a27d2741e8d 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 Tue Jan 23 12:58: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: 192051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1597330dyi; Thu, 25 Jan 2024 04:20:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEy0hPvdpbKXGc0Om2Qdknd2PAjFDTGlVhaYVnpeFe8XgvWsY5q/iodjNkr2UdDENf7eax X-Received: by 2002:a05:6214:e47:b0:682:4c34:ca34 with SMTP id o7-20020a0562140e4700b006824c34ca34mr991583qvc.85.1706185220561; Thu, 25 Jan 2024 04:20:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706185220; cv=pass; d=google.com; s=arc-20160816; b=c7uTDICXAV4KG0QR5jJkuXJUIaBZ4Oe4BTlpBi/Qzdn/X3jZupQhZAFA/eGP/iHy2L SlIa2d7AphwlxY+h3xQpH1ZFig4dBxThmmoliLLU7+vpFCtJ3Q6aFc+ndLBhx/WVpjG8 Jn9zFRGY27mx5nyfel0VzhW/Wj/Dlu0H9PBeOE3FaaqOt0hv3LCAH5608wjPbKyw6Ezr WE/kETxKHs+XRFwnp+OJ2I2idWFm/XPUzU59nYn2pF8LcCcedkrgNAMd025ata0Q97EV eaO6OPDaO9MDP9yqIpSjvaa1IqJsBmwLjiiCd227/gkw+8uE6RYn7TochWSTT8M+h5Ed 3jUw== 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=A+pLMq6Khs7mZ9vOVBT9kJiU7zBTpG072yfzErDcfPw=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=G6Ujzr1Yzt1Uq9MXwTKFTY6jC0ArQAYixcHCU5jBm1k7fZs6wRRTZ5TwHKj6HgZ4hL pCQtGpv+FBxxaAB4cCiYvLKjl9ubqW1kwnrcxUCpMBBRxDYYBPIw6JaHTQJkmEjpUVeR vggoXQcc9CuAr02FQTPvvSYlVnS8jV5/Ib02zBwlIINJArx2GW+wcjGFQLpgXl7oGL7D 1JG8DSFsV/Ramfv5GogUtYKMl//AW4hAKgx56aqFdz3WPj0uo56fp/dm+dawLc8EmlrB AGtb3wnEomq8QDRX/G3zxfQrlaa25pIzYB9uSQH3pccv9/hrQ29ylLwDrCzU4QFKiXM5 HJuA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=drS1tNZV; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35296-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35296-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d4-20020a0cdb04000000b006827afab142si12743733qvk.372.2024.01.25.04.20.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 04:20:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35296-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=drS1tNZV; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35296-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35296-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 3A8211C25AB3 for ; Tue, 23 Jan 2024 13:02:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A093D605A5; Tue, 23 Jan 2024 12:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="drS1tNZV" Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 306805FEFA for ; Tue, 23 Jan 2024 12:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014782; cv=none; b=hQEJEx9ADKfcC4hgEJ3p3tdqwFoL8BHVNGMmR/XN9SuGijUZSO3iYzL0YlH8ZD6rT7MfT/gntRaD8Vp2A10F4ikqti8615FOqCoiHEba/Z26s0UaItwvH20ompuAQF+jD5sV6sntKVqoCEhYAkHLRVIkCA+vI08KQkkmcmYRDvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014782; c=relaxed/simple; bh=maodbjEw57TfdCtC7UkPQKmKKIQeLpeD2PctYOEaXpM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nR+XN8kZOUtrjChtZ3Xlx6Ygu8eiImGvZbHQXkLhedWqjS+UQRcuOAlqaTWudrMdw+/qglCMF+tM62zNMg15gjkm4AcSdsEWL5Bk1ZdnDJIK0OOIwojwNsZOtYvPri3omXDxF4gHguKhmm5ORoLWyYxwfiY5zU1q7m7wGLN8B4A= 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=drS1tNZV; arc=none smtp.client-ip=209.85.221.51 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-wr1-f51.google.com with SMTP id ffacd0b85a97d-339237092dcso3044062f8f.3 for ; Tue, 23 Jan 2024 04:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014779; x=1706619579; 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=A+pLMq6Khs7mZ9vOVBT9kJiU7zBTpG072yfzErDcfPw=; b=drS1tNZVIuCCH4tV9zJzSo58YS2sEo4n+Vu81sJB38JjonhBBFcT1zbmWXOuoXP/wb bPiWNIuVssAVaEWkLPkcWUcAM/gXzvJxtlhxCzgQha+B7mwUTetfZezzqhH77C68oGHP OTZguPt566OH6cHI7cB1TEYmOo5MFcrpxN9EZeR9OwebUG+bdWwlLC8JCfErXN5Y0cck ZmaIsFt/ewMoZkXp1LkM0bPwGTf/qBTXX7c+RKkakUkvZdgXrRb6p3d7bWkQxxvgu/Ke GZN8DfPM+TJ78OTEeV6UjiFQPRCZcEizhtYyYOPXAXw2MHa/q39NdsC4uOxvWElF2r26 4VSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014779; x=1706619579; 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=A+pLMq6Khs7mZ9vOVBT9kJiU7zBTpG072yfzErDcfPw=; b=eHNdf7AofLLRP60gcLPNZKiy2/K+Gx8dOqUtFy8sehdOJDnMGnok9BZ7KcgD72WPqm 4/fOMsvyqDGXa1HcWYlAuPN+HnLS8UBndz6QLdksNXSqAlsXN1Laktd0YQL1KS60g/Wh biOGWiXpauOGB0UUjCq4601e9qQDA+BuxBZTUoKqsDK+NHyCXZYN5kjoMhgQ2lnkvg2j FRoZlT3XQ1DtmTc7XIyx58lVDOhHdwyPytkidcsjMs1OJJl4fqRXNHqlAIAD3CrUjFse 73Eo2UrCkzEQumCZywb3F6gxabOe5Inkbvr6qyDSGLC8MfYHKIEPpxMp8Rp3NApWJeCr rWug== X-Gm-Message-State: AOJu0Yxr0roEBbhrJqUXwpbq44k10hgSxUnbsolCY6U8Fcue22KC2F1J knApky8wA/BlM7lWsnJyw4j0Pfwupl2q+s0WrzUDUIDgM9FhT6CkfQ4S4mo70w8= X-Received: by 2002:a05:600c:808e:b0:40e:62aa:88dc with SMTP id ew14-20020a05600c808e00b0040e62aa88dcmr111549wmb.127.1706014779609; Tue, 23 Jan 2024 04:59:39 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:39 -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 v4 06/15] net: ravb: Assert/de-assert reset on suspend/resume Date: Tue, 23 Jan 2024 14:58:20 +0200 Message-Id: <20240123125829.3970325-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789064873830518464 X-GMAIL-MSGID: 1789064873830518464 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 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 0a27d2741e8d..9fc0e39e33c2 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 Tue Jan 23 12:58: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: 191487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp919274dyi; Wed, 24 Jan 2024 03:21:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IES+sMViX1pb5rXqyMRk+jq95BvapLkQVF2xaN3dBWUtHAW7R1IjXVJRP2Z9x+xti54shxi X-Received: by 2002:aa7:daca:0:b0:55a:7385:e9c7 with SMTP id x10-20020aa7daca000000b0055a7385e9c7mr2019238eds.23.1706095287434; Wed, 24 Jan 2024 03:21:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095287; cv=pass; d=google.com; s=arc-20160816; b=Ddr4djHfrsFY6UnATEUuTBzqj09eJPAj7eQKmdWLXsr901F9EIsLbZDnlb43tb7yKT J7vLZU1CexF80dU40Io/mqKe7GIsLkB6covRkxJMUFKVPXSGwK/TdjJg4bi2+a8HMLa8 v97dx3wMI9VbPlD4txahJwpsuvOWrlgJscyiYixCLdq61ohEvuuEY5ix7jKmGwBlV2bU Ioo5Uu1+STE+jFfwuCa+q1bi8vKoTjqWKHkld3ZMD3uTGn+GEd4veAluVyFO879Or2Su 91tVExVzx58nnf9ztJd5ZQTiKupHG7wC3TQdWRGpBFNG1BRtxvqt5y2psQqsyvetN6kD RO+w== 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=IeIGr0isHZho9VBGYyQbbIbLjrlTE2JdaGwNy3TBU94=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=kBen+8Vkely2iHR0PrsYHmC/IbPbGUhtlbPxNDYWo+8ELGMt7HP4t0DrZa27VWtbUb TnpW/ipKAZpXJ95MnLZ9B0vSLSvBGoo0vgZ2LVNfnQQRZ93QBoINQWOg0sMO9jB8kwFn 8EiI3xrcESsULiyvHyYSmo4DSKfG20T9BKzVQJYpkO3zmXx0v2OldLuzpebGb1FZ8M6G x9HTBR5jmo+UBPvwRdw+fanNquNb4I5FQqkbCYgShnMoh+WMb7amwU9OleJCAUbBGrNL gwM19bHTB03Zy/bXMv3UZA+9YGCKK+WjPeyrKB72dCtdBJH0CVuMV7ChI8yusEBa5lio O1pg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=iljuQ34V; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35298-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35298-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bf10-20020a0564021a4a00b0055c2c6a4df4si3509511edb.319.2024.01.24.03.21.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:21:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35298-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=iljuQ34V; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35298-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35298-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 820611F29696 for ; Tue, 23 Jan 2024 13:04:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B421E60DC5; Tue, 23 Jan 2024 12:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="iljuQ34V" Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 0B49A604A8 for ; Tue, 23 Jan 2024 12:59:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014786; cv=none; b=BCyC73hrsBpbFHykG8Z5PashmOaw93UPyI4jVBAK3lby27IjLIguPwrWMw0+eejk04lkaJeE6WB0UsB3UJfv1+cOaRYKx5tC1koiQAYXpf0pprn+lqLtz7ca7HPXkU7DK1uzB5VSCVTBy2rQEsqPAXitwCW03BOG1FRooVuV6Cs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014786; c=relaxed/simple; bh=ESB4HYfZJVt3bRqXI0pKlqnagS20ipnY3wpC4q0W3as=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ukIprxWRY3OFfdmBIJr40lGkhq/2UhvFI9F39HlT6nXclIm0MRcYDYDod67SQYtu4fw2sW+l0laXHl2EdYn7ysItJ0PvROY+GehNFUvr8Gp/qUwRxMJuGuFhTlIC1kvcXnSgHCekPPyi9xlCEIULNGrcPQkoJjpktI6xe/Uy7jg= 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=iljuQ34V; arc=none smtp.client-ip=209.85.128.41 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-wm1-f41.google.com with SMTP id 5b1f17b1804b1-40e7065b692so46618725e9.3 for ; Tue, 23 Jan 2024 04:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014782; x=1706619582; 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=IeIGr0isHZho9VBGYyQbbIbLjrlTE2JdaGwNy3TBU94=; b=iljuQ34VQYBO4w14BZ/tWR+PmjBdBYaRcYTLsK6y4pRg+mog3efwJuj8D3hXwGwhV1 WNNLq5HtxK8At/2LkJqZhwmVGhxGxt3KrNbld8c1dw5AqaACba/eCzj/pv3RSwSGFt2M wkbuvbeO4kViQRM5aV/4OIcLExIHOppPNFGVDHi4S7BET9czUQdvE6qJNJ/VmJk6NMWG 1H+aN8DdsIJDCwh9s4w45aw+wywU/lSmQB3O7MaF1sXSIYKPDBKTuMfd1v6kZmmhemZe iwJh2pk3//4GgvCFOGS1+5OhDYiWZZH7+M7gvj7KSJh3N/G90MFcrxd9ALVflfnApQ3V 7Gnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014782; x=1706619582; 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=IeIGr0isHZho9VBGYyQbbIbLjrlTE2JdaGwNy3TBU94=; b=B3lBBvSK7VuPeXNAjOR80pfR81ZWcmWMijE/DJDwVudkO1WMAuAEMOCO7wzMHE7agE T7uArWEXTKLkMrwIxKqvnPSsrx5qCQDScydlsxjykJ1JodlfR8PmO8/OERMt7PfphyrZ DlExVN3I87eKgVw3xXm8y93nNlsvb4SpBHRWfCKinWwZRLIkSHbNBjwlLzqC26nd8J4p vIgq/d2Z+yIcmgsYm/cN+2lU4qb4ERF1RLCghjlv4l3ykSVMM4RsPJ59OAjgiC7G+XQq nc+hUciV/aGtlWNML/CZRtRJta3RcXffx8qeJT4qXH90rKgYtouVq+fqaZXNAOi0hwTf rrIQ== X-Gm-Message-State: AOJu0Yy0p0mCYxrzqz79Xc7Hx2/I+Ag43gl1qTV8TN4zU/aTUR0xb3p1 O5SWRbIwDpihbjb/vqbyMVqFNuE4tK0rCnqFrPbJmqdR123NBPy0W+1Rvhh7kQM= X-Received: by 2002:a05:600c:19d3:b0:40e:7b39:183b with SMTP id u19-20020a05600c19d300b0040e7b39183bmr109885wmq.42.1706014782316; Tue, 23 Jan 2024 04:59:42 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:42 -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 v4 08/15] net: ravb: Move the IRQs get and request in the probe function Date: Tue, 23 Jan 2024 14:58:22 +0200 Message-Id: <20240123125829.3970325-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788970572439702797 X-GMAIL-MSGID: 1788970572439702797 From: Claudiu Beznea The runtime PM implementation will disable clocks at the end of ravb_probe(). As some IP variants switch to reset mode as a result of setting module standby through clock disable APIs, to implement runtime PM the resource parsing and requesting are moved in the probe function and IP settings are moved in the open function. This is done because at the end of the probe some IP variants will switch anyway to reset mode and the registers content is lost. Also keeping only register specific operations in the ravb_open()/ravb_close() functions will make them faster. Commit moves IRQ requests to ravb_probe() to have all the IRQs ready when the interface is open. As now IRQs gets and requests are in a single place there is no need to keep intermediary data (like ravb_rx_irqs[] and ravb_tx_irqs[] arrays or IRQs in struct ravb_private). In order to avoid accessing the IP registers while the IP is runtime suspended (e.g. in the timeframe b/w the probe requests shared IRQs and IP clocks are enabled) in the interrupt handlers were introduced pm_runtime_active() checks. The device runtime PM usage counter has been incremented to avoid disabling the device's clocks while the check is in progress (if any). This is a preparatory change to add runtime PM support for all IP variants. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- Changes in v4: - use pm_runtime_active() in interrupt handlers - addressed review comments Changes in v3: - fixed typos in patch description - detailed patch description - reworked the code to have a single function doing IRQ get and request Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb.h | 4 - drivers/net/ethernet/renesas/ravb_main.c | 299 ++++++++++------------- 2 files changed, 130 insertions(+), 173 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index e0f8276cffed..e3506888cca6 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1089,10 +1089,6 @@ struct ravb_private { int msg_enable; int speed; int emac_irq; - int erra_irq; - int mgmta_irq; - int rx_irqs[NUM_RX_QUEUE]; - int tx_irqs[NUM_TX_QUEUE]; unsigned no_avb_link:1; unsigned avb_link_active_low:1; diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 4673cc2faec0..724c11c747a6 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -38,16 +38,6 @@ NETIF_MSG_RX_ERR | \ NETIF_MSG_TX_ERR) -static const char *ravb_rx_irqs[NUM_RX_QUEUE] = { - "ch0", /* RAVB_BE */ - "ch1", /* RAVB_NC */ -}; - -static const char *ravb_tx_irqs[NUM_TX_QUEUE] = { - "ch18", /* RAVB_BE */ - "ch19", /* RAVB_NC */ -}; - void ravb_modify(struct net_device *ndev, enum ravb_reg reg, u32 clear, u32 set) { @@ -1092,11 +1082,23 @@ static irqreturn_t ravb_emac_interrupt(int irq, void *dev_id) { struct net_device *ndev = dev_id; struct ravb_private *priv = netdev_priv(ndev); + struct device *dev = &priv->pdev->dev; + irqreturn_t result = IRQ_HANDLED; + + pm_runtime_get_noresume(dev); + + if (unlikely(!pm_runtime_active(dev))) { + result = IRQ_NONE; + goto out_rpm_put; + } spin_lock(&priv->lock); ravb_emac_interrupt_unlocked(ndev); spin_unlock(&priv->lock); - return IRQ_HANDLED; + +out_rpm_put: + pm_runtime_put_noidle(dev); + return result; } /* Error interrupt handler */ @@ -1176,9 +1178,15 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id) struct net_device *ndev = dev_id; struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; + struct device *dev = &priv->pdev->dev; irqreturn_t result = IRQ_NONE; u32 iss; + pm_runtime_get_noresume(dev); + + if (unlikely(!pm_runtime_active(dev))) + goto out_rpm_put; + spin_lock(&priv->lock); /* Get interrupt status */ iss = ravb_read(ndev, ISS); @@ -1222,6 +1230,9 @@ static irqreturn_t ravb_interrupt(int irq, void *dev_id) } spin_unlock(&priv->lock); + +out_rpm_put: + pm_runtime_put_noidle(dev); return result; } @@ -1230,9 +1241,15 @@ static irqreturn_t ravb_multi_interrupt(int irq, void *dev_id) { struct net_device *ndev = dev_id; struct ravb_private *priv = netdev_priv(ndev); + struct device *dev = &priv->pdev->dev; irqreturn_t result = IRQ_NONE; u32 iss; + pm_runtime_get_noresume(dev); + + if (unlikely(!pm_runtime_active(dev))) + goto out_rpm_put; + spin_lock(&priv->lock); /* Get interrupt status */ iss = ravb_read(ndev, ISS); @@ -1254,6 +1271,9 @@ static irqreturn_t ravb_multi_interrupt(int irq, void *dev_id) } spin_unlock(&priv->lock); + +out_rpm_put: + pm_runtime_put_noidle(dev); return result; } @@ -1261,8 +1281,14 @@ static irqreturn_t ravb_dma_interrupt(int irq, void *dev_id, int q) { struct net_device *ndev = dev_id; struct ravb_private *priv = netdev_priv(ndev); + struct device *dev = &priv->pdev->dev; irqreturn_t result = IRQ_NONE; + pm_runtime_get_noresume(dev); + + if (unlikely(!pm_runtime_active(dev))) + goto out_rpm_put; + spin_lock(&priv->lock); /* Network control/Best effort queue RX/TX */ @@ -1270,6 +1296,9 @@ static irqreturn_t ravb_dma_interrupt(int irq, void *dev_id, int q) result = IRQ_HANDLED; spin_unlock(&priv->lock); + +out_rpm_put: + pm_runtime_put_noidle(dev); return result; } @@ -1727,85 +1756,21 @@ static const struct ethtool_ops ravb_ethtool_ops = { .set_wol = ravb_set_wol, }; -static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler, - struct net_device *ndev, struct device *dev, - const char *ch) -{ - char *name; - int error; - - name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", ndev->name, ch); - if (!name) - return -ENOMEM; - error = request_irq(irq, handler, 0, name, ndev); - if (error) - netdev_err(ndev, "cannot request IRQ %s\n", name); - - return error; -} - /* Network device open function for Ethernet AVB */ static int ravb_open(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; - struct platform_device *pdev = priv->pdev; - struct device *dev = &pdev->dev; int error; napi_enable(&priv->napi[RAVB_BE]); if (info->nc_queues) napi_enable(&priv->napi[RAVB_NC]); - if (!info->multi_irqs) { - error = request_irq(ndev->irq, ravb_interrupt, IRQF_SHARED, - ndev->name, ndev); - if (error) { - netdev_err(ndev, "cannot request IRQ\n"); - goto out_napi_off; - } - } else { - error = ravb_hook_irq(ndev->irq, ravb_multi_interrupt, ndev, - dev, "ch22:multi"); - if (error) - goto out_napi_off; - error = ravb_hook_irq(priv->emac_irq, ravb_emac_interrupt, ndev, - dev, "ch24:emac"); - if (error) - goto out_free_irq; - error = ravb_hook_irq(priv->rx_irqs[RAVB_BE], ravb_be_interrupt, - ndev, dev, "ch0:rx_be"); - if (error) - goto out_free_irq_emac; - error = ravb_hook_irq(priv->tx_irqs[RAVB_BE], ravb_be_interrupt, - ndev, dev, "ch18:tx_be"); - if (error) - goto out_free_irq_be_rx; - error = ravb_hook_irq(priv->rx_irqs[RAVB_NC], ravb_nc_interrupt, - ndev, dev, "ch1:rx_nc"); - if (error) - goto out_free_irq_be_tx; - error = ravb_hook_irq(priv->tx_irqs[RAVB_NC], ravb_nc_interrupt, - ndev, dev, "ch19:tx_nc"); - if (error) - goto out_free_irq_nc_rx; - - if (info->err_mgmt_irqs) { - error = ravb_hook_irq(priv->erra_irq, ravb_multi_interrupt, - ndev, dev, "err_a"); - if (error) - goto out_free_irq_nc_tx; - error = ravb_hook_irq(priv->mgmta_irq, ravb_multi_interrupt, - ndev, dev, "mgmt_a"); - if (error) - goto out_free_irq_erra; - } - } - /* Device init */ error = ravb_dmac_init(ndev); if (error) - goto out_free_irq_mgmta; + goto out_napi_off; ravb_emac_init(ndev); /* Initialise PTP Clock driver */ @@ -1826,26 +1791,6 @@ static int ravb_open(struct net_device *ndev) if (info->gptp) ravb_ptp_stop(ndev); ravb_stop_dma(ndev); -out_free_irq_mgmta: - if (!info->multi_irqs) - goto out_free_irq; - if (info->err_mgmt_irqs) - free_irq(priv->mgmta_irq, ndev); -out_free_irq_erra: - if (info->err_mgmt_irqs) - free_irq(priv->erra_irq, ndev); -out_free_irq_nc_tx: - free_irq(priv->tx_irqs[RAVB_NC], ndev); -out_free_irq_nc_rx: - free_irq(priv->rx_irqs[RAVB_NC], ndev); -out_free_irq_be_tx: - free_irq(priv->tx_irqs[RAVB_BE], ndev); -out_free_irq_be_rx: - free_irq(priv->rx_irqs[RAVB_BE], ndev); -out_free_irq_emac: - free_irq(priv->emac_irq, ndev); -out_free_irq: - free_irq(ndev->irq, ndev); out_napi_off: if (info->nc_queues) napi_disable(&priv->napi[RAVB_NC]); @@ -2180,19 +2125,6 @@ static int ravb_close(struct net_device *ndev) cancel_work_sync(&priv->work); - if (info->multi_irqs) { - free_irq(priv->tx_irqs[RAVB_NC], ndev); - free_irq(priv->rx_irqs[RAVB_NC], ndev); - free_irq(priv->tx_irqs[RAVB_BE], ndev); - free_irq(priv->rx_irqs[RAVB_BE], ndev); - free_irq(priv->emac_irq, ndev); - if (info->err_mgmt_irqs) { - free_irq(priv->erra_irq, ndev); - free_irq(priv->mgmta_irq, ndev); - } - } - free_irq(ndev->irq, ndev); - if (info->nc_queues) napi_disable(&priv->napi[RAVB_NC]); napi_disable(&priv->napi[RAVB_BE]); @@ -2616,6 +2548,90 @@ static void ravb_parse_delay_mode(struct device_node *np, struct net_device *nde } } +static int ravb_setup_irq(struct ravb_private *priv, const char *irq_name, + const char *ch, int *irq, irq_handler_t handler) +{ + struct platform_device *pdev = priv->pdev; + struct net_device *ndev = priv->ndev; + struct device *dev = &pdev->dev; + const char *dev_name; + unsigned long flags; + int error; + + if (irq_name) { + dev_name = devm_kasprintf(dev, GFP_KERNEL, "%s:%s", ndev->name, ch); + if (!dev_name) + return -ENOMEM; + + *irq = platform_get_irq_byname(pdev, irq_name); + flags = 0; + } else { + dev_name = ndev->name; + *irq = platform_get_irq(pdev, 0); + flags = IRQF_SHARED; + } + if (*irq < 0) + return *irq; + + error = devm_request_irq(dev, *irq, handler, flags, dev_name, ndev); + if (error) + netdev_err(ndev, "cannot request IRQ %s\n", dev_name); + + return error; +} + +static int ravb_setup_irqs(struct ravb_private *priv) +{ + const struct ravb_hw_info *info = priv->info; + struct net_device *ndev = priv->ndev; + const char *irq_name, *emac_irq_name; + int error, irq; + + if (!info->multi_irqs) + return ravb_setup_irq(priv, NULL, NULL, &ndev->irq, ravb_interrupt); + + if (info->err_mgmt_irqs) { + irq_name = "dia"; + emac_irq_name = "line3"; + } else { + irq_name = "ch22"; + emac_irq_name = "ch24"; + } + + error = ravb_setup_irq(priv, irq_name, "ch22:multi", &ndev->irq, ravb_multi_interrupt); + if (error) + return error; + + error = ravb_setup_irq(priv, emac_irq_name, "ch24:emac", &priv->emac_irq, + ravb_emac_interrupt); + if (error) + return error; + + if (info->err_mgmt_irqs) { + error = ravb_setup_irq(priv, "err_a", "err_a", &irq, ravb_multi_interrupt); + if (error) + return error; + + error = ravb_setup_irq(priv, "mgmt_a", "mgmt_a", &irq, ravb_multi_interrupt); + if (error) + return error; + } + + error = ravb_setup_irq(priv, "ch0", "ch0:rx_be", &irq, ravb_be_interrupt); + if (error) + return error; + + error = ravb_setup_irq(priv, "ch1", "ch1:rx_nc", &irq, ravb_nc_interrupt); + if (error) + return error; + + error = ravb_setup_irq(priv, "ch18", "ch18:tx_be", &irq, ravb_be_interrupt); + if (error) + return error; + + 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); @@ -2635,9 +2651,8 @@ static int ravb_probe(struct platform_device *pdev) struct reset_control *rstc; struct ravb_private *priv; struct net_device *ndev; - int error, irq, q; struct resource *res; - int i; + int error, q; if (!np) { dev_err(&pdev->dev, @@ -2664,20 +2679,6 @@ static int ravb_probe(struct platform_device *pdev) if (error) goto out_free_netdev; - if (info->multi_irqs) { - if (info->err_mgmt_irqs) - irq = platform_get_irq_byname(pdev, "dia"); - else - irq = platform_get_irq_byname(pdev, "ch22"); - } else { - irq = platform_get_irq(pdev, 0); - } - if (irq < 0) { - error = irq; - goto out_reset_assert; - } - ndev->irq = irq; - SET_NETDEV_DEV(ndev, &pdev->dev); priv = netdev_priv(ndev); @@ -2692,6 +2693,10 @@ static int ravb_probe(struct platform_device *pdev) priv->num_rx_ring[RAVB_NC] = NC_RX_RING_SIZE; } + error = ravb_setup_irqs(priv); + if (error) + goto out_reset_assert; + priv->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(priv->clk)) { error = PTR_ERR(priv->clk); @@ -2739,50 +2744,6 @@ static int ravb_probe(struct platform_device *pdev) priv->avb_link_active_low = of_property_read_bool(np, "renesas,ether-link-active-low"); - if (info->multi_irqs) { - if (info->err_mgmt_irqs) - irq = platform_get_irq_byname(pdev, "line3"); - else - irq = platform_get_irq_byname(pdev, "ch24"); - if (irq < 0) { - error = irq; - 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_rpm_put; - } - priv->rx_irqs[i] = irq; - } - for (i = 0; i < NUM_TX_QUEUE; i++) { - irq = platform_get_irq_byname(pdev, ravb_tx_irqs[i]); - if (irq < 0) { - error = irq; - goto out_rpm_put; - } - priv->tx_irqs[i] = irq; - } - - if (info->err_mgmt_irqs) { - irq = platform_get_irq_byname(pdev, "err_a"); - if (irq < 0) { - error = irq; - goto out_rpm_put; - } - priv->erra_irq = irq; - - irq = platform_get_irq_byname(pdev, "mgmt_a"); - if (irq < 0) { - error = irq; - goto out_rpm_put; - } - priv->mgmta_irq = irq; - } - } - ndev->max_mtu = info->rx_max_buf_size - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN); ndev->min_mtu = ETH_MIN_MTU; From patchwork Tue Jan 23 12:58: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: 191993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1562721dyi; Thu, 25 Jan 2024 03:11:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+L4/TWUlkk+JBuKAGswLujSi+opBfXPOoJx0GtkkuvpoYUcNKYf3NiHp4ruML2WUihfpC X-Received: by 2002:a17:907:1606:b0:a2f:1cd5:94f1 with SMTP id cw6-20020a170907160600b00a2f1cd594f1mr511584ejd.67.1706181115434; Thu, 25 Jan 2024 03:11:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706181115; cv=pass; d=google.com; s=arc-20160816; b=qvaWdS0xZGVz1JSevUPIfaariCz77ibz8DkjgXvSIB9ZZAtadPjqjj7yQMcbE0EXV9 NYWHhZqRwhXHU9rvsFKpTjJZ2tFiaExsY8d2oVo5gAIhYh660MbtF4lWVQTmmYa9iBRa bTjZgFWj8+zP08Pn4pFv5mra+cYF8G/OY5NHnql2RGe4m9RrhLTVht4Lzfx4Y2YEV+Fa aaPT7H3LUOZ0o/heiSBupol81c7INWtVYHkKbBUdJMG3juyuFYfCTXqvBWOY4HPTnA3W S+R3slyIX/+7183ap3utsNcykY4E7rTVo+wUolF622guEGh3auGnWXpFdKWwZam3bP94 do0Q== 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=tPYX9VHMb5f2krEz/XFumSk5tOXOzxIPHZoPxQJGoC4=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=k0YOwZevhLIlW5GkggXuk4nKdz4cTI3VZ0PXag+cVmz+U4lxjkU0Q7694vfYiwAujG 7evBMyreutluIyBk8wDyOsNiCY5cPqjjOBf7sR3zgD9/5Ubw1SLZsccHzUgTyYYxXPpl q4yLLPVxjiFHQKrQFtqa3kO63KC7tXrN0yn/V9nEpTxwe2Z2eZLiwAHLGLWTjY6FUMuB /aksOQnrUJqDojDNOIHbnY/m5X7ANm09bm79ZWB+hI9Nz12N+HDJQqq8ex9tIHlhB2Fd ny//kbWBJ9x4vCpbzGyFONmGlRvnkqaJ4LTmOhYAYci2A4mAuq9Q3OLD0OUPVu2wVq3o hI/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b="L6A1GV/F"; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35299-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35299-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h6-20020a1709060f4600b00a2b94fc6ee9si874740ejj.132.2024.01.25.03.11.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:11:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35299-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="L6A1GV/F"; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35299-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35299-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 C09131F294D3 for ; Tue, 23 Jan 2024 13:04:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3917660BB0; Tue, 23 Jan 2024 12:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="L6A1GV/F" Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 3FEE1604D7 for ; Tue, 23 Jan 2024 12:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014787; cv=none; b=TRGJokW3bTieE77Z7cUkz0GzqLZ3atWg2DRO3F4MZn49w1wx/wOiTIiFJxP5IGhUtDuA/Nc3XPtjqdELp4rRtiFfFAcp37iQi3G5JaDC/yiTTzFZFmUfGDnpnW0AdTpKiO7fHgl1+OyDqhTuy587Djq8moXeFLzvRq8LSoKQx5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014787; c=relaxed/simple; bh=66YZ7j3bbfBxS5uutkyub/JMoxPJjimQzdpNYerbURw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FXikdECRLtYZ+YOFn4amIZ2eLgOFU2YeM51ynaRuqJeSzv15/xMntp4qih19abfWtM4F7i9yICIuGX5xnKPCWd5lPiU1sWDMKb25xPsCRzJf0Wv3X4/NRAgLZXnaKy7lfQk3xHtZjEfTsTu1ESxhxerkg+M+cUrCb7Y+RFiihTk= 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=L6A1GV/F; arc=none smtp.client-ip=209.85.128.41 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-wm1-f41.google.com with SMTP id 5b1f17b1804b1-40eacb4bfa0so22622445e9.1 for ; Tue, 23 Jan 2024 04:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014783; x=1706619583; 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=tPYX9VHMb5f2krEz/XFumSk5tOXOzxIPHZoPxQJGoC4=; b=L6A1GV/FBHtkjnElUV806ttJngEDL/dkL9hZj1AYA8I+FnuP135SIp0EPy49B0XsgB cLn6L592+4NN/8YJ7m7Hzm3EZ2svMdYG0F+N8ssgFF9mDr+ncEiZPGV5AAbCo2FonemT AmnYyoP8xuiLiYTnB3YZwWfkWAgOBMmq5La+q21dDMe6NQkzfh/Ji0gIAQ3270XkGpke Cx6+j+AH0kTdVgnoK5Plg0tg+OigLhEK7bifyfOPjEcbKbc83K48PTEVO94PoL4WQFo3 7C7gqr23EJT9y2DueSqL9qT+7TqtSs1t82lx/9l1B5OkiTbK4hsdCCkj2N30B2O7yAzx sS9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014783; x=1706619583; 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=tPYX9VHMb5f2krEz/XFumSk5tOXOzxIPHZoPxQJGoC4=; b=fYLISqcP43Ria/+NIXDvCSUy7OG87DqfXkBxZ9zYm+dROGfMf0cqRumEcPm6RtfLJC qFAtSv4f1PEf3Bu6mZ3yoF9uQR547bWxOixBl+ZHk1NPLyLxpeoI5Ue8hujs3uSIZowF U3aqrqfWqHahwegUB2sz0a2teWRMCp0bW5VM8/LZUbD6soAuTjAfl1MV0ywCq7ZMggdS PesZ2W9XprudHfmPpD+oFQe+qKbeDrZOLU13S60jsck3ZyFjybD9EbIIx+sxlWJR3KKS i6gPEC8OdwaEPZeFs9js5ZWju5Db10nlut8OXAIQ21PmP2xs4LR8ot1BRx2HUq3c91d4 Ippw== X-Gm-Message-State: AOJu0Yw8qq1a+ELjSKmu9ix4iJAXgizK9Q6LDxk1t9CtBZx2fxfedfvW 1cMuRc/MmdKywaXI912H52bk7UGvXmSEcT/MHWkrVbtpGAt84Dkj6+CbLxWTtnk= X-Received: by 2002:a05:600c:2305:b0:40e:4913:58b5 with SMTP id 5-20020a05600c230500b0040e491358b5mr105852wmo.174.1706014783526; Tue, 23 Jan 2024 04:59:43 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:43 -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 v4 09/15] net: ravb: Split GTI computation and set operations Date: Tue, 23 Jan 2024 14:58:23 +0200 Message-Id: <20240123125829.3970325-10-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789060569568257345 X-GMAIL-MSGID: 1789060569568257345 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 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 724c11c747a6..8956c33c60e2 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 Tue Jan 23 12:58: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: 191488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp919489dyi; Wed, 24 Jan 2024 03:21:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHrbOYcG/NviIY2u+Zq6kRVvVv7MMQABUgT2yFm2plS3pi3NL6TahCOpjqJfN3zL9rzsFaJ X-Received: by 2002:a05:6830:4795:b0:6de:9a8d:3362 with SMTP id df21-20020a056830479500b006de9a8d3362mr1364471otb.49.1706095317259; Wed, 24 Jan 2024 03:21:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095317; cv=pass; d=google.com; s=arc-20160816; b=m9aQT8sbuwfjwQmu4r6vmH+hUEDkZv03XG52fzjITCMxWLQbqF4fwDN5I8sJ8928vN QqJ0KB4BwLUu1k2R8JRdiNKQs6VlMieQiG0kF1hhdCol2YjhX7m3Wwi/A5MEApZ3KbDU Y0GF83oHNNTeziR1/dLxcSrdbCo0HrlVCbLLBB3lbaH+kkg10dPrPNZP9Tc50feBUSqC aLGkwawAFZ01AafhJL3s95ABKaUT+eevunUZMLkGeysFHw6bUYcUMbC054GuDXe5XJzW bTqmpTFFypFemmfJESJVoNM4X2wile1DSwPgOtxhksqGX/Eiabzqb6AOYzt6knRcIliu m2Cw== 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=ErNfF/Xc9qsj3D+ti7spZOyCJXcg8kBzLgnUTUWSxO4=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=NYFlKNsEk/UI0f5oFPX+ekAkx33LZs3zXeNte1C02hmg1tdbA+hhHSyOHocjVjo/n5 i1jJBnRUtrZCTdcDlrYLPOEfb9rlEkXe3X7D+9NBQshc+LUnXve7FU2Fz+qaChYdmCQr G8h9DQ/Kz8vvdn20hzCkupQdQgRUw2+P8FNQM/2Fj1g0Qy2nQf0XS3fTLymh1KIjFPut WthQkn6BfQ7XQNl11247llRxqn1QUADtW/hjG9+mmJEQhpWhzid/R+bhYzWt359EipJS wUAUUiUVukIKjuLHs1+nJoq+OWPtowT/1u4T7/GEeZHH8vgEk6DX7IklDvcfNY3Ik0xI s06g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=XHtv7cSj; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35300-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35300-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k127-20020a632485000000b005cd84b844edsi11462300pgk.604.2024.01.24.03.21.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:21:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35300-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=XHtv7cSj; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35300-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35300-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 7F46C29202C for ; Tue, 23 Jan 2024 13:04:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0343160DD3; Tue, 23 Jan 2024 12:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="XHtv7cSj" Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.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 83602605B4 for ; Tue, 23 Jan 2024 12:59:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014788; cv=none; b=c5lni0bKUSxPeJgQ4oLGTqmlUZG4j+36/+1UM/tuCWHPs7ICNxoKJQ5LVjpBgTpj8tBXsPRZNNEZggVkljpfcp6r6yyX6h3NZI9rjQy07jDclChGS0viX8cWI1ebw4KOczFGaW0Lwnxqku2OzrBYKJ+U232txSeBLS/L65hhMgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014788; c=relaxed/simple; bh=BVKHfjjAvYftCSiWzzn5WbjbFsP7wBJZK7YKMMKP/aA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f4r+dhqK2W81j8QqWHrCuhAsmYKedlaqgsl+883ghXaRhialjZNg7atHBWpCZUp2ME5ExHM4sSIbaTP3QY21+NCA+EpvIuoxwB2REbV6iGrV+bojRSwI07tsuLHaZME9kh1P2hbrYsDNAFhSu7UbktOWOK2eD+2TERkvCavFXGQ= 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=XHtv7cSj; arc=none smtp.client-ip=209.85.128.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-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40e80046246so25676415e9.1 for ; Tue, 23 Jan 2024 04:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014785; x=1706619585; 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=ErNfF/Xc9qsj3D+ti7spZOyCJXcg8kBzLgnUTUWSxO4=; b=XHtv7cSjJ5YJ12yQlgvvplZajiXf0Rot5IK/dJK9x5Aoo51ofbDazEfyWhFnnCT1mF oHLJiSKnUD5jmkZX957EowbYznSCuQ73SIrj5mqX1qpD7iSZekYp3Nto0knTQy9Yt1dQ UvD5ASJaLN1y6qhhfTNGpqN4JczMqrH8C6zZfbmARXiZfvxa0lMRKYh4cGbeQV0+I/gn yUJgDLgdkUG5fyXwxMM0Jjh+dke8Dio56EtWqAfLTqCKE2SyhMbetjUKPdtCgWpKXMY1 4AuwOvc/GnLkqKSIrFDA55L5uXIhPJaIgOWRDSS48rQijaZr/vun5AIuqQa7mor4e/6r phFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014785; x=1706619585; 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=ErNfF/Xc9qsj3D+ti7spZOyCJXcg8kBzLgnUTUWSxO4=; b=I7i7W1/++n+njZ9BUp32ZJkN1xQUpbmUZeBFFd9TyJfOQvhPko6fIHePOyRFRJYwjc LTTVpfPhNnpY96SZiIF5o3RO2YhjKPapU9Fy2rrSoKI8H/f2rouFG8U8nrW5iaGPAqbn IHp4hBq5Dbtdp5evMi7AN/Ihx3vWBTak3MwGVu74ZpS/71DFkMgCkLemAdP6SVC8Sx7a 9XLjK84+LNVTZt0R/tyOPSHaRNdoqxPIy+lNqn6wJDWVqaf0zfmZfPsTfhnK4hMvPTcC fLyPFCqOrpVX6B0usRc041s3MEFIyGPnwwrbk1UXIcDXXSEe0MWcWcAv6+KoYmyRGzWt bSGg== X-Gm-Message-State: AOJu0Yw7xnIiDSa7siH+SoRZuL7CbcL1m4G1+QfVmlGX5IigoQtf8Yrr qKD7xJJOgRwifRoh3wkGWpVBzsbioiDC4hQgF8uZZvN9xbl/FjEtBeAZ/yp2NW4= X-Received: by 2002:a05:600c:68cd:b0:40e:a565:3ce2 with SMTP id jd13-20020a05600c68cd00b0040ea5653ce2mr117549wmb.73.1706014784838; Tue, 23 Jan 2024 04:59:44 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:44 -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 v4 10/15] net: ravb: Move delay mode set in the driver's ndo_open API Date: Tue, 23 Jan 2024 14:58:24 +0200 Message-Id: <20240123125829.3970325-11-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788970603122370362 X-GMAIL-MSGID: 1788970603122370362 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 registers content 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, both delay specific functions were kept together. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- 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 8956c33c60e2..69d4854d6738 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 Tue Jan 23 12:58: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: 192035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1576181dyi; Thu, 25 Jan 2024 03:40:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRwkAgBuR2A2gb6KwZA6EzqEajQu85/jvNdHXiRuTKRysR7bjbrpjyeppyPjfc0tX7xbpB X-Received: by 2002:a05:6808:42:b0:3bd:3bfe:486d with SMTP id v2-20020a056808004200b003bd3bfe486dmr743465oic.119.1706182849647; Thu, 25 Jan 2024 03:40:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706182849; cv=pass; d=google.com; s=arc-20160816; b=COUAzdlZJ1IHuJMDR+kj52JvbJ+LXt733AQ9jGZIgVcal5z86+DALqxxMvn0VAU/Te iRbN1MYfrChlVUcCswa7q2Pe0a0aKzP/il3K7btY57gqWlYon6rUnOi6Q7Jb8/HDYywv +YlZOhVNfQDnpNWcACyuONZj1awuyjEa+WdJ6dTFY+u3awwhZVluKaSly1CBQAuGOU1w RZ5ZESsmSMkc8CruROoraJ41SzYvQtGf14cIMkcuAqf9M6qVm+Z0iJ2W2UBxK1Em8Jtj SaAW9DtnotjEwNLreEVa2I8Bkgx9q11N2TgqvYK7/oPo3cJf80AqH6URubKNrd2vxG+8 JhrQ== 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=4oU6e2ETHxF91J7rUEFncHWZOjTNYygzuarRFBzd88c=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=ForY6ygXFQrlmikoWSRDtK/8vtkNmCmfBTQXKSlqawhOxkKqfPdheuRtqW31jqzDhx 5lIq3GRVkvpbsnPX5Uj8kTP75xUdD0IiOpqvGS7lY1zTv1mlIp6WeR6GUaeElt/iTw9o B59q/EKVWUjwtQcfzuDXvI44ZuYFJtDn49Bq3Ri5DMMD5HpEpgzMzp1e7ekqohapupas KaQb3r5L4zvUV3ubmyyy0wamNI296eLpcqQyZdEcQBU2nRnkMpuKGGvsWp7LvRk8cAHY gM+aI9RmvxiStXBD/TmRc9e4WJTRQL+IKTCjhvPRtXIG4oVvgDYbBXJBa6l+rJOfVCAx RUEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=kVpYesco; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35301-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35301-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n22-20020ac85a16000000b0042a5419e5fdsi5233927qta.127.2024.01.25.03.40.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 03:40:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35301-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=kVpYesco; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35301-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35301-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 345E61C26AEF for ; Tue, 23 Jan 2024 13:04:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39F1560EEE; Tue, 23 Jan 2024 12:59:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="kVpYesco" Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.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 9C7F7605C8 for ; Tue, 23 Jan 2024 12:59:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014790; cv=none; b=N0nIrFz0FnJEgS39k5fia0YDMOdHAWqYfm84OtxApyWunGYYLsj1kZlvRrWtBQ5FU03bsZ0BE4jxMGGaQ8nCWjd/CC/czVBRn8obpsOnNbvv6xKq322kDDpWJqz3flZdKdwwLvJOksub6OQn/6lNkjI1A+NgjdmIz8j6123NdGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014790; c=relaxed/simple; bh=zwRf00erI7gL+iVp7EL8wRdj+/3c4hH+mO5H4G4Z5WQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tEPt/Ecm9pEyrvpIQhOMd93cuF6NZ12bqAaUIt6z8nUEnMFPi3WT3XXJyUcv+1F6oUEzPZdONbJFp26h/2r1ulZbCK+mGYY7RrkySZJ50HNUnjj6wypycPffc43gdd8NEOfGMaf0K31+6/+FTtmzLCoVVmTHUQjSjYhOV9glVEo= 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=kVpYesco; arc=none smtp.client-ip=209.85.221.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-wr1-f49.google.com with SMTP id ffacd0b85a97d-33931b38b65so2210994f8f.3 for ; Tue, 23 Jan 2024 04:59:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014786; x=1706619586; 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=4oU6e2ETHxF91J7rUEFncHWZOjTNYygzuarRFBzd88c=; b=kVpYescoHborLoAT9qW+S2lnooV0v/b3/gznd1o5vXvEeodA2PO1bd2ppn5zhMCn16 End3R3dAhRk5TqPXUD9ddS+vZuEVfmSnDS90dNyKRNE4j/Pv8hBVJ7va1fqOR9NaEs88 vZyUq0ZnjE04WqDx5wq4F8/Fm1VBhUQGdMiHRIuR4ijBpgg0+KPo4f9c1j7bFyJ77MP7 fXKKvlywOONJTtBta0fGRKQTUvM7j/pK1kJ2ckI214RJLP4D44sPHdvnXV59lJZY5kqz Hhk6DQ7/6k8YrpPVF1C1dhjvy9iG6gS/tKsTvJAcpSUvwqajGfLkWCa59fG+dSTEy3d/ iPWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014786; x=1706619586; 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=4oU6e2ETHxF91J7rUEFncHWZOjTNYygzuarRFBzd88c=; b=j/QAE12WnUKwENABVZk1ggi2Q4JvLyrN8W6ltPNCyt3Ym1qANnj1V1LaonxXNS3dz6 yyn6UuabOVAZQy/28Tz85cC+KJ2zoAyloKnMZWCilNjv7k2xWoCR7gLwcuZuz1Xp6e6x vzD68pGJPewbS2vCxVL8oXQTg3A3BIfZxAa6j0oXtaHuBKGUUsrUCeB+DMUMpgbuh6/r AytwQ+hPAkzcGjn+ICvA0x/89/TwIXdFzAEurBfo3bJGCwM6PP05/i8hVDcoAj+qEcNx nycRzzNeJkjS8ObuDXa7bm8Rrgk/jvM6Eqr3OFH8TezCCeqKodox/MoquQ54cZxLlCZF pJXg== X-Gm-Message-State: AOJu0YwvPk+5wIaoKEccpROTmg6qDH8ATNuw8VPSdcAt2yppxBirS+Mh lK5xHxisteZhrSoHEioE4bbRcdGDGLgV/TX3kZwx6KIj/NtNLERsBg+qz/TG2KE= X-Received: by 2002:a7b:cb0e:0:b0:40e:4996:13b0 with SMTP id u14-20020a7bcb0e000000b0040e499613b0mr240501wmj.272.1706014786082; Tue, 23 Jan 2024 04:59:46 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:45 -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 v4 11/15] net: ravb: Move DBAT configuration to the driver's ndo_open API Date: Tue, 23 Jan 2024 14:58:25 +0200 Message-Id: <20240123125829.3970325-12-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789062387899275424 X-GMAIL-MSGID: 1789062387899275424 From: Claudiu Beznea DBAT setup was done in the driver's probe API. As some IP variants switch to reset mode (and thus registers content is lost) when setting clocks (due to module standby functionality) to be able to implement runtime PM move the DBAT configuration in the driver's ndo_open API. This commit prepares the code for the addition of runtime PM. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v4: - none Changes in v3: - collected tags Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 69d4854d6738..3c7748b5e14e 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1865,6 +1865,7 @@ static int ravb_open(struct net_device *ndev) napi_enable(&priv->napi[RAVB_NC]); ravb_set_delay_mode(ndev); + ravb_write(ndev, priv->desc_bat_dma, DBAT); /* Device init */ error = ravb_dmac_init(ndev); @@ -2808,7 +2809,6 @@ static int ravb_probe(struct platform_device *pdev) } for (q = RAVB_BE; q < DBAT_ENTRY_NUM; q++) priv->desc_bat[q].die_dt = DT_EOS; - ravb_write(ndev, priv->desc_bat_dma, DBAT); /* Initialise HW timestamp list */ INIT_LIST_HEAD(&priv->ts_skb_list); From patchwork Tue Jan 23 12:58:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 192042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1585570dyi; Thu, 25 Jan 2024 04:02:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhx9bY2348c5fs00fgMEtzXJN3fHrt4xHGgplcSp5EPSYLVaAisYv64ih9QrV5586zQuxq X-Received: by 2002:a05:6a00:6803:b0:6dd:d358:1247 with SMTP id hq3-20020a056a00680300b006ddd3581247mr262260pfb.41.1706184122320; Thu, 25 Jan 2024 04:02:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706184122; cv=pass; d=google.com; s=arc-20160816; b=unJkyykCMhg7retItmUjJSd+dvz7L/Xvuel1dm3ADSRTD/wAYuUFYWCKlUOxe/vIAc /xnZsjK7r+lhKxR+3+HEnZQyF7sZXj2vfNlal7eTiENIaJGSM7l9rJSI35Vh3dEw5au6 MODf+IhEJQf4s4qHKbKJo1sG73lPeUDA+djaz3Mr+KXlTUPUv2Fb5nEKImbZoqIIlUh+ dEOpwvkr+EjpRQ5mGXy/T/P1dgRBfhplszk7DjK+LIEwGpT1gVQGO0CnjigZKPqCZ6YN tgIR9DN30aPajem90uD3xpA5FM4b4hlhHWJOGq7VTLjLLu1iVPWC/JCFUytjUcYBp0pW fT8Q== 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=u5Hi7im7B+tHnOXIWlrZSV9yMjAsBTdfdkOa8Wn2LcY=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=gu2XnyrmToHzgWZTUaCINE0XVWEhe6bl/xJJOd9lrHpZpP7CravG5Hjl9pqzX/8vl8 R7CWnbc8fxOqr8IvkY5agZNAd3S7LYI7AHAv1gPXK3RLheYE63IWjgyaiZeYSNugrhv1 Y5Gy7EXIYI+2koWW5h0+53d0EUl8/+PMKPnGl9m6mml2ajusurURHLSojS/uVB7duS9D 70SlQtyYVk8bxueljFqNTh9DQL0D8w0NG1EBH7JPD2nZxTWEGqsfyiyIZKaTKcTzJy9w lLKE/W6Kw6VXBReqCElgnJ126L1Z2TJX7qH+Cm1shPlvXIJv6uleU3SS1UX42nfUoLSW XGVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=bI79pg8e; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35302-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35302-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id lp14-20020a056a003d4e00b006dd89a2c692si2950140pfb.275.2024.01.25.04.02.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 04:02:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35302-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=bI79pg8e; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35302-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35302-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 9B8F6B256F3 for ; Tue, 23 Jan 2024 13:05:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 34E18612E7; Tue, 23 Jan 2024 12:59:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="bI79pg8e" Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 30EF46087A for ; Tue, 23 Jan 2024 12:59:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014790; cv=none; b=CZA6BcKRYF5GbYbMxZBpMDKfajH3vb3baWRUWILIbLHsVwNKJRum/yI2Fy3j61O03GL6AJRDtGqeIsu3rPKewXxMIryB//9Ym6Ammd5quROIMUM+sNHgH1/KpwSyeHbERs5IMT+U5jp3UUxrRxE/lEQ0gYv+7wSKmPOjd2VZjFY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014790; c=relaxed/simple; bh=BZKCFAHEpPGNiDq2mJMweBfLlos6yJpODGMDA4g09HU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qnjPIAabWjgXWY+SLzdwGk+Waf6vIOyBg9HcSHP0JHnZKGspiEwYpRluWBjA1Yw4VW7mUk0b6vZX6w8Ak3m9TMnGDxOwtiqBskVz8Q8POrhPr/N7UFJ9JLcX0YvF7u/KwvtTmPorRV+JEbGHGf20/Fz3D62rO3C7fu+7CvTU1Gk= 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=bI79pg8e; arc=none smtp.client-ip=209.85.128.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-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40e7e2e04f0so47335565e9.1 for ; Tue, 23 Jan 2024 04:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014787; x=1706619587; 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=u5Hi7im7B+tHnOXIWlrZSV9yMjAsBTdfdkOa8Wn2LcY=; b=bI79pg8eyv+eyP+pQKoea6dazbjG3RrFYVkm8L5du8GJuq/tB8STdfBY72mrUdlSTn qwNMDiJwkusUT1kQlLYQ7EEvPBg5ebfbZFSDJ5Z22b9kcinEu+NX2xAd9/pGqIBShXJY vsKwu3bGkFTNXwrEldgIhGJ6HNOSfN1uJhCuth8ua0VGvvxao/IRxyRhUN+9ShuDEV28 w2c/tC96ESTRoXVNs1u5cKllv7LcXjQnvpcosh2V9ZdjF73GVQkFxRJIekDtUtQ2z0cN zpivLe/2eAhMmfTbIIR7E/53SUzghF4BinVso69/auqyda3pvnN86HBcbibxCiU8a7fN SHvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014787; x=1706619587; 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=u5Hi7im7B+tHnOXIWlrZSV9yMjAsBTdfdkOa8Wn2LcY=; b=uc5Z7qswxo/rdh8hqe1alFNN5MWqc2ICr7uik5PzVqFtHf2oiuPYYMNrPuW11V0Jfh DMMRP3sJUiBDEzNm0ex8QXzzJOXv/DxWhBgMDae/IYoLSUmOyhhvdAdLBqgm409f9PsI rn06B99HxsyFSBpQmbS2+hPddzkM8elgsW3LUUCSLdyTL8z3eU2eqJwgjcZngfNZsFIB I8KO0SZ29SHM2F4XDHCBWNq7p41TEQ4JPZPHDNbT+Bl9cAghPg/jwSfxIb0SAhXnORVt pJ5m6sha5J7aVbwSA5igDIduyV4HfHHv9FaMwKVrDJs+iSaxRgL0Z3TIIHYp1+KB0cDk d+3g== X-Gm-Message-State: AOJu0Yzr9KGLThEqAtN7Ds3aYTetHIO6mHJbNhB526ulxXFVgQMiQiHb aEM7MCKFTJ1vqhwqOrSX6NhKVCgHSEZW9/9RcTWc+9KZaNczeaYGyUfvDgNNuqc= X-Received: by 2002:a05:600c:4f55:b0:40e:b447:ae7d with SMTP id m21-20020a05600c4f5500b0040eb447ae7dmr502878wmq.33.1706014787628; Tue, 23 Jan 2024 04:59:47 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59:46 -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 v4 12/15] net: ravb: Move PTP initialization in the driver's ndo_open API for ccc_gac platorms Date: Tue, 23 Jan 2024 14:58:26 +0200 Message-Id: <20240123125829.3970325-13-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789063721975851274 X-GMAIL-MSGID: 1789063721975851274 From: Claudiu Beznea The initialization sequence for PTP is the same for platforms with ccc_gac and gptp (according to "Figure 50.71 Flow of gPTP Initialization (Normal, Common to All Modes)" of the R-Car Series, 3rd generation hardware manual and "Figure 37A.53 Flow of gPTP Initialization (Normal, Common to All Modes)" of the RZ/G Series hardware manual). As some IP variants switch to reset mode (and thus the registers content is lost) when setting clocks (due to module standby functionality) to be able to implement runtime PM, move the PTP initialization to the driver's ndo_open API. This commit prepares the code for the addition of runtime PM. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- 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 | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 3c7748b5e14e..91cabe098cc2 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1876,7 +1876,7 @@ static int ravb_open(struct net_device *ndev) ravb_set_gti(ndev); /* Initialise PTP Clock driver */ - if (info->gptp) + if (info->gptp || info->ccc_gac) ravb_ptp_init(ndev, priv->pdev); /* PHY control start */ @@ -1890,7 +1890,7 @@ static int ravb_open(struct net_device *ndev) out_ptp_stop: /* Stop PTP Clock driver */ - if (info->gptp) + if (info->gptp || info->ccc_gac) ravb_ptp_stop(ndev); ravb_stop_dma(ndev); out_napi_off: @@ -2200,7 +2200,7 @@ static int ravb_close(struct net_device *ndev) ravb_write(ndev, 0, TIC); /* Stop PTP Clock driver */ - if (info->gptp) + if (info->gptp || info->ccc_gac) ravb_ptp_stop(ndev); /* Set the config mode to stop the AVB-DMAC's processes */ @@ -2813,10 +2813,6 @@ static int ravb_probe(struct platform_device *pdev) /* Initialise HW timestamp list */ INIT_LIST_HEAD(&priv->ts_skb_list); - /* Initialise PTP Clock driver */ - if (info->ccc_gac) - ravb_ptp_init(ndev, pdev); - /* Debug message level */ priv->msg_enable = RAVB_DEF_MSG_ENABLE; @@ -2861,10 +2857,6 @@ static int ravb_probe(struct platform_device *pdev) out_dma_free: dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, priv->desc_bat_dma); - - /* Stop PTP Clock driver */ - if (info->ccc_gac) - ravb_ptp_stop(ndev); out_rpm_put: pm_runtime_put(&pdev->dev); out_rpm_disable: @@ -2890,10 +2882,6 @@ static void ravb_remove(struct platform_device *pdev) ravb_mdio_release(priv); - /* Stop PTP Clock driver */ - if (info->ccc_gac) - ravb_ptp_stop(ndev); - dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, priv->desc_bat_dma); From patchwork Tue Jan 23 12:58: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: 191489 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp919541dyi; Wed, 24 Jan 2024 03:22:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IEn3pz2YhSPX7hkvZSNX3iOf5PDOBM3gPncfsnmgg2yxePwfOYfgvRLCt9yo8RKRpb77Sck X-Received: by 2002:a05:6402:3411:b0:55c:4ef:f8ec with SMTP id k17-20020a056402341100b0055c04eff8ecmr1971395edc.83.1706095323891; Wed, 24 Jan 2024 03:22:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706095323; cv=pass; d=google.com; s=arc-20160816; b=N4pMd15tV9eEzyF+xgkUHkBYR6ODIdL35WuVufuTrXQ7g1h3IoNKaodg83erW9E4iD mYQWkBCPaX9AkKpDq4XBj+jETevJfejGbq8r5Pb/QN2jybyH7GZ96x+Y7H6NdgDSSHUy yINSVcgHOxmcfTPCYmAl6SU/Pc2wyV05BMYPFLoBholENsm/NNQFYkj7XnBwwnznBj8u YO0EO9XemREZeVREQ6sppta1bKitELBtS3r3fsPb5vuIj6wAoSQvBFWcmgXcaQnhYCTr 6p5tzeYqy/SETAqfITWy52QWgPdOIOJ1ttAglzS09ygoMXYrLXrfs53GJFElrOEnys7b s9Hw== 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=M40Sq12XPx3AN5HTBgz2AHvalMLyn45DfI68COiA/50=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=NiEDvC7CcL6+ugsa2V45WLCbXnhWSUxsTKarwPYdWQPulqq/5KoVyewaJB9duFu1ML SDLmMOiCfZJqYWbOUNiH1+Y1jzjVPsZ+m4cqxdS7/TXJxzUqHPkzy74H/r0+BtUPPUZ1 bkH5s8yUWVHv7uKciq1z54AGHlDoUJe382tqoYgUkFNZ9OAioTHhsWEtwto+L9MBaZkz eJ7Q/p+FOvG766XLsmgai9WErKCaqDFIwKR8iw/IVNTP39ojY8IrpiClvQyRjJbO1ccM aoYMFtjKRzO7QqOQEz6Q94bqu6I7TmvIS87fEuES5msHZYWmhHYKw7t4vNllyDarz+KQ LxNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b="CtHGy/51"; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35303-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35303-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m9-20020a509309000000b0055716150dd2si13124743eda.468.2024.01.24.03.22.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:22:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35303-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="CtHGy/51"; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35303-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35303-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 6BF361F2A0A8 for ; Tue, 23 Jan 2024 13:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 38DDD6168A; Tue, 23 Jan 2024 12:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="CtHGy/51" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 AB5DB60B98 for ; Tue, 23 Jan 2024 12:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014792; cv=none; b=Ul10xBjdWKNBfq0UxyM9Nh36w5nI62HZr9htA/I4+R720iCliOmy44CbmJ3BE6EKQ6RGXwJ23jVgIiK7xV/VQyx/WhiwA8qEKB5uREGDGtz5/H3dMDRPP0HAtx/RxKv45Ujqm4h8jxM0iWEkjffONVZfQ2+xAYWh/tedsUavofA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014792; c=relaxed/simple; bh=YyFbvj9rdXELCvEQMZ8EGmmYEN4CbHMx8owffqm1P7o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sRKaJps4hUBPH4Tkmjcxs3s8PgZKIUwpQDa3NeDMNtlQ74Kv4DtROX+u8soOv3ERnSE7pBjbkoalpgBcgFWrn+Bvs70TfTR2Im5Vz5ZZw30GC2eKz5M/b8v/2CBg5peeGbFFBy1zBh+lyz4GfdjiDqW3zUFkbwubQvqRAA8X9Hw= 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=CtHGy/51; arc=none smtp.client-ip=209.85.128.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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40eb033c1b0so19464175e9.2 for ; Tue, 23 Jan 2024 04:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014789; x=1706619589; 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=M40Sq12XPx3AN5HTBgz2AHvalMLyn45DfI68COiA/50=; b=CtHGy/51RBgi3MM7UN3y/SmnEkofLiHRTp7Obz+suaEwI0/np9H9r9UL+sNjIKlQLk Hj5ELlucRqFkS8OwfGRIQv6S+EXmIu3QoK5fX+ODdcJd4vLRrDP3M467zFUKq3BYMa8K J2HKYxO4+G7SViteolAydH90x9kr1T8ZMhjvwho+HQtQ+3UveBJb94dV22xqrrQTNYBw hNh1QOCsgBiDu1fLa1H2WHuR9CHpkst5qB0SOrK5rP5P2JWzySXUM8T8K09wkCa4ePuY pZl6Zwith1Z/Vq78359PFW1yuSDoyIuPwc700X38MKmKFn2SSvtZwYYMgaon5ef1e1Su 3MLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014789; x=1706619589; 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=M40Sq12XPx3AN5HTBgz2AHvalMLyn45DfI68COiA/50=; b=S5yERW9+DxgNtxyzAH8PqgYzPinQnjyKISZIpY3N1lhzUQIHyKz3mv7VQ2wW1/Dh0q o3d7imfElqTzDPQ92iSj3Pu22Ocqytub4InzwmM9ZULroe7ZOmOYKaJ5UYpZw1RvLIb9 AR4cBefj4ThHGd5MXJHfxQ74iRhwrJYR6ESJC3/FONs3Z6IaclFhkfZb9lIebUe32tVn A/6qY2LgjrrKW6RKxeIL/xQwpddxYAczt6VCul4oLjht9T8IBfYONWpDKOCX4vlB3i1z j8TF6sWao79XSleEqtYDOajmMb8iY4K3FZOpz1JCE4a5jh0bD3us+7wPqlNl2+IU98F9 BhTA== X-Gm-Message-State: AOJu0YwtGjYpZxWtizbRFI5l6K6/XD84RGilhesVd6l02cmcDNoTEXQ9 RS/AnI6qc7Ig1YIa4pVKOGqmlhCPxlAX8OOI5llV+HS0YYrTgvVUmUABd/srQTs= X-Received: by 2002:a05:600c:4f4d:b0:40e:b161:78d with SMTP id m13-20020a05600c4f4d00b0040eb161078dmr129471wmq.113.1706014788969; Tue, 23 Jan 2024 04:59:48 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59: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 v4 13/15] net: ravb: Set config mode in ndo_open and reset mode in ndo_close Date: Tue, 23 Jan 2024 14:58:27 +0200 Message-Id: <20240123125829.3970325-14-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788970610508824665 X-GMAIL-MSGID: 1788970610508824665 From: Claudiu Beznea As some IP variants switch to reset mode (and thus registers content 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. Signed-off-by: Claudiu Beznea --- 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 91cabe098cc2..e22760b91a97 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 Tue Jan 23 12:58: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: 192047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp1591764dyi; Thu, 25 Jan 2024 04:11:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHblCREMFGJUH8kG6YoD19zpGvkVdi8fjHtBXyKkc8mfSi8SM1+roWOJwRC4R+Wt3WvzKTX X-Received: by 2002:aa7:c91a:0:b0:558:9969:6913 with SMTP id b26-20020aa7c91a000000b0055899696913mr488528edt.66.1706184689876; Thu, 25 Jan 2024 04:11:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706184689; cv=pass; d=google.com; s=arc-20160816; b=Oq42OaKWRbpxKNLVZgfbBg5p+5K9+3StkCB835Z+a4Cfn5OeUfZdBWHSnfQ6zl5x9n DG9GJMZkxzhg/44kjF3FDqcGvk7jWbaJBnC2PohzJGO7aMCd5ZFZFc/RHoXBy4qlWgzL Fl5t+Hz72ZlbfkWERAvhSku1QdsNDbbD9n15B8rwQTcHujrxY3r6RgU5o7gwErh+jmGg 9kge9X+wfLyHhdc9KzXlYyJ/jPTg0FT648DV+rLKRlaLoixnZMXsAKAYPBB3QaQ6keDr ekAgBbGfbeNI1RKohMfuI+kwGBDkzT4PGTeqRqsFugNteNO5u5GaBNvGCfOLfc52Gb0q f0bQ== 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=5b1oLq4gou76iDcjhTA1HtV5RCuNVpeTpFhZ4OqPYQ0=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=nTuV14oxYjq/YGH0ruVk1tb5x5KR+mtZXFwOqyQBYF6qbxFM1EgutYSsHSUUNI1eoF I29BCI8RHOzm8Tds6R59/ID2oQeh+SdapWoIKdpd57wj2m1SYoF8Y1dW+9EpDQO4+2yP ZLa7VW1JBmmanBDOyOGX9/7sXwsbtZaE8m43gazRlqzkp3Ewq3HMzDQf/RXGpOgosIo0 m/lwH6R5PAJII9IhzDCJbaZW8al4LX/cuvFcREQix8PUcMg/3RjlLrelG2Tmrt5hPTKp Bm3rlGs6ilb+bfNPUWXtvUfowKKkRLJ8JHzC6ZDH4RfhQ3AB42QylsHALi5q1eLKmomF 7r4w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=YmC4zG0j; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35304-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35304-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw7-20020a056402228700b0055d10585e80si216540edb.190.2024.01.25.04.11.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 04:11:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35304-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=YmC4zG0j; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35304-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35304-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 31B8D1F2A127 for ; Tue, 23 Jan 2024 13:05:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 156F861686; Tue, 23 Jan 2024 12:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="YmC4zG0j" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 B01C060DC3 for ; Tue, 23 Jan 2024 12:59:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014793; cv=none; b=C+vp0o6+Z41XDqq6N2ygYtpv7B4Rt1QC73AT+dohKlCGblotOvhnJQo8YQQ2QxjODcXTwGqdWtxO73mcfs/GbEYvHG227LRQsE4duofkpcctZhfFErmj/tSZdsxvy0Xj4DjibBpxxVfjmfLexkjeKBtYDJjL8u1Mu3yryJa0AEc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014793; c=relaxed/simple; bh=hqR1Fnpsr1zfZ4XXcoXvlX+RpLOUELhZTTBjGjxL0o8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GXW1fu0LyX+sLdJGeeLTA4yVbhhpuQg17uu8yMO84aHsqBwq9JTE4Dtw/kmijQ7KNF4X3rgwnKdaQGe34Uim/ua0gwii8YvsbsANTh+HZ7DsiGFvsmLMcuVKzVZNzIREL0L5bxvCg/XE2DDeaIC/U2fkj0p88F2NOKcdxKLPQBs= 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=YmC4zG0j; arc=none smtp.client-ip=209.85.128.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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40e60e137aaso47443335e9.0 for ; Tue, 23 Jan 2024 04:59:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014790; x=1706619590; 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=5b1oLq4gou76iDcjhTA1HtV5RCuNVpeTpFhZ4OqPYQ0=; b=YmC4zG0jTksQVPjkb92HEunVFQCS4/NAb56zj2Sr1S7O+ZPbIwM01q48AXCmKPow+p WOoDbAebfh8w44pyUwWL7FiyeIjh8EWW3I8AnAOd7MH/KsoJabUvmgcBOqBZrmbnTlim dziiqJvFhEcWDA+znKAcNYWCuRABQ61biSjsWSWyeFq4NMi2PHF8akXMDd+e1K7ApElc 7yNRJz82gq6p9qNqoWDEBn7h+PhYB7w08gAfMT8ZN/Ip5WkMAjwgObcMjMLTh4DCq8aZ MpbO7frsAWo0jdIUB4I2K6drBwMLJIosdKsd+kK+Yu3+1PO8TggsC0k/yUPWHxqke9k8 +K8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014790; x=1706619590; 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=5b1oLq4gou76iDcjhTA1HtV5RCuNVpeTpFhZ4OqPYQ0=; b=wKNxiCEPh77Scsqpnh594WqB734SLSzyfTraMsPeJ8El0uSIm/lqgPDekslahSTzDs D0vJL5g6mBUBV2GufvWCxAJOnLCmGfCvUG49f1i9FMZwJt0QXEdyW0kt2Ance2jxdRdp n3R0oNNi6ux3jHSXi/K2XSf5pcfOD87rW5KGQBM75C6cuk6BDgtBQeivUBtSfZxj7yT5 ljsFziANJ+i9txTqP8BBt8zc1FzaK4fCSAA/mSyRYfnW5uvYNZuqORX+iehhdv9AZ1Vu 4J7qxHEXFoRGhFqm118FF05SYqXstc9XKsULwS7yYZkHZkQv5zw62ZLh2unonNRfnbZh P4KQ== X-Gm-Message-State: AOJu0YyzJW6vLEoVE4gAO3YzN6G1UWYPyaVkd3M1t3cI2XR41geErDGw R3Wo7J7wdt2ci53cbKsS/WOtUIXNWKvNS8FIgCbkEB1DODh0OorXxw8ckgMAIY0= X-Received: by 2002:a05:600c:4509:b0:40e:b244:1be3 with SMTP id t9-20020a05600c450900b0040eb2441be3mr490190wmo.175.1706014790203; Tue, 23 Jan 2024 04:59:50 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59: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 v4 14/15] net: ravb: Simplify ravb_suspend() Date: Tue, 23 Jan 2024 14:58:28 +0200 Message-Id: <20240123125829.3970325-15-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1789064317189521431 X-GMAIL-MSGID: 1789064317189521431 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 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 e22760b91a97..74568c836468 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 Tue Jan 23 12:58:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 190967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp349780dyi; Tue, 23 Jan 2024 06:01:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHL6yX1A/9HELXkLv+1+Y8ExAT80VdyElYYZkypGCM+cIkmnLJD+l98qSbCgXKTTAZ4V29T X-Received: by 2002:a17:906:4fce:b0:a26:d98d:74d7 with SMTP id i14-20020a1709064fce00b00a26d98d74d7mr420016ejw.33.1706018467650; Tue, 23 Jan 2024 06:01:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706018467; cv=pass; d=google.com; s=arc-20160816; b=vB2CVeLpVRaUvtPJl6st3O/IKfVe3b9VndlheFY8ThhvsYa9aW+ItwflCVsibGGesn JWLS+LHays1toM63I1ryYKbovT8kzMS/jiNsBo2BS2zCNgM0ffnw3KkeyTz7OHszRtTS H/JlWQOxz5ouAeWxN4UQ/hDLpi7TMsC3RNg/XwYZlma+NM3X/e4sbQF6WtifvALMREqO x2TpJSf7n/hgrk/epd3ETFShUYTasq7Q8RoBAxv+4yFhs12BXoyhFDgz8nmRRq7/fyi9 Kfk6xAD4v1cP26d8SXf3dIRUOIp6QqcBaIhl8LnXZzZMgjjhEFtKiSz8mZJh/YSJOZbW hSVQ== 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=Gee9HyQUIxP/lOlV73mQEGTBYaMlN2Gud82I2snD3lY=; fh=UyecQQQXnYrqJOxUwLOxxxo1ko/XVjNRN6+YZN+rtNE=; b=SS5GyVOueUeBQPfhm+v3SbiwEpTc0coYdvNRYpMrosq+VZUw9VaNZlHsabeb0Ktq7t PM6cwcbMTn/3913wVtQg8p1doLjx0fDcEBRil4u7mlEB9QxDlNiwxT3KUlvhRfyEc9bJ njRiNya2jPDVoeP9V+cIjbx7NeejLH2sSewRhn00OEfrkS6jv8raH/0QQvo2mH1TNMrF T1hvyuVtBZJdICLGafVEfnZE10JHE/xNTjkwNUKbRwpNt8nhDvo5bjfqao3pgGK5+jiJ v1ITIMUDalRPWc1aYXZfe1b4gXA4LP0HjqSR4wIaD2Z4wM93sWzFiJHaDVlIsw1u8pBE dr+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Ti8TJJXr; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35305-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35305-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kg20-20020a17090776f400b00a2cfe9dd288si10156839ejc.701.2024.01.23.06.01.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 06:01:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35305-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Ti8TJJXr; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-35305-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35305-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 DF5B51F21B71 for ; Tue, 23 Jan 2024 13:06:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5EA3627E5; Tue, 23 Jan 2024 12:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Ti8TJJXr" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.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 1C5FD60EE4 for ; Tue, 23 Jan 2024 12:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014794; cv=none; b=hLsEseJc6jMkOpOxeht4+fNjTDnO7rihHZbFGPWeXOpc1kdyiO1Fb3FghMFPudKbp886cJLa93lQv2NF5jBSnz3eXrbbRndrzH3GPQaE+02bsUjUeAnDT0d6g4lPDBeye+GipV3pdZeupGdrPtXpwAP6xrd9jVQNd+efLxRXEfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706014794; c=relaxed/simple; bh=GAfex3EeCPOP5cI6V5/XBZUeYcq3hRCugb2RoCTcDIw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ajRk1/K2w6t1euU3qxCv2uRFwOZwEacMICRMF8XP21boVOT5+RNMJccty/fMrYB3YUDngiSe+drGhuJTRWrchncGaqdVgZ8fxb/+IB4ePrggPJ8HQzHgYoyCPLWe/kN0PzPt4icQTDfND84feTQHJFI912wZsd0Y8dnFrHNq06k= 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=Ti8TJJXr; arc=none smtp.client-ip=209.85.128.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-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40e490c2115so32382165e9.0 for ; Tue, 23 Jan 2024 04:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1706014791; x=1706619591; 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=Gee9HyQUIxP/lOlV73mQEGTBYaMlN2Gud82I2snD3lY=; b=Ti8TJJXrVyNSkWt4/LQ3iQAdtT/hduqfZPWbO8tIv/sETH09Pb9WiSYh1Q7sIptpMH kRyf+RlG8GNmLtupoJDbQvFbg1MB7MD034YPKRJNnVy3GY749dMZc0NI9uMSUi13qy4X 9NB1ZhyY+aX/k2TgwAwUA5AVSX6GBSE4vl5YnwgMci+vjZD1s/xA7a+t4LYTFUL7Uig0 Jjy+rViQ4KheY8M8XGVmeh6/+/DAw4LOgSBftQFqPjrAsxoLl2Nx+VUxRtHpyIkv711l 2KqjQR4R14LJ9yhVquyQLdlvaLt78TUuRz3iju/6QOTJgBfPoqWew//RQEY2bRMWhHXg tXdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706014791; x=1706619591; 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=Gee9HyQUIxP/lOlV73mQEGTBYaMlN2Gud82I2snD3lY=; b=LurIr53Z98wd3zOul7iUk53h2tWV279M0PQVVGO8C8mH/JRqS3GkFcWncv9a79nzx6 z07hOJ966J6/VCYl5poDMlq9zX7CWQ1xM/ckcpVZZkuRYfIokoJDdlSdI4B9Bc0hpyHp 8vOkyCD8SS+1NHnHOvic6kP7hdJEiPyrpgcEILU6c8NLTVtkcalsFHi8Fdxi91L+y5hp SU7MRknU3Ak1iFcZSuMN0unMajEKbdFpwQF7NDw0yCWpDKfadw40XXxh31gV81RLf2+h C9duI81MADVyJJOfEwGp4HHa1TFMBcshbwsLJJ7p+1ta1NP14yH7p5vfo4oF9XP1lCCm 2aBg== X-Gm-Message-State: AOJu0YzopSYA2wkm22QQhv4DVzvREGeoD02OsKJk+Z2u03ChPbDWDIG/ 6kPXWo2tZgBiNTo/Fny506Wcz7kYZBUHjR72bSimNUFvVuDkneDrTlaHydLghB4= X-Received: by 2002:a7b:c4d0:0:b0:40e:937f:16d8 with SMTP id g16-20020a7bc4d0000000b0040e937f16d8mr122523wmk.50.1706014791440; Tue, 23 Jan 2024 04:59:51 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.135]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c45c400b0040e6ff60057sm33655711wmo.48.2024.01.23.04.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 04:59: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 v4 15/15] net: ravb: Simplify ravb_resume() Date: Tue, 23 Jan 2024 14:58:29 +0200 Message-Id: <20240123125829.3970325-16-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240123125829.3970325-1-claudiu.beznea.uj@bp.renesas.com> References: <20240123125829.3970325-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: 1788890020904993157 X-GMAIL-MSGID: 1788890020904993157 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 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 74568c836468..ff105e332396 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; }