stmmac: convert dwmac-rk to platform driver
authorJoachim Eastwood <manabian@gmail.com>
Thu, 14 May 2015 10:11:02 +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-rk.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h

index a5a56217a8455345f9a27546416440251ea6dc34..cb984606a819c2bc604debb2751c4f842093e9d6 100644 (file)
@@ -55,6 +55,17 @@ config DWMAC_MESON
          the stmmac device driver. This driver is used for Meson6 and
          Meson8 SoCs.
 
+config DWMAC_ROCKCHIP
+       tristate "Rockchip dwmac support"
+       default ARCH_ROCKCHIP
+       depends on OF
+       select MFD_SYSCON
+       help
+         Support for Ethernet controller on Rockchip RK3288 SoC.
+
+         This selects the Rockchip RK3288 SoC glue layer support for
+         the stmmac device driver.
+
 endif
 
 config STMMAC_PCI
index 69cc046afd8cdc9da8e333a228f707fb32e6ae67..e67dea423324e0fb71080cf1904c6c82bbdc50d2 100644 (file)
@@ -8,9 +8,10 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \
 obj-$(CONFIG_STMMAC_PLATFORM)  += stmmac-platform.o
 obj-$(CONFIG_DWMAC_LPC18XX)    += dwmac-lpc18xx.o
 obj-$(CONFIG_DWMAC_MESON)      += dwmac-meson.o
+obj-$(CONFIG_DWMAC_ROCKCHIP)   += dwmac-rk.o
 obj-$(CONFIG_DWMAC_GENERIC)    += dwmac-generic.o
 stmmac-platform-objs:= stmmac_platform.o dwmac-sunxi.o \
-                      dwmac-sti.o dwmac-socfpga.o dwmac-rk.o           \
+                      dwmac-sti.o dwmac-socfpga.o
 
 obj-$(CONFIG_STMMAC_PCI) += stmmac-pci.o
 stmmac-pci-objs:= stmmac_pci.o
index 6249a4ec08f05c3ddb7939ab4f5386fe75a8f551..30e28f0d9a6003546b8aeb9a5e902369709787d1 100644 (file)
 #include <linux/phy.h>
 #include <linux/of_net.h>
 #include <linux/gpio.h>
+#include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/of_device.h>
+#include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include "stmmac_platform.h"
+
 struct rk_priv_data {
        struct platform_device *pdev;
        int phy_iface;
@@ -428,10 +432,31 @@ static void rk_fix_speed(void *priv, unsigned int speed)
                dev_err(dev, "unsupported interface %d", bsp_priv->phy_iface);
 }
 
-const struct stmmac_of_data rk3288_gmac_data = {
+static const struct stmmac_of_data rk3288_gmac_data = {
        .has_gmac = 1,
        .fix_mac_speed = rk_fix_speed,
        .setup = rk_gmac_setup,
        .init = rk_gmac_init,
        .exit = rk_gmac_exit,
 };
+
+static const struct of_device_id rk_gmac_dwmac_match[] = {
+       { .compatible = "rockchip,rk3288-gmac", .data = &rk3288_gmac_data},
+       { }
+};
+MODULE_DEVICE_TABLE(of, rk_gmac_dwmac_match);
+
+static struct platform_driver rk_gmac_dwmac_driver = {
+       .probe  = stmmac_pltfr_probe,
+       .remove = stmmac_pltfr_remove,
+       .driver = {
+               .name           = "rk_gmac-dwmac",
+               .pm             = &stmmac_pltfr_pm_ops,
+               .of_match_table = rk_gmac_dwmac_match,
+       },
+};
+module_platform_driver(rk_gmac_dwmac_driver);
+
+MODULE_AUTHOR("Chen-Zhi (Roger Chen) <roger.chen@rock-chips.com>");
+MODULE_DESCRIPTION("Rockchip RK3288 DWMAC specific glue layer");
+MODULE_LICENSE("GPL");
index bed31e4db7e355f00fb506d59125df4a3503fac4..674f7bd1641a58d5e0f51fe22c87f6a8e319f8d3 100644 (file)
@@ -34,7 +34,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 = "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 be3e137efc55308700888b64b4334c808b093076..fff2a885ffd8877fdcab033635e1c1d0f64e376f 100644 (file)
@@ -27,6 +27,5 @@ 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;
 extern const struct stmmac_of_data socfpga_gmac_data;
-extern const struct stmmac_of_data rk3288_gmac_data;
 
 #endif /* __STMMAC_PLATFORM_H__ */
This page took 0.041173 seconds and 5 git commands to generate.