[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206043055.177004-3-kylehendrydev@gmail.com>
Date: Wed, 5 Feb 2025 20:30:46 -0800
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>,
Russell King <linux@...linux.org.uk>
Cc: Kyle Hendry <kylehendrydev@...il.com>,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/4] net: dsa: b53: mmap: Add gphy control register as a resource
Give b53 driver access to the gphy control register by passing
it in as an optional second reg in the device tree.
Signed-off-by: Kyle Hendry <kylehendrydev@...il.com>
---
drivers/net/dsa/b53/b53_mmap.c | 8 +++++++-
include/linux/platform_data/b53.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/b53/b53_mmap.c b/drivers/net/dsa/b53/b53_mmap.c
index c687360a5b7f..8157f9871133 100644
--- a/drivers/net/dsa/b53/b53_mmap.c
+++ b/drivers/net/dsa/b53/b53_mmap.c
@@ -28,6 +28,7 @@
struct b53_mmap_priv {
void __iomem *regs;
+ void __iomem *gphy_ctrl;
};
static int b53_mmap_read8(struct b53_device *dev, u8 page, u8 reg, u8 *val)
@@ -251,7 +252,7 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
struct device_node *of_ports, *of_port;
struct device *dev = &pdev->dev;
struct b53_platform_data *pdata;
- void __iomem *mem;
+ void __iomem *mem, *gphy_ctrl;
mem = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(mem))
@@ -266,6 +267,10 @@ static int b53_mmap_probe_of(struct platform_device *pdev,
pdata->chip_id = (u32)(unsigned long)device_get_match_data(dev);
pdata->big_endian = of_property_read_bool(np, "big-endian");
+ gphy_ctrl = devm_platform_ioremap_resource(pdev, 1);
+ if (!IS_ERR(gphy_ctrl))
+ pdata->gphy_ctrl = gphy_ctrl;
+
of_ports = of_get_child_by_name(np, "ports");
if (!of_ports) {
dev_err(dev, "no ports child node found\n");
@@ -312,6 +317,7 @@ static int b53_mmap_probe(struct platform_device *pdev)
return -ENOMEM;
priv->regs = pdata->regs;
+ priv->gphy_ctrl = pdata->gphy_ctrl;
dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, priv);
if (!dev)
diff --git a/include/linux/platform_data/b53.h b/include/linux/platform_data/b53.h
index 6f6fed2b171d..ed73287e8ac5 100644
--- a/include/linux/platform_data/b53.h
+++ b/include/linux/platform_data/b53.h
@@ -32,6 +32,7 @@ struct b53_platform_data {
/* only used by MMAP'd driver */
unsigned big_endian:1;
void __iomem *regs;
+ void __iomem *gphy_ctrl;
};
#endif
--
2.43.0
Powered by blists - more mailing lists