|
7 | 7 | #include <linux/module.h>
|
8 | 8 | #include <linux/of_device.h>
|
9 | 9 | #include <linux/usb/of.h>
|
| 10 | +#include <linux/pci_ids.h> |
| 11 | +#include <linux/pci.h> |
10 | 12 |
|
11 | 13 | #include "core.h"
|
12 | 14 |
|
| 15 | +#define PCI_PRODUCT_ID_HAPS_HSOTG 0xabc0 |
| 16 | +#define PCI_DEVICE_ID_LOONGSON_DWC2 0x7a04 |
| 17 | + |
13 | 18 | static void dwc2_set_bcm_params(struct dwc2_hsotg *hsotg)
|
14 | 19 | {
|
15 | 20 | struct dwc2_core_params *p = &hsotg->params;
|
@@ -55,6 +60,14 @@ static void dwc2_set_jz4775_params(struct dwc2_hsotg *hsotg)
|
55 | 60 | !device_property_read_bool(hsotg->dev, "disable-over-current");
|
56 | 61 | }
|
57 | 62 |
|
| 63 | +static void dwc2_set_loongson_params(struct dwc2_hsotg *hsotg) |
| 64 | +{ |
| 65 | + struct dwc2_core_params *p = &hsotg->params; |
| 66 | + |
| 67 | + p->phy_utmi_width = 8; |
| 68 | + p->power_down = DWC2_POWER_DOWN_PARAM_PARTIAL; |
| 69 | +} |
| 70 | + |
58 | 71 | static void dwc2_set_x1600_params(struct dwc2_hsotg *hsotg)
|
59 | 72 | {
|
60 | 73 | struct dwc2_core_params *p = &hsotg->params;
|
@@ -302,6 +315,23 @@ const struct acpi_device_id dwc2_acpi_match[] = {
|
302 | 315 | };
|
303 | 316 | MODULE_DEVICE_TABLE(acpi, dwc2_acpi_match);
|
304 | 317 |
|
| 318 | +const struct pci_device_id dwc2_pci_ids[] = { |
| 319 | + { |
| 320 | + PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, PCI_PRODUCT_ID_HAPS_HSOTG), |
| 321 | + }, |
| 322 | + { |
| 323 | + PCI_DEVICE(PCI_VENDOR_ID_STMICRO, |
| 324 | + PCI_DEVICE_ID_STMICRO_USB_OTG), |
| 325 | + }, |
| 326 | + { |
| 327 | + PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, PCI_DEVICE_ID_LOONGSON_DWC2), |
| 328 | + .driver_data = (unsigned long)dwc2_set_loongson_params, |
| 329 | + }, |
| 330 | + { /* end: all zeroes */ } |
| 331 | +}; |
| 332 | +MODULE_DEVICE_TABLE(pci, dwc2_pci_ids); |
| 333 | +EXPORT_SYMBOL_GPL(dwc2_pci_ids); |
| 334 | + |
305 | 335 | static void dwc2_set_param_otg_cap(struct dwc2_hsotg *hsotg)
|
306 | 336 | {
|
307 | 337 | switch (hsotg->hw_params.op_mode) {
|
@@ -948,13 +978,20 @@ int dwc2_init_params(struct dwc2_hsotg *hsotg)
|
948 | 978 | if (match && match->data) {
|
949 | 979 | set_params = match->data;
|
950 | 980 | set_params(hsotg);
|
951 |
| - } else { |
| 981 | + } else if (!match) { |
952 | 982 | const struct acpi_device_id *amatch;
|
| 983 | + const struct pci_device_id *pmatch = NULL; |
953 | 984 |
|
954 | 985 | amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev);
|
955 | 986 | if (amatch && amatch->driver_data) {
|
956 | 987 | set_params = (set_params_cb)amatch->driver_data;
|
957 | 988 | set_params(hsotg);
|
| 989 | + } else if (!amatch) |
| 990 | + pmatch = pci_match_id(dwc2_pci_ids, to_pci_dev(hsotg->dev->parent)); |
| 991 | + |
| 992 | + if (pmatch && pmatch->driver_data) { |
| 993 | + set_params = (set_params_cb)pmatch->driver_data; |
| 994 | + set_params(hsotg); |
958 | 995 | }
|
959 | 996 | }
|
960 | 997 |
|
|
0 commit comments