From patchwork Thu Dec 14 11:45:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: claudiu beznea X-Patchwork-Id: 179211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9210907dys; Fri, 15 Dec 2023 03:50:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1JhgmpEUqSCArXO1JGOwJeqXskNRlhJ2rtgzmUmSGrfFtq+HMYySdjSiBmqbsjD4OWea3 X-Received: by 2002:a05:6830:14d8:b0:6d9:fc91:f63e with SMTP id t24-20020a05683014d800b006d9fc91f63emr8875921otq.77.1702641026841; Fri, 15 Dec 2023 03:50:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702641026; cv=none; d=google.com; s=arc-20160816; b=SH/1XxEsyx9ftI5CKhYEax6nIhw3ptkSSTDc3oJ9r3dO/tDeupWbegCMmz3CpjpZ/U VxNnCKylaR2qbb8KNFNFeR4rJMQXe30S36zcLwK4k5ZA/39o+XUZqR9tQX1q0tAKA5dz LbCsa63a463baHPPsQhBru7HWHfM7pUM2J5TLpPVL8Q2jJGBnJ+8Qvem9A9jI4KMuNBp sTTOpqVj0ryuVGj7qncmPKF2CKzyHvLXN75voR/G9C23boVXtUhl+htp5JOlOSNWSlF+ KjZ1qL9zCSNYb2rLXG//wyO33UNt2HWWJ6iEDnSu78ZG0FKFPdtTbfNNuaBX8yWL5vFN qOpw== 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 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h2-20020a655182000000b0058978136247si12751426pgq.483.2023.12.15.03.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:50:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; 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 2620:137:e000::3:8 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 AD0A18108349; Thu, 14 Dec 2023 03:47:27 -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 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=ham 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:27 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785348517323696142 X-GMAIL-MSGID: 1785348517323696142 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 Reviewed-by: Sergey Shtylyov --- 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);