From: Marcin Wojtas <mw@semihalf.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, linux@armlinux.org.uk,
jaz@semihalf.com, gjb@semihalf.com, upstream@semihalf.com,
Samer.El-Haj-Mahmoud@arm.com, jon@solid-run.com,
Marcin Wojtas <mw@semihalf.com>
Subject: [net-next: PATCH 1/3] net: mvmdio: add ACPI support
Date: Sun, 13 Jun 2021 20:35:18 +0200 [thread overview]
Message-ID: <20210613183520.2247415-2-mw@semihalf.com> (raw)
In-Reply-To: <20210613183520.2247415-1-mw@semihalf.com>
This patch introducing ACPI support for the mvmdio driver by adding
acpi_match_table with two entries:
* "MRVL0100" for the SMI operation
* "MRVL0101" for the XSMI mode
Also clk enabling is skipped, because the tables do not contain
such data and clock maintenance relies on the firmware.
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
drivers/net/ethernet/marvell/mvmdio.c | 27 +++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index d14762d93640..e66355a0f546 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -17,6 +17,8 @@
* warranty of any kind, whether express or implied.
*/
+#include <linux/acpi.h>
+#include <linux/acpi_mdio.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
@@ -281,7 +283,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
struct orion_mdio_dev *dev;
int i, ret;
- type = (enum orion_mdio_bus_type)of_device_get_match_data(&pdev->dev);
+ type = (enum orion_mdio_bus_type)device_get_match_data(&pdev->dev);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!r) {
@@ -336,7 +338,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
dev_warn(&pdev->dev,
"unsupported number of clocks, limiting to the first "
__stringify(ARRAY_SIZE(dev->clk)) "\n");
- } else {
+ } else if (!has_acpi_companion(&pdev->dev)) {
dev->clk[0] = clk_get(&pdev->dev, NULL);
if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER;
@@ -369,7 +371,12 @@ static int orion_mdio_probe(struct platform_device *pdev)
goto out_mdio;
}
- ret = of_mdiobus_register(bus, pdev->dev.of_node);
+ if (pdev->dev.of_node)
+ ret = of_mdiobus_register(bus, pdev->dev.of_node);
+ else if (is_acpi_node(pdev->dev.fwnode))
+ ret = acpi_mdiobus_register(bus, pdev->dev.fwnode);
+ else
+ ret = -EINVAL;
if (ret < 0) {
dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret);
goto out_mdio;
@@ -383,6 +390,9 @@ static int orion_mdio_probe(struct platform_device *pdev)
if (dev->err_interrupt > 0)
writel(0, dev->regs + MVMDIO_ERR_INT_MASK);
+ if (has_acpi_companion(&pdev->dev))
+ return ret;
+
out_clk:
for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
if (IS_ERR(dev->clk[i]))
@@ -404,6 +414,9 @@ static int orion_mdio_remove(struct platform_device *pdev)
writel(0, dev->regs + MVMDIO_ERR_INT_MASK);
mdiobus_unregister(bus);
+ if (has_acpi_companion(&pdev->dev))
+ return 0;
+
for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
if (IS_ERR(dev->clk[i]))
break;
@@ -421,12 +434,20 @@ static const struct of_device_id orion_mdio_match[] = {
};
MODULE_DEVICE_TABLE(of, orion_mdio_match);
+static const struct acpi_device_id orion_mdio_acpi_match[] = {
+ { "MRVL0100", BUS_TYPE_SMI },
+ { "MRVL0101", BUS_TYPE_XSMI },
+ { },
+};
+MODULE_DEVICE_TABLE(acpi, orion_mdio_acpi_match);
+
static struct platform_driver orion_mdio_driver = {
.probe = orion_mdio_probe,
.remove = orion_mdio_remove,
.driver = {
.name = "orion-mdio",
.of_match_table = orion_mdio_match,
+ .acpi_match_table = ACPI_PTR(orion_mdio_acpi_match),
},
};
--
2.29.0
next prev parent reply other threads:[~2021-06-13 18:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-13 18:35 [net-next: PATCH 0/3] ACPI MDIO support for Marvell controllers Marcin Wojtas
2021-06-13 18:35 ` Marcin Wojtas [this message]
2021-06-13 19:20 ` [net-next: PATCH 1/3] net: mvmdio: add ACPI support Andrew Lunn
2021-06-15 15:13 ` Marcin Wojtas
2021-06-15 19:53 ` Andy Shevchenko
2021-06-13 19:34 ` Andrew Lunn
[not found] ` <CAHp75VdMsYJMCwH2o14e7nJBTj6A38dkcZJ+0WQfnW=keOyoAg@mail.gmail.com>
2021-06-15 15:09 ` Marcin Wojtas
2021-06-15 19:50 ` Andy Shevchenko
2021-06-13 18:35 ` [net-next: PATCH 2/3] net: mvpp2: enable using phylink with ACPI Marcin Wojtas
2021-06-13 18:44 ` Russell King (Oracle)
2021-06-13 20:53 ` Marcin Wojtas
2021-06-13 19:47 ` Andrew Lunn
2021-06-13 21:21 ` Marcin Wojtas
2021-06-13 21:35 ` Andrew Lunn
2021-06-13 23:46 ` Marcin Wojtas
2021-06-14 0:08 ` Andrew Lunn
2021-06-13 18:35 ` [net-next: PATCH 3/3] net: mvpp2: remove unused 'has_phy' field Marcin Wojtas
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=20210613183520.2247415-2-mw@semihalf.com \
--to=mw@semihalf.com \
--cc=Samer.El-Haj-Mahmoud@arm.com \
--cc=davem@davemloft.net \
--cc=gjb@semihalf.com \
--cc=jaz@semihalf.com \
--cc=jon@solid-run.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=upstream@semihalf.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).