This source file includes following definitions.
- tc_dwc_g210_pltfm_probe
- tc_dwc_g210_pltfm_remove
1
2
3
4
5
6
7
8
9
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/platform_device.h>
13 #include <linux/of.h>
14 #include <linux/delay.h>
15
16 #include "ufshcd-pltfrm.h"
17 #include "ufshcd-dwc.h"
18 #include "tc-dwc-g210.h"
19
20
21
22
23 static struct ufs_hba_variant_ops tc_dwc_g210_20bit_pltfm_hba_vops = {
24 .name = "tc-dwc-g210-pltfm",
25 .link_startup_notify = ufshcd_dwc_link_startup_notify,
26 .phy_initialization = tc_dwc_g210_config_20_bit,
27 };
28
29 static struct ufs_hba_variant_ops tc_dwc_g210_40bit_pltfm_hba_vops = {
30 .name = "tc-dwc-g210-pltfm",
31 .link_startup_notify = ufshcd_dwc_link_startup_notify,
32 .phy_initialization = tc_dwc_g210_config_40_bit,
33 };
34
35 static const struct of_device_id tc_dwc_g210_pltfm_match[] = {
36 {
37 .compatible = "snps,g210-tc-6.00-20bit",
38 .data = &tc_dwc_g210_20bit_pltfm_hba_vops,
39 },
40 {
41 .compatible = "snps,g210-tc-6.00-40bit",
42 .data = &tc_dwc_g210_40bit_pltfm_hba_vops,
43 },
44 { },
45 };
46 MODULE_DEVICE_TABLE(of, tc_dwc_g210_pltfm_match);
47
48
49
50
51
52
53 static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev)
54 {
55 int err;
56 const struct of_device_id *of_id;
57 struct ufs_hba_variant_ops *vops;
58 struct device *dev = &pdev->dev;
59
60 of_id = of_match_node(tc_dwc_g210_pltfm_match, dev->of_node);
61 vops = (struct ufs_hba_variant_ops *)of_id->data;
62
63
64 err = ufshcd_pltfrm_init(pdev, vops);
65 if (err)
66 dev_err(dev, "ufshcd_pltfrm_init() failed %d\n", err);
67
68 return err;
69 }
70
71
72
73
74
75
76 static int tc_dwc_g210_pltfm_remove(struct platform_device *pdev)
77 {
78 struct ufs_hba *hba = platform_get_drvdata(pdev);
79
80 pm_runtime_get_sync(&(pdev)->dev);
81 ufshcd_remove(hba);
82
83 return 0;
84 }
85
86 static const struct dev_pm_ops tc_dwc_g210_pltfm_pm_ops = {
87 .suspend = ufshcd_pltfrm_suspend,
88 .resume = ufshcd_pltfrm_resume,
89 .runtime_suspend = ufshcd_pltfrm_runtime_suspend,
90 .runtime_resume = ufshcd_pltfrm_runtime_resume,
91 .runtime_idle = ufshcd_pltfrm_runtime_idle,
92 };
93
94 static struct platform_driver tc_dwc_g210_pltfm_driver = {
95 .probe = tc_dwc_g210_pltfm_probe,
96 .remove = tc_dwc_g210_pltfm_remove,
97 .shutdown = ufshcd_pltfrm_shutdown,
98 .driver = {
99 .name = "tc-dwc-g210-pltfm",
100 .pm = &tc_dwc_g210_pltfm_pm_ops,
101 .of_match_table = of_match_ptr(tc_dwc_g210_pltfm_match),
102 },
103 };
104
105 module_platform_driver(tc_dwc_g210_pltfm_driver);
106
107 MODULE_ALIAS("platform:tc-dwc-g210-pltfm");
108 MODULE_DESCRIPTION("Synopsys Test Chip G210 platform glue driver");
109 MODULE_AUTHOR("Joao Pinto <Joao.Pinto@synopsys.com>");
110 MODULE_LICENSE("Dual BSD/GPL");