mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-30 10:39:04 +00:00
7305e2057a
With kernel 4.19 the DMA API relies on a struct device to work properly. Backport upstream patches which passed a struct device instead of NULL to the DMA API. Fixes kernel panics during boot. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Mathias Kresin <dev@kresin.me>
38 lines
989 B
Diff
38 lines
989 B
Diff
--- a/drivers/net/ethernet/lantiq_etop.c
|
|
+++ b/drivers/net/ethernet/lantiq_etop.c
|
|
@@ -40,6 +40,7 @@
|
|
#include <linux/of_net.h>
|
|
#include <linux/of_irq.h>
|
|
#include <linux/of_platform.h>
|
|
+#include <linux/of_mdio.h>
|
|
|
|
#include <asm/checksum.h>
|
|
|
|
@@ -571,7 +572,8 @@ static int
|
|
ltq_etop_mdio_init(struct net_device *dev)
|
|
{
|
|
struct ltq_etop_priv *priv = netdev_priv(dev);
|
|
- int err;
|
|
+ struct device_node *mdio_np = NULL;
|
|
+ int err, ret;
|
|
|
|
priv->mii_bus = mdiobus_alloc();
|
|
if (!priv->mii_bus) {
|
|
@@ -591,7 +593,15 @@ ltq_etop_mdio_init(struct net_device *de
|
|
priv->mii_bus->name = "ltq_mii";
|
|
snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
|
|
priv->pdev->name, priv->pdev->id);
|
|
- if (mdiobus_register(priv->mii_bus)) {
|
|
+
|
|
+ mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus");
|
|
+
|
|
+ if (mdio_np)
|
|
+ ret = of_mdiobus_register(priv->mii_bus, mdio_np);
|
|
+ else
|
|
+ ret = mdiobus_register(priv->mii_bus);
|
|
+
|
|
+ if (ret) {
|
|
err = -ENXIO;
|
|
goto err_out_free_mdiobus;
|
|
}
|