aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-07-26 07:48:56 -0400
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-07-30 03:39:15 -0400
commit1a7b12f69a9434a766e77c43d113826f0413b032 (patch)
tree2720242d424be41e73414926c88a370273f9b4f9
parent262c25d68e39e0f7e7619f715752c12e167644c3 (diff)
usb: dwc3: pci: Supply device properties via driver data
For now all PCI enumerated dwc3 devices require some properties to be present. This allows us to unconditionally append them and supply via driver_data. No functional change intended. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r--drivers/usb/dwc3/dwc3-pci.c131
1 files changed, 74 insertions, 57 deletions
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
index b29f031dfc23..740ed561f353 100644
--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -101,52 +101,37 @@ unmap:
101 return 0; 101 return 0;
102} 102}
103 103
104static const struct property_entry dwc3_pci_intel_properties[] = {
105 PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
106 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
107 {}
108};
109
110static const struct property_entry dwc3_pci_amd_properties[] = {
111 PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
112 PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
113 PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"),
114 PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"),
115 PROPERTY_ENTRY_BOOL("snps,req_p1p2p3_quirk"),
116 PROPERTY_ENTRY_BOOL("snps,del_p1p2p3_quirk"),
117 PROPERTY_ENTRY_BOOL("snps,del_phy_power_chg_quirk"),
118 PROPERTY_ENTRY_BOOL("snps,lfps_filter_quirk"),
119 PROPERTY_ENTRY_BOOL("snps,rx_detect_poll_quirk"),
120 PROPERTY_ENTRY_BOOL("snps,tx_de_emphasis_quirk"),
121 PROPERTY_ENTRY_U8("snps,tx_de_emphasis", 1),
122 /* FIXME these quirks should be removed when AMD NL tapes out */
123 PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
124 PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
125 PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
126 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
127 {}
128};
129
104static int dwc3_pci_quirks(struct dwc3_pci *dwc) 130static int dwc3_pci_quirks(struct dwc3_pci *dwc)
105{ 131{
106 struct platform_device *dwc3 = dwc->dwc3;
107 struct pci_dev *pdev = dwc->pci; 132 struct pci_dev *pdev = dwc->pci;
108 133
109 if (pdev->vendor == PCI_VENDOR_ID_AMD &&
110 pdev->device == PCI_DEVICE_ID_AMD_NL_USB) {
111 struct property_entry properties[] = {
112 PROPERTY_ENTRY_BOOL("snps,has-lpm-erratum"),
113 PROPERTY_ENTRY_U8("snps,lpm-nyet-threshold", 0xf),
114 PROPERTY_ENTRY_BOOL("snps,u2exit_lfps_quirk"),
115 PROPERTY_ENTRY_BOOL("snps,u2ss_inp3_quirk"),
116 PROPERTY_ENTRY_BOOL("snps,req_p1p2p3_quirk"),
117 PROPERTY_ENTRY_BOOL("snps,del_p1p2p3_quirk"),
118 PROPERTY_ENTRY_BOOL("snps,del_phy_power_chg_quirk"),
119 PROPERTY_ENTRY_BOOL("snps,lfps_filter_quirk"),
120 PROPERTY_ENTRY_BOOL("snps,rx_detect_poll_quirk"),
121 PROPERTY_ENTRY_BOOL("snps,tx_de_emphasis_quirk"),
122 PROPERTY_ENTRY_U8("snps,tx_de_emphasis", 1),
123 /*
124 * FIXME these quirks should be removed when AMD NL
125 * tapes out
126 */
127 PROPERTY_ENTRY_BOOL("snps,disable_scramble_quirk"),
128 PROPERTY_ENTRY_BOOL("snps,dis_u3_susphy_quirk"),
129 PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
130 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
131 { },
132 };
133
134 return platform_device_add_properties(dwc3, properties);
135 }
136
137 if (pdev->vendor == PCI_VENDOR_ID_INTEL) { 134 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
138 int ret;
139
140 struct property_entry properties[] = {
141 PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
142 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
143 { }
144 };
145
146 ret = platform_device_add_properties(dwc3, properties);
147 if (ret < 0)
148 return ret;
149
150 if (pdev->device == PCI_DEVICE_ID_INTEL_BXT || 135 if (pdev->device == PCI_DEVICE_ID_INTEL_BXT ||
151 pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) { 136 pdev->device == PCI_DEVICE_ID_INTEL_BXT_M) {
152 guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid); 137 guid_parse(PCI_INTEL_BXT_DSM_GUID, &dwc->guid);
@@ -155,6 +140,7 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)
155 140
156 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) { 141 if (pdev->device == PCI_DEVICE_ID_INTEL_BYT) {
157 struct gpio_desc *gpio; 142 struct gpio_desc *gpio;
143 int ret;
158 144
159 /* On BYT the FW does not always enable the refclock */ 145 /* On BYT the FW does not always enable the refclock */
160 ret = dwc3_byt_enable_ulpi_refclock(pdev); 146 ret = dwc3_byt_enable_ulpi_refclock(pdev);
@@ -216,9 +202,9 @@ static void dwc3_pci_resume_work(struct work_struct *work)
216} 202}
217#endif 203#endif
218 204
219static int dwc3_pci_probe(struct pci_dev *pci, 205static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
220 const struct pci_device_id *id)
221{ 206{
207 struct property_entry *p = (struct property_entry *)id->driver_data;
222 struct dwc3_pci *dwc; 208 struct dwc3_pci *dwc;
223 struct resource res[2]; 209 struct resource res[2];
224 int ret; 210 int ret;
@@ -261,6 +247,10 @@ static int dwc3_pci_probe(struct pci_dev *pci,
261 dwc->dwc3->dev.parent = dev; 247 dwc->dwc3->dev.parent = dev;
262 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev)); 248 ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev));
263 249
250 ret = platform_device_add_properties(dwc->dwc3, p);
251 if (ret < 0)
252 return ret;
253
264 ret = dwc3_pci_quirks(dwc); 254 ret = dwc3_pci_quirks(dwc);
265 if (ret) 255 if (ret)
266 goto err; 256 goto err;
@@ -298,20 +288,47 @@ static void dwc3_pci_remove(struct pci_dev *pci)
298} 288}
299 289
300static const struct pci_device_id dwc3_pci_id_table[] = { 290static const struct pci_device_id dwc3_pci_id_table[] = {
301 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, 291 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BSW),
302 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, 292 (kernel_ulong_t) &dwc3_pci_intel_properties },
303 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, 293
304 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTLP), }, 294 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT),
305 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SPTH), }, 295 (kernel_ulong_t) &dwc3_pci_intel_properties, },
306 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), }, 296
307 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT_M), }, 297 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
308 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), }, 298 (kernel_ulong_t) &dwc3_pci_intel_properties, },
309 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), }, 299
310 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), }, 300 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTLP),
311 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPLP), }, 301 (kernel_ulong_t) &dwc3_pci_intel_properties, },
312 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CNPH), }, 302
313 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICLLP), }, 303 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_SPTH),
314 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), }, 304 (kernel_ulong_t) &dwc3_pci_intel_properties, },
305
306 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT),
307 (kernel_ulong_t) &dwc3_pci_intel_properties, },
308
309 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BXT_M),
310 (kernel_ulong_t) &dwc3_pci_intel_properties, },
311
312 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_APL),
313 (kernel_ulong_t) &dwc3_pci_intel_properties, },
314
315 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_KBP),
316 (kernel_ulong_t) &dwc3_pci_intel_properties, },
317
318 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_GLK),
319 (kernel_ulong_t) &dwc3_pci_intel_properties, },
320
321 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPLP),
322 (kernel_ulong_t) &dwc3_pci_intel_properties, },
323
324 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH),
325 (kernel_ulong_t) &dwc3_pci_intel_properties, },
326
327 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP),
328 (kernel_ulong_t) &dwc3_pci_intel_properties, },
329
330 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_NL_USB),
331 (kernel_ulong_t) &dwc3_pci_amd_properties, },
315 { } /* Terminating Entry */ 332 { } /* Terminating Entry */
316}; 333};
317MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); 334MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table);