1 // SPDX-License-Identifier: GPL-2.0-only
3 * Synopsys G210 Test Chip driver
5 * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com)
7 * Authors: Joao Pinto <jpinto@synopsys.com>
10 #include <linux/kernel.h>
11 #include <linux/module.h>
12 #include <linux/platform_device.h>
14 #include <linux/delay.h>
16 #include "ufshcd-pltfrm.h"
17 #include "ufshcd-dwc.h"
18 #include "tc-dwc-g210.h"
21 * UFS DWC specific variant operations
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
,
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
,
35 static const struct of_device_id tc_dwc_g210_pltfm_match
[] = {
37 .compatible
= "snps,g210-tc-6.00-20bit",
38 .data
= &tc_dwc_g210_20bit_pltfm_hba_vops
,
41 .compatible
= "snps,g210-tc-6.00-40bit",
42 .data
= &tc_dwc_g210_40bit_pltfm_hba_vops
,
46 MODULE_DEVICE_TABLE(of
, tc_dwc_g210_pltfm_match
);
49 * tc_dwc_g210_pltfm_probe()
50 * @pdev: pointer to platform device structure
53 static int tc_dwc_g210_pltfm_probe(struct platform_device
*pdev
)
56 const struct of_device_id
*of_id
;
57 struct ufs_hba_variant_ops
*vops
;
58 struct device
*dev
= &pdev
->dev
;
60 of_id
= of_match_node(tc_dwc_g210_pltfm_match
, dev
->of_node
);
61 vops
= (struct ufs_hba_variant_ops
*)of_id
->data
;
63 /* Perform generic probe */
64 err
= ufshcd_pltfrm_init(pdev
, vops
);
66 dev_err(dev
, "ufshcd_pltfrm_init() failed %d\n", err
);
72 * tc_dwc_g210_pltfm_remove()
73 * @pdev: pointer to platform device structure
76 static int tc_dwc_g210_pltfm_remove(struct platform_device
*pdev
)
78 struct ufs_hba
*hba
= platform_get_drvdata(pdev
);
80 pm_runtime_get_sync(&(pdev
)->dev
);
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
,
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
,
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
),
105 module_platform_driver(tc_dwc_g210_pltfm_driver
);
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");