forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/drivers/usb/dwc3/dwc3-pci.c
....@@ -2,7 +2,7 @@
22 /**
33 * dwc3-pci.c - PCI Specific glue layer
44 *
5
- * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
5
+ * Copyright (C) 2010-2011 Texas Instruments Incorporated - https://www.ti.com
66 *
77 * Authors: Felipe Balbi <balbi@ti.com>,
88 * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
....@@ -36,6 +36,13 @@
3636 #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e
3737 #define PCI_DEVICE_ID_INTEL_CNPV 0xa3b0
3838 #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee
39
+#define PCI_DEVICE_ID_INTEL_EHLLP 0x4b7e
40
+#define PCI_DEVICE_ID_INTEL_TGPLP 0xa0ee
41
+#define PCI_DEVICE_ID_INTEL_TGPH 0x43ee
42
+#define PCI_DEVICE_ID_INTEL_JSP 0x4dee
43
+#define PCI_DEVICE_ID_INTEL_ADLP 0x51ee
44
+#define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
45
+#define PCI_DEVICE_ID_INTEL_TGL 0x9a15
3946
4047 #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
4148 #define PCI_INTEL_BXT_FUNC_PMU_PWR 4
....@@ -113,6 +120,9 @@
113120 static const struct property_entry dwc3_pci_mrfld_properties[] = {
114121 PROPERTY_ENTRY_STRING("dr_mode", "otg"),
115122 PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
123
+ PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
124
+ PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
125
+ PROPERTY_ENTRY_BOOL("snps,usb2-gadget-lpm-disable"),
116126 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
117127 {}
118128 };
....@@ -133,9 +143,20 @@
133143 PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
134144 PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
135145 PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
136
- PROPERTY_ENTRY_BOOL("snps,usb2-gadget-lpm-disable"),
137146 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
138147 {}
148
+};
149
+
150
+static const struct software_node dwc3_pci_intel_swnode = {
151
+ .properties = dwc3_pci_intel_properties,
152
+};
153
+
154
+static const struct software_node dwc3_pci_intel_mrfld_swnode = {
155
+ .properties = dwc3_pci_mrfld_properties,
156
+};
157
+
158
+static const struct software_node dwc3_pci_amd_swnode = {
159
+ .properties = dwc3_pci_amd_properties,
139160 };
140161
141162 static int dwc3_pci_quirks(struct dwc3_pci *dwc)
....@@ -144,7 +165,8 @@
144165
145166 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
146167 if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
147
- pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
168
+ pdev->device == PCI_DEVICE_ID_INTEL_BXT_M ||
169
+ pdev->device == PCI_DEVICE_ID_INTEL_EHLLP) {
148170 guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid);
149171 dwc->has_dsm_for_pm = true;
150172 }
....@@ -205,7 +227,7 @@
205227 int ret;
206228
207229 ret = pm_runtime_get_sync(&dwc3->dev);
208
- if (ret) {
230
+ if (ret < 0) {
209231 pm_runtime_put_sync_autosuspend(&dwc3->dev);
210232 return;
211233 }
....@@ -217,7 +239,6 @@
217239
218240 static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
219241 {
220
- struct property_entry *p = (struct property_entry *)id->driver_data;
221242 struct dwc3_pci *dwc;
222243 struct resource res[2];
223244 int ret;
....@@ -260,7 +281,7 @@
260281 dwc->dwc3->dev.parent = dev;
261282 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev));
262283
263
- ret = platform_device_add_properties(dwc->dwc3, p);
284
+ ret = device_add_software_node(&dwc->dwc3->dev, (void *)id->driver_data);
264285 if (ret < 0)
265286 goto err;
266287
....@@ -283,6 +304,7 @@
283304
284305 return 0;
285306 err:
307
+ device_remove_software_node(&dwc->dwc3->dev);
286308 platform_device_put(dwc->dwc3);
287309 return ret;
288310 }
....@@ -299,60 +321,82 @@
299321 #endif
300322 device_init_wakeup(&pci->dev, false);
301323 pm_runtime_get(&pci->dev);
324
+ device_remove_software_node(&dwc->dwc3->dev);
302325 platform_device_unregister(dwc->dwc3);
303326 }
304327
305328 static const struct pci_device_id dwc3_pci_id_table[] = {
306329 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BSW),
307
- (kernel_ulong_t) &dwc3_pci_intel_properties },
330
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
308331
309332 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT),
310
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
333
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
311334
312335 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
313
- (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
336
+ (kernel_ulong_t) &dwc3_pci_intel_mrfld_swnode, },
314337
315338 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLLP),
316
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
339
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
317340
318341 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
319
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
342
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
320343
321344 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
322
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
345
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
323346
324347 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTH),
325
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
348
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
326349
327350 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT),
328
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
351
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
329352
330353 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT_M),
331
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
354
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
332355
333356 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_APL),
334
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
357
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
335358
336359 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_KBP),
337
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
360
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
338361
339362 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_GLK),
340
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
363
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
341364
342365 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPLP),
343
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
366
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
344367
345368 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH),
346
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
369
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
347370
348371 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV),
349
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
372
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
350373
351374 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP),
352
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
375
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
376
+
377
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_EHLLP),
378
+ (kernel_ulong_t) &dwc3_pci_intel_swnode },
379
+
380
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPLP),
381
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
382
+
383
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPH),
384
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
385
+
386
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),
387
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
388
+
389
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLP),
390
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
391
+
392
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
393
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
394
+
395
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),
396
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
353397
354398 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
355
- (kernel_ulong_t) &dwc3_pci_amd_properties, },
399
+ (kernel_ulong_t) &dwc3_pci_amd_swnode, },
356400 { } /* Terminating Entry */
357401 };
358402 MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);