Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp9782rdb; Fri, 5 Jan 2024 00:28:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVDVL6YIfF+awooRO2lZyNSJ1g/YfcC+mRaxvFNOzQcwN6o+G+eGRW5FyFmKSs3fwC1uIN X-Received: by 2002:a05:6a20:6d07:b0:198:e949:51fa with SMTP id fv7-20020a056a206d0700b00198e94951famr2070966pzb.32.1704443299338; Fri, 05 Jan 2024 00:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704443299; cv=none; d=google.com; s=arc-20160816; b=g7cM6LXMqWn/jYrxfixnbFCaRFYXDOzGQ/qPGaYGJwqSeUr2WiUc9x0emPx7jZJyfo qVA2zmzoi78d1Gp0LV6fNNqrLU8LgzuVeUZ6wMixRMJ747UdBVI46UvMXaiN4dNqS6/a vsOSsjkSRgGq3O1dp7+dMIo6NbqlgEc8mIf6ZVSLS7hrRvPsmEK6aerCOFyEiSsVVGIj C3fvuGSQACGyFKzqDqY6xpBar1z7adnjHAdg+eDxMDBZgsIJKC7nDLxpb+yCshbhFtv/ eLl0y2N1OEL3OEFBFQ33vgWa0Zve130KxsM6XVWk6WwYEf6YFFbZCYs5lau0uSJSbgwH 7ySg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5orQgwfDjSBIeq4ujM8DL6jz3CCIaE3k0jKXQPZpdUw=; fh=qryrdWWtksp4Ojh0keXejXriHeHARah4mOGZkuZ1jnk=; b=RPJ/EGNW18ncRPno3b3zAcT2L8lVoJcdKeMlONVqAtAjURYOnbWhRgiJfLnRLlJDyu MzK2FxnceRIPXs6MecycMS/QFkUQznyY0jNHKM1dgBxBxFrM/SwO9SGyoP+zDBb0qURg zbQ4PFVMIoNWBP9jcUbEIYVq5fiV6SmXjb81YdA6n21HWnWooBrQlYg5Q7O2wxf4hw8O 89rcLIicf8ff7/is2gDm+B1c/4AXeB+I/xXOFtc1TTH21Vzg/7+1ruzlQ16JArA3/qff UQp3YbUjcURGhZR54YhINoP0vuO5pTcW7PT8XW2TP+zgz3ua+LuEE+8NTZ8dRyCED4Pg ssyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=PQOnPIiA; spf=pass (google.com: domain of linux-kernel+bounces-17591-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17591-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x7-20020a636307000000b005cdfed45ee3si917588pgb.794.2024.01.05.00.28.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:28:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17591-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=PQOnPIiA; spf=pass (google.com: domain of linux-kernel+bounces-17591-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17591-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 04204287815 for ; Fri, 5 Jan 2024 08:28:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65BAE2DF73; Fri, 5 Jan 2024 08:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="PQOnPIiA" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3115A2DF63 for ; Fri, 5 Jan 2024 08:24:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a275b3a1167so154273666b.3 for ; Fri, 05 Jan 2024 00:24:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1704443097; x=1705047897; 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=5orQgwfDjSBIeq4ujM8DL6jz3CCIaE3k0jKXQPZpdUw=; b=PQOnPIiAM+K/1FD5C+58uAbe9lf+6xzCMUQPaflCfyvfDvEwLX3wzuNMnPuZRfV4Co V6W1Yhq13VBKOdirmUGMcX9Q2YMvsz3gHS3St4c3EDNk8XnZ8bjH9TyWWVm38gZcNo+U IaRVmuAafsorcwt4BHD8WjS6kjcqMzPJcS9vbXzfvqDSpn5O+iJkXrFe4GFDahtChwL0 50KW7dYLeP5ArDVWvjbSCEfR/tKwzcNq+JUDRaWnw7YHCg9gtOpn1YrGGPHHrXW3tqfK QFTEtWJFae0FVWREHd0+wyze6w4sUYVWfQVtq2+VaAgBTcsz24Y3uaUzkfAFmGQOFklg P3EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704443097; x=1705047897; 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=5orQgwfDjSBIeq4ujM8DL6jz3CCIaE3k0jKXQPZpdUw=; b=uCvAZiuUuuy7gX9rKWaLuyH5EhFWQdkRgf3Ae13G1RYjLlwEkaWGPPYi6gY7i32lAE CQGhsSNbn7SjHS19tW3p4tWztZZXDTVbuQeCcjLGXx1MqZU7dLMLhcMjv7mQnDojF4fS tZTHpN9HWc9yPJHzZWlEJxMY904d+l2mR+cNMcnwym0ofmHfR/QGAWY9WFkQ9AM3PxPk hjeHKWgCPf2kV67iVn3mYholb3aV7TSKmR6bpTMam2+jD5ngfxxePJdz0NtgSO9GCHWp qhKMJ33I9u9crcNpOQ5fsDKDrh8G/DreF9/sGA8DqTbRm19HSbpVj+0BLyuThyob+rYz zbnA== X-Gm-Message-State: AOJu0YxWoVWsyOJXCPLuSMrfSAhqJ0Lw4RRcy0+FdZTDE7XsZ68KHf09 LyLkyeFwJK7atL7zmC44xdoY8G7bLxlQMQ== X-Received: by 2002:a17:906:474e:b0:a27:32a0:b838 with SMTP id j14-20020a170906474e00b00a2732a0b838mr986323ejs.112.1704443097504; Fri, 05 Jan 2024 00:24:57 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.5]) by smtp.gmail.com with ESMTPSA id j15-20020a1709064b4f00b00a28e759a447sm596198ejv.213.2024.01.05.00.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 00:24:57 -0800 (PST) From: Claudiu X-Google-Original-From: Claudiu To: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com, p.zabel@pengutronix.de, yoshihiro.shimoda.uh@renesas.com, wsa+renesas@sang-engineering.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, claudiu.beznea@tuxon.dev, geert+renesas@glider.be, Claudiu Beznea Subject: [PATCH net-next v3 12/19] net: ravb: Move PTP initialization in the driver's ndo_open API for ccc_gac platorms Date: Fri, 5 Jan 2024 10:23:32 +0200 Message-Id: <20240105082339.1468817-13-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240105082339.1468817-1-claudiu.beznea.uj@bp.renesas.com> References: <20240105082339.1468817-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea The initialization sequence for PTP is the same for platforms with ccc_gac and gptp (according to "Figure 50.71 Flow of gPTP Initialization (Normal, Common to All Modes)" of the R-Car Series, 3rd generation hardware manual and "Figure 37A.53 Flow of gPTP Initialization (Normal, Common to All Modes)" of the RZ/G Series hardware manual). As some IP variants switch to reset mode (and thus the registers content is lost) when setting clocks (due to module standby functionality) to be able to implement runtime PM, move the PTP initialization to the driver's ndo_open API. This commit prepares the code for the addition of runtime PM. Reviewed-by: Sergey Shtylyov Signed-off-by: Claudiu Beznea --- Changes in v3: - fixed typos in patch description - collected tags Changes in v2: - none; this patch is new drivers/net/ethernet/renesas/ravb_main.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index dbc26c3e95ec..1cc1ecd8d6a8 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -1837,7 +1837,7 @@ static int ravb_open(struct net_device *ndev) ravb_set_gti(ndev); /* Initialise PTP Clock driver */ - if (info->gptp) + if (info->gptp || info->ccc_gac) ravb_ptp_init(ndev, priv->pdev); /* PHY control start */ @@ -1851,7 +1851,7 @@ static int ravb_open(struct net_device *ndev) out_ptp_stop: /* Stop PTP Clock driver */ - if (info->gptp) + if (info->gptp || info->ccc_gac) ravb_ptp_stop(ndev); ravb_stop_dma(ndev); out_napi_off: @@ -2161,7 +2161,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 */ @@ -2774,10 +2774,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; @@ -2822,10 +2818,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: @@ -2851,10 +2843,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