lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250620134132.5195-5-kylehendrydev@gmail.com>
Date: Fri, 20 Jun 2025 06:41:19 -0700
From: Kyle Hendry <kylehendrydev@...il.com>
To: Florian Fainelli <florian.fainelli@...adcom.com>,
	Andrew Lunn <andrew@...n.ch>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Russell King <linux@...linux.org.uk>
Cc: noltari@...il.com,
	jonas.gorski@...il.com,
	Kyle Hendry <kylehendrydev@...il.com>,
	Florian Fainelli <f.fainelli@...il.com>,
	netdev@...r.kernel.org,
	devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [RFC PATCH net-next 4/6] net: dsa: b53: mmap: Add register layout for bcm63268

Add a structure to describe the ephy control register.
Add table with single entry for bcm63268. When probing,
try to match table entry with the chip_id.

Signed-off-by: Kyle Hendry <kylehendrydev@...il.com>
---
 drivers/net/dsa/b53/b53_mmap.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/b53/b53_mmap.c b/drivers/net/dsa/b53/b53_mmap.c
index a0c06d703861..1bebf5b9826b 100644
--- a/drivers/net/dsa/b53/b53_mmap.c
+++ b/drivers/net/dsa/b53/b53_mmap.c
@@ -27,9 +27,31 @@
 
 #include "b53_priv.h"
 
+struct b53_phy_info {
+	u32 chip_id;
+	u32 mask;
+	u32 num_ephy;
+	const u32 *ephy_offset;
+};
+
 struct b53_mmap_priv {
 	void __iomem *regs;
 	struct regmap *gpio_ctrl;
+	const struct b53_phy_info *phy_info;
+};
+
+static const u32 bcm63268_ephy_offsets[] = {4, 9, 14};
+
+static const struct b53_phy_info bcm63xx_ephy_info[] = {
+	{
+		/* 6318 has different reg layout,
+		 * need to distinguish it somehow
+		 */
+		.chip_id = BCM63268_DEVICE_ID,
+		.mask = GENMASK(4, 0),
+		.num_ephy = ARRAY_SIZE(bcm63268_ephy_offsets),
+		.ephy_offset = bcm63268_ephy_offsets,
+	}
 };
 
 static int b53_mmap_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
@@ -296,7 +318,7 @@ static int b53_mmap_probe(struct platform_device *pdev)
 	struct b53_platform_data *pdata = pdev->dev.platform_data;
 	struct b53_mmap_priv *priv;
 	struct b53_device *dev;
-	int ret;
+	int i, ret;
 
 	if (!pdata && np) {
 		ret = b53_mmap_probe_of(pdev, &pdata);
@@ -316,6 +338,14 @@ static int b53_mmap_probe(struct platform_device *pdev)
 	priv->regs = pdata->regs;
 
 	priv->gpio_ctrl = syscon_regmap_lookup_by_phandle(np, "brcm,gpio-ctrl");
+	if (!IS_ERR(priv->gpio_ctrl)) {
+		for (i = 0; i < ARRAY_SIZE(bcm63xx_ephy_info); i++) {
+			if (bcm63xx_ephy_info[i].chip_id == pdata->chip_id) {
+				priv->phy_info = &bcm63xx_ephy_info[i];
+				break;
+			}
+		}
+	}
 
 	dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, priv);
 	if (!dev)
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ