From patchwork Thu Feb 22 20:56:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13568122 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 E2D1471747 for ; Thu, 22 Feb 2024 20:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635417; cv=none; b=or3xP7nbNQcxZSDumvtMFmeGGwQw1VClTMUzeaQ+3771UasQXp9ONi2Azt9Oj74TFN/VU0FY6O9FEzQwvrmc0MU4VbsSyumt30YlyCGstYMLivGcpntm4aiy78wLTkKQTeY8Wog/Gn75nYMHuhVW3KBgux/lVEYU7yq3DYiBksA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635417; c=relaxed/simple; bh=VkXvftA1YTpgKB8ehCPE8IVGpfxUAm8pBCOC50JCXZg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=by/k/4FlRZMjHyT6h29uf5nPcLxhsrsKXG6yrb2FtcixFjUEgf9YMhebWHbFhC4Gs9U1YnGNNGwcfl3bQ0/jX54T7DxNbS16DZOd4MDN4AELvjiq029ENltlCwAmwLdNH5odX6SGyk27AjySZ7wHeQbjDeVpen0Flaj1Ifnp48Q= 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=huQyEGbD; arc=none smtp.client-ip=209.85.128.173 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="huQyEGbD" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-608342633b8so2021567b3.1 for ; Thu, 22 Feb 2024 12:56:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708635415; x=1709240215; 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=S0CDgqQWgjii4Hx1jPo4gRUEdfQUA5XUuhBB+eE2jD4=; b=huQyEGbDsL6i2t5w7GLj0xc9xEUa4ZVDQhFJC4m/4O2a5qdld/grNkEJYyPGta2vBU PKkkwAx1JBCqV9TxB/way8i0tNI1Dq8814t3mXMBZwEwFMfnz9ghT2nX4N+34DXPStmd thSvotMR7V0P1fdJtVvMgtpmy1n92WkQcb11A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635415; x=1709240215; 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=S0CDgqQWgjii4Hx1jPo4gRUEdfQUA5XUuhBB+eE2jD4=; b=PxVjyGANetiMOK3DckTc5fNCMt2IKUAxKzbqEvg2qt2x7ZYQ+6nRPrAO8FiaqGDzjF GnNPYD7GTrURT6tlMX7EzvPjqndNDbwEkovIEmwcJ0LuHOPiKHKCmx2/nzgzvVgbzuHm 8igreJH9iZ5fMSP2/+vd9tYP685NuFsgT9M+jwciPvJZKh2HukwiviFQu8DomNSJ7mV4 +Dl8GpWMQZFFHasGWZOe1VZsAFqeVZyaJKrq9x7JDpWc6VWIlRRYYaXEqhb8OBkFOZgA ZSejbk2WqE9WhAUgPgvVc0u9J+ES2mzULO2h/wstOSU23qY/1skl/lOWYuiuOonRHwzX jv6w== X-Gm-Message-State: AOJu0Yz6IbXWA8aV5AkoLYlHz2W9UWFSO8x45x7nserbVPC7oNGoKVS4 f20PiB6pkE97FBxkobaMipzSbcvnn9RzJsrJNi7HJ3+tx/YMQxKQQi8sAypP+AEQI9FvZ8FUfHq x2lr97N6FrVbow47HNlLJVl5slbW66vlpHtL2bhBnz71jgm3Oq/mKpOm2CIBIr0+rLdk0veZiwI C3WzYPwb/4FUegjcN6BPAxQiLDV5q10GFsHp7fhcjo2Q== X-Google-Smtp-Source: AGHT+IHv5X9Uw50BOV7TX7PfEkc0rDcEl9gfw9/JUnaXDihhMVUNwI6tUezgloZDFuJ1SK8EhUZW4w== X-Received: by 2002:a81:c504:0:b0:608:8b1e:cee with SMTP id k4-20020a81c504000000b006088b1e0ceemr327660ywi.25.1708635414616; Thu, 22 Feb 2024 12:56:54 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jr11-20020a05622a800b00b0042e224098eesm3159370qtb.27.2024.02.22.12.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:56:54 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, 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, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, Justin Chen Subject: [PATCH net-next 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.2 Date: Thu, 22 Feb 2024 12:56:39 -0800 Message-Id: <20240222205644.707326-2-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222205644.707326-1-justin.chen@broadcom.com> References: <20240222205644.707326-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: 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 Thu Feb 22 20:56:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13568123 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (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 880DE7174A for ; Thu, 22 Feb 2024 20:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635420; cv=none; b=QoKxNx23g2Hw/tunGd80tPKlcDgBvMazOMKIQcKUN0BOMJOD3flwYJl8EmLmxIUYX3u2lhtklKDD7axXBbQsI3CEtOthFNn+D6JMOVDdEoMYJpuHGDpbXwmgfsSEFwBnR9Ms7lJKG2xCYhnbs//ThxucQ6nqMegrfPDNqibapTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635420; c=relaxed/simple; bh=vEBs+tyJDk0/ibmOfMa6yx/xvvcwdGT1ZjDb0VTtppA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=E2AI/3ysbTOddIvLwyXAgBIjTiRKgD8skdF0Bw+Tz2wFljkC5jw5YPKqE80Aonx73rmts9Oowj1O1ClEYOQSwAH1qA/mokKmj92nRbLL3ZHTE+F7bXZgFlHeP7sJ+tVcl+NM0Jf5Kf24qGD9CXLpNF+pxL0t0aAAPHZ1dEZ76ho= 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=SbFZHjQi; arc=none smtp.client-ip=209.85.160.174 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="SbFZHjQi" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-42a9f4935a6so9209251cf.1 for ; Thu, 22 Feb 2024 12:56:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708635417; x=1709240217; 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=xgyQQ54uYthVR1Mz3xQ5yUS6zO9na+VW4ozIUqUag7k=; b=SbFZHjQiDhphWRgJ/LRXhAHIh9lamVsitFckjSxKyne8TV3JTqU+VrRjB4NufZr8il bbIlVIsf9DbgHXI8NPoM61hDovviOdBl6VJQqteOU6M/XwzjGepxOfDmyMDBTvrRPy5c NaJJ2Hrjn6jl5099HI+flensZ0jzbaWF/c7o0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635417; x=1709240217; 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=xgyQQ54uYthVR1Mz3xQ5yUS6zO9na+VW4ozIUqUag7k=; b=dOhXpGTGqM5FepcAhBqxRINf28M3wnbUh5z+uIGVB/un8slO9xgGVKvq0K+Ln5A3wQ gcl3+z50zUvm/2RKqAjYzMiM2qfCDpO3d91ONOeEEmbLidfO+QDo1fzoC9uOSIMhkhrk CVrGMTmbQ26jlJuDLar/raW1Xqn9Y6x1sqhyV1CQZqoFV9Xhljqy88RlW98yh5zpdDTI tnQKHfg0brK3a44KLQf/i6IHI5W45Y1sgtX+ZyRhsip8akXbrBbtgbzxfcmEU2oKDxuQ 5WxOE1YzwBpcscMQFQbNtSPJBete1iS5lNuHd8WxksOxtCl9HoVIAtceae+rdDrdYRGK Xs6g== X-Gm-Message-State: AOJu0YxdSH9ne05q9xKkro1Za1kZ4PnQOTUXauGfOUM1aX/fZViYN26i aNkvU/Zkzv04XtXA4ngYy6JNc/ieyf29nIcoSFoshR1ZCIT2Xfl5/779zjS2CzKb8xql22qkRIj rgIqVzLQe3x0k8DYEBFVoZZRBtXPvgEy/XE6i7cP4CSExLiAUbyyxDIKwuQ6BdH2T37gEZz0kFN oLCt1bMNafSZ4Q1a9T/SLQWaZhaNGy/EqgKRDw4z0k3Q== X-Google-Smtp-Source: AGHT+IFn4tf+2VIjmoyqKS0JWgfsm1+eq5a7kQzZdPQ7HFM/NlGm8g5agAEFARgrwowCXeYLZUX5bw== X-Received: by 2002:a05:622a:148e:b0:42c:8b9a:e252 with SMTP id t14-20020a05622a148e00b0042c8b9ae252mr6050845qtx.16.1708635417043; Thu, 22 Feb 2024 12:56:57 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jr11-20020a05622a800b00b0042e224098eesm3159370qtb.27.2024.02.22.12.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:56:56 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, 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, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, Justin Chen Subject: [PATCH net-next 2/6] dt-bindings: net: brcm,asp-v2.0: Add asp-v2.2 Date: Thu, 22 Feb 2024 12:56:40 -0800 Message-Id: <20240222205644.707326-3-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222205644.707326-1-justin.chen@broadcom.com> References: <20240222205644.707326-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 --- 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..5a345f03de17 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,bcm74165-asp + - const: brcm,asp-v2.2 - items: - enum: - brcm,bcm74165-asp From patchwork Thu Feb 22 20:56:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13568124 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (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 D326173F1A for ; Thu, 22 Feb 2024 20:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635422; cv=none; b=TipMWmvJhSbnmyf6QMgQW8E4pxtTGY2XUxHwExHXpL7LRMOrGaaryiZhVpEmJr6v02IwaTvShsG7NJ6A3VE12tdgED7kDf7u5OVafAZqH8IUEhOlIhqhaPyI+h+NdZlm1LXxb8LWzR75tbD6mJKmWMX2BMaX35Cfln6j9b+AWbc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635422; c=relaxed/simple; bh=W3auJq3byfgYmSuVQqfLfn5WNNM5Dt7sPxH0WQ3Vmwo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=hBJkzIB0Ol85FDdjWockDA5gm20hXEw2iaStYnI6LR6cDh93nRWP6/MtTxNOkUJfy29D5LLdaFs3jsJXWUq2hho8lQVt49udESo+pgGkUsKaOncbdAFVoS82LIpn4vhr7hqxpiE7ZQcmsVkHpcmUST6lt9bkvtmMxSaDXBp/oKQ= 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=A9HY9OKR; arc=none smtp.client-ip=209.85.160.176 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="A9HY9OKR" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-42a9f4935a6so9209491cf.1 for ; Thu, 22 Feb 2024 12:57:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708635419; x=1709240219; 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=EE83DN+0LhtAEJBn3GX5N6W9XOyxAwYBD7kr/dD7adA=; b=A9HY9OKRbqbUqbp8m3kVIWzLATHpp4LiZ/mUPH9thr6yhU/3aY4862+aKLAruxcthr lwVZFwnVQG9vqR++2z4DY9xInBxvR6L0IcRjQnJUDjSMkuiRiSFJJ69nWAKrPjailO10 Lf+OVANYHMujuJEsp8YUgvVCV1Ix0NZpVO0Is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635419; x=1709240219; 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=EE83DN+0LhtAEJBn3GX5N6W9XOyxAwYBD7kr/dD7adA=; b=MdIL3i6g6NuT+VxrkuXgKYiwPUZVjbjj1qf1pdK6jd3p16mPgNZskjHNawgDMrMYtr A6FE3l7+zGdCINObvRecR8McLTAXrSlDKx6n8fVkgNd1BAr721yaydj/VCA2S3BvMR/O odShFXxz4cJVLXrwy6Llu3Ms4pwX8fDCTyLmTu3i69tiaRgAVeG8Wzr8J8mFfMfbDZfY iY7P/ZY7xjKVRrp58CxWq2l+wRW+AW4yVuJdUo+hxYY2Al0y10xjJ/aJF4MK2jn+p3/A CkXIEwZwp0CgRGoOjsGOf9lD948807yNAW6+/vEwTkC3+YbBICCqQwZNmewWYWylb/Y7 /0Hw== X-Gm-Message-State: AOJu0YwTv4a6UQWNHKXqqsk7v4A1oJqoTEIodU9bRuOqZ461dV0BXctP T0ZPgjqwkrL9Lae9TZTriFG7PvdvVJnUqrlzY+sGY0mzJtMZ8Jqk4Hwe5RfiycuegUtg1BQwEjO HjB4yu15m4I0jHbno0qpOxFEi1RNSlMdJSl0FUQnQCr27ZnbwkRSc1S9yY2KatxaYDYr7FP3kxq SiikRpcXZthTOfITVA1pRdQW2Tm9MFDrl95aUkZDdDnA== X-Google-Smtp-Source: AGHT+IGwkyUH+6p0xy7W8u0pZmBr9HQdlTDxDyrZ09ZtqPW8aLyZhsI5Yow7Pvxz3sc50ghJ8j6z1w== X-Received: by 2002:ac8:5cd3:0:b0:42e:18e5:3e06 with SMTP id s19-20020ac85cd3000000b0042e18e53e06mr5438073qta.34.1708635419295; Thu, 22 Feb 2024 12:56:59 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jr11-20020a05622a800b00b0042e224098eesm3159370qtb.27.2024.02.22.12.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:56:59 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, 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, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, Justin Chen Subject: [PATCH net-next 3/6] net: bcmasp: Add support for ASP 2.2 Date: Thu, 22 Feb 2024 12:56:41 -0800 Message-Id: <20240222205644.707326-4-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222205644.707326-1-justin.chen@broadcom.com> References: <20240222205644.707326-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 29b04a274d07..3086b0b9b784 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 0420f17e53a9..cbe9acfa985d 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c @@ -1330,6 +1330,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"); } @@ -1378,6 +1381,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 Thu Feb 22 20:56:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13568125 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 0367973F25 for ; Thu, 22 Feb 2024 20:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635424; cv=none; b=RazjamQGgpWy/zVsyZEKii0SqCWxltETjExW0TxQspSpxQj+Ik5IoAHg1G3qiZyK0iQI+qMyXJxEDAWT7rDQQPjVvtYFimvujMudlbYym9JUtgg5K71DD5hzNzudoyMO4HuSG8iZScABl/0FpxA/UlbiXWbi7L4fZVF/+UkAMKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635424; c=relaxed/simple; bh=xfhxPMKh/1VejSC74ICEbi+TqSdPtpibvpqQUdhELoU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=AwUqVY+Am4oBaFoizOsDLzaMTSvIHrU5eg8GFebBq/6qJ5z59Z6GB49qerDa3TFB6yyGUTh9brISdaYxMCKwhA0j/G2K4QlQ3JLaxqyToZbzXND8MhyIdqrgrNAKyj9yx2XAhzhMTLLfXht/9l16IYLYZBOO/Co747XrQMeNwgU= 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=QnBYdaaY; arc=none smtp.client-ip=209.85.160.178 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="QnBYdaaY" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-42a35c720b8so92181cf.3 for ; Thu, 22 Feb 2024 12:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708635421; x=1709240221; 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=hWenpxvtzlFUUBMPUJFs77JhtbTorr+dRrnaLJz3aSc=; b=QnBYdaaYUlXPNflbNDTxGYnBpWN3vSwsXDDiVcRwVuRQGrQujqVn1CwR08U8S0AZ8Q 1nOXP76urKt0pZaYGomwdNnh0W/6TVaKun98viCbaLAqX8L8h+xQX93TJLRD1b2MAvzZ C2IkL1GJMeeMRqbJAcyKeV0aJWI/Af/vjVWzE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635421; x=1709240221; 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=hWenpxvtzlFUUBMPUJFs77JhtbTorr+dRrnaLJz3aSc=; b=K3OSzwL+vLTzVRijWkNkFabWqobMd5kTlN1WEams6qKx8oYV6YtwJsGsKI3E+kSatz qN5gjdu5bsMoxg/7wKgi9NJwACjHC4GU9YKOvXBfOnJm3vKJnVR1i35s47EyStiq82T8 WVCQO/t51c34ZzwI7rGNYt1B9F7PbV7o8l4bY0v2El7cjKDQVn5iVBi/hW8IloKUyCKV m/9uIm400sc6L3zlDpYRIF/LHDS3w4/jPixf2ukUHKjxNHBtt8Tz3ts9buqwNQzRLFbc vHWhJmVCqgad8EJmYRZalb5SILQJ6aMJtSWF/oJpOmVbN51sWeZRE0jc7cz/h4xStFTd A4aQ== X-Gm-Message-State: AOJu0YxWIZK/QtEoKtLNrU4lFkT2pxpIcvwdGUaNmyWY6KsuHfJpTMCY HGEeVvdtHQbGNzU5yBR+qzNTaQtzmaTwy6pPpX4XQP4ZdzJwJC+AKr2//7z7AFzxsif7qHa2GXt 4s/H4Z/KVe3Z8sDe+v90DY4kpyHXOqIarAmLekZKABZCHTeftHRGo4LysAZFdhyrSwUSYK4GLPc vbiIYtQ3nDmNQ/oSIib7qHPZZFGLnRfU0qx2Z9zU9vWA== X-Google-Smtp-Source: AGHT+IGlVz64SoscRpWT7UW/JVfWdhKucFMjH8n4lW8oJt/BFUbHjiWIJ5wi6ywo7gNa4lY+y2dXJg== X-Received: by 2002:a05:622a:34f:b0:42d:feeb:64df with SMTP id r15-20020a05622a034f00b0042dfeeb64dfmr277488qtw.36.1708635421518; Thu, 22 Feb 2024 12:57:01 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jr11-20020a05622a800b00b0042e224098eesm3159370qtb.27.2024.02.22.12.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:57:01 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, 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, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, Justin Chen Subject: [PATCH net-next 4/6] net: phy: mdio-bcm-unimac: Add asp v2.2 support Date: Thu, 22 Feb 2024 12:56:42 -0800 Message-Id: <20240222205644.707326-5-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222205644.707326-1-justin.chen@broadcom.com> References: <20240222205644.707326-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 Thu Feb 22 20:56:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13568126 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 DDD5A73F33 for ; Thu, 22 Feb 2024 20:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635426; cv=none; b=UU9Lpz2/4y8dur7XNoUuXLCmDDU16yljGmGj1Zo8ZWfclGAs9jhl3MLSl66AuF5E+WUlFsIXgrHHHlYgFlNM5ITevZLpVsb5GoU/qZ58CgEqChYwwyHYRpF15BR9IhyDWXylc/X1JpeJyR3Oz5QE+r8K1hMeuajnUJF6OjNxUZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635426; c=relaxed/simple; bh=q1ZH7yIUqFcd9MTGDHmRPHuIklsw1eKBMw0vlVYjAF4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=MWYPNd4dxcTKP30uKPPbfD7L4utVmpc9aA7/5pyrJ6sSaBMHYfRprO5z33KGhpiNQE6d8XyS8x6BvdKw5VV4z+ZuPnGdVV+GVhOjdyUE4b7EZ/8lpHsLF0NapB0e7lIAQRrl0FFx/t+wH8FZZMZywMqHrMvPibUCOwRGRhyrmZU= 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=HmDGbtV+; arc=none smtp.client-ip=209.85.128.173 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="HmDGbtV+" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-6085b652fc8so1819697b3.2 for ; Thu, 22 Feb 2024 12:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708635424; x=1709240224; 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=RGQI2yalz6BpWO9w8LLQyK5yZ1mY0xsDb9d/gt6s7cM=; b=HmDGbtV+OoH9bLjqBTuu/QckagG8gY+/zhFumttTnOTgD3eAiQ1lhBivvpsVp4mL7p XATVxHAuZPlXEWHkEpA23mtyIumRvbqHpqjQ9ijJVtqhC5FiVL/hT2wyTbhDBL7S4Whx G9gPmW3y2mfJluz7iDYh4KzYDUzTXmlNR/mdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635424; x=1709240224; 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=RGQI2yalz6BpWO9w8LLQyK5yZ1mY0xsDb9d/gt6s7cM=; b=ZA0FCDdFCLIYCb4qLGgKm8NLAIPOyQaKwATtBkbvv7+O/J4sUL6w8CVUbHu4uNMaJy xK9+vm750ABCE9CLCpnQFYEGLKlRX9LUzSCn5Ftvp4jF6vvMR7ZgPONFKFzepPx5vHZ3 g9Hk/3BtUnj7e8nusvEot596keSWzGzK4nDcXHGbtV0LjPXwCwwnwI3KDzfeqA/NKYQA CAwc2uZDms8NLMpMwfmcXdWQw4ptwJKmldaQSQXUrEIdkXEmqgm77mQBSmvWVUtvdio6 jmH9BkfpClxHekOvKW7AsTdbHFoVZuw5qKzs9MOKto38N4krGqUe3nRAiumyU/XppJ8y ovPQ== X-Gm-Message-State: AOJu0Yz93C+ZGGLOVH0bLvPFce27m8lIAXTapE76bERw6sjptPRbZAeB d488dvgxEvDXbHvLr7vq3A06Q7ddTr4NJXxy/RAyvk5WLLhL3UvVX5DS2t3kqTeTVCveGDoQvZ9 CW8fgnYaPr0D7ICogU2a8mjMYhCQdY+xGV9iQZFcG6HhGNbwh9pVnUjG3Itf3tJF+U4zGTNZ0vD JmPWZ4pt3ZPMXpWRtia3t7RfnGvwPF/i3t1Nk4pGeW9g== X-Google-Smtp-Source: AGHT+IF6rt2RmDlbkG4SUgjztfcZk8Kw+bXcqmbMIBdwSCUpEh9gDmf3GsfNwjfG5swpbgaQMxOQSA== X-Received: by 2002:a81:a056:0:b0:608:b523:c410 with SMTP id x83-20020a81a056000000b00608b523c410mr187637ywg.41.1708635423728; Thu, 22 Feb 2024 12:57:03 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jr11-20020a05622a800b00b0042e224098eesm3159370qtb.27.2024.02.22.12.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:57:03 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, 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, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, Justin Chen Subject: [PATCH net-next 5/6] net: bcmasp: Keep buffers through power management Date: Thu, 22 Feb 2024 12:56:43 -0800 Message-Id: <20240222205644.707326-6-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222205644.707326-1-justin.chen@broadcom.com> References: <20240222205644.707326-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 cbe9acfa985d..1aed28b06309 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 */ @@ -1070,17 +1046,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 */ @@ -1094,12 +1065,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); @@ -1115,6 +1080,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 Thu Feb 22 20:56:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13568127 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (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 8CE2312D1E8 for ; Thu, 22 Feb 2024 20:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635429; cv=none; b=ml1WnPX5TCWCpW/ShP5P489BkCuf1N1TapBiqcjTgo49/wu/Jb4qn+5ho/i1BrPZ2Ew3cblrPmbjppCbBynhCM+1gNYACp4OsAXW1Xt/o7JqXsw4+j0kFJXNggV/sT8ZSRlqgc8dBoXtMOHdsxCfs5BlBDt62ED981527Zqq8ns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708635429; c=relaxed/simple; bh=cCaL2mu5GzoT4dxqj+iHQV4fDBuGRe3vdGV97rb3lqs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=F/nhfAubrh+oKmxUQaqFWxzksbKdC+jIQtBB6oVGTQ2Gk893mZpvzn8qglYlZmZHwWyvolvKSZpPdDdZUFHOq63W6Gr/E2b3U+ZVNFcfeZbXUWNqjTWJgffc5KFXaSK5m6g0JvNBNpcXAvOJnbLuwFaedHGiHHdbyEyz+VL+Aqs= 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=X26vXH5q; arc=none smtp.client-ip=209.85.160.179 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="X26vXH5q" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-42a029c8e62so290781cf.1 for ; Thu, 22 Feb 2024 12:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708635426; x=1709240226; 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=FIpO513eJAVxgtG71VSIHb3UzfyMfcLBwIpnZp5qVFw=; b=X26vXH5qJJlIuRjsAZGUzqMWGR5Z+OaTEA0HHbYS/Z3PPwLUy/7kkcFJyXGq910i9T Pzk0R5uznfNoOWNLc2WhBchOSbgLQ8cIpIzbfnGfNCs3iS6gr/1x7VuPYq1D60FePNnD PqpWykIAwpTofNTEI9ExIKyNE0ChTBovWXXJs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708635426; x=1709240226; 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=FIpO513eJAVxgtG71VSIHb3UzfyMfcLBwIpnZp5qVFw=; b=wRf8AwiU7BgIQRtSuEGoDs/FsBZiPmsfBN6hpiK1W8v+00dTvpp0IBqMJpTbyjrEJQ wd3pWK5zePVa+aiKuz1zZn9cread9xricfqjPN98RAIDg6YfbfMoy8vIsZMN5V61uXSi ZZKAxAa71TpXdAZeKvVG/OkrWMn9sdzzOuUUVOGMzn2fYCSBozHhoewlSDHPOQ41+tXA +PkDYB+v4FsN/SNrtOXrvKBsTjUSts12doFJVsF2ZkwFeeI6669TleEECPtju9alWNrZ 9Ou++CmSc/Asw3nqPcaSdIWf6svS0ggP4MB9SwcK1FoXc4/XAWQ/HZ5/3yCesIsytVT1 l0Og== X-Gm-Message-State: AOJu0YzmBXz3Vqz/Wt3g30fsSVjBoVSa7qQjladS6MkNr689RMp08r4Q S+mJT8/y3Sn+ngZJB8GE65Oh4dMMQaGsNpgKFKQWQEqlc+bV5/lA7qCaTrKt85shwjX2zUiaye6 TPuQqlkdnFSbDfYzJKT/hH2nPUkJfDIPKdvskz6nTupc4B59Y7Klnw5U4pyiOl0+DtbSVZM5oyn CsNKVF3NEVbdxreQPJl1Wmtgfa1w7EKAQtBhbtd4hPjg== X-Google-Smtp-Source: AGHT+IGy1qCsgNT10YtMAC/kdQLI1fRjJLjgcT6oS9zQPWJAPnC9qWxQa2z//70gk63Ktr6q0jtE3Q== X-Received: by 2002:a05:622a:1745:b0:42e:2b6:8b52 with SMTP id l5-20020a05622a174500b0042e02b68b52mr370785qtk.14.1708635426039; Thu, 22 Feb 2024 12:57:06 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id jr11-20020a05622a800b00b0042e224098eesm3159370qtb.27.2024.02.22.12.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:57:05 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, 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, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, rafal@milecki.pl, devicetree@vger.kernel.org, Justin Chen Subject: [PATCH net-next 6/6] net: bcmasp: Add support for PHY interrupts Date: Thu, 22 Feb 2024 12:56:44 -0800 Message-Id: <20240222205644.707326-7-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222205644.707326-1-justin.chen@broadcom.com> References: <20240222205644.707326-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 3086b0b9b784..a2627c2a6e45 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 1aed28b06309..a2fa8dcbe387 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); @@ -1027,6 +1029,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect) netdev_err(dev, "could not attach to PHY\n"); goto err_phy_disable; } + + if (intf->internal_phy) + dev->phydev->irq = PHY_MAC_INTERRUPT; } else if (!intf->wolopts) { ret = phy_resume(dev->phydev); if (ret)