Skip to contentSkip to conversation

stmmac: Add device-tree support

PATCH Superseded Stefan Roese 3 participants 8 messages Mar 13, 2012 1 message not in the archive

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 stmmac: Add device-tree support

This patch adds support to configure the STMMAC ethernet driver via device-tree instead of platform_data.

Currently, only the properties needed on SPEAr600 are provided. All other properties should be added once needed on other platforms.

Cc Giuseppe Cavallaro <[email protected]>

---
v2:
- Renamed stm -> st
- Renamed compatible to "st,spear600-gmac"
- Removed "prog-burst-len", "had-gmac", has-pmt" properties. They are now implicitly set for "st,spear600-gmac" compatible devices.
- Removed phy-addr
- Used "if (pdev->dev.of_node)" to distinguish between DT and non-DT version instead of #ifdef

 Documentation/devicetree/bindings/net/stmmac.txt   |   28 ++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   76 +++++++++++++++++++-
 2 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/stmmac.txt
Documentation/devicetree/bindings/net/stmmac.txt new file +28 -0
new file mode 100644
index 0000000..a91f4e1
@@ -0,0 +1,28 @@
+* STMicroelectronics 10/100/1000 Ethernet driver (GMAC)
+
+Required properties:
+- compatible: Should be "st,spear600-gmac"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the STMMAC interrupts
+- interrupt-names: Should contain the interrupt names "macirq"
+  "eth_wake_irq" if this interrupt is supported in the "interrupts"
+  property
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "mii", "rmii", "gmii", "rgmii".
+
+Optional properties:
+- mac-address: 6 bytes, mac address
+
+Examples:
+
+	gmac0: stmmac@e0800000 {
+		compatible = "st,spear600-gmac";
+		reg = <0xe0800000 0x8000>;
+		interrupt-parent = <&vic1>;
+		interrupts = <24 23>;
+		interrupt-names = "macirq", "eth_wake_irq";
+		mac-address = [000000000000]; /* Filled in by U-Boot */
+		phy-mode = "gmii";
+	};
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +74 -2

114 lines not on this page · raw message

Signature · 1 line
1.7.9.2
#1 lore raw
Quoted 7 lines · Stefan Roese
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +5 -0
 
+#ifdef CONFIG_OF
+static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
+					    struct plat_stmmacenet_data *plat,
+					    const char **mac)
+{

<snip...>

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 67

Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7 -0
+}
+#else
+static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
+					    struct plat_stmmacenet_data *plat,
+					    const char **mac)
+{
+	return ERR_PTR(-ENOSYS);

why ERR_PTR()?

Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
+}
+#endif /* CONFIG_OF */
+
 /**
  * stmmac_pltfr_probe
  * @pdev: platform device pointer
@@ -58,7 +101,25 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 		ret = -ENOMEM;

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_pltfr_probe(struct platform_device *pdev) · line 110

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7 -1
 		goto out_release_region;
 	}
-	plat_dat = pdev->dev.platform_data;
+
+	if (pdev->dev.of_node) {
+		plat_dat = devm_kzalloc(&pdev->dev,
+					sizeof(struct plat_stmmacenet_data),
+					GFP_KERNEL);
+		if (!plat_dat) {
+			pr_err("%s: ERROR: no memory", __func__);

why don't we use dev_err here?

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_pltfr_probe(struct platform_device *pdev) · line 117

Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +7 -0
+			ret = -ENOMEM;
+			goto out_unmap;
+		}
+
+		ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
+		if (ret) {
+			pr_err("%s: main dt probe failed", __func__);

here too?

Signature · 1 line
viresh
#2 lore raw
Quoted 7 lines · On Tuesday 13 March 2012 09:53:06 Viresh Kumar wrote:
Quoted 6 lines · Stefan Roese
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -0
 
+#ifdef CONFIG_OF
+static int __devinit stmmac_probe_config_dt(struct platform_device

*pdev, + struct

plat_stmmacenet_data *plat,

Quoted 9 lines
Quoted 2 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -0
+					    const char **mac)
+{

<snip...>

Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
+}
+#else
+static int __devinit stmmac_probe_config_dt(struct platform_device

*pdev, + struct

plat_stmmacenet_data *plat,

Quoted 5 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 67

Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
+					    const char **mac)
+{
+	return ERR_PTR(-ENOSYS);

why ERR_PTR()?

Thanks for spotting. Will fix in next version.

Quoted 15 lines
Quoted 15 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
+}
+#endif /* CONFIG_OF */
+
 
 /**
 
  * stmmac_pltfr_probe
  * @pdev: platform device pointer
@@ -58,7 +101,25 @@ static int stmmac_pltfr_probe(struct platform_device
 *pdev)
 
 		ret = -ENOMEM;
 		goto out_release_region;
 
Quoted 7 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_pltfr_probe(struct platform_device *pdev)

Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +4 -1
 	}
 
-	plat_dat = pdev->dev.platform_data;
+
+	if (pdev->dev.of_node) {
+		plat_dat = devm_kzalloc(&pdev->dev,
+					sizeof(struct 

plat_stmmacenet_data),

Quoted 5 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_pltfr_probe(struct platform_device *pdev) · line 110

Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +3 -0
+					GFP_KERNEL);
+		if (!plat_dat) {
+			pr_err("%s: ERROR: no memory", __func__);

why don't we use dev_err here?

Consistency. pr_err is used in this driver. So I'm sticking to it with this patch as well.

Thanks,
Stefan

#3 lore raw
Quoted 2 lines · Stefan Roese

Consistency. pr_err is used in this driver. So I'm sticking to it with this patch as well.

Hmmm. I don't know, but can you add another patch before this one to move those prints.

Signature · 1 line
viresh
#4 lore raw
Quoted 6 lines · On Tuesday 13 March 2012 12:11:18 Viresh Kumar wrote:
Quoted 2 lines · Stefan Roese

Consistency. pr_err is used in this driver. So I'm sticking to it with this patch as well.

Hmmm. I don't know, but can you add another patch before this one to move those prints.

Sure, I could. But I have to admit that this is currently not top of my priority.

Peppe as driver maintainer might have some input here. Is this dev_err vs pr_err a show-stopper for this patch?

Thanks,
Stefan

#5 lore raw
Quoted 2 lines · Stefan Roese

Peppe as driver maintainer might have some input here. Is this dev_err vs pr_err a show-stopper for this patch?

Not really :)

Signature · 1 line
viresh
#7 lore raw
In reply to a message not in the archive
Quoted 40 lines · Stefan Roese

This patch adds support to configure the STMMAC ethernet driver via device-tree instead of platform_data.

Currently, only the properties needed on SPEAr600 are provided. All other properties should be added once needed on other platforms.

Cc Giuseppe Cavallaro <[email protected]>

---
v2:
- Renamed stm -> st
- Renamed compatible to "st,spear600-gmac"
- Removed "prog-burst-len", "had-gmac", has-pmt" properties. They are now implicitly set for "st,spear600-gmac" compatible devices.
- Removed phy-addr
- Used "if (pdev->dev.of_node)" to distinguish between DT and non-DT version instead of #ifdef

 Documentation/devicetree/bindings/net/stmmac.txt   |   28 ++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   76 +++++++++++++++++++-
 2 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/stmmac.txt
Documentation/devicetree/bindings/net/stmmac.txt new file +10 -0
new file mode 100644
index 0000000..a91f4e1
@@ -0,0 +1,28 @@
+* STMicroelectronics 10/100/1000 Ethernet driver (GMAC)
+
+Required properties:
+- compatible: Should be "st,spear600-gmac"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the STMMAC interrupts
+- interrupt-names: Should contain the interrupt names "macirq"
+  "eth_wake_irq" if this interrupt is supported in the "interrupts"

Documentation/devicetree/bindings/net/stmmac.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/net/stmmac.txt new file +10 -0
+  property
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "mii", "rmii", "gmii", "rgmii".
+
+Optional properties:
+- mac-address: 6 bytes, mac address
+
+Examples:
+
+	gmac0: stmmac@e0800000 {

Use generic names: gmac0: ethernet@e0800000

Quoted 24 lines
Documentation/devicetree/bindings/net/stmmac.txt new file +8 -0
+		compatible = "st,spear600-gmac";
+		reg = <0xe0800000 0x8000>;
+		interrupt-parent = <&vic1>;
+		interrupts = <24 23>;
+		interrupt-names = "macirq", "eth_wake_irq";
+		mac-address = [000000000000]; /* Filled in by U-Boot */
+		phy-mode = "gmii";
+	};
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +6 -0
index 3aad981..ed8b477 100644
@@ -24,8 +24,50 @@
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_net.h>
 #include "stmmac.h"
 
+#ifdef CONFIG_OF
+static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
+					    struct plat_stmmacenet_data *plat,
+					    const char **mac)

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 44

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +10 -0
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	if (!np)
+		return -ENODEV;
+
+	*mac = of_get_mac_address(np);
+
+	plat->interface = of_get_phy_mode(np);
+	of_property_read_u32(np, "phy-addr", &plat->phy_addr);

This property doesn't exist anymore.

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 54

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +10 -0
+	plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
+					   sizeof(struct stmmac_mdio_bus_data),
+					   GFP_KERNEL);
+
+	/*
+	 * Currently only the properties needed on SPEAr600
+	 * are provided. All other properties should be added
+	 * once needed on other platforms.
+	 */
+        if (of_device_is_compatible(np, "st,spear600-gmac")) {

indent is using spaces.

Quoted 88 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +48 -2
+		plat->pbl = 8;
+		plat->has_gmac = 1;
+		plat->pmt = 1;
+	}
+
+	return 0;
+}
+#else
+static int __devinit stmmac_probe_config_dt(struct platform_device *pdev,
+					    struct plat_stmmacenet_data *plat,
+					    const char **mac)
+{
+	return ERR_PTR(-ENOSYS);
+}
+#endif /* CONFIG_OF */
+
 /**
  * stmmac_pltfr_probe
  * @pdev: platform device pointer
@@ -39,7 +81,8 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 	struct resource *res;
 	void __iomem *addr = NULL;
 	struct stmmac_priv *priv = NULL;
-	struct plat_stmmacenet_data *plat_dat;
+	struct plat_stmmacenet_data *plat_dat = NULL;
+	const char *mac = NULL;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
@@ -58,7 +101,25 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 		ret = -ENOMEM;
 		goto out_release_region;
 	}
-	plat_dat = pdev->dev.platform_data;
+
+	if (pdev->dev.of_node) {
+		plat_dat = devm_kzalloc(&pdev->dev,
+					sizeof(struct plat_stmmacenet_data),
+					GFP_KERNEL);
+		if (!plat_dat) {
+			pr_err("%s: ERROR: no memory", __func__);
+			ret = -ENOMEM;
+			goto out_unmap;
+		}
+
+		ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
+		if (ret) {
+			pr_err("%s: main dt probe failed", __func__);
+			goto out_unmap;
+		}
+	} else {
+		plat_dat = pdev->dev.platform_data;
+	}
 
 	/* Custom initialisation (if needed)*/
 	if (plat_dat->init) {
@@ -73,6 +134,10 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
 		goto out_unmap;
 	}
 
+	/* Get MAC address if available (DT) */
+	if (mac)
+		memcpy(priv->dev->dev_addr, mac, ETH_ALEN);
+
 	/* Get the MAC information */
 	priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
 	if (priv->dev->irq == -ENXIO) {
@@ -178,6 +243,12 @@ static const struct dev_pm_ops stmmac_pltfr_pm_ops = {
 static const struct dev_pm_ops stmmac_pltfr_pm_ops;
 #endif /* CONFIG_PM */
 
+static const struct of_device_id stmmac_dt_ids[] = {
+	{ .compatible = "st,spear600-gmac", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
+
 static struct platform_driver stmmac_driver = {
 	.probe = stmmac_pltfr_probe,
 	.remove = stmmac_pltfr_remove,
@@ -185,6 +256,7 @@ static struct platform_driver stmmac_driver = {
 		   .name = STMMAC_RESOURCE_NAME,
 		   .owner = THIS_MODULE,
 		   .pm = &stmmac_pltfr_pm_ops,
+		   .of_match_table = of_match_ptr(stmmac_dt_ids),
 		   },
 };
 
#8 lore raw

Rob,

thanks for the review. I'll fix the issues and send an updated patch version.

Stefan

Quoted 75 lines · On Tuesday 13 March 2012 15:18:59 Rob Herring wrote:
Quoted 43 lines · Stefan Roese

This patch adds support to configure the STMMAC ethernet driver via device-tree instead of platform_data.

Currently, only the properties needed on SPEAr600 are provided. All other properties should be added once needed on other platforms.

Cc Giuseppe Cavallaro <[email protected]>

---
v2:
- Renamed stm -> st
- Renamed compatible to "st,spear600-gmac"
- Removed "prog-burst-len", "had-gmac", has-pmt" properties.

They are now implicitly set for "st,spear600-gmac" compatible devices.

- Removed phy-addr
- Used "if (pdev->dev.of_node)" to distinguish between DT

and non-DT version instead of #ifdef

 Documentation/devicetree/bindings/net/stmmac.txt   |   28 ++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |   76
 +++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/stmmac.txt
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/net/stmmac.txt new file mode 100644 index 0000000..a91f4e1

Documentation/devicetree/bindings/net/stmmac.txt new file +10 -0
@@ -0,0 +1,28 @@
+* STMicroelectronics 10/100/1000 Ethernet driver (GMAC)
+
+Required properties:
+- compatible: Should be "st,spear600-gmac"
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the STMMAC interrupts
+- interrupt-names: Should contain the interrupt names "macirq"
+  "eth_wake_irq" if this interrupt is supported in the "interrupts"

Documentation/devicetree/bindings/net/stmmac.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/net/stmmac.txt new file +10 -0
+  property
+- phy-mode: String, operation mode of the PHY interface.
+  Supported values are: "mii", "rmii", "gmii", "rgmii".
+
+Optional properties:
+- mac-address: 6 bytes, mac address
+
+Examples:
+
+	gmac0: stmmac@e0800000 {

Use generic names: gmac0: ethernet@e0800000

Quoted 18 lines
Documentation/devicetree/bindings/net/stmmac.txt new file +8 -0
+		compatible = "st,spear600-gmac";
+		reg = <0xe0800000 0x8000>;
+		interrupt-parent = <&vic1>;
+		interrupts = <24 23>;
+		interrupt-names = "macirq", "eth_wake_irq";
+		mac-address = [000000000000]; /* Filled in by U-Boot */
+		phy-mode = "gmii";
+	};
(quoted diff) +0 -0

b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3aad981..ed8b477 100644

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 -0
@@ -24,8 +24,50 @@
 
 #include <linux/platform_device.h>
 #include <linux/io.h>
 
Quoted 8 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +4 -0
+#include <linux/of.h>
+#include <linux/of_net.h>
 
 #include "stmmac.h"
 
+#ifdef CONFIG_OF
+static int __devinit stmmac_probe_config_dt(struct platform_device
 *pdev, +					    struct 

plat_stmmacenet_data *plat,

Quoted 14 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 44

Quoted 11 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +11 -0
+					    const char **mac)
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	if (!np)
+		return -ENODEV;
+
+	*mac = of_get_mac_address(np);
+
+	plat->interface = of_get_phy_mode(np);
+	of_property_read_u32(np, "phy-addr", &plat->phy_addr);

This property doesn't exist anymore.

Quoted 2 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 48

Quoted 2 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 -0
+	plat->mdio_bus_data = devm_kzalloc(&pdev->dev,
+					   sizeof(struct 

stmmac_mdio_bus_data),

Quoted 11 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c line 54

Quoted 8 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +8 -0
+					   GFP_KERNEL);
+
+	/*
+	 * Currently only the properties needed on SPEAr600
+	 * are provided. All other properties should be added
+	 * once needed on other platforms.
+	 */
+        if (of_device_is_compatible(np, "st,spear600-gmac")) {

indent is using spaces.

Quoted 10 lines
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +9 -0
+		plat->pbl = 8;
+		plat->has_gmac = 1;
+		plat->pmt = 1;
+	}
+
+	return 0;
+}
+#else
+static int __devinit stmmac_probe_config_dt(struct platform_device

*pdev, + struct

plat_stmmacenet_data *plat,

Quoted 32 lines
Quoted 32 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +8 -1
+					    const char **mac)
+{
+	return ERR_PTR(-ENOSYS);
+}
+#endif /* CONFIG_OF */
+
 
 /**
 
  * stmmac_pltfr_probe
  * @pdev: platform device pointer
@@ -39,7 +81,8 @@ static int stmmac_pltfr_probe(struct platform_device
 *pdev)
 
 	struct resource *res;
 	void __iomem *addr = NULL;
 	struct stmmac_priv *priv = NULL;
 
-	struct plat_stmmacenet_data *plat_dat;
+	struct plat_stmmacenet_data *plat_dat = NULL;
+	const char *mac = NULL;
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +0 -0
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res)
@@ -58,7 +101,25 @@ static int stmmac_pltfr_probe(struct platform_device
 *pdev)
 
 		ret = -ENOMEM;
 		goto out_release_region;
 
Quoted 7 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c static int stmmac_pltfr_probe(struct platform_device *pdev)

Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +4 -1
 	}
 
-	plat_dat = pdev->dev.platform_data;
+
+	if (pdev->dev.of_node) {
+		plat_dat = devm_kzalloc(&pdev->dev,
+					sizeof(struct 

plat_stmmacenet_data),

Quoted 64 lines
Quoted 64 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +19 -0
+					GFP_KERNEL);
+		if (!plat_dat) {
+			pr_err("%s: ERROR: no memory", __func__);
+			ret = -ENOMEM;
+			goto out_unmap;
+		}
+
+		ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
+		if (ret) {
+			pr_err("%s: main dt probe failed", __func__);
+			goto out_unmap;
+		}
+	} else {
+		plat_dat = pdev->dev.platform_data;
+	}
 
 	/* Custom initialisation (if needed)*/
 	if (plat_dat->init) {
@@ -73,6 +134,10 @@ static int stmmac_pltfr_probe(struct platform_device
 *pdev)
 
 		goto out_unmap;
 
 	}
 
+	/* Get MAC address if available (DT) */
+	if (mac)
+		memcpy(priv->dev->dev_addr, mac, ETH_ALEN);
+
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +6 -0
 	/* Get the MAC information */
 	priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
 	if (priv->dev->irq == -ENXIO) {
@@ -178,6 +243,12 @@ static const struct dev_pm_ops stmmac_pltfr_pm_ops =
 {
 
 static const struct dev_pm_ops stmmac_pltfr_pm_ops;
 #endif /* CONFIG_PM */
 
+static const struct of_device_id stmmac_dt_ids[] = {
+	{ .compatible = "st,spear600-gmac", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
+
 

static struct platform_driver stmmac_driver = {

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 -0
 	.probe = stmmac_pltfr_probe,
 	.remove = stmmac_pltfr_remove,
@@ -185,6 +256,7 @@ static struct platform_driver stmmac_driver = {
 
 		   .name = STMMAC_RESOURCE_NAME,
 		   .owner = THIS_MODULE,
 		   .pm = &stmmac_pltfr_pm_ops,
 
+		   .of_match_table = of_match_ptr(stmmac_dt_ids),
 

},

};