netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kyle Hendry <kylehendrydev@gmail.com>
To: Florian Fainelli <florian.fainelli@broadcom.com>,
	Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>
Cc: Kyle Hendry <kylehendrydev@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] net: dsa: b53: mmap: Add gphy control register as a resource
Date: Wed,  5 Feb 2025 20:30:46 -0800	[thread overview]
Message-ID: <20250206043055.177004-3-kylehendrydev@gmail.com> (raw)
In-Reply-To: <20250206043055.177004-1-kylehendrydev@gmail.com>

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@gmail.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


  parent reply	other threads:[~2025-02-06  4:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06  4:30 [PATCH 0/4] net: dsa: b53: Enable internal GPHY on BCM63268 Kyle Hendry
2025-02-06  4:30 ` [PATCH 1/4] net: dsa: b53: Indicate which BCM63268 port is GPHY Kyle Hendry
2025-02-06  4:30 ` Kyle Hendry [this message]
2025-02-06  4:30 ` [PATCH 3/4] net: dsa: b53: Add phy_enable(), phy_disable() methods Kyle Hendry
2025-02-06  4:30 ` [PATCH 4/4] net: dsa: b53: mmap: Implement phy_enable for BCM63268 gphy Kyle Hendry
2025-02-06 18:15 ` [PATCH 0/4] net: dsa: b53: Enable internal GPHY on BCM63268 Florian Fainelli
2025-02-06 20:17   ` Andrew Lunn
2025-02-07  1:41     ` Kyle Hendry
2025-02-07 16:44       ` Vladimir Oltean
2025-02-07 16:44       ` Florian Fainelli
2025-02-09 23:30         ` Andrew Lunn
2025-02-10 17:25           ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250206043055.177004-3-kylehendrydev@gmail.com \
    --to=kylehendrydev@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).