diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-23 22:02:19 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-02-23 22:02:19 +0300 |
commit | 99a85b901eb54f62ff0c3fd6eb56e60b7b9f15c8 (patch) | |
tree | 0c6637b7d2172e079c30e966847326767cbaf45c /drivers/usb/dwc3/dwc3-pci.c | |
parent | 135f9be9194cf7778eb73594aa55791b229cf27c (diff) | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (diff) | |
download | linux-99a85b901eb54f62ff0c3fd6eb56e60b7b9f15c8.tar.xz |
Merge tag 'v4.0-rc1' into patchwork
Linux 34.0-rc1
* tag 'v4.0-rc1': (8947 commits)
Linux 4.0-rc1
autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation
procfs: fix race between symlink removals and traversals
debugfs: leave freeing a symlink body until inode eviction
Documentation/filesystems/Locking: ->get_sb() is long gone
trylock_super(): replacement for grab_super_passive()
fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions
VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
SELinux: Use d_is_positive() rather than testing dentry->d_inode
Smack: Use d_is_positive() rather than testing dentry->d_inode
TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR()
Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode
Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb
VFS: Split DCACHE_FILE_TYPE into regular and special types
VFS: Add a fallthrough flag for marking virtual dentries
VFS: Add a whiteout dentry type
VFS: Introduce inode-getting helpers for layered/unioned fs environments
kernel: make READ_ONCE() valid on const arguments
blk-throttle: check stats_cpu before reading it from sysfs
...
Diffstat (limited to 'drivers/usb/dwc3/dwc3-pci.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-pci.c | 178 |
1 files changed, 32 insertions, 146 deletions
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index b642a2f998f9..8d950569d557 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -22,9 +22,6 @@ #include <linux/pci.h> #include <linux/platform_device.h> -#include <linux/usb/otg.h> -#include <linux/usb/usb_phy_generic.h> - #include "platform_data.h" /* FIXME define these in <linux/pci_ids.h> */ @@ -36,66 +33,41 @@ #define PCI_DEVICE_ID_INTEL_SPTLP 0x9d30 #define PCI_DEVICE_ID_INTEL_SPTH 0xa130 -struct dwc3_pci { - struct device *dev; - struct platform_device *dwc3; - struct platform_device *usb2_phy; - struct platform_device *usb3_phy; -}; - -static int dwc3_pci_register_phys(struct dwc3_pci *glue) +static int dwc3_pci_quirks(struct pci_dev *pdev) { - struct usb_phy_generic_platform_data pdata; - struct platform_device *pdev; - int ret; + if (pdev->vendor == PCI_VENDOR_ID_AMD && + pdev->device == PCI_DEVICE_ID_AMD_NL_USB) { + struct dwc3_platform_data pdata; - memset(&pdata, 0x00, sizeof(pdata)); + memset(&pdata, 0, sizeof(pdata)); - pdev = platform_device_alloc("usb_phy_generic", 0); - if (!pdev) - return -ENOMEM; - - glue->usb2_phy = pdev; - pdata.type = USB_PHY_TYPE_USB2; - pdata.gpio_reset = -1; + pdata.has_lpm_erratum = true; + pdata.lpm_nyet_threshold = 0xf; - ret = platform_device_add_data(glue->usb2_phy, &pdata, sizeof(pdata)); - if (ret) - goto err1; + pdata.u2exit_lfps_quirk = true; + pdata.u2ss_inp3_quirk = true; + pdata.req_p1p2p3_quirk = true; + pdata.del_p1p2p3_quirk = true; + pdata.del_phy_power_chg_quirk = true; + pdata.lfps_filter_quirk = true; + pdata.rx_detect_poll_quirk = true; - pdev = platform_device_alloc("usb_phy_generic", 1); - if (!pdev) { - ret = -ENOMEM; - goto err1; - } + pdata.tx_de_emphasis_quirk = true; + pdata.tx_de_emphasis = 1; - glue->usb3_phy = pdev; - pdata.type = USB_PHY_TYPE_USB3; - - ret = platform_device_add_data(glue->usb3_phy, &pdata, sizeof(pdata)); - if (ret) - goto err2; - - ret = platform_device_add(glue->usb2_phy); - if (ret) - goto err2; + /* + * FIXME these quirks should be removed when AMD NL + * taps out + */ + pdata.disable_scramble_quirk = true; + pdata.dis_u3_susphy_quirk = true; + pdata.dis_u2_susphy_quirk = true; - ret = platform_device_add(glue->usb3_phy); - if (ret) - goto err3; + return platform_device_add_data(pci_get_drvdata(pdev), &pdata, + sizeof(pdata)); + } return 0; - -err3: - platform_device_del(glue->usb2_phy); - -err2: - platform_device_put(glue->usb3_phy); - -err1: - platform_device_put(glue->usb2_phy); - - return ret; } static int dwc3_pci_probe(struct pci_dev *pci, @@ -103,18 +75,8 @@ static int dwc3_pci_probe(struct pci_dev *pci, { struct resource res[2]; struct platform_device *dwc3; - struct dwc3_pci *glue; int ret; struct device *dev = &pci->dev; - struct dwc3_platform_data dwc3_pdata; - - memset(&dwc3_pdata, 0x00, sizeof(dwc3_pdata)); - - glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); - if (!glue) - return -ENOMEM; - - glue->dev = dev; ret = pcim_enable_device(pci); if (ret) { @@ -124,12 +86,6 @@ static int dwc3_pci_probe(struct pci_dev *pci, pci_set_master(pci); - ret = dwc3_pci_register_phys(glue); - if (ret) { - dev_err(dev, "couldn't register PHYs\n"); - return ret; - } - dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); if (!dwc3) { dev_err(dev, "couldn't allocate dwc3 device\n"); @@ -147,70 +103,34 @@ static int dwc3_pci_probe(struct pci_dev *pci, res[1].name = "dwc_usb3"; res[1].flags = IORESOURCE_IRQ; - if (pci->vendor == PCI_VENDOR_ID_AMD && - pci->device == PCI_DEVICE_ID_AMD_NL_USB) { - dwc3_pdata.has_lpm_erratum = true; - dwc3_pdata.lpm_nyet_threshold = 0xf; - - dwc3_pdata.u2exit_lfps_quirk = true; - dwc3_pdata.u2ss_inp3_quirk = true; - dwc3_pdata.req_p1p2p3_quirk = true; - dwc3_pdata.del_p1p2p3_quirk = true; - dwc3_pdata.del_phy_power_chg_quirk = true; - dwc3_pdata.lfps_filter_quirk = true; - dwc3_pdata.rx_detect_poll_quirk = true; - - dwc3_pdata.tx_de_emphasis_quirk = true; - dwc3_pdata.tx_de_emphasis = 1; - - /* - * FIXME these quirks should be removed when AMD NL - * taps out - */ - dwc3_pdata.disable_scramble_quirk = true; - dwc3_pdata.dis_u3_susphy_quirk = true; - dwc3_pdata.dis_u2_susphy_quirk = true; - } - ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res)); if (ret) { dev_err(dev, "couldn't add resources to dwc3 device\n"); return ret; } - pci_set_drvdata(pci, glue); - - ret = platform_device_add_data(dwc3, &dwc3_pdata, sizeof(dwc3_pdata)); + pci_set_drvdata(pci, dwc3); + ret = dwc3_pci_quirks(pci); if (ret) - goto err3; - - dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask); + goto err; - dwc3->dev.dma_mask = dev->dma_mask; - dwc3->dev.dma_parms = dev->dma_parms; dwc3->dev.parent = dev; - glue->dwc3 = dwc3; ret = platform_device_add(dwc3); if (ret) { dev_err(dev, "failed to register dwc3 device\n"); - goto err3; + goto err; } return 0; - -err3: +err: platform_device_put(dwc3); return ret; } static void dwc3_pci_remove(struct pci_dev *pci) { - struct dwc3_pci *glue = pci_get_drvdata(pci); - - platform_device_unregister(glue->dwc3); - platform_device_unregister(glue->usb2_phy); - platform_device_unregister(glue->usb3_phy); + platform_device_unregister(pci_get_drvdata(pci)); } static const struct pci_device_id dwc3_pci_id_table[] = { @@ -228,45 +148,11 @@ static const struct pci_device_id dwc3_pci_id_table[] = { }; MODULE_DEVICE_TABLE(pci, dwc3_pci_id_table); -#ifdef CONFIG_PM_SLEEP -static int dwc3_pci_suspend(struct device *dev) -{ - struct pci_dev *pci = to_pci_dev(dev); - - pci_disable_device(pci); - - return 0; -} - -static int dwc3_pci_resume(struct device *dev) -{ - struct pci_dev *pci = to_pci_dev(dev); - int ret; - - ret = pci_enable_device(pci); - if (ret) { - dev_err(dev, "can't re-enable device --> %d\n", ret); - return ret; - } - - pci_set_master(pci); - - return 0; -} -#endif /* CONFIG_PM_SLEEP */ - -static const struct dev_pm_ops dwc3_pci_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(dwc3_pci_suspend, dwc3_pci_resume) -}; - static struct pci_driver dwc3_pci_driver = { .name = "dwc3-pci", .id_table = dwc3_pci_id_table, .probe = dwc3_pci_probe, .remove = dwc3_pci_remove, - .driver = { - .pm = &dwc3_pci_dev_pm_ops, - }, }; MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); |