2 * Generic DWMAC platform driver
4 * Copyright (C) 2007-2011 STMicroelectronics Ltd
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
12 #include <linux/module.h>
14 #include <linux/platform_device.h>
17 #include "stmmac_platform.h"
19 static int dwmac_generic_probe(struct platform_device *pdev)
21 struct plat_stmmacenet_data *plat_dat;
22 struct stmmac_resources stmmac_res;
25 ret = stmmac_get_platform_resources(pdev, &stmmac_res);
29 if (pdev->dev.of_node) {
30 plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
31 if (IS_ERR(plat_dat)) {
32 dev_err(&pdev->dev, "dt configuration failed\n");
33 return PTR_ERR(plat_dat);
36 plat_dat = dev_get_platdata(&pdev->dev);
38 dev_err(&pdev->dev, "no platform data provided\n");
42 /* Set default value for multicast hash bins */
43 plat_dat->multicast_filter_bins = HASH_TABLE_SIZE;
45 /* Set default value for unicast filter entries */
46 plat_dat->unicast_filter_entries = 1;
49 return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
52 static const struct of_device_id dwmac_generic_match[] = {
53 { .compatible = "st,spear600-gmac"},
54 { .compatible = "snps,dwmac-3.40a"},
55 { .compatible = "snps,dwmac-3.50a"},
56 { .compatible = "snps,dwmac-3.610"},
57 { .compatible = "snps,dwmac-3.70a"},
58 { .compatible = "snps,dwmac-3.710"},
59 { .compatible = "snps,dwmac-3.72a"},
60 { .compatible = "snps,dwmac-4.00"},
61 { .compatible = "snps,dwmac-4.10a"},
62 { .compatible = "snps,dwmac"},
63 { .compatible = "snps,dwxgmac-2.10"},
64 { .compatible = "snps,dwxgmac"},
67 MODULE_DEVICE_TABLE(of, dwmac_generic_match);
69 static struct platform_driver dwmac_generic_driver = {
70 .probe = dwmac_generic_probe,
72 .name = STMMAC_RESOURCE_NAME,
73 .pm = &stmmac_pltfr_pm_ops,
74 .of_match_table = dwmac_generic_match,
77 module_platform_driver(dwmac_generic_driver);
79 MODULE_DESCRIPTION("Generic dwmac driver");
80 MODULE_LICENSE("GPL v2");