Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6614050rdb; Fri, 15 Dec 2023 03:55:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI6hP36ckMFevfJr/8ndr27DvZ4aG+fhzQdMZXTVWdoe3WmOPy2648oc1/DzOP3javLpMy X-Received: by 2002:a05:6359:420a:b0:170:4323:3249 with SMTP id kn10-20020a056359420a00b0017043233249mr10512302rwb.51.1702641330344; Fri, 15 Dec 2023 03:55:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702641330; cv=none; d=google.com; s=arc-20160816; b=H5ULguM4ezM9wg8BwnKILQJp1Zk6/ObkB5zm8+KsXlKNi1bZgOdaDQY6y/+Ae7emTL 7+CfU3ZujIuYlT8AlCH3Z0hoNMVzMreePBAcjt/N28xLnuIGYeexdsNgA2mDoJ1rBjJj u5N4ret5kb1T0QV+cD5qdwfVReBSdwHwVf7AWZWrbJ7mR9D5nd5IQUXyYHPAbG+u79hO GNrcoJQC36fKTcr/kLNm1+vjiA7H3SVfYr6J2az8E+YCJIAkppdzt30EZh1c8h4QQjhO imzKz7iQkwaau7D2rPLiuGLzBsYJkt39h23kqHa5leN6CpFx3Kl/jR6rgstdzn9zC9mQ p7Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YUpk9YEw4O5jZFB/MhCu88qNpJzCkLxLIB6VsR179rU=; fh=JRNH3R6BkbckLgmyv72Fq6g69IcAiTiL2Sp+o8fsz+8=; b=mcSFjKrjddpqwytCKYco/kbYW41XRkhVwKEfDlGbCkG+2XOjLDJ4p+NUXp5pbEtXHc YA6HyzqkO53nthlEBAY/oa6b0xZK4JGzGuZ1pkIMCJILzH3k7X6GRvF2TQr3rq7kiryd HEq9acvXj7OUVVI0j0vV0pr0mSY7kKm4rLr0BOMI1PcO/VRIwF46ZxaUbRpj1NRdCumf e/ZMb6VzUcicmQ1ppK1t3lRzLPO7Kxh2LgwyzPqIvK+qlZwpn1jUmEBfrRtLLEekwECO F1PDNXjB5U5rjXbykZuAwym3oe0JBNLwUvcLshcHh+KrFqeP4JeED7jAPw6flF2uLdgm 2WRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=kvJ9INdg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id bt21-20020a17090af01500b0028b391b40aesi277959pjb.139.2023.12.15.03.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:55:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=kvJ9INdg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 33BD88106F46; Thu, 14 Dec 2023 03:47:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444316AbjLNLrS (ORCPT + 99 others); Thu, 14 Dec 2023 06:47:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444241AbjLNLqy (ORCPT ); Thu, 14 Dec 2023 06:46:54 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A811BD for ; Thu, 14 Dec 2023 03:46:39 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-50e0d1f9fe6so2852700e87.1 for ; Thu, 14 Dec 2023 03:46:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1702554398; x=1703159198; 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=YUpk9YEw4O5jZFB/MhCu88qNpJzCkLxLIB6VsR179rU=; b=kvJ9INdg0ZqMNqg8of9oBNzFNJJFxmQ70NToJ82NrikOjaxrizVuPoNIqcBLuY/+MD T1oo8gLFyEyXjhVMAZKvOHsYmBnVeP7XM+SGiO5pX0YTkfxHW5XfpBI15FVAAZymQ3Eu 5QsPdbE2qjJNp219I0CFCIexY4OwHZbGR/yom+uSMYbt/kqBMHX/GT5v8OdnPqPtrN2g hFv2SqqMJNQ0B9mTNAwRv3jMAjVQ3QW6HAAfb5czcaVASuAjHk6ZEbg8pwUd0Xv1flQA SFdGx6V7oDTlp/XyR79Odwvr1zHAn5L8im5BPr9eYcr2ivNfxjnFGNrfIfRWV6FayLun xMHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702554398; x=1703159198; 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=YUpk9YEw4O5jZFB/MhCu88qNpJzCkLxLIB6VsR179rU=; b=WRW9cN1XjE3MpDYw49eMDmrkyIIwilwvAy1kzu0y/ICKu07BBZLFx2zfLtgWYyit/k X06IDe/C7PKWTLcsAIohFGG9vnnb0cgOuswt76Jb6c3jcmEH/HXOGJwlo3OTVgf8CI/e DiKkG0ijntmZZlvK+DNi/GGxwxYANiciQEyik+/0SDSWKCbw3Y2BnmSt8CwlDgvK0jiy 1D6wtgIkfAOiRq0VM4/fXZqBr7/OwUUTdiEYSawAkfsRL8maYS/mShHvY7U+Cza4PlpO 60Q20fmKfeQ9beWiSUZrTlrrDWnSCaXcKf86pTVeuo1RTxCb91ehp0Y1p+0zGN0Crr/v x0Fw== X-Gm-Message-State: AOJu0YxmdLtz/DDI9jTS7M+YoLy85wmWR/jDCpypI2AoD7KS0r15ryog jcjmS+Q3WH5h/5loGcfeLFz6yw== X-Received: by 2002:ac2:4e8f:0:b0:50c:44:919e with SMTP id o15-20020ac24e8f000000b0050c0044919emr3721718lfr.108.1702554398125; Thu, 14 Dec 2023 03:46:38 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.103]) by smtp.gmail.com with ESMTPSA id ll9-20020a170907190900b00a1da2f7c1d8sm9240877ejc.77.2023.12.14.03.46.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03: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, richardcochran@gmail.com, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com, geert+renesas@glider.be Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Claudiu Beznea Subject: [PATCH net-next v2 12/21] net: ravb: Move ptp initialization in the driver's ndo_open API for ccc_gac platorms Date: Thu, 14 Dec 2023 13:45:51 +0200 Message-Id: <20231214114600.2451162-13-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231214114600.2451162-1-claudiu.beznea.uj@bp.renesas.com> References: <20231214114600.2451162-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:47:33 -0800 (PST) From: Claudiu Beznea The initialization sequence for PTP is the same for platforms with ccc_gac and gptp (according to chapter "Figure 50.71 Flow of gPTP Initialization (Normal, Common to All Modes)" of the R-Car Series, 3rd generation hardware manual and chapter "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 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. Signed-off-by: Claudiu Beznea --- 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 6b8ca08be35e..db9222fc57c2 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1835,7 +1835,7 @@ static int ravb_open(struct net_device *ndev) goto out_dma_stop; /* Initialise PTP Clock driver */ - if (info->gptp) + if (info->gptp || info->ccc_gac) ravb_ptp_init(ndev, priv->pdev); /* PHY control start */ @@ -1849,7 +1849,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); out_dma_stop: ravb_stop_dma(ndev); @@ -2151,7 +2151,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 */ @@ -2846,10 +2846,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; @@ -2894,10 +2890,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: @@ -2924,10 +2916,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); -- 2.39.2