hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
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 }
....@@ -165,10 +187,12 @@
165187
166188 /*
167189 * A lot of BYT devices lack ACPI resource entries for
168
- * the GPIOs, add a fallback mapping to the reference
190
+ * the GPIOs. If the ACPI entry for the GPIO controller
191
+ * is present add a fallback mapping to the reference
169192 * design GPIOs which all boards seem to use.
170193 */
171
- gpiod_add_lookup_table(&platform_bytcr_gpios);
194
+ if (acpi_dev_present("INT33FC", NULL, -1))
195
+ gpiod_add_lookup_table(&platform_bytcr_gpios);
172196
173197 /*
174198 * These GPIOs will turn on the USB2 PHY. Note that we have to
....@@ -205,7 +229,7 @@
205229 int ret;
206230
207231 ret = pm_runtime_get_sync(&dwc3->dev);
208
- if (ret) {
232
+ if (ret < 0) {
209233 pm_runtime_put_sync_autosuspend(&dwc3->dev);
210234 return;
211235 }
....@@ -217,7 +241,6 @@
217241
218242 static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
219243 {
220
- struct property_entry *p = (struct property_entry *)id->driver_data;
221244 struct dwc3_pci *dwc;
222245 struct resource res[2];
223246 int ret;
....@@ -260,7 +283,7 @@
260283 dwc->dwc3->dev.parent = dev;
261284 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev));
262285
263
- ret = platform_device_add_properties(dwc->dwc3, p);
286
+ ret = device_add_software_node(&dwc->dwc3->dev, (void *)id->driver_data);
264287 if (ret < 0)
265288 goto err;
266289
....@@ -283,6 +306,7 @@
283306
284307 return 0;
285308 err:
309
+ device_remove_software_node(&dwc->dwc3->dev);
286310 platform_device_put(dwc->dwc3);
287311 return ret;
288312 }
....@@ -299,60 +323,82 @@
299323 #endif
300324 device_init_wakeup(&pci->dev, false);
301325 pm_runtime_get(&pci->dev);
326
+ device_remove_software_node(&dwc->dwc3->dev);
302327 platform_device_unregister(dwc->dwc3);
303328 }
304329
305330 static const struct pci_device_id dwc3_pci_id_table[] = {
306331 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BSW),
307
- (kernel_ulong_t) &dwc3_pci_intel_properties },
332
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
308333
309334 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT),
310
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
335
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
311336
312337 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
313
- (kernel_ulong_t) &dwc3_pci_mrfld_properties, },
338
+ (kernel_ulong_t) &dwc3_pci_intel_mrfld_swnode, },
314339
315340 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLLP),
316
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
341
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
317342
318343 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CMLH),
319
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
344
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
320345
321346 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
322
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
347
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
323348
324349 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTH),
325
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
350
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
326351
327352 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT),
328
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
353
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
329354
330355 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT_M),
331
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
356
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
332357
333358 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_APL),
334
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
359
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
335360
336361 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_KBP),
337
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
362
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
338363
339364 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_GLK),
340
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
365
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
341366
342367 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPLP),
343
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
368
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
344369
345370 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH),
346
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
371
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
347372
348373 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV),
349
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
374
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
350375
351376 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP),
352
- (kernel_ulong_t) &dwc3_pci_intel_properties, },
377
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
378
+
379
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_EHLLP),
380
+ (kernel_ulong_t) &dwc3_pci_intel_swnode },
381
+
382
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPLP),
383
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
384
+
385
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGPH),
386
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
387
+
388
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),
389
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
390
+
391
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLP),
392
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
393
+
394
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
395
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
396
+
397
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),
398
+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
353399
354400 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
355
- (kernel_ulong_t) &dwc3_pci_amd_properties, },
401
+ (kernel_ulong_t) &dwc3_pci_amd_swnode, },
356402 { } /* Terminating Entry */
357403 };
358404 MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);