---help---
          Support for NXP LPC18xx/43xx DWMAC Ethernet.
 
+config DWMAC_MESON
+       tristate "Amlogic Meson dwmac support"
+       default ARCH_MESON
+       depends on OF
+       help
+         Support for Ethernet controller on Amlogic Meson SoCs.
+
+         This selects the Amlogic Meson SoC glue layer support for
+         the stmmac device driver. This driver is used for Meson6 and
+         Meson8 SoCs.
+
 endif
 
 config STMMAC_PCI
 
 # Ordering matters. Generic driver must be last.
 obj-$(CONFIG_STMMAC_PLATFORM)  += stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)    += dwmac-lpc18xx.o
+obj-$(CONFIG_DWMAC_MESON)      += dwmac-meson.o
 obj-$(CONFIG_DWMAC_GENERIC)    += dwmac-generic.o
-stmmac-platform-objs:= stmmac_platform.o dwmac-meson.o dwmac-sunxi.o   \
+stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
                       dwmac-sti.o dwmac-socfpga.o dwmac-rk.o           \
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 
 #include <linux/ethtool.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/stmmac.h>
 
        return dwmac;
 }
 
-const struct stmmac_of_data meson6_dwmac_data = {
+static const struct stmmac_of_data meson6_dwmac_data = {
        .setup          = meson6_dwmac_setup,
        .fix_mac_speed  = meson6_dwmac_fix_mac_speed,
 };
+
+static const struct of_device_id meson6_dwmac_match[] = {
+       { .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
+       { }
+};
+MODULE_DEVICE_TABLE(of, meson6_dwmac_match);
+
+static struct platform_driver meson6_dwmac_driver = {
+       .probe  = stmmac_pltfr_probe,
+       .remove = stmmac_pltfr_remove,
+       .driver = {
+               .name           = "meson6-dwmac",
+               .pm             = &stmmac_pltfr_pm_ops,
+               .of_match_table = meson6_dwmac_match,
+       },
+};
+module_platform_driver(meson6_dwmac_driver);
+
+MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
+MODULE_DESCRIPTION("Amlogic Meson DWMAC glue layer");
+MODULE_LICENSE("GPL v2");
 
 static const struct of_device_id stmmac_dt_ids[] = {
        /* SoC specific glue layers should come before generic bindings */
        { .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
-       { .compatible = "amlogic,meson6-dwmac", .data = &meson6_dwmac_data},
        { .compatible = "allwinner,sun7i-a20-gmac", .data = &sun7i_gmac_data},
        { .compatible = "st,stih415-dwmac", .data = &stih4xx_dwmac_data},
        { .compatible = "st,stih416-dwmac", .data = &stih4xx_dwmac_data},
 
 int stmmac_pltfr_remove(struct platform_device *pdev);
 extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
 
-extern const struct stmmac_of_data meson6_dwmac_data;
 extern const struct stmmac_of_data sun7i_gmac_data;
 extern const struct stmmac_of_data stih4xx_dwmac_data;
 extern const struct stmmac_of_data stid127_dwmac_data;