From: Jeremy Linton <jeremy.linton@arm.com>
To: netdev@vger.kernel.org
Cc: opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org, wahrenst@gmx.net, andrew@lunn.ch,
hkallweit1@gmail.com, Jeremy Linton <jeremy.linton@arm.com>
Subject: [PATCH 4/6] net: bcmgenet: Initial bcmgenet ACPI support
Date: Sat, 1 Feb 2020 01:46:23 -0600 [thread overview]
Message-ID: <20200201074625.8698-5-jeremy.linton@arm.com> (raw)
In-Reply-To: <20200201074625.8698-1-jeremy.linton@arm.com>
The rpi4 is capable of booting in ACPI mode with the latest
edk2-platform commits. As such it would be helpful if the genet
platform device were usable.
To achieve this we add a new MODULE_DEVICE_TABLE, and convert
a few dt specific methods to their generic device_ calls. Until
the next patch, ACPI based machines will fallback on random
mac addresses.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
.../net/ethernet/broadcom/genet/bcmgenet.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 120fa05a39ff..c736700f829e 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) "bcmgenet: " fmt
+#include <linux/acpi.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
@@ -3476,7 +3477,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
const struct bcmgenet_plat_data *pdata;
struct bcmgenet_priv *priv;
struct net_device *dev;
- const void *macaddr;
+ const void *macaddr = NULL;
unsigned int i;
int err = -EIO;
const char *phy_mode_str;
@@ -3510,7 +3511,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
if (dn)
macaddr = of_get_mac_address(dn);
- else
+ else if (pd)
macaddr = pd->mac_address;
priv->base = devm_platform_ioremap_resource(pdev, 0);
@@ -3555,8 +3556,9 @@ static int bcmgenet_probe(struct platform_device *pdev)
priv->dev = dev;
priv->pdev = pdev;
- if (of_id) {
- pdata = of_id->data;
+
+ pdata = device_get_match_data(&pdev->dev);
+ if (pdata) {
priv->version = pdata->version;
priv->dma_max_burst_length = pdata->dma_max_burst_length;
} else {
@@ -3595,7 +3597,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
/* If this is an internal GPHY, power it on now, before UniMAC is
* brought out of reset as absolutely no UniMAC activity is allowed
*/
- if (dn && !of_property_read_string(dn, "phy-mode", &phy_mode_str) &&
+ if (!device_property_read_string(&pdev->dev, "phy-mode", &phy_mode_str) &&
!strcasecmp(phy_mode_str, "internal"))
bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
@@ -3768,6 +3770,12 @@ static int bcmgenet_suspend(struct device *d)
static SIMPLE_DEV_PM_OPS(bcmgenet_pm_ops, bcmgenet_suspend, bcmgenet_resume);
+static const struct acpi_device_id genet_acpi_match[] = {
+ { "BCM6E4E", (kernel_ulong_t)&bcm2711_plat_data },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, genet_acpi_match);
+
static struct platform_driver bcmgenet_driver = {
.probe = bcmgenet_probe,
.remove = bcmgenet_remove,
@@ -3776,6 +3784,7 @@ static struct platform_driver bcmgenet_driver = {
.name = "bcmgenet",
.of_match_table = bcmgenet_match,
.pm = &bcmgenet_pm_ops,
+ .acpi_match_table = ACPI_PTR(genet_acpi_match),
},
};
module_platform_driver(bcmgenet_driver);
--
2.24.1
next prev parent reply other threads:[~2020-02-01 7:46 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-01 7:46 [PATCH 0/6] Add ACPI bindings to the genet Jeremy Linton
2020-02-01 7:46 ` [PATCH 1/6] mdio_bus: Add generic mdio_find_bus() Jeremy Linton
2020-02-01 7:46 ` [PATCH 2/6] net: bcmgenet: refactor phy mode configuration Jeremy Linton
2020-02-01 16:24 ` Florian Fainelli
2020-02-01 19:10 ` Jeremy Linton
2020-02-03 1:17 ` Andrew Lunn
2020-02-03 3:24 ` Florian Fainelli
2020-02-03 18:46 ` Jeremy Linton
2020-02-03 18:55 ` Florian Fainelli
2020-02-05 21:05 ` kbuild test robot
2020-02-01 7:46 ` [PATCH 3/6] net: bcmgenet: enable automatic phy discovery Jeremy Linton
2020-02-01 15:25 ` Andrew Lunn
2020-02-01 19:07 ` Jeremy Linton
2020-02-03 20:55 ` Florian Fainelli
2020-02-03 21:21 ` Andrew Lunn
2020-02-01 20:02 ` Jeremy Linton
2020-02-03 1:15 ` Andrew Lunn
2020-02-03 21:10 ` Jeremy Linton
2020-02-01 7:46 ` Jeremy Linton [this message]
2020-02-01 15:33 ` [PATCH 4/6] net: bcmgenet: Initial bcmgenet ACPI support Andrew Lunn
2020-02-01 19:09 ` Jeremy Linton
2020-02-01 7:46 ` [PATCH 5/6] net: bcmgenet: Fetch MAC address from the adapter Jeremy Linton
2020-02-01 15:37 ` Andrew Lunn
2020-02-01 19:20 ` Jeremy Linton
2020-02-01 7:46 ` [PATCH 6/6] net: bcmgenet: reduce severity of missing clock warnings Jeremy Linton
2020-02-01 16:18 ` Florian Fainelli
2020-02-01 16:44 ` Stefan Wahren
2020-02-01 19:27 ` Jeremy Linton
2020-02-03 18:36 ` Nicolas Saenz Julienne
2020-02-03 19:08 ` Stefan Wahren
2020-02-03 21:21 ` Florian Fainelli
2020-02-05 18:42 ` Stefan Wahren
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=20200201074625.8698-5-jeremy.linton@arm.com \
--to=jeremy.linton@arm.com \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=wahrenst@gmx.net \
/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).