From patchwork Tue Feb 27 18:54:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13574315 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (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 6526951C4D for ; Tue, 27 Feb 2024 18:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060103; cv=none; b=QEBNJTbhffmdyg6giYc4HaDJU213eTbQ/feUbEFzNrtmbznYkYe54RuMEjKGrxse6TTVDNlVh2GimTLUDp2VcuSPfWLTOugJAf+YPnTxs331hIPZEwmvqn+vt3uBt1ooa/2raQY8EGaWlSAtAyJ4/Eix6QvvHQTSuHI9+dI7Xac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060103; c=relaxed/simple; bh=3mOHVpZPSlr6khHYWoh7x6rEvbt/PNrJysbckSDoo48=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=GeYh0DjwRG/AYEmYov3WlvpfpOJ4i/km8NFw7ttM8SEy4J+kMCToydPfvzdxRx6d9xG9CcW/0G8dp+vcZXqBj16dEa0gkRQFrAltoatQg4Lx6APtjTlOnuG977gI0ADzlFB3oTXo5ACl5YbXOFWq29ubSwNd6udj6xg8q5rRDfk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=E/a46Rd2; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="E/a46Rd2" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3bbbc6b4ed1so3790650b6e.2 for ; Tue, 27 Feb 2024 10:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709060101; x=1709664901; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jhrzlKKOMDo8NOyYbjNpnEDFAR5niCuImP7RMdNJcrc=; b=E/a46Rd2YT7BawfNW3npeAlKc8RZHbsLz84stJmmzx5Omg6ejFkGjoeRd3fUNgi7z3 1n3e1aOAwYP0h85gKohq81cq+k1WRiWl+9d0sRnzp1+ELfsUpAJT5+T8TwEXGGEUtGr1 3BJBAgJmqGl1fKE5jPptD5AKvFmTyNxJxZZAQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060101; x=1709664901; h=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=jhrzlKKOMDo8NOyYbjNpnEDFAR5niCuImP7RMdNJcrc=; b=V12SWPjZ89cdwgy2aUvMDkPVHNPkl1vV0S3GLQchIqRLXt8Rhq4NDSasR+RYg19qCA DARYltDW185Ncy+FJ7/HgbanhOp3jyw06GXZuolQYMZ4FbllbLSpWZhvruaZI/g6olnc X21nHqg4SvdwJc4BdNgSrxonLGHzfZEJN8UhDowpLTU+fHsbrG1qmMzLs0DwMVlQcBsd xJGYoTdKSqNMpZoZNUcxr2DnF0ImXn1gFWpLMhNRPTnfJnCSzONgPgKs0GNFjI8bhOma tCedXLcrUjD8Ru9IxYM1z978VCFj/qEcNT8B8iIOPRGS81HrFwY/hwnTVKkmNxiFvwB4 DI0A== X-Gm-Message-State: AOJu0Yyftrk455E4NWbpY/ddxqxIAoZwnXui/PGcuSqVk2tBdgJivuKE BvMv7U3fFq3ZXeKrAaHg4uWzJeYhQkhqQsQjgNZm/F/BleCT2f2LCsGvV0FoPrDlvxvta4kEpOR FIzrh9j5VH7tPOrc2e9mAqqVTqoINUacDvjvA/Ilrc6BgAu6v+S27QV3wSSdOawzeTjwtUwyo0K ZLDbab+5OQiZbD6O/lWoF/QV6cNMZL5vmIrEfNHDrZ49qT X-Google-Smtp-Source: AGHT+IHPMATYkMKptpfnz2ZClr4c6cgWk3ElQ43Nj+NWnsFU1tRjB3nBG/iqLUSVkvtnZhgKxoiy2Q== X-Received: by 2002:a05:6808:23d3:b0:3c1:b51c:ddca with SMTP id bq19-20020a05680823d300b003c1b51cddcamr1319387oib.46.1709060101243; Tue, 27 Feb 2024 10:55:01 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b006e466369645sm6236898pfl.132.2024.02.27.10.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:55:00 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Justin Chen , Krzysztof Kozlowski Subject: [PATCH net-next v2 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.2 Date: Tue, 27 Feb 2024 10:54:49 -0800 Message-Id: <20240227185454.2767610-2-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227185454.2767610-1-justin.chen@broadcom.com> References: <20240227185454.2767610-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The ASP 2.2 Ethernet controller uses a brcm unimac. Signed-off-by: Justin Chen Acked-by: Krzysztof Kozlowski Acked-by: Florian Fainelli --- Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml b/Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml index 6684810fcbf0..23dfe0838dca 100644 --- a/Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml +++ b/Documentation/devicetree/bindings/net/brcm,unimac-mdio.yaml @@ -24,6 +24,7 @@ properties: - brcm,genet-mdio-v5 - brcm,asp-v2.0-mdio - brcm,asp-v2.1-mdio + - brcm,asp-v2.2-mdio - brcm,unimac-mdio reg: From patchwork Tue Feb 27 18:54:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13574316 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 C975F524CF for ; Tue, 27 Feb 2024 18:55:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060105; cv=none; b=Gsj4euzFcEWvnHxW5RTj6XKBNDW+fheaidm8VHyjshoX9zUzxJOHEQCoXWS37JyZQ7Rl7A/bigIL4t543iRqC9gsvFAbhuW7MDZCIzwCjLh0abwmo1hfUB8GxqQgltNnXHJ3G2tqQ+sQp1pjFBIl++TDXd0qbCGgshPCEFY41Jg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060105; c=relaxed/simple; bh=/PXMHUqiSb09632YB4UbZAT8r/b20EtCL6z7SHzXVEc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=jvyLo2u0dKUe6YBIHrAVnpxp1whLiZXXRfiHAo3R29brxIWYBy4yzejV61XdIpQVCPkYZ540Y/1CG1+RyQGOtbeXPH0ldjIz+eHXU0lDEM9w5AfHKu2VYXvFxHZqq0e5g4q2KuEkluILYfvd1Qbiy+o9MjbeJ/4r1LGeW4nF6iM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=ZCaoYU0k; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ZCaoYU0k" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6e55b33ad14so74545b3a.1 for ; Tue, 27 Feb 2024 10:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709060103; x=1709664903; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Okxx/dyk58h3ISKNAxo1PIymiEJvoY6qkEN1bLLVRkQ=; b=ZCaoYU0kPBkuU8pPa00tZiu2fda4w5ckukoufzuy3e3MHRTPJ30jVZl36t3EqLHTeI PqFM40Bhl4xILNQxyg2uclS81N/txGsxA4BARcvhdtwi8rW1fyxjA4fD0eOG2vL1khxa JLaTtvCMCbedy2F0FPTDQmie3QKu7JvqwPcZo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060103; x=1709664903; h=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=Okxx/dyk58h3ISKNAxo1PIymiEJvoY6qkEN1bLLVRkQ=; b=CF7mw5nR0r1g7PkIxjaN8XSEjlanmjEb3tHEa+wfz0CZk+Jcr8qR0xUrhzLk97plZi MoApTscdFfSJqNjQjzpxMrSY3v7YqBTwRCzq07H8gxIEB+08zl5XOh7ecVVGK6/j0BUb ugPLNR0W1cTw9EuIcRjAlxxTYMCUuJI8tHSpi7vCVzyjOQt6buJ7DKOBA1zTc4JElmH9 PCjKjOp8SsFKGA6Ce1DGfBnT8DCOo44Wapr+ktjYmzIgVAd+gtFQ3t+/toWRDnn7ImRF 3XD6mwHtjl+24g1P6F+prJlYryKeZ/kqQgoLwvvWpdvB21pw1sOCllm+t6XAlpPVDaZ9 Hb1w== X-Gm-Message-State: AOJu0YyTaFMF5FhjkEtauaMT9j78TKnsaz9NMDCMKRCptsTmr5b9ky2S FK55BEmT6roOrktgwrS3Gu5kCkjajoylBWCqtLmJOZGXQQBhrKjRzyH5IjkMXF5OCDa6gC9bd9L MENjwQoXWcyiwTWjHWtuz3w24LrVSkQ3k68jtrNs4lUcVsq7P3rz2p62t8sZnhsoONT2DMSgs3I k8qMFZh+Na5I0+g+f6/s4n+S8Ry32Acq9i3yGuGjmarOpq X-Google-Smtp-Source: AGHT+IEge4MCOB+YMs9Rj6w7ys1vJXWJKBCKyqEzISCjnmPzB29hHN5E5RTlb2c8dlY70oFdlMwOHQ== X-Received: by 2002:a05:6a00:1ac7:b0:6e4:fc2b:62d5 with SMTP id f7-20020a056a001ac700b006e4fc2b62d5mr9771626pfv.0.1709060102689; Tue, 27 Feb 2024 10:55:02 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b006e466369645sm6236898pfl.132.2024.02.27.10.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:55:02 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Justin Chen Subject: [PATCH net-next v2 2/6] dt-bindings: net: brcm,asp-v2.0: Add asp-v2.2 Date: Tue, 27 Feb 2024 10:54:50 -0800 Message-Id: <20240227185454.2767610-3-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227185454.2767610-1-justin.chen@broadcom.com> References: <20240227185454.2767610-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add support for ASP 2.2. Signed-off-by: Justin Chen Acked-by: Florian Fainelli Acked-by: Krzysztof Kozlowski --- v2 - Change brcm,bcm74165-asp to brcm,bcm74165b0-asp Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml index 75d8138298fb..660e2ca42daf 100644 --- a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml +++ b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml @@ -15,6 +15,10 @@ description: Broadcom Ethernet controller first introduced with 72165 properties: compatible: oneOf: + - items: + - enum: + - brcm,bcm74165b0-asp + - const: brcm,asp-v2.2 - items: - enum: - brcm,bcm74165-asp From patchwork Tue Feb 27 18:54:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13574317 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 C4DBD14900D for ; Tue, 27 Feb 2024 18:55:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060107; cv=none; b=po21pIXeasodxQUOYUxNXP5sjNYjC+m3eGkqmlu94k0SaBjTbMPK0DOzvsdQQ601x6JsLMNfqxClWnhndXDlADfGUp9FOJa4Y2jLWJ1g4k0DTNKlgptyvWdwPCU4g+WQlsqkShJQzpA8C40rrOr1puCSufTWi5eChRrem5yIxAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060107; c=relaxed/simple; bh=Wyu1jahk7MsLUsFVOim8Lvvi3dBpgFXZKaeOkwSLlo4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=lk39EugmKEdmU5U+6z/51TgNSRYZ+C3xAsu4yPDOd5/09GY4oO82l+hSWnBiLnzK5Rb4NdZipyVtrdSDWTge+OoBLyYuh59z1dekoSBMjyErIXpupfdVZGsGY2mRA8AKbn1Hl1TwGZ3a4wjRhRXqM4Tvf2PxnkQeKVNH+iAVtBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=RdT4Dg+8; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="RdT4Dg+8" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-6e544f927d4so75024b3a.0 for ; Tue, 27 Feb 2024 10:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709060105; x=1709664905; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=mu74E3AHEGh/lnH/V9BZxJ96q4iNfEcZVNuQ6CH7s1E=; b=RdT4Dg+826o5TzHeD+e1GkLFSZU0vgza1hwMhL3lLQq6ch1xchJrsZS+H0J58uOM7n fLjDj3tW1tkSdCVuH6cUs0bYRjB7fTWcMEgvWvE2FszekrpE6kDWxCF81iJv6P0eo7Qu 9IhLT2SmEvSEqQL5pvnzvQE08ylQQy/POWsMY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060105; x=1709664905; h=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=mu74E3AHEGh/lnH/V9BZxJ96q4iNfEcZVNuQ6CH7s1E=; b=ly7OwWZRALPaRw5KhZh6aqc0ddB8+ssuuFMRxQObgO7/JbEiwIfp67s+8+ZcoB2l2O fc7VZxipqb5l7CaBVu/oot1dXd2ey8wtCmrJFfyJRIk1+M9TJI3N2+uuWvQ7xWjTF/4n lryHKNGhH6EcbP8l/I564DdH+4xyCxaGTS2W6bqI0Iu7fHPfuL/w4j3AC2YHpVVADKdw y2VczdLfqmhCFezIUICoE3D0pwBHSFy0eyI5uKjLgZZVbUW3epcN9LumDFTVmjo75pLN yR3ozfawwiIZvODJb6vnWQqWIMFQ7oxQOYmQXhFl1qzu42VBbptbN5bU7zWs9wpN9p8l QOtg== X-Gm-Message-State: AOJu0YwCzHkBFXE/aLi8pw2Odjwqd1hmquWkv+FN4EyLVDilEvRKi9d+ o7+a7K6qkYDd3efl2YdneSsRNTB1Tet22Uamqep9CKYgt+7Vv0fIEckU02C6qJgF3/vDMt26/x4 v9Hmed9GidTjTxtDrJ/J6AUHCz/VKHpL7Now/dBUfMzDdMeFK06OnAUvRFLzLVJqkC1I8J7kfOL nkUGlJP6PSK1frtlTl0mVC4afypii5jSj1/otHaotN+H/J X-Google-Smtp-Source: AGHT+IECA4u6r1pmMJSDEwUWdbkT6+U9EgtuRrYW3spLINI8CMPYH3dzna9WMwoEGTXpNceGY+r3KA== X-Received: by 2002:a05:6a00:2d21:b0:6e4:c102:8065 with SMTP id fa33-20020a056a002d2100b006e4c1028065mr305423pfb.5.1709060104410; Tue, 27 Feb 2024 10:55:04 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b006e466369645sm6236898pfl.132.2024.02.27.10.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:55:03 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Justin Chen Subject: [PATCH net-next v2 3/6] net: bcmasp: Add support for ASP 2.2 Date: Tue, 27 Feb 2024 10:54:51 -0800 Message-Id: <20240227185454.2767610-4-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227185454.2767610-1-justin.chen@broadcom.com> References: <20240227185454.2767610-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org ASP 2.2 improves power savings during low power modes. A new register was added to toggle to a slower clock during low power modes. EEE was broken for ASP 2.0/2.1. A HW workaround was added for ASP 2.2 that requires toggling a chicken bit. Signed-off-by: Justin Chen Acked-by: Florian Fainelli --- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 73 +++++++++++++++++-- drivers/net/ethernet/broadcom/asp2/bcmasp.h | 18 ++++- .../net/ethernet/broadcom/asp2/bcmasp_intf.c | 6 ++ 3 files changed, 87 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c index 80245c65cc90..100c69f3307a 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c @@ -972,7 +972,26 @@ static void bcmasp_core_init(struct bcmasp_priv *priv) ASP_INTR2_CLEAR); } -static void bcmasp_core_clock_select(struct bcmasp_priv *priv, bool slow) +static void bcmasp_core_clock_select_many(struct bcmasp_priv *priv, bool slow) +{ + u32 reg; + + reg = ctrl2_core_rl(priv, ASP_CTRL2_CORE_CLOCK_SELECT); + if (slow) + reg &= ~ASP_CTRL2_CORE_CLOCK_SELECT_MAIN; + else + reg |= ASP_CTRL2_CORE_CLOCK_SELECT_MAIN; + ctrl2_core_wl(priv, reg, ASP_CTRL2_CORE_CLOCK_SELECT); + + reg = ctrl2_core_rl(priv, ASP_CTRL2_CPU_CLOCK_SELECT); + if (slow) + reg &= ~ASP_CTRL2_CPU_CLOCK_SELECT_MAIN; + else + reg |= ASP_CTRL2_CPU_CLOCK_SELECT_MAIN; + ctrl2_core_wl(priv, reg, ASP_CTRL2_CPU_CLOCK_SELECT); +} + +static void bcmasp_core_clock_select_one(struct bcmasp_priv *priv, bool slow) { u32 reg; @@ -1166,6 +1185,24 @@ static void bcmasp_wol_irq_destroy_per_intf(struct bcmasp_priv *priv) } } +static void bcmasp_eee_fixup(struct bcmasp_intf *intf, bool en) +{ + u32 reg, phy_lpi_overwrite; + + reg = rx_edpkt_core_rl(intf->parent, ASP_EDPKT_SPARE_REG); + phy_lpi_overwrite = intf->internal_phy ? ASP_EDPKT_SPARE_REG_EPHY_LPI : + ASP_EDPKT_SPARE_REG_GPHY_LPI; + + if (en) + reg |= phy_lpi_overwrite; + else + reg &= ~phy_lpi_overwrite; + + rx_edpkt_core_wl(intf->parent, reg, ASP_EDPKT_SPARE_REG); + + usleep_range(50, 100); +} + static struct bcmasp_hw_info v20_hw_info = { .rx_ctrl_flush = ASP_RX_CTRL_FLUSH, .umac2fb = UMAC2FB_OFFSET, @@ -1178,6 +1215,7 @@ static const struct bcmasp_plat_data v20_plat_data = { .init_wol = bcmasp_init_wol_per_intf, .enable_wol = bcmasp_enable_wol_per_intf, .destroy_wol = bcmasp_wol_irq_destroy_per_intf, + .core_clock_select = bcmasp_core_clock_select_one, .hw_info = &v20_hw_info, }; @@ -1194,17 +1232,39 @@ static const struct bcmasp_plat_data v21_plat_data = { .init_wol = bcmasp_init_wol_shared, .enable_wol = bcmasp_enable_wol_shared, .destroy_wol = bcmasp_wol_irq_destroy_shared, + .core_clock_select = bcmasp_core_clock_select_one, .hw_info = &v21_hw_info, }; +static const struct bcmasp_plat_data v22_plat_data = { + .init_wol = bcmasp_init_wol_shared, + .enable_wol = bcmasp_enable_wol_shared, + .destroy_wol = bcmasp_wol_irq_destroy_shared, + .core_clock_select = bcmasp_core_clock_select_many, + .hw_info = &v21_hw_info, + .eee_fixup = bcmasp_eee_fixup, +}; + +static void bcmasp_set_pdata(struct bcmasp_priv *priv, const struct bcmasp_plat_data *pdata) +{ + priv->init_wol = pdata->init_wol; + priv->enable_wol = pdata->enable_wol; + priv->destroy_wol = pdata->destroy_wol; + priv->core_clock_select = pdata->core_clock_select; + priv->eee_fixup = pdata->eee_fixup; + priv->hw_info = pdata->hw_info; +} + static const struct of_device_id bcmasp_of_match[] = { { .compatible = "brcm,asp-v2.0", .data = &v20_plat_data }, { .compatible = "brcm,asp-v2.1", .data = &v21_plat_data }, + { .compatible = "brcm,asp-v2.2", .data = &v22_plat_data }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, bcmasp_of_match); static const struct of_device_id bcmasp_mdio_of_match[] = { + { .compatible = "brcm,asp-v2.2-mdio", }, { .compatible = "brcm,asp-v2.1-mdio", }, { .compatible = "brcm,asp-v2.0-mdio", }, { /* sentinel */ }, @@ -1265,16 +1325,13 @@ static int bcmasp_probe(struct platform_device *pdev) if (!pdata) return dev_err_probe(dev, -EINVAL, "unable to find platform data\n"); - priv->init_wol = pdata->init_wol; - priv->enable_wol = pdata->enable_wol; - priv->destroy_wol = pdata->destroy_wol; - priv->hw_info = pdata->hw_info; + bcmasp_set_pdata(priv, pdata); /* Enable all clocks to ensure successful probing */ bcmasp_core_clock_set(priv, ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE, 0); /* Switch to the main clock */ - bcmasp_core_clock_select(priv, false); + priv->core_clock_select(priv, false); bcmasp_intr2_mask_set_all(priv); bcmasp_intr2_clear_all(priv); @@ -1381,7 +1438,7 @@ static int __maybe_unused bcmasp_suspend(struct device *d) */ bcmasp_core_clock_set(priv, 0, ASP_CTRL_CLOCK_CTRL_ASP_TX_DISABLE); - bcmasp_core_clock_select(priv, true); + priv->core_clock_select(priv, true); clk_disable_unprepare(priv->clk); @@ -1399,7 +1456,7 @@ static int __maybe_unused bcmasp_resume(struct device *d) return ret; /* Switch to the main clock domain */ - bcmasp_core_clock_select(priv, false); + priv->core_clock_select(priv, false); /* Re-enable all clocks for re-initialization */ bcmasp_core_clock_set(priv, ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE, 0); diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h index 312bf9b6576e..61598dc070b1 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h @@ -33,6 +33,12 @@ #define ASP_WAKEUP_INTR2_FILT_1 BIT(3) #define ASP_WAKEUP_INTR2_FW BIT(4) +#define ASP_CTRL2_OFFSET 0x2000 +#define ASP_CTRL2_CORE_CLOCK_SELECT 0x0 +#define ASP_CTRL2_CORE_CLOCK_SELECT_MAIN BIT(0) +#define ASP_CTRL2_CPU_CLOCK_SELECT 0x4 +#define ASP_CTRL2_CPU_CLOCK_SELECT_MAIN BIT(0) + #define ASP_TX_ANALYTICS_OFFSET 0x4c000 #define ASP_TX_ANALYTICS_CTRL 0x0 @@ -134,8 +140,11 @@ enum asp_rx_net_filter_block { #define ASP_EDPKT_RX_PKT_CNT 0x138 #define ASP_EDPKT_HDR_EXTR_CNT 0x13c #define ASP_EDPKT_HDR_OUT_CNT 0x140 +#define ASP_EDPKT_SPARE_REG 0x174 +#define ASP_EDPKT_SPARE_REG_EPHY_LPI BIT(4) +#define ASP_EDPKT_SPARE_REG_GPHY_LPI BIT(3) -#define ASP_CTRL 0x101000 +#define ASP_CTRL_OFFSET 0x101000 #define ASP_CTRL_ASP_SW_INIT 0x04 #define ASP_CTRL_ASP_SW_INIT_ACPUSS_CORE BIT(0) #define ASP_CTRL_ASP_SW_INIT_ASP_TX BIT(1) @@ -372,6 +381,8 @@ struct bcmasp_plat_data { void (*init_wol)(struct bcmasp_priv *priv); void (*enable_wol)(struct bcmasp_intf *intf, bool en); void (*destroy_wol)(struct bcmasp_priv *priv); + void (*core_clock_select)(struct bcmasp_priv *priv, bool slow); + void (*eee_fixup)(struct bcmasp_intf *priv, bool en); struct bcmasp_hw_info *hw_info; }; @@ -390,6 +401,8 @@ struct bcmasp_priv { void (*init_wol)(struct bcmasp_priv *priv); void (*enable_wol)(struct bcmasp_intf *intf, bool en); void (*destroy_wol)(struct bcmasp_priv *priv); + void (*core_clock_select)(struct bcmasp_priv *priv, bool slow); + void (*eee_fixup)(struct bcmasp_intf *intf, bool en); void __iomem *base; struct bcmasp_hw_info *hw_info; @@ -530,7 +543,8 @@ BCMASP_CORE_IO_MACRO(rx_analytics, ASP_RX_ANALYTICS_OFFSET); BCMASP_CORE_IO_MACRO(rx_ctrl, ASP_RX_CTRL_OFFSET); BCMASP_CORE_IO_MACRO(rx_filter, ASP_RX_FILTER_OFFSET); BCMASP_CORE_IO_MACRO(rx_edpkt, ASP_EDPKT_OFFSET); -BCMASP_CORE_IO_MACRO(ctrl, ASP_CTRL); +BCMASP_CORE_IO_MACRO(ctrl, ASP_CTRL_OFFSET); +BCMASP_CORE_IO_MACRO(ctrl2, ASP_CTRL2_OFFSET); struct bcmasp_intf *bcmasp_interface_create(struct bcmasp_priv *priv, struct device_node *ndev_dn, int i); diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c index e429876c7291..36e6fae937ea 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c @@ -1333,6 +1333,9 @@ static void bcmasp_suspend_to_wol(struct bcmasp_intf *intf) ASP_WAKEUP_INTR2_MASK_CLEAR); } + if (intf->eee.eee_enabled && intf->parent->eee_fixup) + intf->parent->eee_fixup(intf, true); + netif_dbg(intf, wol, ndev, "entered WOL mode\n"); } @@ -1381,6 +1384,9 @@ static void bcmasp_resume_from_wol(struct bcmasp_intf *intf) { u32 reg; + if (intf->eee.eee_enabled && intf->parent->eee_fixup) + intf->parent->eee_fixup(intf, false); + reg = umac_rl(intf, UMC_MPD_CTRL); reg &= ~UMC_MPD_CTRL_MPD_EN; umac_wl(intf, reg, UMC_MPD_CTRL); From patchwork Tue Feb 27 18:54:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13574318 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (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 EDFE414A086 for ; Tue, 27 Feb 2024 18:55:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060109; cv=none; b=TxmbGFB0kUPJA8gqR2NUtPLiERx75RQxkGXSfIafF0qUOgaaP3DFuwc1f040ncoe2zFbJrkbZu/r5dvNaLvyPG7OORWd3LtvkGDdXmjWFbEywIcvAEYDf6Y5c5pLkTJlE3EDV779J3leAWPlg5CiYrCipxCISiNQNfDlj/YiSVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060109; c=relaxed/simple; bh=RPNvbU5ToUJJd7o+1anBEfHzdFmpOP0plOiwCHrsv2g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=G/Ws0JZkP31EATDWTnGrWLAevKGVTynVWVwShktgRe8xEl9AirB/EDfFW0GVRvPfxuX7C4MjBvdYrDCLUMsN3GOD5/VOEPna8ZPZ0xBJCd2MMTfSJlbEU9PkOlTGdM7ug6anJrxyc45Df10CgvKNvfal+VQcbOAIyT2G2UDwtQk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=C2h4mQaq; arc=none smtp.client-ip=209.85.210.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="C2h4mQaq" Received: by mail-ot1-f49.google.com with SMTP id 46e09a7af769-6dc8b280155so3338939a34.0 for ; Tue, 27 Feb 2024 10:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709060107; x=1709664907; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=aNMC1BCh4qM1tlyl4hi2wK0/IkR9CJQr9C5n5LVM23I=; b=C2h4mQaqHDmgvMl/eGLGuD9h7lyvI5k6xR0jawpgiF1W8amPinXdoDi+vRxSstRuXh Y/K0hseBdFSbvLptNCGwo0Rcu3XghRq3SUCMmdUHibCztNMir0RSW0a+SrdXWjjPgBIb m5+s060Jkmm00lsaBYJfj2H7Ql0iRoEJxhI5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060107; x=1709664907; h=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=aNMC1BCh4qM1tlyl4hi2wK0/IkR9CJQr9C5n5LVM23I=; b=M48UNBYx06ShPoCE7+6ffige7pG1ltDTHlsIeVVbU93j/oYkUGGbPDoUbDa0/FHtYq 5e6bW/b8pYC56Lvki+4aaT6xiu5hgxS8f1F2lLJjx+EgJTlyTLtLK24oRauIOqcFNBLL egP3e4Jmz4m+YGn6JKQe2dmM+54LQ5zXqOIMemzt3AjCvprFfiW/Hz2Q0RhcwEGfTYno byW3C9VXoGs0ikTaDNEIEwk3/VDvgh5SYy/JfbIt+376iHFn/wrAIbG0XVwS6SzB05Ay kEv8vNrpAmCw+63CRAQpn5oeEq1t4VwXNtjIG0e+9BGpfFoXiv2dx5MlbkVNuruUIzvv zyDA== X-Gm-Message-State: AOJu0YyGuMk9BpuQoD3K1sQtc+Me5mUOb+6Rr1IkCIcrJpK9sJpePOvJ edhoB2waUawnvtLC0x+RCu/CSYy2D89iwCALbmmGX158d3+rP9p5eoDrmbK77T/e5EYsavlqVr9 zn9Rn3aNM84Dss9EnnyggQg29KUCVukbHyVPsH5rNnaPt/evLZwpu6uc070YtdzLII8yBK7xOqN S9K6+fLRPlvt17PNc91/qCuOgwjgJFLmhHnvk6/Q5rP/3T X-Google-Smtp-Source: AGHT+IGIyWNtEy+jOiVtH4B/95rEO+0oWON7vIgRwxQgQ4vzkFSxfZodbTXeTufQybvj+WWjghC1Kw== X-Received: by 2002:a9d:7dd6:0:b0:6e4:253f:c551 with SMTP id k22-20020a9d7dd6000000b006e4253fc551mr9813304otn.29.1709060106765; Tue, 27 Feb 2024 10:55:06 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b006e466369645sm6236898pfl.132.2024.02.27.10.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:55:05 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Justin Chen Subject: [PATCH net-next v2 4/6] net: phy: mdio-bcm-unimac: Add asp v2.2 support Date: Tue, 27 Feb 2024 10:54:52 -0800 Message-Id: <20240227185454.2767610-5-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227185454.2767610-1-justin.chen@broadcom.com> References: <20240227185454.2767610-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add mdio compat string for ASP 2.0 ethernet driver. Signed-off-by: Justin Chen Acked-by: Florian Fainelli --- drivers/net/mdio/mdio-bcm-unimac.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c index 6fe08427fdd4..f40eb50bb978 100644 --- a/drivers/net/mdio/mdio-bcm-unimac.c +++ b/drivers/net/mdio/mdio-bcm-unimac.c @@ -334,6 +334,7 @@ static SIMPLE_DEV_PM_OPS(unimac_mdio_pm_ops, NULL, unimac_mdio_resume); static const struct of_device_id unimac_mdio_ids[] = { + { .compatible = "brcm,asp-v2.2-mdio", }, { .compatible = "brcm,asp-v2.1-mdio", }, { .compatible = "brcm,asp-v2.0-mdio", }, { .compatible = "brcm,genet-mdio-v5", }, From patchwork Tue Feb 27 18:54:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13574319 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 87C2814AD04 for ; Tue, 27 Feb 2024 18:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060111; cv=none; b=GtuP84+lRx/yAXHjaWx4iOXFCjLkeIVDYvQe3NpUIZ9tSQF6/fcHI5HT6cYd/py9T/PDNWS/g8vv/xDzV0PIsferlLWyLbGkgvwx3m8lvGq2bC1FS2v8VXIHBzTeI5m6Rwd7+XyQl7JCmXMXWQ4AvrWl08+7tlGqH2s0dFlf9Ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060111; c=relaxed/simple; bh=ToD0SmBWUrk7DVTpDD1+wlNk8RiKK71OqmhkfqYpRKM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=p5+ZEMzSo0mOGaE0kagNP69wwAneKB2H8eJGJVObWvGr5S1X9ga/l5Jb+tYS+Z+UBTgy6YM1OFyRFyw5CyJTgpD3COTNpte6E3c4xGSwOV4J14OF/c340X4Y8wLEokM+uDWll9lj+PoTVrawItFJPHKmjywPmkzo4uX0m8nBzDo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=diJ54Yrw; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="diJ54Yrw" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e544f927d4so75082b3a.0 for ; Tue, 27 Feb 2024 10:55:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709060109; x=1709664909; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=6/81acXTLD3okeoxdhRaZaWmVZzxskxx/NHE1ckLvTs=; b=diJ54YrwgiMK07fS3GTvcmUAZBm+RRgtoZ4DGSHUpQS+UEheDJVaUGF4rcxZkPCb2d scKZsbQsKcDR+hfMJoSUtAo5v8HqplhoJ127aVrvyVznWmihFL6FMlCSyAMgXYcSJNUY s+ZH10fPoytaRSqueKBuSznhTBxNMm8wSy6K0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060109; x=1709664909; h=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=6/81acXTLD3okeoxdhRaZaWmVZzxskxx/NHE1ckLvTs=; b=MtJ8RPU9zu+1u2oR9iPu4KYI/+utvqa+nELVUUPLxnjNs7h4UnEm4rJTRlhUIrRGa1 VnYLcnTO36k3BaeMklej1iChFd7PSAA8pQ/EMzsWP9Zb1tUqg40eur/DBThAsNH5RYhT +WxNY6WF2+DKyEg8M+exR2EINh6vqncq0izKqb2FQwGzcvcIYLn1AdmUEw6jE1tRKNlE JgAZwUU/OF6UFQVU++MYuW5E4l5y39nADthpJWu+SGxLESlGRKPWLjXPTLmDaLeSe0lA l5GaDSEixxv6LbJU8hh/QV09wQak342u/aZTR5YWvRpjUd3F9MB1/5HVLBzdfsjX1Vz+ X6fQ== X-Gm-Message-State: AOJu0YyvmG2EcZJdVv63wULEIV+j/lvHli668GEt3fKSiht9xFvLmto2 swxcIg2n6n1eb3CNoeD+Wq/nZI95CLHgRmWFNodbbXbJykca2rmxZ8e5sNdVUGiavS6rsDOSQ6a Ul97B/ZAy0MDaleTh+2i2Pbx1Akzbic9/NHL0ydXlB/gTWJ0Y+oSla8POk1me20iNMB4/vYEL4i o8Vq7kYnMCluztcsLCNtKGk11duFl31VV36Ppqx0mVw4DM X-Google-Smtp-Source: AGHT+IHFml8YC5w8sVYrpw7xt2tiOtfMLaUqB/iEG7thNNsuKn7QKwHLK2kCXWJEif9XHpxMW6qMPg== X-Received: by 2002:a05:6a00:4f0a:b0:6e5:bb8:dc19 with SMTP id lb10-20020a056a004f0a00b006e50bb8dc19mr196805pfb.15.1709060108348; Tue, 27 Feb 2024 10:55:08 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b006e466369645sm6236898pfl.132.2024.02.27.10.55.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:55:07 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Justin Chen Subject: [PATCH net-next v2 5/6] net: bcmasp: Keep buffers through power management Date: Tue, 27 Feb 2024 10:54:53 -0800 Message-Id: <20240227185454.2767610-6-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227185454.2767610-1-justin.chen@broadcom.com> References: <20240227185454.2767610-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org There is no advantage of freeing and re-allocating buffers through suspend and resume. This waste cycles and makes suspend/resume time longer. We also open ourselves to failed allocations in systems with heavy memory fragmentation. Signed-off-by: Justin Chen Acked-by: Florian Fainelli --- drivers/net/ethernet/broadcom/asp2/bcmasp.h | 1 + .../net/ethernet/broadcom/asp2/bcmasp_intf.c | 181 ++++++++---------- 2 files changed, 76 insertions(+), 106 deletions(-) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h index 61598dc070b1..127a5340625e 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h @@ -315,6 +315,7 @@ struct bcmasp_intf { struct bcmasp_desc *rx_edpkt_cpu; dma_addr_t rx_edpkt_dma_addr; dma_addr_t rx_edpkt_dma_read; + dma_addr_t rx_edpkt_dma_valid; /* RX buffer prefetcher ring*/ void *rx_ring_cpu; diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c index 36e6fae937ea..0b378a6d43e7 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c @@ -674,40 +674,78 @@ static void bcmasp_adj_link(struct net_device *dev) phy_print_status(phydev); } -static int bcmasp_init_rx(struct bcmasp_intf *intf) +static int bcmasp_alloc_buffers(struct bcmasp_intf *intf) { struct device *kdev = &intf->parent->pdev->dev; struct page *buffer_pg; - dma_addr_t dma; - void *p; - u32 reg; - int ret; + /* Alloc RX */ intf->rx_buf_order = get_order(RING_BUFFER_SIZE); buffer_pg = alloc_pages(GFP_KERNEL, intf->rx_buf_order); if (!buffer_pg) return -ENOMEM; - dma = dma_map_page(kdev, buffer_pg, 0, RING_BUFFER_SIZE, - DMA_FROM_DEVICE); - if (dma_mapping_error(kdev, dma)) { - __free_pages(buffer_pg, intf->rx_buf_order); - return -ENOMEM; - } intf->rx_ring_cpu = page_to_virt(buffer_pg); - intf->rx_ring_dma = dma; - intf->rx_ring_dma_valid = intf->rx_ring_dma + RING_BUFFER_SIZE - 1; + intf->rx_ring_dma = dma_map_page(kdev, buffer_pg, 0, RING_BUFFER_SIZE, + DMA_FROM_DEVICE); + if (dma_mapping_error(kdev, intf->rx_ring_dma)) + goto free_rx_buffer; + + intf->rx_edpkt_cpu = dma_alloc_coherent(kdev, DESC_RING_SIZE, + &intf->rx_edpkt_dma_addr, GFP_KERNEL); + if (!intf->rx_edpkt_cpu) + goto free_rx_buffer_dma; + + /* Alloc TX */ + intf->tx_spb_cpu = dma_alloc_coherent(kdev, DESC_RING_SIZE, + &intf->tx_spb_dma_addr, GFP_KERNEL); + if (!intf->tx_spb_cpu) + goto free_rx_edpkt_dma; - p = dma_alloc_coherent(kdev, DESC_RING_SIZE, &intf->rx_edpkt_dma_addr, + intf->tx_cbs = kcalloc(DESC_RING_COUNT, sizeof(struct bcmasp_tx_cb), GFP_KERNEL); - if (!p) { - ret = -ENOMEM; - goto free_rx_ring; - } - intf->rx_edpkt_cpu = p; + if (!intf->tx_cbs) + goto free_tx_spb_dma; - netif_napi_add(intf->ndev, &intf->rx_napi, bcmasp_rx_poll); + return 0; + +free_tx_spb_dma: + dma_free_coherent(kdev, DESC_RING_SIZE, intf->tx_spb_cpu, + intf->tx_spb_dma_addr); +free_rx_edpkt_dma: + dma_free_coherent(kdev, DESC_RING_SIZE, intf->rx_edpkt_cpu, + intf->rx_edpkt_dma_addr); +free_rx_buffer_dma: + dma_unmap_page(kdev, intf->rx_ring_dma, RING_BUFFER_SIZE, + DMA_FROM_DEVICE); +free_rx_buffer: + __free_pages(buffer_pg, intf->rx_buf_order); + + return -ENOMEM; +} + +static void bcmasp_reclaim_free_buffers(struct bcmasp_intf *intf) +{ + struct device *kdev = &intf->parent->pdev->dev; + + /* RX buffers */ + dma_free_coherent(kdev, DESC_RING_SIZE, intf->rx_edpkt_cpu, + intf->rx_edpkt_dma_addr); + dma_unmap_page(kdev, intf->rx_ring_dma, RING_BUFFER_SIZE, + DMA_FROM_DEVICE); + __free_pages(virt_to_page(intf->rx_ring_cpu), intf->rx_buf_order); + + /* TX buffers */ + dma_free_coherent(kdev, DESC_RING_SIZE, intf->tx_spb_cpu, + intf->tx_spb_dma_addr); + kfree(intf->tx_cbs); +} +static void bcmasp_init_rx(struct bcmasp_intf *intf) +{ + /* Restart from index 0 */ + intf->rx_ring_dma_valid = intf->rx_ring_dma + RING_BUFFER_SIZE - 1; + intf->rx_edpkt_dma_valid = intf->rx_edpkt_dma_addr + (DESC_RING_SIZE - 1); intf->rx_edpkt_dma_read = intf->rx_edpkt_dma_addr; intf->rx_edpkt_index = 0; @@ -733,64 +771,23 @@ static int bcmasp_init_rx(struct bcmasp_intf *intf) rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_addr, RX_EDPKT_DMA_WRITE); rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_addr, RX_EDPKT_DMA_READ); rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_addr, RX_EDPKT_DMA_BASE); - rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_addr + (DESC_RING_SIZE - 1), - RX_EDPKT_DMA_END); - rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_addr + (DESC_RING_SIZE - 1), - RX_EDPKT_DMA_VALID); - - reg = UMAC2FB_CFG_DEFAULT_EN | - ((intf->channel + 11) << UMAC2FB_CFG_CHID_SHIFT); - reg |= (0xd << UMAC2FB_CFG_OK_SEND_SHIFT); - umac2fb_wl(intf, reg, UMAC2FB_CFG); + rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_valid, RX_EDPKT_DMA_END); + rx_edpkt_dma_wq(intf, intf->rx_edpkt_dma_valid, RX_EDPKT_DMA_VALID); - return 0; - -free_rx_ring: - dma_unmap_page(kdev, intf->rx_ring_dma, RING_BUFFER_SIZE, - DMA_FROM_DEVICE); - __free_pages(virt_to_page(intf->rx_ring_cpu), intf->rx_buf_order); - - return ret; + umac2fb_wl(intf, UMAC2FB_CFG_DEFAULT_EN | ((intf->channel + 11) << + UMAC2FB_CFG_CHID_SHIFT) | (0xd << UMAC2FB_CFG_OK_SEND_SHIFT), + UMAC2FB_CFG); } -static void bcmasp_reclaim_free_all_rx(struct bcmasp_intf *intf) -{ - struct device *kdev = &intf->parent->pdev->dev; - - dma_free_coherent(kdev, DESC_RING_SIZE, intf->rx_edpkt_cpu, - intf->rx_edpkt_dma_addr); - dma_unmap_page(kdev, intf->rx_ring_dma, RING_BUFFER_SIZE, - DMA_FROM_DEVICE); - __free_pages(virt_to_page(intf->rx_ring_cpu), intf->rx_buf_order); -} -static int bcmasp_init_tx(struct bcmasp_intf *intf) +static void bcmasp_init_tx(struct bcmasp_intf *intf) { - struct device *kdev = &intf->parent->pdev->dev; - void *p; - int ret; - - p = dma_alloc_coherent(kdev, DESC_RING_SIZE, &intf->tx_spb_dma_addr, - GFP_KERNEL); - if (!p) - return -ENOMEM; - - intf->tx_spb_cpu = p; + /* Restart from index 0 */ intf->tx_spb_dma_valid = intf->tx_spb_dma_addr + DESC_RING_SIZE - 1; intf->tx_spb_dma_read = intf->tx_spb_dma_addr; - - intf->tx_cbs = kcalloc(DESC_RING_COUNT, sizeof(struct bcmasp_tx_cb), - GFP_KERNEL); - if (!intf->tx_cbs) { - ret = -ENOMEM; - goto free_tx_spb; - } - intf->tx_spb_index = 0; intf->tx_spb_clean_index = 0; - netif_napi_add_tx(intf->ndev, &intf->tx_napi, bcmasp_tx_poll); - /* Make sure channels are disabled */ tx_spb_ctrl_wl(intf, 0x0, TX_SPB_CTRL_ENABLE); tx_epkt_core_wl(intf, 0x0, TX_EPKT_C_CFG_MISC); @@ -806,26 +803,6 @@ static int bcmasp_init_tx(struct bcmasp_intf *intf) tx_spb_dma_wq(intf, intf->tx_spb_dma_addr, TX_SPB_DMA_BASE); tx_spb_dma_wq(intf, intf->tx_spb_dma_valid, TX_SPB_DMA_END); tx_spb_dma_wq(intf, intf->tx_spb_dma_valid, TX_SPB_DMA_VALID); - - return 0; - -free_tx_spb: - dma_free_coherent(kdev, DESC_RING_SIZE, intf->tx_spb_cpu, - intf->tx_spb_dma_addr); - - return ret; -} - -static void bcmasp_reclaim_free_all_tx(struct bcmasp_intf *intf) -{ - struct device *kdev = &intf->parent->pdev->dev; - - /* Free descriptors */ - dma_free_coherent(kdev, DESC_RING_SIZE, intf->tx_spb_cpu, - intf->tx_spb_dma_addr); - - /* Free cbs */ - kfree(intf->tx_cbs); } static void bcmasp_ephy_enable_set(struct bcmasp_intf *intf, bool enable) @@ -915,10 +892,7 @@ static void bcmasp_netif_deinit(struct net_device *dev) bcmasp_enable_rx_irq(intf, 0); netif_napi_del(&intf->tx_napi); - bcmasp_reclaim_free_all_tx(intf); - netif_napi_del(&intf->rx_napi); - bcmasp_reclaim_free_all_rx(intf); } static int bcmasp_stop(struct net_device *dev) @@ -932,6 +906,8 @@ static int bcmasp_stop(struct net_device *dev) bcmasp_netif_deinit(dev); + bcmasp_reclaim_free_buffers(intf); + phy_disconnect(dev->phydev); /* Disable internal EPHY or external PHY */ @@ -1073,17 +1049,12 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) intf->old_link = -1; intf->old_pause = -1; - ret = bcmasp_init_tx(intf); - if (ret) - goto err_phy_disconnect; - - /* Turn on asp */ + bcmasp_init_tx(intf); + netif_napi_add_tx(intf->ndev, &intf->tx_napi, bcmasp_tx_poll); bcmasp_enable_tx(intf, 1); - ret = bcmasp_init_rx(intf); - if (ret) - goto err_reclaim_tx; - + bcmasp_init_rx(intf); + netif_napi_add(intf->ndev, &intf->rx_napi, bcmasp_rx_poll); bcmasp_enable_rx(intf, 1); /* Turn on UniMAC TX/RX */ @@ -1097,12 +1068,6 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) return 0; -err_reclaim_tx: - netif_napi_del(&intf->tx_napi); - bcmasp_reclaim_free_all_tx(intf); -err_phy_disconnect: - if (phydev) - phy_disconnect(phydev); err_phy_disable: if (intf->internal_phy) bcmasp_ephy_enable_set(intf, false); @@ -1118,6 +1083,10 @@ static int bcmasp_open(struct net_device *dev) netif_dbg(intf, ifup, dev, "bcmasp open\n"); + ret = bcmasp_alloc_buffers(intf); + if (ret) + return ret; + ret = clk_prepare_enable(intf->parent->clk); if (ret) return ret; From patchwork Tue Feb 27 18:54:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13574320 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 D80F814A086 for ; Tue, 27 Feb 2024 18:55:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060112; cv=none; b=Pf2tHls5EsoVprT9kVEY8+kzj97qZ3P2cam8i2jXU6xaHzwYEfFF2FTWwstJkTm98vMs0+QsirRDADjQP9oNyCSloYpH9u+p2ptEkgxYn47V/VpjR9UQYsznj/DgSAh0pQFmyZ1ecO9xZdDnUhMoXag6cgw38G8rbyngA4Tfchk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709060112; c=relaxed/simple; bh=CSsygOuFaYPkRvAPlVtAXAWX78lycA/mwJCyHzTH1jQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=lT0MjIJzY3IWxLMfyq6J1HTxYP0ET5VMv02HFuE4V/inUa7HYAD0JDnMOHC9oDhtR/TVx+MO1bjSWwXIS3o2jit1AfrnQlGPadDsxaZkuf6O4B7OESCYggBf1MY9yh1f0z5SuHN0+zjRvXT8V1zxgkTf60V6JmP7IjgETWeDnPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=iGI9i6/8; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="iGI9i6/8" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6e46dcd8feaso1650407b3a.2 for ; Tue, 27 Feb 2024 10:55:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709060110; x=1709664910; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=6G2cb+b7ZxTdec35kwMlk2lZ/+wp3B97BS0yDDfoehE=; b=iGI9i6/8Q6u9rSuVyje8VcLQ7tW4SrqGEh7msuHr8/+Ai9lQJHVgj5wj+K8x1dJnOv chAAzO/Dsh9G6pfU/OYcO/U50ssrIDkbnq23zqJasfsjyTy7Nofb8R+SOH4niurF+BSv 8U5VRklfxOmbR7MKeJsPKjUrfKGdgCtFUy3lo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709060110; x=1709664910; h=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=6G2cb+b7ZxTdec35kwMlk2lZ/+wp3B97BS0yDDfoehE=; b=gb3HyVI3ZCjCQfu/wGEPgWTk7qE3sQtP3/oBQcF87GWQKKNXj8tLmsYEePrOb7y89B 0D2GPFcJgmool5CqwgZYsUnjpMfowXyUw3Lu3Wvzrnxqq3X/yR1ltpdLRINfZzxI70Zi OyXY03jg7XIZ/I3CR5AVEYv2XD3JvdM29ydmkvsvMrWjgEK/JBFEAtX7qASZjNxk9IV7 SW4/Jz8UuoRMaQUfyU8ORezAYWfhKaBaeR/lGaWNTshBhRi0H4/iFG18ypchsgIVk2x0 zmSAS2AgHy7TJMlyCc6MemUqr3S95lLVw+kYDMfdXCPONElY2j/izfUX2FPG3eX9rPv/ SNkw== X-Gm-Message-State: AOJu0YzDzUd1e4/HTc9iGyaBV53K/Kw2oXNi5MfkwzSvmYM14o4/D/nh VbiRZOR9HtmM9vXD7Wg4FFpty5Dd3Z8DDRJ6wolIZ/cRNxpMce8QhfJu0uagaDp/O73lkv00e3h Inis43CutAyMf2vfgKvL3/xyDG4wTODdJE1oaS1jAdNrG8YdHMMl6CL1EYEwt8yRk8lzEUEQ0Q9 dRpvz2sk5D1ro9Ie1usBFjvKc3C4lS18YWAfQfb2FzaihK X-Google-Smtp-Source: AGHT+IG6+amgoqxQKHjGq6XjXVCP0fU7/gBclv8pHu2hAOCpHmPldwnoy9Bh81RxGTjV8HVEVg9JGQ== X-Received: by 2002:a05:6a00:6c99:b0:6e5:54b5:f16c with SMTP id jc25-20020a056a006c9900b006e554b5f16cmr1952800pfb.0.1709060109803; Tue, 27 Feb 2024 10:55:09 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b006e466369645sm6236898pfl.132.2024.02.27.10.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:55:09 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: florian.fainelli@broadcom.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Justin Chen Subject: [PATCH net-next v2 6/6] net: bcmasp: Add support for PHY interrupts Date: Tue, 27 Feb 2024 10:54:54 -0800 Message-Id: <20240227185454.2767610-7-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227185454.2767610-1-justin.chen@broadcom.com> References: <20240227185454.2767610-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Hook up the phy interrupts for internal phys to reduce mdio traffic and improve responsiveness of link changes. Signed-off-by: Justin Chen Acked-by: Florian Fainelli --- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 17 +++++++++++++++++ drivers/net/ethernet/broadcom/asp2/bcmasp.h | 4 ++++ .../net/ethernet/broadcom/asp2/bcmasp_intf.c | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c index 100c69f3307a..a806dadc4196 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c @@ -31,6 +31,20 @@ static void _intr2_mask_set(struct bcmasp_priv *priv, u32 mask) priv->irq_mask |= mask; } +void bcmasp_enable_phy_irq(struct bcmasp_intf *intf, int en) +{ + struct bcmasp_priv *priv = intf->parent; + + /* Only supported with internal phys */ + if (!intf->internal_phy) + return; + + if (en) + _intr2_mask_clear(priv, ASP_INTR2_PHY_EVENT(intf->channel)); + else + _intr2_mask_set(priv, ASP_INTR2_PHY_EVENT(intf->channel)); +} + void bcmasp_enable_tx_irq(struct bcmasp_intf *intf, int en) { struct bcmasp_priv *priv = intf->parent; @@ -79,6 +93,9 @@ static void bcmasp_intr2_handling(struct bcmasp_intf *intf, u32 status) __napi_schedule_irqoff(&intf->tx_napi); } } + + if (status & ASP_INTR2_PHY_EVENT(intf->channel)) + phy_mac_interrupt(intf->ndev->phydev); } static irqreturn_t bcmasp_isr(int irq, void *data) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.h b/drivers/net/ethernet/broadcom/asp2/bcmasp.h index 127a5340625e..f93cb3da44b0 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.h +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.h @@ -19,6 +19,8 @@ #define ASP_INTR2_TX_DESC(intr) BIT((intr) + 14) #define ASP_INTR2_UMC0_WAKE BIT(22) #define ASP_INTR2_UMC1_WAKE BIT(28) +#define ASP_INTR2_PHY_EVENT(intr) ((intr) ? BIT(30) | BIT(31) : \ + BIT(24) | BIT(25)) #define ASP_WAKEUP_INTR2_OFFSET 0x1200 #define ASP_WAKEUP_INTR2_STATUS 0x0 @@ -556,6 +558,8 @@ void bcmasp_enable_tx_irq(struct bcmasp_intf *intf, int en); void bcmasp_enable_rx_irq(struct bcmasp_intf *intf, int en); +void bcmasp_enable_phy_irq(struct bcmasp_intf *intf, int en); + void bcmasp_flush_rx_port(struct bcmasp_intf *intf); extern const struct ethtool_ops bcmasp_ethtool_ops; diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c index 0b378a6d43e7..8fbeb506abb9 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c @@ -382,6 +382,7 @@ static void bcmasp_netif_start(struct net_device *dev) bcmasp_enable_rx_irq(intf, 1); bcmasp_enable_tx_irq(intf, 1); + bcmasp_enable_phy_irq(intf, 1); phy_start(dev->phydev); } @@ -890,6 +891,7 @@ static void bcmasp_netif_deinit(struct net_device *dev) /* Disable interrupts */ bcmasp_enable_tx_irq(intf, 0); bcmasp_enable_rx_irq(intf, 0); + bcmasp_enable_phy_irq(intf, 0); netif_napi_del(&intf->tx_napi); netif_napi_del(&intf->rx_napi); @@ -1028,6 +1030,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) goto err_phy_disable; } + if (intf->internal_phy) + dev->phydev->irq = PHY_MAC_INTERRUPT; + /* Indicate that the MAC is responsible for PHY PM */ phydev->mac_managed_pm = true; } else if (!intf->wolopts) {