1 From 34722924d416c3521de2bc8d10dfcd07a55135ea Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wens@csie.org>
3 Date: Sat, 7 Dec 2013 01:29:36 +0800
4 Subject: [PATCH] net: stmmac: Use platform data tied with compatible strings
6 Signed-off-by: Chen-Yu Tsai <wens@csie.org>
8 .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 29 ++++++++++++++--------
9 1 file changed, 19 insertions(+), 10 deletions(-)
11 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
12 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
16 #include <linux/of_net.h>
17 +#include <linux/of_device.h>
20 +static const struct of_device_id stmmac_dt_ids[] = {
21 + { .compatible = "st,spear600-gmac"},
22 + { .compatible = "snps,dwmac-3.610"},
23 + { .compatible = "snps,dwmac-3.70a"},
24 + { .compatible = "snps,dwmac-3.710"},
25 + { .compatible = "snps,dwmac"},
28 +MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
31 static int stmmac_probe_config_dt(struct platform_device *pdev,
32 struct plat_stmmacenet_data *plat,
33 @@ -35,10 +46,18 @@ static int stmmac_probe_config_dt(struct
35 struct device_node *np = pdev->dev.of_node;
36 struct stmmac_dma_cfg *dma_cfg;
37 + const struct of_device_id *device;
42 + device = of_match_device(stmmac_dt_ids, &pdev->dev);
47 + memcpy(plat, device->data, sizeof(*plat));
49 *mac = of_get_mac_address(np);
50 plat->interface = of_get_phy_mode(np);
52 @@ -257,16 +276,6 @@ static const struct dev_pm_ops stmmac_pl
53 static const struct dev_pm_ops stmmac_pltfr_pm_ops;
54 #endif /* CONFIG_PM */
56 -static const struct of_device_id stmmac_dt_ids[] = {
57 - { .compatible = "st,spear600-gmac"},
58 - { .compatible = "snps,dwmac-3.610"},
59 - { .compatible = "snps,dwmac-3.70a"},
60 - { .compatible = "snps,dwmac-3.710"},
61 - { .compatible = "snps,dwmac"},
64 -MODULE_DEVICE_TABLE(of, stmmac_dt_ids);
66 struct platform_driver stmmac_pltfr_driver = {
67 .probe = stmmac_pltfr_probe,
68 .remove = stmmac_pltfr_remove,