From patchwork Wed Feb 28 22:53:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13576080 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 A2B4372907 for ; Wed, 28 Feb 2024 22:54:21 +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=1709160863; cv=none; b=aqOxjXjpLlvBUue5/UvxZVpIhNSN4EDzlor+NKXIsgGVi7ZOGHLhVyXKbLP98U5K+3yGzsbMDwkNZAXS+gbrnGNmVVQ54X5+Qib/PAa9/lgKjqANX2kLPp7hGb7iHMr46uz5oUdYlofasxr4I+mYRb7PAJXmCdR3ooZOeQjMM84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160863; c=relaxed/simple; bh=rVlojHdRSZwnkdYxyI/C42YlG6TXxxUmABtz0o6cOeY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=kr7vO6j9jI4Yvl94hAB7jYMdCbGhHJPw/5HqddyrN3V6uypSB3DUjvJHPkoZqMOJ8YEYFR8cTODAXdu+x6MmN4vSdva19ZOLw9uDCTovvcx+ZF9HuJX/Xw1QLE/54JEdewy6y5dUhtXqShD95C4pRZo+xdXjnmVqcazwTSIhg50= 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=RKFnq17b; 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="RKFnq17b" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-42eb3821a2dso2222871cf.1 for ; Wed, 28 Feb 2024 14:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709160860; x=1709765660; 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=AS3WSe738mNPOhub4LODqKhpMxoo+unDi9NUNj0MfJs=; b=RKFnq17bisBCGSYe00zewzAMSWPuYY3Nxqj0PoiBL2xuNncBqn98JrXn/Z0G1BBkJo QHS1W97Aagjnn7hraLh1L22nocF8OZOUGNXrdsT9zLBtboq7NY9O4iLmTTesHYlbWyHM bDIhEwDKzB1Cz8duFwYXpQrgKjJfBUL81a6xU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709160860; x=1709765660; 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=AS3WSe738mNPOhub4LODqKhpMxoo+unDi9NUNj0MfJs=; b=HptMIANrXKvdWJ+vXf2/OB/XyVApcTI/E1lQcd/CBwEmaua3iGPgPUE3e3ExvrCeqU DSDwVG+U7rn5UrL2LNJzzztVgPw5A/xWhnehmUQOKOhceqqXsQ4dYS02IL/2wM3iL4Z+ wwzpbXODuoaMGoEZpha2x6CWsN/iXGowbeevVbaCJae5dpSQr3AG1R+cT5pQ+jV5HhgZ 5dWbJpa8KgWvgmcoPeRJ1iztvHmPKRoQDPv/122LOF3ufMybmOWVWG6dyfUIYkv1ed7a gzrClV71wR99ZxHevYOo9aCf/BITVCDmmcq6Yf2qJbHoGkpxTw/zntPgxMpxwEbxAobt 7rsg== X-Gm-Message-State: AOJu0YyJKqOhQ8D9YsbgygSe/5i3tGhOOlQ/vOdyDBE4n9jYk71Dqjer 15OJafxnNX2JxVERfiV9TkoLpJS0UIcAyBnxCCyQcnUblh9LVYLQ4NCn8d4hvq3XAu052j8Nvwd EU9Tar6MezR7Q2eYITHrRZr4n2AyYrmF/pSFmeZMDX6nruFnUXGSMpZe3XE7VH3fwDQ0R8rEtAn YL40mMuaOa7X7Hs2xhJmVkB1LkHrm7BPYCYqYOlLMYKIEg X-Google-Smtp-Source: AGHT+IEu21tXud+uSl33igKCETY9zNvP/Qz0G7/Ii2fdexO3etwNh+8y88mmDEJNNjKxU6XYyVbvtw== X-Received: by 2002:a05:622a:1816:b0:42e:b590:c23 with SMTP id t22-20020a05622a181600b0042eb5900c23mr409420qtc.68.1709160860337; Wed, 28 Feb 2024 14:54:20 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b1-20020ac812c1000000b0042e3468a98csm95036qtj.4.2024.02.28.14.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:54:20 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: horms@kernel.org, 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 , Krzysztof Kozlowski Subject: [PATCH net-next v3 1/6] dt-bindings: net: brcm,unimac-mdio: Add asp-v2.2 Date: Wed, 28 Feb 2024 14:53:55 -0800 Message-Id: <20240228225400.3509156-2-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228225400.3509156-1-justin.chen@broadcom.com> References: <20240228225400.3509156-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 Wed Feb 28 22:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13576081 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com [209.85.217.41]) (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 B773D72918 for ; Wed, 28 Feb 2024 22:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160866; cv=none; b=LnTDTRFjeBh2wO/OeSQ6dPCFc9zjoXcjFuZdwphiE+d2rNdOJlvtEvB8wdUBSyBwDh5dwTcYc7dF0X6gfO2EMEwCnu30eTM9u12rN69Enxr34UvDsZdqp+Z59p5lP0PucLuD0etfRRwcR9sDBB1fk1z2UsIA82lFiASjd01DP4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160866; c=relaxed/simple; bh=5dy4nBjkM1R4hrK3PxHGLVZEyBZx2kVN7VfSDvn6ADQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=JcUWltemcVOgNiOFUHtdOH8aVqfkpOxkk+BJu43glZMRIaehEH4gajRZId8KV5vV/DSbx4RY2LL/PpjZAhM14Gl6QxM1b1yQvmbh8E7bozJVYoVBWkajEmvyfR7vOPpAsTdpesK/J7eOdOJz0IDS2Ryx9nZIzoBY5PeC/rFAZno= 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=ZxoN9SB7; arc=none smtp.client-ip=209.85.217.41 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="ZxoN9SB7" Received: by mail-vs1-f41.google.com with SMTP id ada2fe7eead31-4724f2b88cbso89129137.3 for ; Wed, 28 Feb 2024 14:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709160862; x=1709765662; 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=ueGl1SMeT1vr0j1BoTffXpjrCdDq7aQZWCV3yfKtB7E=; b=ZxoN9SB7gQOhV6yuQbTDilZSA37XBdjOBXCuwLP+7C4GwGKhqBc5niQQY6eKpJdQyP RKeiL7Qb4F1ARMKTGaZ8qcVW0Kiv0jSNU/h56Dkuz2Ty9eJ0gRrdqVCL1D84Nc5m+zrV 1mtxL1+bK9hhxKzlZcJsgQs5Qcp2V5z21elKA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709160862; x=1709765662; 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=ueGl1SMeT1vr0j1BoTffXpjrCdDq7aQZWCV3yfKtB7E=; b=HaNrUEuNXPB2nbl4xCEpfp3isLYfyhl8k0SDRHp12OGiQbLa8Xqy5rnNY1YkLAxBEE sxvwBnAqyOHSieryKvD8OymsY75e+7cIOqsbVg3gsUiylllxz386tC8ENidPj6+qCryO t9acIR1yMBsCsi+qhi9ATkI8QIDzBYQAx/POmhi1GXB1urBKAfgHZzQuBWerf1mmA2HG BIDQB85D/HCnURq7j7NCfuHj8dZt/UdrHB615hVCdwxuyam+DLxmAbBSQdjlZzgWz88J TVwm4o/Joum+6ZC8FoLknDxG82VNiCgYWyNX9QMQ6/+kT+A6GyJgej8cVDm1S/uAWRg7 kauA== X-Gm-Message-State: AOJu0YzKgn+I7crls8n4TYa++Rz4/lUkefmK5WnCHnYY30U8+8lld3jm ouOJKSm3zyPDEDgZsFZUWgbWJXW3Ycxvpwxc8NHwQaE1c35lfEw2Rx8UTGTwEUlUy4p0ngyKj/Z 5mZwSWXdJywAToPeszXb/Mispn7kpleOSkbzXyyE3vHrdhhIbUpVVSq8Q7esicAEzgbfAnxvONo nopFkJ4IYh04dRCHtEduS4E4l4R8UffV0jMSSnjxPmmOvv X-Google-Smtp-Source: AGHT+IGl0pVFaJgInnTNpIz/u/5qcyqhAe/6ssIjbnz5q2gw58uW4xIwpE2mWFsz7pZe2JVwRlLFxA== X-Received: by 2002:a05:6102:3190:b0:472:7490:778d with SMTP id c16-20020a056102319000b004727490778dmr232059vsh.4.1709160862635; Wed, 28 Feb 2024 14:54:22 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b1-20020ac812c1000000b0042e3468a98csm95036qtj.4.2024.02.28.14.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:54:22 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: horms@kernel.org, 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 , Krzysztof Kozlowski Subject: [PATCH net-next v3 2/6] dt-bindings: net: brcm,asp-v2.0: Add asp-v2.2 Date: Wed, 28 Feb 2024 14:53:56 -0800 Message-Id: <20240228225400.3509156-3-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228225400.3509156-1-justin.chen@broadcom.com> References: <20240228225400.3509156-1-justin.chen@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add support for ASP 2.2. Signed-off-by: Justin Chen Acked-by: Florian Fainelli Acked-by: Krzysztof Kozlowski --- v2 - Change brcm,bcm74165-asp to brcm,bcm74165b0-asp Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml index 75d8138298fb..660e2ca42daf 100644 --- a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml +++ b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml @@ -15,6 +15,10 @@ description: Broadcom Ethernet controller first introduced with 72165 properties: compatible: oneOf: + - items: + - enum: + - brcm,bcm74165b0-asp + - const: brcm,asp-v2.2 - items: - enum: - brcm,bcm74165-asp From patchwork Wed Feb 28 22:53:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13576084 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 093617442E for ; Wed, 28 Feb 2024 22:54:30 +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=1709160873; cv=none; b=R4OjlmQCeicZNWvEM4whHkrzVVZ2B5UynyYJBh6DAhaZBqxjYZ0JhqBUSMzO8QPKEr8r8JsM3KP67ohJ8oPUC8LSNbKO5OuneBGE6D+Mcky5iXwU8Zj99dh7LvlxSa0TOTkTjl/K6iXmRYvnFQ5i9M0u0Vn2FfrX0rG2+nsDSOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160873; c=relaxed/simple; bh=bC2LvQzQODu87pkiGciZzfXIoGJvfBxG/cIp2ufTYoY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=lPz1bCtIugpevsMmIA+BWb8iPFGWJVtFoeV2G2EmbcItdkQLyWzPY0MxFrygBAIA8Zxk5kbu8BjcNZveXMhGLD+MmWv1Ym4bEf4nIw276gb+9D+2KrErHjJGSNa03q9tIyvNUbvtSQEDw7dFWvNqs/aYPkaNT9KFUjCi9qUNW/U= 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=MJpVcKSA; 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="MJpVcKSA" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-42e89610ed8so1739361cf.3 for ; Wed, 28 Feb 2024 14:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709160865; x=1709765665; 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=rP5gxB3N/XzfGbU3HPfxW1WDLDfb1aNd3i6DVeLVh6c=; b=MJpVcKSArsZbBVp9Ey21FOGB5Rh2LlroVQcY7axOIJmts10VK2dncvQZvlsjPb9lyB UEAqZvV2JOc+LutGMSXrgI5K40vsbCzxM6yhKi/8XvgGFkR/JzySmqavLetXpPq/cYDp pwK5tkBVVa7kNVhg2/F6G1duqg2cL9jxq0FVI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709160865; x=1709765665; 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=rP5gxB3N/XzfGbU3HPfxW1WDLDfb1aNd3i6DVeLVh6c=; b=I7NGyARoI9Le3dNeJMIV6YHOTTSsroKC/kLnVs/maoDRv8tna5zoDKIo2rmmWnUJID IsKrxxYDQw+/KaACGjOGYIQiJYWrEtKKT6ufhhM9IXTj7TvFEuMyP5T39c3oqEQfPFGK +rRYi6WJjA1duhS9gJEfKH0uhxiZOvDwHCbRzXxIzc+V/dlsA5i6v7LzuI4dVY0KT/nA 3Utzuv2LNHJ5pdZ2B4v8DqEHlu5P7P3BWWwDsOFdebRvD709njQIRxQ5cW/pvwmRXJQI IMp+XjToRs/JLypcpa3wL0iuqMgvFKIDKq8VvOAf+5SpnK4fiYEFwMThoR9eIYHGGgVC AN1w== X-Gm-Message-State: AOJu0Yw9Rz1B1kRnHzivj3W1exehfC51px6sXA2y8Nl8UaqN38eoDCLH aGycYssH5uFR4fgY9OB8gU/gQ6liGR9mTt+G18sIV0UHDewJtD0T5DTTKOMFqDqImQ3+nyZVbwG VO1WiPJ0xDQXqxmot7Zb8qx5sQL8Sw5qjh4kslrgmn4dKbaO6h19nLiL79f4mbyN9hl2WN/fuUR E8x7wbOQEHLp/adrRKrCMDXppX9QlX0HN2NTuEw0woR9OQ X-Google-Smtp-Source: AGHT+IHEohhI9trQCiFtr6xrzgIxkpRcty9tBBZctGxBIKZMbol7k2w7tp+lWVKh+2QF+Iprkszv4w== X-Received: by 2002:ac8:7f4a:0:b0:42e:b777:f28b with SMTP id g10-20020ac87f4a000000b0042eb777f28bmr553922qtk.12.1709160864848; Wed, 28 Feb 2024 14:54:24 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b1-20020ac812c1000000b0042e3468a98csm95036qtj.4.2024.02.28.14.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:54:24 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: horms@kernel.org, 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 v3 3/6] net: bcmasp: Add support for ASP 2.2 Date: Wed, 28 Feb 2024 14:53:57 -0800 Message-Id: <20240228225400.3509156-4-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228225400.3509156-1-justin.chen@broadcom.com> References: <20240228225400.3509156-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 Wed Feb 28 22:53:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13576082 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 58BC072900 for ; Wed, 28 Feb 2024 22:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160869; cv=none; b=N+FTYTw7nPdZu+mQ/8GrRzBxtrTqjzA/ExGu6jdlJHnh18vgRjGABvPWsrRSZLIcqXSjK9B9wWhxHtrKMUKiwtNFHtuBu9vQrqn0NBNGOPU+EBxDWbfRj+ouSK7Hy874TCHmq68GploFy9QhubTE9TZv5dbaKCOwiTadz+XyoDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160869; c=relaxed/simple; bh=HCm13zJldwTzR77ESlwV5GiJsi1RFaq0ravfaHofk7k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=a2c9M33AWTNm9EL0LIhiMHjKBtBqmNZep6v1Jo0ht5IG1/xImLeGu02qRN5dYz7Kz+MgsUT3KvxW8zL6257aEqQSZ7rMkCfFti6jMi/XFuCuVrm3WK8kfdr7IrjyW6dHwHlrnfcyZ0n27MBb8xVb57Dpr329LvH9Pw80uAL4UL8= 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=Oh5fKQjO; arc=none smtp.client-ip=209.85.160.181 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="Oh5fKQjO" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-42e78c39ff0so12670351cf.0 for ; Wed, 28 Feb 2024 14:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709160867; x=1709765667; 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=gwZt54V2WAhzrr3THSU7Wj9L+kCEa35n0KErP/r1VPo=; b=Oh5fKQjO+O0Eelc/W36pZV0qSNjV/eXraqAxcNlqY6bjCyYOOhwWw6XSrD4nAkbGmf A20IbMqSZ5UJp48zeqZPKqumPYNmeTqZh8lN0+FenfP/5G0n4elTelBZ6mGePv5O+5eu DEnyIJB33IWNT2jgEdkoklCnOS3D/2TZCZFJY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709160867; x=1709765667; 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=gwZt54V2WAhzrr3THSU7Wj9L+kCEa35n0KErP/r1VPo=; b=hvRsq8ySWGscBgWAxbkdxrx8eM72woEwe8AjFYZGn5ln5fWDwsvbUNRZnFBxKVe2ra vNOiQlhzlQjA2plXJqTEMhGkUPB1KX8NLNvlUxUKiiLRIGUHwqvvpTMDATXCkWqT0naz UyBNtNoDdKTuRmaKYw69Xco708gNbvESN0fSfp25Lt/hb5bVxM/V6ujka9/07PX7cHSS D8Rh3ww8AzryweOD4LDgVBbIfFFiQXa3qUTMymbJ+k/xyIYYUXAwZ7VmTDUyCqeOymx9 91t0IPPR1T47c29MJygDr9Cu+ncVWtzE7lz8HtyKL2fGCt39hpNJoyR/a4mFORtRCHKP J7bg== X-Gm-Message-State: AOJu0YwSsLvYw3c/UNhfXf38QfFqy3E/fJN0hryftl+Qi42uIo1WZYGW RZP18iLjmr/OKdZVsaUDDYddW2pEUUBCX7/bKx+lChF5qF9kdtnW3lk09n04hB/TNe/l8VC6JgT 5WKnmsyF9EArq2LNbKtwG0ZVvRf49u3B/BbrGaqKqfa4GAGnoCrJhO6tQTWiiiF7IgYEBbHAe0U 6pfwdLm05/rk//h8V3QWmn/9RO5psVb4Eo6oAjPf9j36oe X-Google-Smtp-Source: AGHT+IEaBm5JOJcjAOQMNrAyer0NoXyGpJ/sRjZ5yIETqH4n8JW/syaVRK+jT+VcYbuREWqn3E4x+A== X-Received: by 2002:ac8:5c09:0:b0:42e:afc4:49ab with SMTP id i9-20020ac85c09000000b0042eafc449abmr272289qti.3.1709160867087; Wed, 28 Feb 2024 14:54:27 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b1-20020ac812c1000000b0042e3468a98csm95036qtj.4.2024.02.28.14.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:54:26 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: horms@kernel.org, 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 v3 4/6] net: phy: mdio-bcm-unimac: Add asp v2.2 support Date: Wed, 28 Feb 2024 14:53:58 -0800 Message-Id: <20240228225400.3509156-5-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228225400.3509156-1-justin.chen@broadcom.com> References: <20240228225400.3509156-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 Wed Feb 28 22:53:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13576083 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 DF2427290E for ; Wed, 28 Feb 2024 22:54:30 +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=1709160873; cv=none; b=Gcv/fqVRzvXCTpKhsMNqACkQmsHBQLuFXtwazCxqdDrcUZhv2ZwIz7xlLH5yxiN4h7tMucufJ5htckQl+gdAEcC8zHabxCe7wBA3OlFO8wrz+NAjqvC3b3PpF5kg7ztp5r5yPp/GnR8+k1FgMftECUIUvCUZMWxdMFafmMfOwa0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160873; c=relaxed/simple; bh=veE00LbdvFXUxPZILVs8dUaavYtYE6fkZ+WJvY34C7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=HyVmz+9Lp3NTGHPvolJWvi/WbIjDhS6M46ZQoV+l2Oxe+ikhsQl8M2+TCN2L7Gw14XBieGZgqVL0I7rrY24zBPFILG5gluu8oSM9nZXKiUGw3hxUlS5D1P4DKLewW6R2qmFu69adnY7y2RCakiwj2P5rpZXVOiTW77dfabqJonA= 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=Qwa9a0+e; 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="Qwa9a0+e" Received: by mail-qt1-f174.google.com with SMTP id d75a77b69052e-42e885c8885so1283251cf.2 for ; Wed, 28 Feb 2024 14:54:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709160870; x=1709765670; 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=2JFJ4AUmtx0jq0iu2oMk6Oit8SBDlIcaRW3I3w/3ElY=; b=Qwa9a0+eTZ42ZlmNdbtQ8Z/9Vl7sMi7VvYOIS3ZHH63R/9WHf2P+40hn+6A05IyoP1 XFzY1ij+bG4dMWqzpYRgA6tmgp9jKXoNjgB8d+0ZIvVg4+AkwvFoOOqpH+h4aHglqtNw sfeDz5sy+CAvpy7ygLIr5QerhAK3IzRz1j7yw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709160870; x=1709765670; 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=2JFJ4AUmtx0jq0iu2oMk6Oit8SBDlIcaRW3I3w/3ElY=; b=KnKM+EtMZ/CT8FHKwCODV0FSf9R/yLxNa1rpcIUtuk4UQFYCsTLFDK518/ewvweePB aYUSpoQw5B53XkuPQQ/6dfZ9CBRBxkFWLR2eizU4Nn5YV4ZkhLT8k6GUAoSzUd+L2XGB tr73BtXKyBwqJXIumP9h6cChnKuZPDv5KD3K3nceZnsVdgKMaxxC1egh9a93MYnIBEYa MA2+jdNNPYotyPjUlYKZi4rQ8BZrG1XeWuONzbxVNZnBSKcB2J9igYE+SfbeKaZijXN1 hTELlxPVsgwUZx6GSeX+UNIAlj96zWUSGS1YcbtrO4tj7bGhnUzWHgjpBRBHuEU4M6gD qPOw== X-Gm-Message-State: AOJu0Yy3b+pgbqMUiDrGx3vLtqoPz7XkowepRZQzmHQFigxjK4cpZivi 2BNGSU86nWCMolUdKWR4elJqn3jrVNi92dgE9Ls/IcZmBS9nhncnpwqV4fLnZZrSnU4GflFkIYi KKoUQqSv20OwMYclEw21DgvNnkNbVLwiKYdUD2mUUj+LAItB/ZJ9HQj97cbJisRjykASoRo132/ gsSwEyP3G75Kw/AWgD/8Xtmmx+HWOn5yJh1q28ahgzNkDw X-Google-Smtp-Source: AGHT+IGV5N+Wj2DIvlOtL5nszgJye1qSzY96bPlByBtx+SUpV/A390zH0FF6Zyszw2+WwBdMga4D8w== X-Received: by 2002:ac8:594b:0:b0:42e:774e:2987 with SMTP id 11-20020ac8594b000000b0042e774e2987mr403116qtz.38.1709160869608; Wed, 28 Feb 2024 14:54:29 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b1-20020ac812c1000000b0042e3468a98csm95036qtj.4.2024.02.28.14.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:54:29 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: horms@kernel.org, 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 v3 5/6] net: bcmasp: Keep buffers through power management Date: Wed, 28 Feb 2024 14:53:59 -0800 Message-Id: <20240228225400.3509156-6-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228225400.3509156-1-justin.chen@broadcom.com> References: <20240228225400.3509156-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 --- v3 - Free resources when bcmasp_open() partially fails drivers/net/ethernet/broadcom/asp2/bcmasp.h | 1 + .../net/ethernet/broadcom/asp2/bcmasp_intf.c | 192 ++++++++---------- 2 files changed, 85 insertions(+), 108 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..25b03d32d791 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,13 +1083,24 @@ static int bcmasp_open(struct net_device *dev) netif_dbg(intf, ifup, dev, "bcmasp open\n"); - ret = clk_prepare_enable(intf->parent->clk); + ret = bcmasp_alloc_buffers(intf); if (ret) return ret; - ret = bcmasp_netif_init(dev, true); + ret = clk_prepare_enable(intf->parent->clk); if (ret) + goto err_free_mem; + + ret = bcmasp_netif_init(dev, true); + if (ret) { clk_disable_unprepare(intf->parent->clk); + goto err_free_mem; + } + + return ret; + +err_free_mem: + bcmasp_reclaim_free_buffers(intf); return ret; } From patchwork Wed Feb 28 22:54:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13576085 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2025E4086E for ; Wed, 28 Feb 2024 22:54:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160874; cv=none; b=tELr2sLFbEKQLJREUDH07aNgesj0vem+wuJTKENedIwZbVrnlytTgTFARBTigbyWiK9AoDxloKATJjstRXz4ejkN7K4mKHuQugunrVnjnip2pqswKp/ckUurzTxOGHFMwse9JaryH4jenXP7gNcAbcCNzGuh7gbm2zBRZatCXyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709160874; c=relaxed/simple; bh=vsVYv6r09YptEgEouCuJU7NGd34Kje6Gl1toOn3fKmE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=szrpuYTlAvzyumDOjm6V2+pG0iHqvYvKIFmj/IKESbNM8fontyfcxj/LhV2JPz7Yz9LvOibH/UTqwrJlWAHJQcN6oNxgrHqJDjNM/GU4dry3YSA4UOVZZVSUZujml5yjce5i6B/np+iNEUKhbCmINJ/ljuA06K/SJp62hM7ucCY= 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=bb3h8Hib; arc=none smtp.client-ip=209.85.167.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bb3h8Hib" Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3c19e18470aso177801b6e.1 for ; Wed, 28 Feb 2024 14:54:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1709160872; x=1709765672; 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=fjNMpRyzx1o5ChTSFYaAgokjl1iX8X34MVn643sMmDc=; b=bb3h8HibDGSNUJqXR2Pqmba4MGHS9Lt05XEK1163WwEsYZLKdZwz5H1KdMl4sZBT4H QgydprwzcvWmYclC3GstSwjeeXuax1qmA3Sxfqr6zGoRLUs5TM8GysZmjFphwAx4Egex zc9Y0UwvXBiZhXmGwYD/0dw9s6WtGEXwFpuYY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709160872; x=1709765672; 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=fjNMpRyzx1o5ChTSFYaAgokjl1iX8X34MVn643sMmDc=; b=Jn+MxcYfAZ0YaefBTWCtD2tubDT5m5quCKNoy19LGh9Qn1Ob/Xefue5ovR3tsZZU5u Qym2pXhwQEQfLVSbCttLIomi+BneEzcDVeu0vAmFjqrtdD/xb/BHz3pkXUpAy83s16AQ 79tKIzy8NgS6cgDvAKujbyWyXRnjfIKLijl3+z51K2VdUzOBdajyyIUqNsBpXPpBfTK7 CKO5afzSVAzOA3NK0V+YdVE+8zrjbxB6lRgewXnlVHo7vt2oM4kRzjFgk9MmqgVMtRMU yie/3E2YYja4GXCeZo1uaX5cA+KqRp8eMu6ujIFVzdBpkcBcJznMkm5hvNDLzWjdgL48 UrHw== X-Gm-Message-State: AOJu0YxltVgI8nqf27IF/RoJJyGVpGzFfjNlK+O/x4cXXQG2L1FHrItz 1xkTAo8VJV5hKNg7kc667TBPuuhE+zZU/ZlNa99QkntUsv+2AgUbK6550/geXKntJ+Bx7nAYa+q MUh8hyuiTu+2vm99TIcyC259WydceLKFQlDV3Yrv9J4jQgiom8u+bdBKJu2r/Jjs2vjXd6rs+D3 JEIl7WZUN6lFeEX2xE6454kLimLt709cMnGm18n0xiBKZa X-Google-Smtp-Source: AGHT+IGZW1uqGMT0XDvduJRVSy4t4jAgcgn8W+fI4wcrEmlYbvGkJWelbm2tWhSBORJ6ntWjT76sjw== X-Received: by 2002:a05:6808:ab8:b0:3c0:443c:84bb with SMTP id r24-20020a0568080ab800b003c0443c84bbmr339469oij.59.1709160871908; Wed, 28 Feb 2024 14:54:31 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id b1-20020ac812c1000000b0042e3468a98csm95036qtj.4.2024.02.28.14.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 14:54:31 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: horms@kernel.org, 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 v3 6/6] net: bcmasp: Add support for PHY interrupts Date: Wed, 28 Feb 2024 14:54:00 -0800 Message-Id: <20240228225400.3509156-7-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240228225400.3509156-1-justin.chen@broadcom.com> References: <20240228225400.3509156-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 25b03d32d791..dd06b68b33ed 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) {