diff options
Diffstat (limited to 'drivers/usb/dwc3/dwc3-pci.c')
| -rw-r--r-- | drivers/usb/dwc3/dwc3-pci.c | 57 | 
1 files changed, 49 insertions, 8 deletions
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 06d0e88ec8af..6b018048fe2e 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -40,10 +40,13 @@  #define PCI_DEVICE_ID_INTEL_TGPLP		0xa0ee  #define PCI_DEVICE_ID_INTEL_TGPH		0x43ee  #define PCI_DEVICE_ID_INTEL_JSP			0x4dee +#define PCI_DEVICE_ID_INTEL_ADL			0x465e  #define PCI_DEVICE_ID_INTEL_ADLP		0x51ee  #define PCI_DEVICE_ID_INTEL_ADLM		0x54ee  #define PCI_DEVICE_ID_INTEL_ADLS		0x7ae1  #define PCI_DEVICE_ID_INTEL_RPLS		0x7a61 +#define PCI_DEVICE_ID_INTEL_MTLP		0x7ec1 +#define PCI_DEVICE_ID_INTEL_MTL			0x7e7e  #define PCI_DEVICE_ID_INTEL_TGL			0x9a15  #define PCI_DEVICE_ID_AMD_MR			0x163a @@ -120,6 +123,14 @@ static const struct property_entry dwc3_pci_intel_properties[] = {  	{}  }; +static const struct property_entry dwc3_pci_intel_phy_charger_detect_properties[] = { +	PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), +	PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), +	PROPERTY_ENTRY_BOOL("linux,phy_charger_detect"), +	PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), +	{} +}; +  static const struct property_entry dwc3_pci_intel_byt_properties[] = {  	PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),  	PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), @@ -169,6 +180,10 @@ static const struct software_node dwc3_pci_intel_swnode = {  	.properties = dwc3_pci_intel_properties,  }; +static const struct software_node dwc3_pci_intel_phy_charger_detect_swnode = { +	.properties = dwc3_pci_intel_phy_charger_detect_properties, +}; +  static const struct software_node dwc3_pci_intel_byt_swnode = {  	.properties = dwc3_pci_intel_byt_properties,  }; @@ -185,7 +200,8 @@ static const struct software_node dwc3_pci_amd_mr_swnode = {  	.properties = dwc3_pci_mr_properties,  }; -static int dwc3_pci_quirks(struct dwc3_pci *dwc) +static int dwc3_pci_quirks(struct dwc3_pci *dwc, +			   const struct software_node *swnode)  {  	struct pci_dev			*pdev = dwc->pci; @@ -239,10 +255,30 @@ static int dwc3_pci_quirks(struct dwc3_pci *dwc)  				gpiod_put(gpio);  				usleep_range(10000, 11000);  			} + +			/* +			 * Make the pdev name predictable (only 1 DWC3 on BYT) +			 * and patch the phy dev-name into the lookup table so +			 * that the phy-driver can get the GPIOs. +			 */ +			dwc->dwc3->id = PLATFORM_DEVID_NONE; +			platform_bytcr_gpios.dev_id = "dwc3.ulpi"; + +			/* +			 * Some Android tablets with a Crystal Cove PMIC +			 * (INT33FD), rely on the TUSB1211 phy for charger +			 * detection. These can be identified by them _not_ +			 * using the standard ACPI battery and ac drivers. +			 */ +			if (acpi_dev_present("INT33FD", "1", 2) && +			    acpi_quirk_skip_acpi_ac_and_battery()) { +				dev_info(&pdev->dev, "Using TUSB1211 phy for charger detection\n"); +				swnode = &dwc3_pci_intel_phy_charger_detect_swnode; +			}  		}  	} -	return 0; +	return device_add_software_node(&dwc->dwc3->dev, swnode);  }  #ifdef CONFIG_PM @@ -253,7 +289,7 @@ static void dwc3_pci_resume_work(struct work_struct *work)  	int ret;  	ret = pm_runtime_get_sync(&dwc3->dev); -	if (ret) { +	if (ret < 0) {  		pm_runtime_put_sync_autosuspend(&dwc3->dev);  		return;  	} @@ -307,11 +343,7 @@ static int dwc3_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)  	dwc->dwc3->dev.parent = dev;  	ACPI_COMPANION_SET(&dwc->dwc3->dev, ACPI_COMPANION(dev)); -	ret = device_add_software_node(&dwc->dwc3->dev, (void *)id->driver_data); -	if (ret < 0) -		goto err; - -	ret = dwc3_pci_quirks(dwc); +	ret = dwc3_pci_quirks(dwc, (void *)id->driver_data);  	if (ret)  		goto err; @@ -412,6 +444,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_JSP),  	  (kernel_ulong_t) &dwc3_pci_intel_swnode, }, +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADL), +	  (kernel_ulong_t) &dwc3_pci_intel_swnode, }, +  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLP),  	  (kernel_ulong_t) &dwc3_pci_intel_swnode, }, @@ -424,6 +459,12 @@ static const struct pci_device_id dwc3_pci_id_table[] = {  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),  	  (kernel_ulong_t) &dwc3_pci_intel_swnode, }, +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTLP), +	  (kernel_ulong_t) &dwc3_pci_intel_swnode, }, + +	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MTL), +	  (kernel_ulong_t) &dwc3_pci_intel_swnode, }, +  	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),  	  (kernel_ulong_t) &dwc3_pci_intel_swnode, },  | 
