From patchwork Mon Nov 20 08:45:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460917 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED899C54E76 for ; Mon, 20 Nov 2023 08:46:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbjKTIqZ (ORCPT ); Mon, 20 Nov 2023 03:46:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232266AbjKTIqY (ORCPT ); Mon, 20 Nov 2023 03:46:24 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26992AA for ; Mon, 20 Nov 2023 00:46:20 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4081ccf69dcso7951525e9.0 for ; Mon, 20 Nov 2023 00:46:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469978; x=1701074778; 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=O/Q1YDzSiSuqzbLh5eHVltDp4epdTy0gP5JRv4NY97M=; b=WXJyXxq69lQKY0+sRMGanqJ6zHo+duWpMv5PPux7HPsPyOTuf6eKj+P8QwF67lBNa/ dn06P7rsXm6xvqBmJIyBF2cDU/K+3aQumTm9Jlbnjw1dl9fXAGVgpSAwqbfRRBoi5+3H y85zUXqX0ox9OtA74y7CmAOw/5SJEjdinYMRj7UsOZBlJIeqHZRqXS2fU5exQiBPfftz dSGZaZAJfZ3X8+yHu3Ule7Wbxpl4sVJWlON1/fzsA0R/v/Nct6KXRsFk/fUVgf9cfJE5 U2vi7G8gPNnT9WOU+7eVEkJp2NCiaKEEvLI1R7xadTyr4NK6ViWoim2xIOPb0J6ORFDa 0lHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469978; x=1701074778; 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=O/Q1YDzSiSuqzbLh5eHVltDp4epdTy0gP5JRv4NY97M=; b=R8dwSne/AERKrDLAwqLDfhZTrVXGsqb0UlFJUPRI1ATcYllJwmfEVBYB8BJKqr2FNU /Vtkz24nPVcNyo/DAOVNYaBf4iKHbZO7CSpK7haThVUHZfDm+ZJum1/GPM9lSyMvNCob ng8oJZIIR9FaTdzwIsEQpkx9KR2qBfb00N6EyTs0fhk5i6akmM63BvwkUg1cXK/mKLJ6 83hlAetrzGsI/ebShhqGI6vQkbJkYLyIcAVwb06aqiF5rrxXb8vSOY/4LJKSFYSk/78y 5jn41ee9NV7k9XZAd/ZS8wfY3WBCGuA373xWjDNxR7kSskiONLwyRyR3dwZKs7HZbnRM DjcQ== X-Gm-Message-State: AOJu0YxPE6+hiZvuhn77ouZUjnbW2W2JqmJpy3wmR9RW8ea7DUAT0a4R 8EGo5u9nO4pDmWDOj9sc0sSQqw== X-Google-Smtp-Source: AGHT+IGguzzps8WTXHQDOz4RLWoYc1q9Kn2P1FSlhPOyUbpQ66wry2laGEFnLXjuLpuT8sqFntGuUw== X-Received: by 2002:adf:e7c9:0:b0:32d:d2aa:ed21 with SMTP id e9-20020adfe7c9000000b0032dd2aaed21mr8616747wrn.28.1700469978402; Mon, 20 Nov 2023 00:46:18 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:18 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 01/13] net: ravb: Check return value of reset_control_deassert() Date: Mon, 20 Nov 2023 10:45:54 +0200 Message-Id: <20231120084606.4083194-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea reset_control_deassert() could return an error. Some devices cannot work if reset signal de-assert operation fails. To avoid this check the return code of reset_control_deassert() in ravb_probe() and take proper action. Fixes: 0d13a1a464a0 ("ravb: Add reset support") Signed-off-by: Claudiu Beznea --- drivers/net/ethernet/renesas/ravb_main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index c70cff80cc99..342978bdbd7e 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2645,7 +2645,12 @@ static int ravb_probe(struct platform_device *pdev) ndev->features = info->net_features; ndev->hw_features = info->net_hw_features; - reset_control_deassert(rstc); + error = reset_control_deassert(rstc); + if (error) { + free_netdev(ndev); + return error; + } + pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); From patchwork Mon Nov 20 08:45:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460918 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE83BC5AD4C for ; Mon, 20 Nov 2023 08:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232346AbjKTIq1 (ORCPT ); Mon, 20 Nov 2023 03:46:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232334AbjKTIq0 (ORCPT ); Mon, 20 Nov 2023 03:46:26 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 554BDA2 for ; Mon, 20 Nov 2023 00:46:22 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3316bb1303bso1642937f8f.0 for ; Mon, 20 Nov 2023 00:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469981; x=1701074781; 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=Cp/UKHVnA714ikdJHZcbqGoPP5UR9IDH6yqWS6ig3mM=; b=pmrFMg4J196kShqfjSh2VBLm0SzHZsKZj+uD7XU4nNdfVg7EJm3DRaouPPq6JE1VV/ TFBguly6ExckGVq2Z/Ck6g3mXbNXEbSdFFu2+uh1BKNZxYzvB1/WN2yZwwP0SdW9Go+P /ehFdaz1+kQRhQmQkQpkg4eBy3/2Y8pRecfE2NMezpOfMS4W1CX+xZwEWfxetxAwjFti e4Bz5bwIPGfyCOxJi/9M0rTgU4RjlFdE9Mn/SblEOGyEYinEhWMc9vUhMgePN648KkGn i7/AvH0d4dhl4mjV05fl4C4eQr3MEBi0LG/idtAmANe/kJmKb/a0aMYJmCtZv/Th0H+I IPgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469981; x=1701074781; 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=Cp/UKHVnA714ikdJHZcbqGoPP5UR9IDH6yqWS6ig3mM=; b=wjg+i08PeTyjTEa++FX3o0ovugwADtl+7iu3d8s6DcADott/2qTuNb0S8qxfNyL/ep b8NH165U7XGos+5anM2jP8PQgFT83Du41xFLK2H0Vi8Kp0xxQ9C96fuy9rZyN7F9ZoYA ati602vzfOnyqcABokWro9TrGhhNxc2kumHPlsWshp9TYlArLi7obYHMVzVWPCAGZLkd kkEp4UmJQP0ZGuX6ujwQ0EIuMjg1Ua4YqdltzmA3QIvHH7umnGrE0vtaGSG5A2v100pJ VBs3fvAjDlO/1y6IFm2Zl4M5JK/RMG8oOfrnAhbHQcxlIOUlNfg0pFPtnNIQ4Xzqu7vH bphg== X-Gm-Message-State: AOJu0YwOwwxsQDB9rmE2+8hOzNe39FEWU50MLaAP3W3vEjEQpbsIIUTe 14gjLOJZ2xMRa0f9BwJES7cNfQ== X-Google-Smtp-Source: AGHT+IFDUtcL/kItW6Ct8wAYuHmG27hXUs5xVSozigyLzY20qpW+SnjNg8LDtQ8uSwnwos1Zsdc1hA== X-Received: by 2002:a05:6000:108f:b0:331:6cfd:e2fc with SMTP id y15-20020a056000108f00b003316cfde2fcmr3780250wrw.21.1700469980699; Mon, 20 Nov 2023 00:46:20 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:20 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 02/13] net: ravb: Use pm_runtime_resume_and_get() Date: Mon, 20 Nov 2023 10:45:55 +0200 Message-Id: <20231120084606.4083194-3-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea pm_runtime_get_sync() may return with error. In case it returns with error dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get() takes care of this. Thus use it. Along with this pm_runtime_resume_and_get() and reset_control_deassert() were moved before alloc_etherdev_mqs() to simplify the error path. Also, in case pm_runtime_resume_and_get() returns error the reset signal is deasserted and runtime PM is disabled (by jumping to the proper error handling label). Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Signed-off-by: Claudiu Beznea --- drivers/net/ethernet/renesas/ravb_main.c | 28 +++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 342978bdbd7e..0486add302b3 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2635,25 +2635,26 @@ static int ravb_probe(struct platform_device *pdev) return dev_err_probe(&pdev->dev, PTR_ERR(rstc), "failed to get cpg reset\n"); + error = reset_control_deassert(rstc); + if (error) + return error; + + pm_runtime_enable(&pdev->dev); + error = pm_runtime_resume_and_get(&pdev->dev); + if (error < 0) + goto pm_runtime_disable; + ndev = alloc_etherdev_mqs(sizeof(struct ravb_private), NUM_TX_QUEUE, NUM_RX_QUEUE); - if (!ndev) - return -ENOMEM; - + if (!ndev) { + error = -ENOMEM; + goto pm_runtime_put; + } info = of_device_get_match_data(&pdev->dev); ndev->features = info->net_features; ndev->hw_features = info->net_hw_features; - error = reset_control_deassert(rstc); - if (error) { - free_netdev(ndev); - return error; - } - - pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); - if (info->multi_irqs) { if (info->err_mgmt_irqs) irq = platform_get_irq_byname(pdev, "dia"); @@ -2878,8 +2879,9 @@ static int ravb_probe(struct platform_device *pdev) clk_disable_unprepare(priv->refclk); out_release: free_netdev(ndev); - +pm_runtime_put: pm_runtime_put(&pdev->dev); +pm_runtime_disable: pm_runtime_disable(&pdev->dev); reset_control_assert(rstc); return error; From patchwork Mon Nov 20 08:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460920 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 715F9C54FB9 for ; Mon, 20 Nov 2023 08:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232367AbjKTIqa (ORCPT ); Mon, 20 Nov 2023 03:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232350AbjKTIq2 (ORCPT ); Mon, 20 Nov 2023 03:46:28 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ED869F for ; Mon, 20 Nov 2023 00:46:24 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507c5249d55so5951129e87.3 for ; Mon, 20 Nov 2023 00:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469982; x=1701074782; 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=JaLlJ6X3V1xHNer/E9XxQegzqXLhmCjDZ2XDUDwECf0=; b=hFF9v8vxRv3WzQLLMENRefHc3LQUaAWnQkMYDw1qFjrHNM0+9LgFNwfIp34rX0G1bU Jynegwftr7oKGKrl/gsv5U3Isj19tQHrzyCmmFrO42K36hK9iKYBFfWIvzpovU4OUowl GzLwnBmOGorEbRCaHvAIkNE97Hu1TqX08Sm00Dus7e/fJllQjP/hNe29oc5OLzR4hsSj gRFPXvs6+pBVsbI6tjgyjHio3FC4hy0lBbIkdnT9whjZ9YsKEhogGh1y8uhjtng/NvzP Tf9dtG4SKZyfathYIbTijyIMrWgoU7gjDMUUsIsgDibyoF85lJE45aJdO/glM0undr5J EWDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469982; x=1701074782; 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=JaLlJ6X3V1xHNer/E9XxQegzqXLhmCjDZ2XDUDwECf0=; b=rQ31xYq1UetoOD1tMXLIRNrGFHG4qvs440xZUQAxO8AKMeTopNYqmakt6yf2SLAuCY K8MeaoDtjtyPlMVU6HDo2rCmevMG23dxEXQojIprvFS/QXf30dWS/fu0EuVoMFJZsb/G 8I13EZox2ARhy/pXefYA5og1c6kdAuabvUJB1j70SGH6vp4nnDrwHfYIT8gQR7WntXyX h3vbqBU9gsWrHd3mJrsCRFSh8rgUpBvgVJD6J9m5G+KnVq8cSJ/USfY5E5xhygmev+sR 9QiG1R7XwQ+COJktkyxezVjBMV1o6mgDpW0954ZTmvdDhEexkvlR13M1VsNnxOgw2iJ+ Dqlg== X-Gm-Message-State: AOJu0YwaTqtrZrG8SQTrsqxqn1qiMQBU5eLhGGGtviZ1DgCY1DQKnemT mdemkE157S9SzbpIT/HnwyBQPQ== X-Google-Smtp-Source: AGHT+IEf8vUgakOaNbWbAB6YxeQiP2RuYbpQL+g5e2su4/B8sSFdfMT3asP/LNDHBhO+rU+q30rUUQ== X-Received: by 2002:ac2:5297:0:b0:507:c871:7888 with SMTP id q23-20020ac25297000000b00507c8717888mr4574449lfm.9.1700469982498; Mon, 20 Nov 2023 00:46:22 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:22 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 03/13] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Date: Mon, 20 Nov 2023 10:45:56 +0200 Message-Id: <20231120084606.4083194-4-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea Hardware manual of RZ/G3S (and RZ/G2L) specifies the following on the description of CXR35 register (chapter "PHY interface select register (CXR35)"): "After release reset, make write-access to this register before making write-access to other registers (except MDIOMOD). Even if not need to change the value of this register, make write-access to this register at least one time. Because RGMII/MII MODE is recognized by accessing this register". The setup procedure for EMAC module (chapter "Setup procedure" of RZ/G3S, RZ/G2L manuals) specifies the E-MAC.CXR35 register is the first EMAC register that is to be configured. Note [A] from chapter "PHY interface select register (CXR35)" specifies the following: [A] The case which CXR35 SEL_XMII is used for the selection of RGMII/MII in APB Clock 100 MHz. (1) To use RGMII interface, Set ‘H’03E8_0000’ to this register. (2) To use MII interface, Set ‘H’03E8_0002’ to this register. Take into account these indication. Fixes: 1089877ada8d ("ravb: Add RZ/G2L MII interface support") Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0486add302b3..d798a7109a09 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -515,6 +515,15 @@ static void ravb_emac_init_gbeth(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); + if (priv->phy_interface == PHY_INTERFACE_MODE_MII) { + ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35); + ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0); + } else { + ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_RGMII, CXR35); + ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, + CXR31_SEL_LINK0); + } + /* Receive frame limit set register */ ravb_write(ndev, GBETH_RX_BUFF_MAX + ETH_FCS_LEN, RFLR); @@ -537,14 +546,6 @@ static void ravb_emac_init_gbeth(struct net_device *ndev) /* E-MAC interrupt enable register */ ravb_write(ndev, ECSIPR_ICDIP, ECSIPR); - - if (priv->phy_interface == PHY_INTERFACE_MODE_MII) { - ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0); - ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35); - } else { - ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, - CXR31_SEL_LINK0); - } } static void ravb_emac_init_rcar(struct net_device *ndev) From patchwork Mon Nov 20 08:45:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460919 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5043C54E76 for ; Mon, 20 Nov 2023 08:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232298AbjKTIqa (ORCPT ); Mon, 20 Nov 2023 03:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbjKTIq3 (ORCPT ); Mon, 20 Nov 2023 03:46:29 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D2BE5 for ; Mon, 20 Nov 2023 00:46:25 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-32f7bd27c2aso3060212f8f.2 for ; Mon, 20 Nov 2023 00:46:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469984; x=1701074784; 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=W5DUTseQ9M13B3c/uNsGDyKmzs8yrYsJMqyVo9/Bt0g=; b=SffkOGBzwA4VLDateY/j88lK4kM93BCcrecM+r8sOsIKiPFqFMkxD0QZCLGS1KDKA8 lTV6i6Dnmn9kr14gQvYDiLHLIS/SpKkA/FxTWm+ZoEQP/s5WFg5osYmiwgumnu8SautG Cmr0qYF2ZrSURmdKM6tBsZe+0FIN9XNtFX8xOy4wRL0j7vcmx0ERgJJN3LfITIGIrq4g J1JICItYgP6tOBuNBlnaLIVFRwbxRHOcu6UQ0GkCnAnho21UN5lujm7tOl82twRISzAF pZU0w4/2vTwireL9dEIg7VNqCwabLw9Fs7au5Lzh4+uF6dLL17nB7cQzoDrxX5fhXTDa 0CrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469984; x=1701074784; 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=W5DUTseQ9M13B3c/uNsGDyKmzs8yrYsJMqyVo9/Bt0g=; b=Pt/e7hAA95RloUixw7cB1gzqs8Idcmnn8W9Emj4Y373h9n0evIpCch+ozWoTD8n6PG pwxFt+WXCZrafR70GxGbnzpfzIiy2BdcWbBgFeyy6W8JqJJowhNbAzXP2sveeglVLaxL 4Q7Dmp/h196a0sBE1FqZmJyEzL39/EWtMFmDor8/px05WJfOsdcWHd5PBxjAuIIj3O0A xB3WAG4SbJ/Ic4hTL5ToyuYPlOzCIptXm7N9UnZXqkog2Gzd1bJUR2aNF7UbGOJjTyPD 7UYzzNHelfW3Q8+wHxy+aKOCxeR8gLLzArxiXV2dj4KBPb/ay9uHO4ZZx570gnax54lY jjBg== X-Gm-Message-State: AOJu0Yw3mP2a7hFZ6Jq1pu1n/YtZPLcRufbB2/ZjQNZt+i4iOeKmjtoy kyEzLdlUb6KNd/gijVXz5FyHbw== X-Google-Smtp-Source: AGHT+IH+kw0D3I8hcIjXDKB623M+1uoixo0SRLnUYry7SJ1e2Cyi7IKXMIG8YCxsaQqU/WoO+oYnFw== X-Received: by 2002:adf:e406:0:b0:331:6d38:5d18 with SMTP id g6-20020adfe406000000b003316d385d18mr3774080wrm.61.1700469984417; Mon, 20 Nov 2023 00:46:24 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:23 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 04/13] net: ravb: Start TX queues after HW initialization succeeded Date: Mon, 20 Nov 2023 10:45:57 +0200 Message-Id: <20231120084606.4083194-5-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea ravb_phy_start() may fail. If that happens the TX queues remain started. Thus move the netif_tx_start_all_queues() after PHY is successfully initialized. Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index d798a7109a09..b7e9035cb989 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1812,13 +1812,13 @@ static int ravb_open(struct net_device *ndev) if (info->gptp) ravb_ptp_init(ndev, priv->pdev); - netif_tx_start_all_queues(ndev); - /* PHY control start */ error = ravb_phy_start(ndev); if (error) goto out_ptp_stop; + netif_tx_start_all_queues(ndev); + return 0; out_ptp_stop: From patchwork Mon Nov 20 08:45:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460921 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7749C197A0 for ; Mon, 20 Nov 2023 08:46:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbjKTIqj (ORCPT ); Mon, 20 Nov 2023 03:46:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbjKTIqh (ORCPT ); Mon, 20 Nov 2023 03:46:37 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B65192 for ; Mon, 20 Nov 2023 00:46:28 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32dc9ff4a8fso2579410f8f.1 for ; Mon, 20 Nov 2023 00:46:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469987; x=1701074787; 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=yTMsePF1mIhRVZgGZkTVw0dE2aONjlO+ow85WD/JWc8=; b=ktCZkBmkvmQUDiyuap6uQwubSBx7KGSyi5EtxzayIrQ8mSpYn8nEM7yjrs8+RbyHng Rg3Dr7OTYPdQ2I5lYB0Ff2+9k1CSYbG5St9XWKu/diOxFfCW38O75PK0PX+CPusRH/D7 mh5m8YPIaILJM6NoK2UH7jn+uWoLwI4QtoWePpC7W/nTojbKAyAgX3RuDNwfhd0uFc25 S6BV2OTfxLOZ9FgMedRqAwbMALqpUVONeG7f0chfq2aXWCJSIxca4gaaTlmiisBX6VGd DO1+5vK3+CBGMArf3bmA9Ngzv5Z31sZfIlsiddoSsDQKAvSqbmkaBHzfEwOff/MJq3Ou W2mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469987; x=1701074787; 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=yTMsePF1mIhRVZgGZkTVw0dE2aONjlO+ow85WD/JWc8=; b=ed8mfar+Cg+QBZF1RJ2YcIXLlhdhuEL8DJbI03QDpTaKLPeSkGihX4b7r3dL5z4krw qDeF9lN627ObPwaIQ0K+sQg6uWTnZTqreLEGxeqcEPCr7tsTbXupMc5/DktTWrMGS3/y jKDOjBYGOiDmourPq/8hXOIZT1WZWv67VkcTfdR5JtC1IdFcgx3kmcA1FVAQzCW8W6Pv VRt/0YETNYZl8Gp3GLhwWAv/Jmxlbr9HY3RefhJ+4MZPH9t1jyXiuSXJ2xaVGpjOkbrQ BiH5xmnEV7b0pC+uF2zLMfWG0e56/gSwkr3M5mVCyTn84qhSFt5yZQv+zj64y2rU57Yt gLDw== X-Gm-Message-State: AOJu0Yz382Jn5JNMLsjlxUCfIaDcY+6iM/0rXuwQ+zxGark743qd3Tsf Eb/Zk7+9CLkvuiHFqZstY2NjvQ== X-Google-Smtp-Source: AGHT+IHfqiV7VgEqFIq+d6ViMBq15jgGeoQzEC1z36ww167uYWXbfgpS3O66gbmfQWdM9U1Cajw2iQ== X-Received: by 2002:a5d:64e5:0:b0:32d:8da0:48d0 with SMTP id g5-20020a5d64e5000000b0032d8da048d0mr4783264wri.68.1700469987164; Mon, 20 Nov 2023 00:46:27 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:26 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 05/13] net: ravb: Stop DMA in case of failures on ravb_open() Date: Mon, 20 Nov 2023 10:45:58 +0200 Message-Id: <20231120084606.4083194-6-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea In case ravb_phy_start() returns with error the settings applied in ravb_dma_init() are not reverted (e.g. config mode). For this call ravb_stop_dma() on failure path of ravb_open(). Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver") Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index b7e9035cb989..588e3be692d3 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1825,6 +1825,7 @@ static int ravb_open(struct net_device *ndev) /* Stop PTP Clock driver */ if (info->gptp) ravb_ptp_stop(ndev); + ravb_stop_dma(ndev); out_free_irq_mgmta: if (!info->multi_irqs) goto out_free_irq; From patchwork Mon Nov 20 08:45:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460923 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53D02C197A0 for ; Mon, 20 Nov 2023 08:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbjKTIqn (ORCPT ); Mon, 20 Nov 2023 03:46:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbjKTIqh (ORCPT ); Mon, 20 Nov 2023 03:46:37 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15370D4D for ; Mon, 20 Nov 2023 00:46:31 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3316c6e299eso1558451f8f.1 for ; Mon, 20 Nov 2023 00:46:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469989; x=1701074789; 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=X03fkvD/NmOk7FgJvVd2vA4cAoE3eXt5JBylRkbge34=; b=VUQPU/G8li7LV8UImVQnl6eH1YdsTdMPeMdYKJFo06tj0MIQ0ripS076wB4txtetXw TskECWtfuId9X3jmcv7W+L11HIKCBGLliELgDLtxVYcqOgTXq1VLI1WrPBIXL0hmN6Mm dX9unbFe9YucMGpq+IEyScGLAL3EwyA4R+OtpaQnMzvUxG9tNk0yJGsVAyHiSL469+fE e2ghgQg2Rv8GxDKF0SGfGm8ifO0wNdjKpcCdHSobf5a0l/z0z/nMGFMmV0Qx2gyJJs1D jdq4LeyVC73uu5a6gnPmYMPaynCaBDvScNaNlERMv00c7UnH/82n83dpr+k+4Y84fNFM 8/hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469989; x=1701074789; 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=X03fkvD/NmOk7FgJvVd2vA4cAoE3eXt5JBylRkbge34=; b=Zg6Ne0e9Cc9w88QCCqPkyLT6Njz+QWar/ggh3kIyYuigxgd7wnzBpR1SSBJ2ip/Kqs Kebq+jCAFwlIhZsjmFEwLXevfl/3FIzdlmckHINMP+ZWlodXUd6OSqTnipk2Hg7zX2JV gqONckE6tou7c73OZ4YuiDAjs5YXZ8bp3r0EUKcU61Z9sreBb0cAQogMdgq7iO5sBQHu pj7FVyAXFMenDW44CvBX/lf6x1kYhDb7G64ObhzTQ5z3r0jQwuW7h7YqxTDi2qmfwrDu bAivyVwVEzzQ/q9taAOvAVukNy+1EMaQTt4ZtOuGTLQuiIjUcGvcPrjjSmR3jjIv/Dqn 2fvA== X-Gm-Message-State: AOJu0YzR6ydL174TDgX48ZdqS+2+9cpZXZWx8sShuiXQAZL/eoQR+uvA 5MSV4HKk1PhDVWboPkuwToHEFA== X-Google-Smtp-Source: AGHT+IFSlGhbc9YVoJY/Cj/t9l8QVKfrxCMhnLQGLI4Mxl0wHVZMEMgDMtkKoth9oaA89rn5KUGRJw== X-Received: by 2002:a5d:5b8c:0:b0:32d:96a7:9551 with SMTP id df12-20020a5d5b8c000000b0032d96a79551mr3771027wrb.36.1700469989563; Mon, 20 Nov 2023 00:46:29 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:29 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 06/13] net: ravb: Let IP specific receive function to interrogate descriptors Date: Mon, 20 Nov 2023 10:45:59 +0200 Message-Id: <20231120084606.4083194-7-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea ravb_poll() initial code used to interrogate the first descriptor of the RX queue in case gptp is false to know if ravb_rx() should be called. This is done for non GPTP IPs. For GPTP IPs the driver PTP specific information was used to know if receive function should be called. As every IP has it's own receive function that interrogates the RX descriptor list in the same way the ravb_poll() was doing there is no need to double check this in ravb_poll(). Removing the code form ravb_poll() and adjusting ravb_rx_gbeth() leads to a cleaner code. Signed-off-by: Claudiu Beznea --- drivers/net/ethernet/renesas/ravb_main.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 588e3be692d3..0fc9810c5e78 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -771,12 +771,15 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q) int limit; entry = priv->cur_rx[q] % priv->num_rx_ring[q]; + desc = &priv->gbeth_rx_ring[entry]; + if (desc->die_dt == DT_FEMPTY) + return false; + boguscnt = priv->dirty_rx[q] + priv->num_rx_ring[q] - priv->cur_rx[q]; stats = &priv->stats[q]; boguscnt = min(boguscnt, *quota); limit = boguscnt; - desc = &priv->gbeth_rx_ring[entry]; while (desc->die_dt != DT_FEMPTY) { /* Descriptor type must be checked before all other reads */ dma_rmb(); @@ -1279,25 +1282,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 Mon Nov 20 08:46:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460922 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14CCFC54E76 for ; Mon, 20 Nov 2023 08:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232427AbjKTIqm (ORCPT ); Mon, 20 Nov 2023 03:46:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232425AbjKTIqi (ORCPT ); Mon, 20 Nov 2023 03:46:38 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F5AD6E for ; Mon, 20 Nov 2023 00:46:33 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-32faea0fa1fso2323709f8f.1 for ; Mon, 20 Nov 2023 00:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469992; x=1701074792; 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=zOeweRIPTzisv61dwOGKybnTDN8hrPF1gwr4IaPej8U=; b=AELpa+2CXCkaWfwEbbZ8yxg91im79/l4D8Gwtc2ZpsFdgHqJsRuUgDw6UhLW5iUOaw 0FiEdlYw4OISlH1GyTUZDr29CvwOIgdNDK0oPgR86lR0W/jLE7v9hHi6iLgYyLWovcuN 8nur0uYIW1Bf8YnNDsbaRiwB+QzOKdU3PPW0g2zlGNNzThYS9G50PTb54wQqWJqVmp35 DK7fjMSqVZYV8AucUi0StDRhUmkXmIespw3zSaSJiIQ4tZeXBzA04osOpfQSZbzKSLyb AgzfNjoIwXTBvehl4Hw9Ac5lQJbtfpQz5vVVuhNcs6g7HIe3K7xK2Q2rF8/7mnnLfpo6 uxYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469992; x=1701074792; 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=zOeweRIPTzisv61dwOGKybnTDN8hrPF1gwr4IaPej8U=; b=WUr1xyIGPcl1gf8xeh6ERekbhetMIFYGHtID/AN9aB9aVr2yh/DAk/tKxL6eu3woUq +xlgt6fbIQurbCx2hMYDQhmy+fYVsxvOu8Jz4ZY4ZBCcC/O78rryY6mDuorHC9onRXAI S50MJOWgCv5VNgC/EehK3Hwpb9+9BtLBwkyAidQTRqwfjhOby1WsLj/x5y7ZRQwPvyoD WAnexS2rbIX0rJe10qA6b2Q+U8eykBMw/VNhBBiOVcOR3p/UmL8hYw9OPN+YBBg8IzRI b5uL39D4szX+mxXFXPIEoDJW9Ll2o1qr+iW6bidwsilPgZsIJ+WKrX4WokK9nqGSVSlL YCiA== X-Gm-Message-State: AOJu0YyGE6ANJrDjouoz73qXmvx8HygkjIzA5SB/Mbyb+5Gq6Wa/YdfT oY8lzS4fwCRuB6fKSJmlp2VtyA== X-Google-Smtp-Source: AGHT+IGEwTzVgPi+XFKHAI7QWLlDbO9F0/k65IkPe/o0Zgw1EIxZFufAS/j1wVNsDC3NMAVavifbbQ== X-Received: by 2002:a05:6000:2ce:b0:331:2f9e:e8a8 with SMTP id o14-20020a05600002ce00b003312f9ee8a8mr6641722wry.8.1700469992303; Mon, 20 Nov 2023 00:46:32 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:31 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 07/13] net: ravb: Rely on PM domain to enable gptp_clk Date: Mon, 20 Nov 2023 10:46:00 +0200 Message-Id: <20231120084606.4083194-8-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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 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 Ethernet driver functions like ravb_runtime_nop(). PM domain does all that is needed. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 0fc9810c5e78..836fdb4b3bfd 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2762,7 +2762,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); @@ -2786,7 +2785,7 @@ static int ravb_probe(struct platform_device *pdev) /* 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); @@ -2806,7 +2805,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; @@ -2869,8 +2868,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: @@ -2893,7 +2890,6 @@ static void ravb_remove(struct platform_device *pdev) if (info->ccc_gac) ravb_ptp_stop(ndev); - clk_disable_unprepare(priv->gptp_clk); clk_disable_unprepare(priv->refclk); /* Set reset mode */ From patchwork Mon Nov 20 08:46:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460924 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B58C7C197A0 for ; Mon, 20 Nov 2023 08:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232563AbjKTIqz (ORCPT ); Mon, 20 Nov 2023 03:46:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232454AbjKTIql (ORCPT ); Mon, 20 Nov 2023 03:46:41 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFD9E1AD for ; Mon, 20 Nov 2023 00:46:36 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-32fdc5be26dso2663857f8f.2 for ; Mon, 20 Nov 2023 00:46:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469995; x=1701074795; 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=DzcPPHS9PLZPTA2qr9UA335fHiFxWMFmb2QEUprvcuU=; b=gaKjawyRvmtWnZzaIkrr/naPRCwvlX6RMI7pboiXv+Xlu9jpOf2qDPqa/iAP/mcCCg gcZqSEViPByiRa1mXqf5dlBYbBmbNJpGJG82zhh+jYo+UqPRQJG113UWYdTYq6MmdbJ7 XKzmeOtBLweueCJvbPfJV62qraBNvhYh5/IOmO9OoFrZoa+VLubipm+3R9fACJL4LmFb kv0HEI+/fR2dbQ3aWCtmJkViPyvkVhco9A392QB2imrPPwQ+QT2qKKBe2c+Phocxqwe5 VBdTGnpIk/MJQ96t51EuKW9TQXAqaHjDbM+fMZesFXlK2QbGL0j/ncXJNu6Ek7QNCTZ9 9xiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469995; x=1701074795; 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=DzcPPHS9PLZPTA2qr9UA335fHiFxWMFmb2QEUprvcuU=; b=bTdCYTGqUDZm7fDzas7gA2cblsgvsusnIAohffNMTGAlbjLvjhjxPWhYsnAQj9T301 z681oRFYLbsp03GJwRD14aS5Ax30Rr7eSHSJZCIvKMnvZuFS1L1BH6CtXi024k3d72Xv P5Myiw2FT+qu4uOjJk22dH721NdupRrozWEl7DM9gaFbJuLlnWd1YQKty9DX/vt2EY7U 5BLQ9XYrHd63cv9d4hGemnrmw9ihYl7s2KxBl4nf85eFQ/UMvABOHih5rEMKk2uhn8tP ldWVZm//y7fGbhkHMBnggeW7mFOXQT9hxkdvyBPA9gXzF+o8tZF/asGeKDlP0eQ3JKSr kAyw== X-Gm-Message-State: AOJu0Ywv62W4vmn6D/N7ZfdOedtzNvnMiK/QL/5pgpQxSNguc+2K2Cgq /mQYpg0yYLnuoNBNlFHTRR26tQ== X-Google-Smtp-Source: AGHT+IESA/FNyVv4jfN3ZbB7tbyHeGwu3USQsyegzaRPh/atGzZvqVXvBllR97R9rSm4O2NOQn17og== X-Received: by 2002:a05:6000:a8f:b0:32f:7867:112 with SMTP id dh15-20020a0560000a8f00b0032f78670112mr4914227wrb.13.1700469995379; Mon, 20 Nov 2023 00:46:35 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46: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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 08/13] net: ravb: Rely on PM domain to enable refclk Date: Mon, 20 Nov 2023 10:46:01 +0200 Message-Id: <20231120084606.4083194-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea For RZ/G3S and RZ/G2L SoCs the Ethernet's reference clock is part of the Ethernet's power domain. It is controlled though CPG driver that is providing the support for power domain that Ethernet belongs. Thus, to be able to implement runtime PM (at least for RZ/G3S at the moment) w/o the need to add clock enable/disable specific calls in runtime PM ops of ravb driver and interfere with other IP specific implementations, add a new variable to struct_hw_info and enable the reference clock based on the value of this variable (the variable states if reference clock is part of the Ethernet's power domain). Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb.h | 1 + drivers/net/ethernet/renesas/ravb_main.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index e0f8276cffed..c2d8d890031f 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1043,6 +1043,7 @@ struct ravb_hw_info { unsigned nc_queues:1; /* AVB-DMAC has RX and TX NC queues */ unsigned magic_pkt:1; /* E-MAC supports magic packet detection */ unsigned half_duplex:1; /* E-MAC supports half duplex mode */ + unsigned refclk_in_pd:1; /* Reference clock is part of a power domain. */ }; struct ravb_private { diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 836fdb4b3bfd..ddd8cd2c0f89 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2502,6 +2502,7 @@ static const struct ravb_hw_info gbeth_hw_info = { .tx_counters = 1, .carrier_counters = 1, .half_duplex = 1, + .refclk_in_pd = 1, }; static const struct of_device_id ravb_match_table[] = { @@ -2749,12 +2750,14 @@ static int ravb_probe(struct platform_device *pdev) goto out_release; } - priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); - if (IS_ERR(priv->refclk)) { - error = PTR_ERR(priv->refclk); - goto out_release; + if (!info->refclk_in_pd) { + priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk"); + if (IS_ERR(priv->refclk)) { + error = PTR_ERR(priv->refclk); + goto out_release; + } + clk_prepare_enable(priv->refclk); } - clk_prepare_enable(priv->refclk); if (info->gptp_ref_clk) { priv->gptp_clk = devm_clk_get(&pdev->dev, "gptp"); @@ -2869,7 +2872,8 @@ static int ravb_probe(struct platform_device *pdev) if (info->ccc_gac) ravb_ptp_stop(ndev); out_disable_refclk: - clk_disable_unprepare(priv->refclk); + if (!info->refclk_in_pd) + clk_disable_unprepare(priv->refclk); out_release: free_netdev(ndev); pm_runtime_put: @@ -2890,7 +2894,8 @@ static void ravb_remove(struct platform_device *pdev) if (info->ccc_gac) ravb_ptp_stop(ndev); - clk_disable_unprepare(priv->refclk); + if (!info->refclk_in_pd) + clk_disable_unprepare(priv->refclk); /* Set reset mode */ ravb_write(ndev, CCC_OPC_RESET, CCC); From patchwork Mon Nov 20 08:46:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460925 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9888AC197A0 for ; Mon, 20 Nov 2023 08:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232413AbjKTIrE (ORCPT ); Mon, 20 Nov 2023 03:47:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbjKTIqx (ORCPT ); Mon, 20 Nov 2023 03:46:53 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4CCDD7C for ; Mon, 20 Nov 2023 00:46:40 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32fdc5be26dso2663882f8f.2 for ; Mon, 20 Nov 2023 00:46:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700469998; x=1701074798; 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=JnubXRxqwunb9d9wAijOwoMF4ml5sMiS99lc6deFk3g=; b=kDjgvOwsGrktkE6c+4SJ7VsHqDJ5DFCbTuJwiiMqs/PQWj6VgIf2NTgz1Ma+IsMVdo qkIqBM95A7M3eSW+/NB4dfMErnpCwuK5OU3/cEUIQQk4blNSArVLAFA/0fyu2ky1O5hh RTVgN+x0nthlUWB5nkH+eB5JDaGCVBeVgV5GebEH15NWuxywUfrTpkcplCf+X+mKWpvG s16cV5JgkUkrw3qO1nr5fMNRkg1ILPzRyPzxzLLnYUz5JgOwLCOpIZZKmhALcSUG2AmJ acJV7Y42jlCY8Om8VsxoTZmSr4zHkIduE9W/hqABNxUZOFU0sr3vHvv1n9gLx0tiYO04 P8zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700469998; x=1701074798; 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=JnubXRxqwunb9d9wAijOwoMF4ml5sMiS99lc6deFk3g=; b=H/PT7TvG40qCufM4SShMd8i+OuhBvRVlQPIcIGyaL3fx7GRZF+Yxf8wbBSj8pVNXTO 4p6THouthFH4quTUsAqM9S3nR/M7XMMT+3DhFrkgUfw4akalDD75NcGAkHdX0Upuajw1 IuQfTzy55HXDDd2pty+zKFZAKW9bxyTWK6XJkG3gPz/NUIoYRjaA+lz4cGhm0mxkcDCY IDWQkQ9G20RafvcMwOSga98c0+EbBlc4FVOhMm5iuIU6cKH7cmur5FumrQ5wCys0soRG fzxHQLlDbgja1V/FQ9v05Uf3bAUCkSYeF5eHpNcWV7diS+wvVvqqsyLjr0lsP9qFTtla Zj1Q== X-Gm-Message-State: AOJu0YwvB4gD+o0+1vu/OxX0ZGosW0jsreo45g0Lec58ztEYLvbubdAg TK4yQyf+6oB0g+MbgtdSYnIMmA== X-Google-Smtp-Source: AGHT+IEMct7WxOL7CEruxo5dhNLNWOxO//4tc7G+NL8rWLz5AtDQvNUkk8+27zWIFX2LTYBR/EnH+A== X-Received: by 2002:a5d:64c6:0:b0:332:c527:66e8 with SMTP id f6-20020a5d64c6000000b00332c52766e8mr1784413wri.7.1700469998154; Mon, 20 Nov 2023 00:46:38 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:37 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 09/13] net: ravb: Make reset controller support mandatory Date: Mon, 20 Nov 2023 10:46:02 +0200 Message-Id: <20231120084606.4083194-10-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea On RZ/G3S SoC the reset controller is mandatory for the IP to work. The device tree binding documentation for ravb driver specifies that the resets are mandatory. Based on this make the resets mandatory also in driver for all ravb devices. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov Reviewed-by: Geert Uytterhoeven --- 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 ddd8cd2c0f89..8874c48604c0 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2627,7 +2627,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 Mon Nov 20 08:46:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460926 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABB14C54FB9 for ; Mon, 20 Nov 2023 08:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232714AbjKTIrH (ORCPT ); Mon, 20 Nov 2023 03:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbjKTIqz (ORCPT ); Mon, 20 Nov 2023 03:46:55 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E66A10DD for ; Mon, 20 Nov 2023 00:46:42 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32fdc5be26dso2663901f8f.2 for ; Mon, 20 Nov 2023 00:46:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700470000; x=1701074800; 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=ezAPzcxWw8oaCnMq9MMaqVY5m8sIIEr0Duonqihjljk=; b=g5Wn/FQ2SCHrMFOlQK69E2fXGkqdPXGOtq+BnN16UECyS9OIc7JxZIr/IcCSh2nlVQ exWMW+ADLQDiPmJWVGMsqZkuIzxTn4KKpjQBycfeoNQiiUrzor3tUywlUp6MBuiye0wN 3DufUJ5lpJd06fdKoMAWSTOE9M9B3xHVWfThe+XOPJYPmsXe5KyNv3UmcG0Oetld8ddI qJsTAoo75c/q6g818gsJWEtY2MTMnvZZ7n1+k89ZfYfDnSnzkEzCax5xoNguHeiTQ15d LvqzjZldC6scJOgaUdBzq5qWWdvjuredeutRpV18+APhn1oKVLOCW6IUcgRXoMS5yr1g Veaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700470000; x=1701074800; 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=ezAPzcxWw8oaCnMq9MMaqVY5m8sIIEr0Duonqihjljk=; b=SrQSzIIg4FbhweRWG+mQcPYERnV3EA9kOULVrqpY2su4h2sptH0tqewbb7bsz8RLy1 +NyUly/jeQI869xTwwgbKSeutQZ4ZCgQ5TLsox6Lq3RU41LeoM0nrQ2V3D2sIiUBHMgb JZirvnpZWGzPaNIiyjOsum3I4ZDHDpSZHjw+AbBeHZ4ZHgC1PXqf8pnvHtMUbpDrZfyh YnnxelK11SUpAKGE5K6x5N1cEpt23b/8f+ZiYiN+RTXYA/oqT/kBZcQrgLXQ0Y3BAcZc 2Vb7vvfROaYc8yuqDkXozM+Xhs1SGxR1s+fU298JFcSsJA9t3GAHdy+7ZB7+f20xm6TH PqsQ== X-Gm-Message-State: AOJu0Yyupn8XmCFH6ZKmvbrfShkRmTzmikC1VG+VJkcxD7qinYHr+/Lq HEZFCtLAnsqe1JAjlZQKZ8Ysew== X-Google-Smtp-Source: AGHT+IEAgykpFjgvqjsDJ9ujkx/pXzS0QC1Ua+yXU5aenNy6UwS04GrphPWepSLY5gmq7jYPGWeDwg== X-Received: by 2002:a05:6000:1001:b0:331:34c1:7a0 with SMTP id a1-20020a056000100100b0033134c107a0mr3949148wrx.57.1700469999993; Mon, 20 Nov 2023 00:46:39 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46: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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 10/13] net: ravb: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Date: Mon, 20 Nov 2023 10:46:03 +0200 Message-Id: <20231120084606.4083194-11-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov Reviewed-by: Geert Uytterhoeven --- 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 8874c48604c0..15fc494a8b97 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2953,7 +2953,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); @@ -2975,7 +2975,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); @@ -3029,7 +3029,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. @@ -3042,8 +3042,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 = { @@ -3051,7 +3051,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 Mon Nov 20 08:46:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460927 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EC61C5AD4C for ; Mon, 20 Nov 2023 08:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232437AbjKTIrJ (ORCPT ); Mon, 20 Nov 2023 03:47:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232596AbjKTIq4 (ORCPT ); Mon, 20 Nov 2023 03:46:56 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E1B610E9 for ; Mon, 20 Nov 2023 00:46:43 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-32ddfb38c02so2710247f8f.3 for ; Mon, 20 Nov 2023 00:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700470002; x=1701074802; 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=t9P13AuwHQNyol8ESmYlCJi/3K3sWj05YLgHYicy7J8=; b=iBMqkxPNTEKDL95lA/Gege1l4FJrPbPsQCoqpWNqFF2xGZpWxD7QcZ+0dPgruBqd7k kRNbJgglTjkPvfYFgeXcY3b34xL3OWM2i/93BPqdqqiS23OkEQs1bYRZhj17Bkwi8GYT EC/CIeV5zt9pRat8dYqMKNQkydET0BXuURurn3vAHb6kKZwDTjUrp0ilxDX7UtC1cow7 TFsP2n4/JeTaGIC/KugGxw2noj3cAZE+VNP8Pz02vz2w+AgMlcnNwN0/Y2M0MOC1VxSU 28cL473bju9D7Kdu6Pqfk2ZHiYXCOF0lfx394up4yYe8r3E1t+P1uLmiuKDbLXKPUdLr dTXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700470002; x=1701074802; 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=t9P13AuwHQNyol8ESmYlCJi/3K3sWj05YLgHYicy7J8=; b=QPuS5NM2nJ70O4R4u+jiUJsXl30CZEcOyeBwISMc7TZaCRc0SLKHRKd4neR35aH698 a/F74c05Trid9hoWj58gocR97TXIeeYUSoMnAkid4cOw8NNe3chuIWXPNBBz+d/1wa+p yGKrnKio4sBixG3pKXKo14uL62qK2WxYsCmTacwSJNpRle2x8LkiRXcpgEUg9HCuLELM ZJ9tuppA4SpybVFApy14S+sTNj1cIw96QWqg7TIq4OTRb8TYCTrQt5rHC0VKDQwDkHGM DKcJMhDkU1GNOLxTmt9L+g1cpof0gbc46GVJg740j8SYlJ6jH1tNCn/Qp+zCotbzFsqL tUeA== X-Gm-Message-State: AOJu0YzVR7nXCrcKJWQMgSLBSbT/bClAIH9RUtdpQO/59VCD8mlv5kXC NxxsYukd6tKXhO8wTJ1IaRR4/Q== X-Google-Smtp-Source: AGHT+IH4tqjzxhfDBRO9JzLmK8bOQRhJkxyEAkin5Qwp4aH4sfWHYtHF/u857ef9ciIBxj5ZRGSdMg== X-Received: by 2002:a5d:5f94:0:b0:32f:8a45:93a8 with SMTP id dr20-20020a5d5f94000000b0032f8a4593a8mr5042551wrb.0.1700470001599; Mon, 20 Nov 2023 00:46:41 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46:41 -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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 11/13] net: ravb: Use tabs instead of spaces Date: Mon, 20 Nov 2023 10:46:04 +0200 Message-Id: <20231120084606.4083194-12-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea Use tabs instead of spaces in ravb_set_rate_gbeth() function. This aligns with the coding style requirements. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- 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 15fc494a8b97..a93b3d6b1863 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -85,13 +85,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 Mon Nov 20 08:46:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460928 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD7DFC54E76 for ; Mon, 20 Nov 2023 08:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232381AbjKTIrP (ORCPT ); Mon, 20 Nov 2023 03:47:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232494AbjKTIq6 (ORCPT ); Mon, 20 Nov 2023 03:46:58 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D83151701 for ; Mon, 20 Nov 2023 00:46:45 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40859dee28cso15815375e9.0 for ; Mon, 20 Nov 2023 00:46:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700470003; x=1701074803; 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=qirNTaItgFaMUz8YEvAxbXzojjhdr1B68PxcW9IQleo=; b=lHhSrTOzg2RcBZxg+vZ9/+B9PiidVlx1tBsEF1HhSdIHDYoTcmQAupzx+1xo86gsxq IjpZzSekwx2GZSUBPqwh0BwxH0tIWKeCe8kGP0aSh5knp0s17JZqxsXOj84z5wmendAZ wxGap0W2OR6CFsIJm7IHcTU25LB7sAGm8Itmm2R6kENa7suFL3VHBUeqCvTUeDkdRNpo uaEw7YZ/Vi8DbVrcy/9dkNt+ue1eYBj8zscqJ2SNl5fUYzf7O7rJSUsqmX6lUrjQSZwz +onPhF9Nh6INJUfu6ff1tX8LaeEAPnXDUA6dKGYgwgf/ZdoyPc/2EwtCP9SwFlo4Fsrl DOCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700470003; x=1701074803; 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=qirNTaItgFaMUz8YEvAxbXzojjhdr1B68PxcW9IQleo=; b=W21cxFQKodZOAk4RoQ/j1m0vOfFpnJTSCboGV1Th5DAcSAkyLZjYEyS012Gy3bC2ye lDL/3K4klcx1vzqNULBYio65bPx8kpTobIXNbti60bNIv2QKDjBQVZtJzafK91H0KzNF Lz2MPMbheaBy6ty7qtVlw2FQo0ZSApHYeJf52gNWS2RdQH2ZhKdn+lPngE3Sdn57ECBN uEWnUdr8iyMqhCSm3LM+idoXP1fdR/PjVu7illrIWKY8x20/fPkb3IWoIm6YlfVezOz6 pIfYTJ0wfGAZd52GEk8yNGhojlGOODZsEWymWpQGjVbmNDaAfkqggGW5W7d7YxBvQ3AU FdOw== X-Gm-Message-State: AOJu0Yw6SHZ2jPv7n4t6cLzTTm597N7Iou6Te6NMcIpMSMRUnnLZudt7 Sa2zQyZECe/lrdNlkud+/uLuhg== X-Google-Smtp-Source: AGHT+IEQ1eXLmnYRK/XGrJL81A/yawh9W/SR/aidkq6ssLa4Fbn90i50o8mhIyWvT0d7h6s3vgo4og== X-Received: by 2002:a5d:59a9:0:b0:332:c2a0:c0d0 with SMTP id p9-20020a5d59a9000000b00332c2a0c0d0mr3072606wrr.46.1700470003219; Mon, 20 Nov 2023 00:46:43 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46: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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 12/13] net: ravb: Assert/deassert reset on suspend/resume Date: Mon, 20 Nov 2023 10:46:05 +0200 Message-Id: <20231120084606.4083194-13-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea RZ/G3S can go to deep sleep states where power to most of the SoC parts is off. When resumming from such state the Ethernet controller needs to be reinitialized. Deasserting the reset signal for it should also be done. Thus add reset assert/deassert on suspend/resume functions. On resume function the de-assert was not reverted in case of failures to give user a chance to restore the interface (e.g. bringing down/up the interface) in case suspend/resume fails. Signed-off-by: Claudiu Beznea Reviewed-by: Sergey Shtylyov --- drivers/net/ethernet/renesas/ravb_main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index a93b3d6b1863..f4634ac0c972 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2972,7 +2972,10 @@ static int ravb_suspend(struct device *dev) if (priv->info->ccc_gac) ravb_ptp_stop(ndev); - return ret; + if (priv->wol_enabled) + return ret; + + return reset_control_assert(priv->rstc); } static int ravb_resume(struct device *dev) @@ -2980,7 +2983,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 Mon Nov 20 08:46:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13460956 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 294D5C54E76 for ; Mon, 20 Nov 2023 08:47:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232409AbjKTIrb (ORCPT ); Mon, 20 Nov 2023 03:47:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjKTIrE (ORCPT ); Mon, 20 Nov 2023 03:47:04 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4437D5E for ; Mon, 20 Nov 2023 00:46:47 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50aabfa1b75so1136061e87.3 for ; Mon, 20 Nov 2023 00:46:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1700470005; x=1701074805; 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=7FNYhRa/kTA6OUz1GxKxTdj30g/SDXO/leUXkzzIoxw=; b=VO0kq44x/Wrch2l5+Q2+FYZCPkFeiV1TaJFx3HDqz3Qc91dlnm32ICrOeS/za1WGy9 +cde5RstXHKniIsl87ENRryRktE/DkdZDv5gVDf/oUxRlxZ4YV3tibfOs0KgTv8I4fW0 nPTG2Tw7uzh5ii5xHD5V8l7XHid40OzAGTtsxetw7v7Ann2CTwcLzLeLYCKwz+AC1IQ7 TBjrzVz+5tMAQd/rnNKI43ebYbMy9gv/RMR058K0GwBs0kis6Ca9WwFFKLZajunWpuKa Q8SliCxbuLzFClSwuu3EYYHqRMdxqCw7Hhn9F7euMV+kTuMCNv2GqKo+Y4sZ39Nv/a6v PMSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700470005; x=1701074805; 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=7FNYhRa/kTA6OUz1GxKxTdj30g/SDXO/leUXkzzIoxw=; b=cDR56oMgEaDenq0Rn8r6Rdqi3ByQPkY4gD8A46Q3qZxhSyzPOIvAdEKHVrsGEGxxL7 sRFa19WtbM4aLg2zACw0+1uLTfcXEuKmjW5tbgOxXSD8fn14FbLJV+SRpkP0Zz3xx9po 9/1v5c4ExSaZSTJJAJCuowSWl+bl+laxcFpW4/2mwDfW3OeU2X9jPTrj9NiiY16Apy+h 7s4S5L9HBsmrY8Z5uTZVXtvREWvHKefMnSlFfFbCXgQTYzc6WHaLfYNS4LSCISEiKiBR lVBw4tExSJeqqLQqE13VGPIq20cX8RhY2WjKIwU1ZZPYEggD+gSdeqxPC7yuFSiXa7dA kt0Q== X-Gm-Message-State: AOJu0YyRLFzAaxtHPk42bQ4/RzyNbbTZO9P96kbegUjSc9+YGcfV1gy7 Eh21eV4TtEzHRILe4fF7YHgZIg== X-Google-Smtp-Source: AGHT+IHtxPlpXQ4BayjBdJJbq3iQegNvuqGSMbNIEngr6vOZDv3NmG/e15q/dsXWFZlOZoNSSCnIIQ== X-Received: by 2002:a05:6512:208:b0:509:75b8:637b with SMTP id a8-20020a056512020800b0050975b8637bmr5013308lfo.30.1700470005365; Mon, 20 Nov 2023 00:46:45 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.183]) by smtp.gmail.com with ESMTPSA id b8-20020a5d45c8000000b003142e438e8csm10435267wrs.26.2023.11.20.00.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 00:46: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, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, geert+renesas@glider.be, wsa+renesas@sang-engineering.com, biju.das.jz@bp.renesas.com, prabhakar.mahadev-lad.rj@bp.renesas.com, sergei.shtylyov@cogentembedded.com, mitsuhiro.kimura.kc@renesas.com, masaru.nagai.vx@renesas.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH 13/13] net: ravb: Add runtime PM support Date: Mon, 20 Nov 2023 10:46:06 +0200 Message-Id: <20231120084606.4083194-14-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> References: <20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org From: Claudiu Beznea RZ/G3S supports enabling/disabling clocks for its modules (including Ethernet module). For this commit adds runtime PM support which relies on PM domain to enable/disable Ethernet clocks. At the end of probe ravb_pm_runtime_put() is called which will turn off the Ethernet clocks (if no other request arrives at the driver). After that if the interface is brought up (though ravb_open()) then the clocks remain enabled until interface is brought down (operation done though ravb_close()). If any request arrives to the driver while the interface is down the clocks are enabled to serve the request and then disabled. Signed-off-by: Claudiu Beznea --- drivers/net/ethernet/renesas/ravb.h | 1 + drivers/net/ethernet/renesas/ravb_main.c | 99 ++++++++++++++++++++++-- 2 files changed, 93 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index c2d8d890031f..50f358472aab 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1044,6 +1044,7 @@ struct ravb_hw_info { unsigned magic_pkt:1; /* E-MAC supports magic packet detection */ unsigned half_duplex:1; /* E-MAC supports half duplex mode */ unsigned refclk_in_pd:1; /* Reference clock is part of a power domain. */ + unsigned rpm:1; /* Runtime PM available. */ }; struct ravb_private { diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index f4634ac0c972..d70ed7e5f7f6 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -145,12 +145,41 @@ static void ravb_read_mac_address(struct device_node *np, } } +static int ravb_pm_runtime_get(struct ravb_private *priv) +{ + const struct ravb_hw_info *info = priv->info; + + if (!info->rpm) + return 0; + + return pm_runtime_resume_and_get(&priv->pdev->dev); +} + +static void ravb_pm_runtime_put(struct ravb_private *priv) +{ + const struct ravb_hw_info *info = priv->info; + struct device *dev = &priv->pdev->dev; + + if (!info->rpm) + return; + + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); +} + static void ravb_mdio_ctrl(struct mdiobb_ctrl *ctrl, u32 mask, int set) { struct ravb_private *priv = container_of(ctrl, struct ravb_private, mdiobb); + int ret; + + ret = ravb_pm_runtime_get(priv); + if (ret < 0) + return; ravb_modify(priv->ndev, PIR, mask, set ? mask : 0); + + ravb_pm_runtime_put(priv); } /* MDC pin control */ @@ -176,8 +205,17 @@ static int ravb_get_mdio_data(struct mdiobb_ctrl *ctrl) { struct ravb_private *priv = container_of(ctrl, struct ravb_private, mdiobb); + int ret; - return (ravb_read(priv->ndev, PIR) & PIR_MDI) != 0; + ret = ravb_pm_runtime_get(priv); + if (ret < 0) + return ret; + + ret = (ravb_read(priv->ndev, PIR) & PIR_MDI) != 0; + + ravb_pm_runtime_put(priv); + + return ret; } /* MDIO bus control struct */ @@ -1796,10 +1834,14 @@ static int ravb_open(struct net_device *ndev) } } + error = ravb_pm_runtime_get(priv); + if (error < 0) + return error; + /* Device init */ error = ravb_dmac_init(ndev); if (error) - goto out_free_irq_mgmta; + goto pm_runtime_put; ravb_emac_init(ndev); /* Initialise PTP Clock driver */ @@ -1820,7 +1862,8 @@ static int ravb_open(struct net_device *ndev) if (info->gptp) ravb_ptp_stop(ndev); ravb_stop_dma(ndev); -out_free_irq_mgmta: +pm_runtime_put: + ravb_pm_runtime_put(priv); if (!info->multi_irqs) goto out_free_irq; if (info->err_mgmt_irqs) @@ -2064,6 +2107,11 @@ static struct net_device_stats *ravb_get_stats(struct net_device *ndev) struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; struct net_device_stats *nstats, *stats0, *stats1; + int ret; + + ret = ravb_pm_runtime_get(priv); + if (ret < 0) + return NULL; nstats = &ndev->stats; stats0 = &priv->stats[RAVB_BE]; @@ -2107,6 +2155,8 @@ static struct net_device_stats *ravb_get_stats(struct net_device *ndev) nstats->rx_over_errors += stats1->rx_over_errors; } + ravb_pm_runtime_put(priv); + return nstats; } @@ -2115,11 +2165,18 @@ static void ravb_set_rx_mode(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); unsigned long flags; + int ret; + + ret = ravb_pm_runtime_get(priv); + if (ret < 0) + return; spin_lock_irqsave(&priv->lock, flags); ravb_modify(ndev, ECMR, ECMR_PRM, ndev->flags & IFF_PROMISC ? ECMR_PRM : 0); spin_unlock_irqrestore(&priv->lock, flags); + + ravb_pm_runtime_put(priv); } /* Device close function for Ethernet AVB */ @@ -2187,6 +2244,11 @@ static int ravb_close(struct net_device *ndev) if (info->nc_queues) ravb_ring_free(ndev, RAVB_NC); + /* Note that if RPM is enabled on plaforms with ccc_gac=1 this needs to be skipped and + * added to suspend function after PTP is stopped. + */ + ravb_pm_runtime_put(priv); + return 0; } @@ -2503,6 +2565,7 @@ static const struct ravb_hw_info gbeth_hw_info = { .carrier_counters = 1, .half_duplex = 1, .refclk_in_pd = 1, + .rpm = 1, }; static const struct of_device_id ravb_match_table[] = { @@ -2636,6 +2699,12 @@ static int ravb_probe(struct platform_device *pdev) if (error) return error; + info = of_device_get_match_data(&pdev->dev); + + if (info->rpm) { + pm_runtime_set_autosuspend_delay(&pdev->dev, 100); + pm_runtime_use_autosuspend(&pdev->dev); + } pm_runtime_enable(&pdev->dev); error = pm_runtime_resume_and_get(&pdev->dev); if (error < 0) @@ -2647,7 +2716,6 @@ static int ravb_probe(struct platform_device *pdev) error = -ENOMEM; goto pm_runtime_put; } - info = of_device_get_match_data(&pdev->dev); ndev->features = info->net_features; ndev->hw_features = info->net_hw_features; @@ -2856,6 +2924,8 @@ static int ravb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, ndev); + ravb_pm_runtime_put(priv); + return 0; out_napi_del: @@ -2880,6 +2950,8 @@ static int ravb_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); pm_runtime_disable: pm_runtime_disable(&pdev->dev); + if (info->rpm) + pm_runtime_dont_use_autosuspend(&pdev->dev); reset_control_assert(rstc); return error; } @@ -2889,6 +2961,11 @@ static void ravb_remove(struct platform_device *pdev) struct net_device *ndev = platform_get_drvdata(pdev); struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; + int error; + + error = ravb_pm_runtime_get(priv); + if (error < 0) + return; /* Stop PTP Clock driver */ if (info->ccc_gac) @@ -2908,6 +2985,8 @@ static void ravb_remove(struct platform_device *pdev) priv->desc_bat_dma); pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); + if (info->rpm) + pm_runtime_dont_use_autosuspend(&pdev->dev); reset_control_assert(priv->rstc); free_netdev(ndev); platform_set_drvdata(pdev, NULL); @@ -2989,6 +3068,10 @@ static int ravb_resume(struct device *dev) if (ret) return ret; + ret = ravb_pm_runtime_get(priv); + if (ret < 0) + return ret; + /* If WoL is enabled set reset mode to rearm the WoL logic */ if (priv->wol_enabled) ravb_write(ndev, CCC_OPC_RESET, CCC); @@ -3005,7 +3088,7 @@ static int ravb_resume(struct device *dev) /* Set GTI value */ ret = ravb_set_gti(ndev); if (ret) - return ret; + goto pm_runtime_put; /* Request GTI loading */ ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); @@ -3024,15 +3107,17 @@ static int ravb_resume(struct device *dev) if (priv->wol_enabled) { ret = ravb_wol_restore(ndev); if (ret) - return ret; + goto pm_runtime_put; } ret = ravb_open(ndev); if (ret < 0) - return ret; + goto pm_runtime_put; ravb_set_rx_mode(ndev); netif_device_attach(ndev); } +pm_runtime_put: + ravb_pm_runtime_put(priv); return ret; }