stmmac: convert dwmac-meson to platform driver
authorJoachim Eastwood <manabian@gmail.com>
Thu, 14 May 2015 10:11:01 +0000 (12:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 May 2015 16:44:22 +0000 (12:44 -0400)
Convert platform glue layer into a proper platform
driver and add it to the build system.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/Kconfig
drivers/net/ethernet/stmicro/stmmac/Makefile
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h

index aa03e26437e218e34987c4d5dac7c76389973f72..a5a56217a8455345f9a27546416440251ea6dc34 100644 (file)
@@ -44,6 +44,17 @@ config DWMAC_LPC18XX
        ---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
index 96a3abfc15bb695cbe95af5ec98125cebe10c7e2..69cc046afd8cdc9da8e333a228f707fb32e6ae67 100644 (file)
@@ -7,8 +7,9 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o  \
 # 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
index cca028d632f611ee99c3396e9f57da3c9360dbe5..61a324a87d09e0b6f06873ce35131adbfbf9826d 100644 (file)
@@ -15,6 +15,7 @@
 #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>
 
@@ -63,7 +64,28 @@ static void *meson6_dwmac_setup(struct platform_device *pdev)
        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");
index 1fd65e780a0592eff4d61d985ce1c250f3c01852..bed31e4db7e355f00fb506d59125df4a3503fac4 100644 (file)
@@ -35,7 +35,6 @@
 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},
index 23d10f6e88469cd673a444b5e0d222c0ff503fc7..be3e137efc55308700888b64b4334c808b093076 100644 (file)
@@ -23,7 +23,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev);
 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;