From patchwork Fri Feb 23 22:24:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13570118 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.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 0D77F14EFC9 for ; Fri, 23 Feb 2024 22:24:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727091; cv=none; b=Gzgr5CyV5eFG6iEFfN4s1VcU+IEbYOANrLw15L7rXluKljA5XZtWn/qExs5/gah/UTEhG7TWr94w58//Qsy5syMup7z2PmPU+8aEA6hYIC6nWOr7dKfi1IhKpyHYuQtZ5StOWjzMu/A+e0UKVzaseTOLoagEkiAayaJIJ4hdh7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727091; c=relaxed/simple; bh=/4iCx79BijmoEIOLL76LyJI/QcHRr0+mQnD59jxtukQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=O/DGrRi0tZC+yAVudEXkpTh4fTGm78EzaVEq77MTqShpDWoFsRjeKLnITTY8j1sjn0H3/6V4szXFNOXDJ+7gRA9IDS4DI1SK1uTP1P0KgPUse7+dp/XLt7ny9sLR6KseUiajU8kDNp825oZ/HXFnznNdtS/GoOm60+/ga5WHL9Q= 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=XPc2SPxl; arc=none smtp.client-ip=209.85.160.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="XPc2SPxl" Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-429de32dad9so4706251cf.2 for ; Fri, 23 Feb 2024 14:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708727089; x=1709331889; 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=SmXwm/t9LqdrJJE1FJHemCUbwsZG2tOOsRCiIKlDF0w=; b=XPc2SPxlIbwNy/biQ/IWN+INrGeF8tUCYrLCykR4vR9uIGpwAg66EOr/day5jQgAvu p4ronj43zVkh4gXLQqlLi2Rqr2ooXQehxbFsveOzASw/quDgQpzusHs4qiCdU/oPLgN6 EHrmJUrqVpt4FXxOCs+IoXXSDKi0+5U4bohUU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708727089; x=1709331889; 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=SmXwm/t9LqdrJJE1FJHemCUbwsZG2tOOsRCiIKlDF0w=; b=gjlGr0Kc6IOXKA/dYHoQd3shjWtZBBCI+lfw4EQxE4Qin8g9VbHBLXwQO1YNlDH8oo a0XCSfkenmjCHAQ17Yf79xgbH4Uzemf09Rgpqz/B5kpIHFbx3c42Dqu0UxsWeq57U5Qx sPTFWtbvUr5mooMHDdJKJYc3bMp2MECUcjhS5BWituXE4nPFcs8OXliiS/X7YKoGenVS RNm+NJG8Rf9eO3qy9nBF6Y+MH4xeuVlDx0/dUgvm5UCoCwlZo+3QrctmefIfylpzn1Gx xXApr9jg/keYJsfiV3eiTKo/PURUTu1DFX9VHoq6q6anO6FNwONc7597UrKoeCv+2LEv crjg== X-Gm-Message-State: AOJu0YzMOC6KaYstspDlpEZdCPbjE3G7GeNEnpcPWPS15PT9FEzH7TwV 2JLeAjYr1xosBG6P+ui2XugTF4kMZ6JvxdgOb0x5M0fE/t/qzD/5d4UDJgS0lQ0kEYrQ3q/flgR 8jdX1W1odaP6yJxEZdr1/Za+f2OF+69ehPzowv4tdzMozAQoQDq+Eqxsb1dfodgzcaa8ix5Gc5/ CscSgiPDMao17lZhR47/NDtXLcKzgsjJkVKD1c2EmHhw== X-Google-Smtp-Source: AGHT+IHM/8l8J+IrOplsW2kSX5kvcgc4FdCzcyAB8gEVHmYZvVvz1CyBS3AQ4THsnBSXrVxF3XIFcw== X-Received: by 2002:ac8:5acc:0:b0:42e:4a13:d5e7 with SMTP id d12-20020ac85acc000000b0042e4a13d5e7mr508398qtd.36.1708727088748; Fri, 23 Feb 2024 14:24:48 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n19-20020ac86753000000b0042e6198372dsm1036403qtp.97.2024.02.23.14.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:24:48 -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 resend 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.2 Date: Fri, 23 Feb 2024 14:24:29 -0800 Message-Id: <20240223222434.590191-2-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223222434.590191-1-justin.chen@broadcom.com> References: <20240223222434.590191-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 Fri Feb 23 22:24:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13570119 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ua1-f44.google.com (mail-ua1-f44.google.com [209.85.222.44]) (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 3EFE01448E1 for ; Fri, 23 Feb 2024 22:24:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727094; cv=none; b=ELXyf79R/+v94yml6+QJqB3ijI3qxxGsDVgbICNJMK5S3O+mAxQ4G4npI7+XYFnClkB0J1x0+sJQ+6AgfdiWKDibzsKQ28o4Oc0fqcm7WJJ9ByWUYTOBeD0CXk+S83YuBSMmzIXWrYgRoDcLFTcicfy0Hb9GmFvKoy0F9/613gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727094; c=relaxed/simple; bh=ZQ4deJ3h9LCV6V+rZIJ+CCZQQ7tp1+f2RRewtfOYENE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=XpK8lIrW/bKhaaNS7IF+hc/MCmZKBd9ZqIZFqhtMIC31Gj1YZcts4EyY2BS2gauxACRlb13rdGjFZixJVnqG65BMvjXjMUG+HGv1xSSCBIw0FSSysHVyAjBASuL8LbKpV+0uPCFcxcSpIbo/MIXziPdJaLt7G+3F1LOzfC5o3l4= 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=CtX8/Tlp; arc=none smtp.client-ip=209.85.222.44 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="CtX8/Tlp" Received: by mail-ua1-f44.google.com with SMTP id a1e0cc1a2514c-7d5bbbe57bbso744379241.1 for ; Fri, 23 Feb 2024 14:24:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708727092; x=1709331892; 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=sNg2SFvYu+0rzxUPrcM7R0wEms0lo6DfOPMfooSm2KY=; b=CtX8/TlpEt4eY/hgY+zcGLhiwNUFF/bQSn16REYvVOUcAke2d7Yxipuw8mRQO7qrXn 7Y/cdBbOAOgmo6HO1Kxiue7HMsMDiyPHlls1fd7AyEHh5uBMGnC5JScricMz+t14AL9r JR2C++q2eSQuAW3WbBkMfqEnGntJ3+WIwPEzk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708727092; x=1709331892; 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=sNg2SFvYu+0rzxUPrcM7R0wEms0lo6DfOPMfooSm2KY=; b=PZDUZANvCZokXDvF9kcqXHdVmxhhggJywpMB8zfwuKheDtlPrCr9sYhccWSqsxV1QQ 2ju+4Eu/acWq7eeMC42NZRgQ/JpXlSc/w047AvdHWcHeBFflYjnmrayMq3K85cvPErik M3LvfHaoIbT2y2fkbqTph/f2L0xvonDiXuOVK5i6/rC5YQJPB9+MRrMTFHtxGcdsFx02 EW3PlYWgotHuJuHwUi94S6hRnRpnstiisRFJiIKgF/ydTAXgC0Br8EJ9D3uMV62TR8F1 /6d1SbNqgJqu9aKdr63gZ4dmK6N1rJzBNhj2/QjCWLM7BhpE/FqaXON+NsJmFbomVAmj nfog== X-Gm-Message-State: AOJu0Yz0S5JeUdRweMWvpZfmNaaR4DxePrHJH1tIfxwzue28J5/4zKYU Cn/iR077Pd57BghlApjIYnOaKt0ezJ/7fk57SMnNSt8lG8IqglZKnC0a4SdZsYhHO6HggpbBFBf fkhBtUlg0jz38/N/lVWEbYVHU3o6Aj1ohg3B7W1C75GzvEt06/ABycabmLv/8glmhqvRVapKP2c 7VbdrlxRTrxN1SfzVtTUizmOcbssAdnfQV0ZNmgV1reg== X-Google-Smtp-Source: AGHT+IEZ+I21sppK8kzqOgQbL6NXkPlNix8dYUFFmrOmtP4xiuis3MT90fHDl24PtCpiFUDS/Ih2dw== X-Received: by 2002:a05:6102:9ba:b0:471:bee4:4ff0 with SMTP id f26-20020a05610209ba00b00471bee44ff0mr1207092vsb.32.1708727091066; Fri, 23 Feb 2024 14:24:51 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n19-20020ac86753000000b0042e6198372dsm1036403qtp.97.2024.02.23.14.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:24:50 -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 resend 2/6] dt-bindings: net: brcm,asp-v2.0: Add asp-v2.2 Date: Fri, 23 Feb 2024 14:24:30 -0800 Message-Id: <20240223222434.590191-3-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223222434.590191-1-justin.chen@broadcom.com> References: <20240223222434.590191-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 Fri Feb 23 22:24:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13570120 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.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 C356214EFDE for ; Fri, 23 Feb 2024 22:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727096; cv=none; b=D+Fi34mjlAoRs46Xs6D7J0UlTdcu+kZJP7H3cn04cIlpIPFYsO9kddMBELxzW0qceyD5l3TIupCmrdEKApeUtRN68uHRIxxhpsRVLVODufcE335tj7X2lmAcVSaaG+rEnAnOxpiGStgJbrEDvTVOlVvbLl+ScQ4bn9/ZM4Yeqxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727096; c=relaxed/simple; bh=VUxdo3fQfEhgtzRIydcUHdmZOX8vOg6RCdw8xbyMoqc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Err6SNcjR7NEeZBkRNdCXSTOy2pBq3jU74NguF6WLsCtCMHRbGsf/Clu10ym1HMTd4P3g+zgPbBq5mo5Gq8GdH0eRCxjpZbMkmCovNwuSnLg8PQfQG7SEG3moO+KfhKkPKgN/A0QKnCKtuwq+AuXlKvfsEFSH0BR5RWjirha9RE= 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=EUgx3Vxn; arc=none smtp.client-ip=209.85.160.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="EUgx3Vxn" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-429de32dad9so4706451cf.2 for ; Fri, 23 Feb 2024 14:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708727093; x=1709331893; 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=VWgePZ2b6I5QgQuqpW3DTluQFagRalx+siEo5cULkjI=; b=EUgx3Vxn1kJv0VzjlueZoBrqA3OpbpxG+3Lnz2T7HdmgFUPaRXdMeDIsAjGP2QKUuO 35i1EJsbLqG2qpL4hwB5JxS777EMZBuz4D6YA2j4QBD27/mfGrxH/MVIyDGEimDgOKNI EV38qjj2ToDTlhgp0qKbanE5u/E7MDUmcewj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708727093; x=1709331893; 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=VWgePZ2b6I5QgQuqpW3DTluQFagRalx+siEo5cULkjI=; b=RkHNjc83IHlBkookGwvXub0XJjJs86LVRrSDRwZM7iDBkNvfZALC4Kq9i1/Au/WOjp ftN9rkH3t9yVR4hSXfKR2d6/NoC4DWeKUehixnIScVYEhmfzow3DGFY4C5o47nDvecuB yH47S2pBTCQSJf5n/UR7M4/cyQ1AirKgWgUQV5FVnOilidz1MLxoJy2EC3j9nYohPAB2 EgcAf7a3zoVc6GLJO3o6SKLrXi3GVQq6GZBr7EAdDiQy9/3FFY58ZsWGQzDG/HYGwlgC 1xJ8LdUBt23ADseI4kKJPzK4WTiK5qP30aQtoe2kDqBat3uNnhmnD+6vSxt7IOfKZ3Rp Xdug== X-Gm-Message-State: AOJu0YxQ7XDal/6YhM49dhiVku2qBo1t4tTHfQtEh3TRT0LO2gQafijx xcs2uGRscLkpBdAGoNoacTazOGiQ3i1aDEd2AfgUIk2mkkVQd2Xc419eRfxMGDwKJ6IE9VFUNZ8 AfoXmdygLnBm3eiE4NfsmV4KnmVxzfO4nD0LGFXjaRaO4iSKFIpYqH0oybr/J6UgyUF2nsXIy6b u2/d2J3jz7uixehQDRbsD8JNdGqL/5cbf0snzoy+4wDQ== X-Google-Smtp-Source: AGHT+IHToTsLnJsoj2UFYahXTWN+sdSVQhXGhQezJKFqMK2Ttu36wb8TwDUUNkazv6pYsAi9Y66kBg== X-Received: by 2002:a05:622a:1a05:b0:42e:5ca9:2523 with SMTP id f5-20020a05622a1a0500b0042e5ca92523mr549170qtb.14.1708727093351; Fri, 23 Feb 2024 14:24:53 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n19-20020ac86753000000b0042e6198372dsm1036403qtp.97.2024.02.23.14.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:24:52 -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 resend 3/6] net: bcmasp: Add support for ASP 2.2 Date: Fri, 23 Feb 2024 14:24:31 -0800 Message-Id: <20240223222434.590191-4-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223222434.590191-1-justin.chen@broadcom.com> References: <20240223222434.590191-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 Fri Feb 23 22:24:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13570121 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f178.google.com (mail-yw1-f178.google.com [209.85.128.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 D85C514F961 for ; Fri, 23 Feb 2024 22:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727098; cv=none; b=CNXdsVa35EJgVbS+LM7MPXAnGOY8Vgeu8CSNKIU8HTws69re/6EdmugoRUtj3PsbOW6Xa3BxkSr3sNhjfxv9GsJNQWEGlc/x4YVAyqi5S8O6ooXC6a7pS+Gdrd3s6ChQKSJ925UpQVsLBsQM1Moum4/BkZL4dG722zIdgFE+93s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727098; c=relaxed/simple; bh=Bt8V4aoK86AHHYgU14oDLgkzZXb7I0/9byOKufM+xnc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=MP3KGk7ax4WXSwA6j2KdD7otf85BmXPKHl+2kbrqGZqW0eH+oVoWx4hF3tP2wrd9er7l8xBZRehMKF3Ib3ERNQb7VSavsEhakxeIL+r7yGRGAAf8NvjPBphOmAxLhZBa9Rn6qwr60G1ARXAhp5PH6zNHWUuPacyMjOP6Uui1y9s= 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=Lq7W5dgz; arc=none smtp.client-ip=209.85.128.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="Lq7W5dgz" Received: by mail-yw1-f178.google.com with SMTP id 00721157ae682-60884277a6dso16118657b3.1 for ; Fri, 23 Feb 2024 14:24:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708727095; x=1709331895; 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=ZKfJ/PW7cJgMdSs1ZNrSdmu0Fp0EUwziehu8ivBGDh4=; b=Lq7W5dgzkFkiUnIEpzpa+7o+DPktbOaSmjHe+Vhv5Cn0EKRIqdY7EtC3JlaylWN5rm GjXQ+oHSJ7j2S/MpWGLUrLGucPobznECEk/Ma2ur7m1+9kDWx+tU1h7tDJwiAYMOoUJ3 io/Wk4osh/JHcv/o1PDjs5ZVTKVchsjGfmqx8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708727095; x=1709331895; 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=ZKfJ/PW7cJgMdSs1ZNrSdmu0Fp0EUwziehu8ivBGDh4=; b=tgxxKcIorKw66ajK8Bcuw4BZgvnUm5VjvM9CmwJsUJYRbVz16UK3JbaIF2KJhOSM6n k71FvMTbyaFA7ZSRmT4HXwkdiSVRw91dooD8w7qzHzTHcqIckf4FMlRLK+xYkm5ou3IG J8MjTfhu1zoR/ZgN3ZAeRuKOkkXnIMui3iYz5T4jyOmdsqrai32sNsTJSLrGgsBKaXx2 UQ2v/hknDdpyUrBjkGA5lI2rVaa/+w4wwGnjZCkZ3RQcpn/pSoB8b2yVSmUOB97wJu9b HFivNwjp/JWZNpRtFl28kzfaCZu2EHg+2ebIBM1KApIl2CJCQPo+OQUTTn9v8AlhF1N6 SAYA== X-Gm-Message-State: AOJu0YzXMk+PH3k3NqFyLX7N7fBTMiIEPjuL6FB+dil51KZ6rgd80eKC Anq/qwMALb5xziKr/KPG9Rn59R8vxlXvVA0besQVWD96MS0SENWJVXiGFDMsk09mAYT2NLHfr+/ VBGNCX82OZFFcJMW+SViH2FeUMUrAsvW4ea7rQouZsgJFMRwRyhcZPGpsq3g0mtoYcsflwT8H78 WUeEi5buZanzvs1kUZNdsqa1j+xSQxev8l/VAGQeP8kg== X-Google-Smtp-Source: AGHT+IHn371iyDSoIhNU70hqeDpp5/nSYdRM4qNouEosxcn5xnsGaW7dUaGfceO8U/5F5u6xcT0JHA== X-Received: by 2002:a81:6cc7:0:b0:608:cde6:3dd2 with SMTP id h190-20020a816cc7000000b00608cde63dd2mr969919ywc.24.1708727095507; Fri, 23 Feb 2024 14:24:55 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n19-20020ac86753000000b0042e6198372dsm1036403qtp.97.2024.02.23.14.24.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:24:55 -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 resend 4/6] net: phy: mdio-bcm-unimac: Add asp v2.2 support Date: Fri, 23 Feb 2024 14:24:32 -0800 Message-Id: <20240223222434.590191-5-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223222434.590191-1-justin.chen@broadcom.com> References: <20240223222434.590191-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 Fri Feb 23 22:24:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13570122 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) (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 70B1A14F97D for ; Fri, 23 Feb 2024 22:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727101; cv=none; b=oclF3/sZwxXdd4ZveTtlaTpRjeheThvT6xwqpo4KmbdJ+LenJU+93c3zatismUTIoJ/M+ybc7O7UEpZQ4eCVcxciKEHn4S+vhmLowRGCgaQhHY0HjjmeXJ9zfTlwi3OwvpfhpQXGJpL74Z3cmFzngOMiEWKY4hKoNYb47eMl03U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727101; c=relaxed/simple; bh=w+KWa7UR+NEkPnK8SNqy+v4eo+otmPo+8vC4f82nsPU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=L57zctArlXAbzI4kPQnU1IgjV/l5bfeeaxbvD/MgyxxRbMkb2Gp5KFK21lu6ptCZ0FoqHzc+xU5TejFtyVEYkIMYhK/zBDAdLI9zNu+WKVXQWb4gloyvjC5+Wx7VJkZU0k0h6209cLaEeqj8X8SCPjVfQ8595z2Ba3ElnAXVKcQ= 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=cR4AEKSs; arc=none smtp.client-ip=209.85.222.47 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="cR4AEKSs" Received: by mail-ua1-f47.google.com with SMTP id a1e0cc1a2514c-7d5c257452dso362686241.0 for ; Fri, 23 Feb 2024 14:24:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708727098; x=1709331898; 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=j/j45Qgc64XfdmXgV/kURIs3GxiD/Q68GWPzuOfLciM=; b=cR4AEKSsZkjLjS0dx8mGcATbPZcavjpriGRCu56qQSjJ3j27/wPdXODAu1SAiaQXTC FqPrC0liwy30W8tA41JyGO9/goYBbzhghbfgEWBCtnfdpLyhJkd6NpsTG9mNkZOwA0fE GtKsUQFNgFU4afa1t7CXLAzGMb2eXNrDM6u40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708727098; x=1709331898; 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=j/j45Qgc64XfdmXgV/kURIs3GxiD/Q68GWPzuOfLciM=; b=TJbqw31vTmnYewGxOsdgg+hz8qUmESNjpge2Pt/CIBrz1E0QvXdNOMrp+5Q8ooJpO9 VnjVjlhNik11CrK7Ll1946mZE8seC6dm/1G4AOnJXFFlX+Q/3jCMSyWx9rAp/wZYp+9T sjWx0O8ljn4NNOzA22SiRhyPA7V3MyK2AiKO8EWB0qNj0rCsCikcRgo/lxbWr0vY9k3b OfkMHZVdsc2A0cbFkihX8iERTXdTMu+mGumXKD6Owe7fdE/Uo8iQnVqWAK9vR3eLVocw l1Nk2ms1LMugmcatrT2li9euf5UCMySiX54Wre+M31cQ/kET5fc0iTg7tSCC1eW/e9w6 EHZg== X-Gm-Message-State: AOJu0YxnK5rk0krS+Fiv1GiPL1IVUhInKajDxUtWUOcInHf2kHgJQWua CR1A1Ivp7msqoYegolyvea1VJqlLObTFKBbTRX6gN8nyWyJdlaJH1QmtPfre2AL7zofIbdWU6jj zzmQ3PId8n4h9AJsmUsHWGeMzhx9MPw5vi9AypVoTPa+o8El8VQJgF66oAnFpAPFfID6LthgpRP e58Z9nfYZ+NfIAjBLX8+9FL0LqEKcEnroff4oNgwK2eA== X-Google-Smtp-Source: AGHT+IFeF9KK4Uq/NbxHh2yHCzPB1TtGcSipqrKUlpwYIndZq83chBc2B3ziPM7V1IQiifb6cTqE6w== X-Received: by 2002:a67:f5d4:0:b0:470:5080:451 with SMTP id t20-20020a67f5d4000000b0047050800451mr1260944vso.16.1708727097943; Fri, 23 Feb 2024 14:24:57 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n19-20020ac86753000000b0042e6198372dsm1036403qtp.97.2024.02.23.14.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:24:57 -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 resend 5/6] net: bcmasp: Keep buffers through power management Date: Fri, 23 Feb 2024 14:24:33 -0800 Message-Id: <20240223222434.590191-6-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223222434.590191-1-justin.chen@broadcom.com> References: <20240223222434.590191-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 Fri Feb 23 22:24:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13570123 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.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 8E4A714F987 for ; Fri, 23 Feb 2024 22:25:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727103; cv=none; b=Eva+sOaIwc5kINvArfMeKUd+P6zYd8RL/RLL3ngZXEWLA8eoiw93fZPd/f9o3bfiiKiRa7Aj7nOropAXgCFfT6ts/f++Tf9D4r/qzeZxZP5VrfzLtC+yH+RzXy3C4t+J9Nu4eQQtEGWkTN9VZa8f6w20I3nJ4YuAD1NLDX/Fv8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708727103; c=relaxed/simple; bh=UEDTp9LEia7qit/Upz4U/OEBEotuEJBidfZMhpGrxVg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=iSKoDAMaaOW1XvQBnGlCOEhlNq0IzjKyCEYdho0l0oJWbGZAMrPGUPwgwGd3L0/YVBGhZTShH+5NjGWZYJLv/xqsL17dPV7deg2ofgE0XkdoaTzLr2xmUUXfeNyBKw4VhRBbYOFdd4WQyvNJiogyj4GdPAM5RSOG/XlEz6qWShY= 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=GwubpKuf; arc=none smtp.client-ip=209.85.219.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="GwubpKuf" Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-dcd94fb9e4dso1457686276.2 for ; Fri, 23 Feb 2024 14:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1708727100; x=1709331900; 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=U9KfxosW74kZG5yZSh7j2R31MCQmiAO1oDrY4bBWb/o=; b=GwubpKufx+e7gVMiqQKgx3PfsHCXa3VqaYhF3MbBRAKBAxuOmVtBa/5ncgaDbcEit8 Exg/n9KRbWao9OA9lIAHM4peylXS+hcwZyDV4rPJWZnriWbAsiVM7QGtRs6e396HT4Oe T+P9WDQjW9BRTSK6ifhAlHUAp4Hhl7DXhgdhY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708727100; x=1709331900; 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=U9KfxosW74kZG5yZSh7j2R31MCQmiAO1oDrY4bBWb/o=; b=jHvMzHlDrsK36NTM35JhslngwXHawbU/7vR8nKa9Pyp277y+fDwmARdzlj6iJStldI LbUfFfqEClNA6keB7/qdaHOmEpr+hOfC1FuBIaPb31oXmRICdOLKTwbqXGs5hTGm9FHo ocb9A8Ke0FTDStBXWzwTxZ6r2XIPuyKTTICCUQKYrp8yrppkthhhJiJ6Jq1qO7XXLmEq KJiLbnzh7lyhr0U6lmdh6b4oCCMAGKbPYbLqO2TU3t74hsNRhiDIphrbaHyDxvDS6HvK PSnvZxHsK+PNy2nFIjZfe3PywD6qJr7XuvUjvsc9STZ1sIQwic32f/9KG3uQHHeVe28O tW5Q== X-Gm-Message-State: AOJu0YyfQW+2tAcD9//IDUwxhRwknc39h4FuYWQWf2larW7bDsGbCAp7 8L+DRs+fmB7M86L3qSw76Dq/IWjC49JgmP0T9DeJVBWr+USrdGYGe9NiC58k1f4f8NzCo6fIwbw Raj5l9ChKjTe6JhaXBAPwIoRU69I3TI7M9jEARr7Evh5jnvkxzIdZVcOG9ZSbYyt2gfCqAHl8WN Coh2OX38KugQfpc/U9Q4CQ1RPZiTLiKQfQrhfeHNsjNw== X-Google-Smtp-Source: AGHT+IH8fUZKBc4ZAsfPhK0UHjuGLSL8NYePxeShNo9nTTQkd3czfXf38dMHz7cX0vuTYOAPJsDwtg== X-Received: by 2002:a25:8a11:0:b0:dc7:5157:d43d with SMTP id g17-20020a258a11000000b00dc75157d43dmr1153868ybl.42.1708727100152; Fri, 23 Feb 2024 14:25:00 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n19-20020ac86753000000b0042e6198372dsm1036403qtp.97.2024.02.23.14.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:24: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 resend 6/6] net: bcmasp: Add support for PHY interrupts Date: Fri, 23 Feb 2024 14:24:34 -0800 Message-Id: <20240223222434.590191-7-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240223222434.590191-1-justin.chen@broadcom.com> References: <20240223222434.590191-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) {