22
22
#include <linux/acpi.h>
23
23
24
24
#include "xhci.h"
25
+ #include "xhci-plat.h"
25
26
#include "xhci-mvebu.h"
26
27
#include "xhci-rcar.h"
27
28
@@ -31,6 +32,7 @@ static int xhci_plat_setup(struct usb_hcd *hcd);
31
32
static int xhci_plat_start (struct usb_hcd * hcd );
32
33
33
34
static const struct xhci_driver_overrides xhci_plat_overrides __initconst = {
35
+ .extra_priv_size = sizeof (struct xhci_plat_priv ),
34
36
.reset = xhci_plat_setup ,
35
37
.start = xhci_plat_start ,
36
38
};
@@ -48,11 +50,9 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
48
50
/* called during probe() after chip reset completes */
49
51
static int xhci_plat_setup (struct usb_hcd * hcd )
50
52
{
51
- struct device_node * of_node = hcd -> self .controller -> of_node ;
52
53
int ret ;
53
54
54
- if (of_device_is_compatible (of_node , "renesas,xhci-r8a7790" ) ||
55
- of_device_is_compatible (of_node , "renesas,xhci-r8a7791" )) {
55
+ if (xhci_plat_type_is (hcd , XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2 )) {
56
56
ret = xhci_rcar_init_quirk (hcd );
57
57
if (ret )
58
58
return ret ;
@@ -63,19 +63,49 @@ static int xhci_plat_setup(struct usb_hcd *hcd)
63
63
64
64
static int xhci_plat_start (struct usb_hcd * hcd )
65
65
{
66
- struct device_node * of_node = hcd -> self .controller -> of_node ;
67
-
68
- if (of_device_is_compatible (of_node , "renesas,xhci-r8a7790" ) ||
69
- of_device_is_compatible (of_node , "renesas,xhci-r8a7791" ))
66
+ if (xhci_plat_type_is (hcd , XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2 ))
70
67
xhci_rcar_start (hcd );
71
68
72
69
return xhci_run (hcd );
73
70
}
74
71
72
+ #ifdef CONFIG_OF
73
+ static const struct xhci_plat_priv xhci_plat_marvell_armada = {
74
+ .type = XHCI_PLAT_TYPE_MARVELL_ARMADA ,
75
+ };
76
+
77
+ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = {
78
+ .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2 ,
79
+ };
80
+
81
+ static const struct of_device_id usb_xhci_of_match [] = {
82
+ {
83
+ .compatible = "generic-xhci" ,
84
+ }, {
85
+ .compatible = "xhci-platform" ,
86
+ }, {
87
+ .compatible = "marvell,armada-375-xhci" ,
88
+ .data = & xhci_plat_marvell_armada ,
89
+ }, {
90
+ .compatible = "marvell,armada-380-xhci" ,
91
+ .data = & xhci_plat_marvell_armada ,
92
+ }, {
93
+ .compatible = "renesas,xhci-r8a7790" ,
94
+ .data = & xhci_plat_renesas_rcar_gen2 ,
95
+ }, {
96
+ .compatible = "renesas,xhci-r8a7791" ,
97
+ .data = & xhci_plat_renesas_rcar_gen2 ,
98
+ }, {
99
+ },
100
+ };
101
+ MODULE_DEVICE_TABLE (of , usb_xhci_of_match );
102
+ #endif
103
+
75
104
static int xhci_plat_probe (struct platform_device * pdev )
76
105
{
77
106
struct device_node * node = pdev -> dev .of_node ;
78
107
struct usb_xhci_pdata * pdata = dev_get_platdata (& pdev -> dev );
108
+ const struct of_device_id * match ;
79
109
const struct hc_driver * driver ;
80
110
struct xhci_hcd * xhci ;
81
111
struct resource * res ;
@@ -133,18 +163,24 @@ static int xhci_plat_probe(struct platform_device *pdev)
133
163
goto put_hcd ;
134
164
}
135
165
136
- if (of_device_is_compatible (pdev -> dev .of_node ,
137
- "marvell,armada-375-xhci" ) ||
138
- of_device_is_compatible (pdev -> dev .of_node ,
139
- "marvell,armada-380-xhci" )) {
166
+ xhci = hcd_to_xhci (hcd );
167
+ match = of_match_node (usb_xhci_of_match , node );
168
+ if (match ) {
169
+ const struct xhci_plat_priv * priv_match = match -> data ;
170
+ struct xhci_plat_priv * priv = hcd_to_xhci_priv (hcd );
171
+
172
+ /* Just copy data for now */
173
+ * priv = * priv_match ;
174
+ }
175
+
176
+ if (xhci_plat_type_is (hcd , XHCI_PLAT_TYPE_MARVELL_ARMADA )) {
140
177
ret = xhci_mvebu_mbus_init_quirk (pdev );
141
178
if (ret )
142
179
goto disable_clk ;
143
180
}
144
181
145
182
device_wakeup_enable (hcd -> self .controller );
146
183
147
- xhci = hcd_to_xhci (hcd );
148
184
xhci -> clk = clk ;
149
185
xhci -> main_hcd = hcd ;
150
186
xhci -> shared_hcd = usb_create_shared_hcd (driver , & pdev -> dev ,
@@ -255,19 +291,6 @@ static const struct dev_pm_ops xhci_plat_pm_ops = {
255
291
#define DEV_PM_OPS NULL
256
292
#endif /* CONFIG_PM */
257
293
258
- #ifdef CONFIG_OF
259
- static const struct of_device_id usb_xhci_of_match [] = {
260
- { .compatible = "generic-xhci" },
261
- { .compatible = "xhci-platform" },
262
- { .compatible = "marvell,armada-375-xhci" },
263
- { .compatible = "marvell,armada-380-xhci" },
264
- { .compatible = "renesas,xhci-r8a7790" },
265
- { .compatible = "renesas,xhci-r8a7791" },
266
- { },
267
- };
268
- MODULE_DEVICE_TABLE (of , usb_xhci_of_match );
269
- #endif
270
-
271
294
static const struct acpi_device_id usb_xhci_acpi_match [] = {
272
295
/* XHCI-compliant USB Controller */
273
296
{ "PNP0D10" , },
0 commit comments