From patchwork Tue Jul 30 16:22:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13747634 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25D9CC3DA49 for ; Tue, 30 Jul 2024 16:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=52aOJkrh22+zle+fgR9wwsrFucffno14G9yuESYfRvA=; b=pDBZXQKbfdoruUEdFronn1ev/f LMclU2Wz+iulxK0H5c+tiL2rSCkBvl3fl0lZfwkz0WLU7wanaac/8dsEnPA101iDZ8Z/PvgrMAAlW 0GvgmZcrZdy3GJzWlNv5p3qk0WWe4tsMshI1MghVF8hRjEAnqAxnRKLSKcyFZQOdRLlneaFEUKJ+W tHW44k7QKz1pOwEiCdzKqAIXkzD5rVwTygb6UyBybq+s9FALzWYQH1B+K2jjBo2y16WMRJI8PI9Ju suErAKfXbKBGicQcTx6I8JGx28CaAOuRymCGGyym0wg9V+X3FqDDOCd8dHKQ1aYzonqFsGegZcd/E PfvQFcwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYph8-0000000Fr8N-2C4K; Tue, 30 Jul 2024 16:27:26 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYpdO-0000000FpxF-1RnU for linux-arm-kernel@lists.infradead.org; Tue, 30 Jul 2024 16:23:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AC65661FFA; Tue, 30 Jul 2024 16:23:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B502C32782; Tue, 30 Jul 2024 16:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722356613; bh=vQDIJsnOGGgaq4WYfkSJ5Agb4wD4Q3L1HuA+vM95XEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cF7pObyahraRhAF99pcJUmdgGM/1WTC/y0IVLeCUHdFXkb6cHHegi68wCj9YwLl9T BtqXYP5yZ07DvmadE5xwfq7eRuK9ngfAaUx4L0NjM6NlhTqyPZtWEAKLKeSgOeR99K dS1yCJ2D4IbwYQ7gXjn6WJUrI+/Oq/HbB+WR2qG4bga/+Kk9eEpXHLp6W0fTJQbLDM eQpgjjtopQ7Hb7WmpMPTwm19RKdA+/uagIb0DeyBNQqL2QXe7tlHhV3Y59FDfJi2o5 Z866MTil2g3srNkPQzRjJQPO2XXbMvtWDY6dOWwFMpGC1xZeuPB6KIRnLwHMQPBi5o 04wSJRnoxcFgw== From: Lorenzo Bianconi To: netdev@vger.kernel.org Cc: nbd@nbd.name, lorenzo.bianconi83@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-arm-kernel@lists.infradead.org, upstream@airoha.com, angelogioacchino.delregno@collabora.com, benjamin.larsson@genexis.eu, rkannoth@marvell.com, sgoutham@marvell.com, andrew@lunn.ch, arnd@arndb.de, horms@kernel.org Subject: [PATCH net-next 7/9] net: airoha: Clean-up all qdma controllers running airoha_hw_cleanup() Date: Tue, 30 Jul 2024 18:22:46 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240730_092334_471439_9955CBD7 X-CRM114-Status: GOOD ( 11.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Run airoha_hw_cleanup routine for both QDMA controllers available on EN7581 SoC removing airoha_eth module or in airoha_probe error path. This is a preliminary patch to support multi-QDMA controllers. Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/mediatek/airoha_eth.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c index 498c65b4e449..2e21577f9ce2 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c @@ -2096,9 +2096,8 @@ static int airoha_hw_init(struct platform_device *pdev, return 0; } -static void airoha_hw_cleanup(struct airoha_eth *eth) +static void airoha_hw_cleanup(struct airoha_qdma *qdma) { - struct airoha_qdma *qdma = ð->qdma[0]; int i; for (i = 0; i < ARRAY_SIZE(qdma->q_rx); i++) { @@ -2714,7 +2713,9 @@ static int airoha_probe(struct platform_device *pdev) return 0; error: - airoha_hw_cleanup(eth); + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_hw_cleanup(ð->qdma[i]); + for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i]; @@ -2732,7 +2733,9 @@ static void airoha_remove(struct platform_device *pdev) struct airoha_eth *eth = platform_get_drvdata(pdev); int i; - airoha_hw_cleanup(eth); + for (i = 0; i < ARRAY_SIZE(eth->qdma); i++) + airoha_hw_cleanup(ð->qdma[i]); + for (i = 0; i < ARRAY_SIZE(eth->ports); i++) { struct airoha_gdm_port *port = eth->ports[i];