Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "usb: cdnsp: Add support for device-only configuration"

This reverts commit 7b7f2dd913829e06705035dfc41ca25fa6ec68d3.

There was some problems with an earlier cdns3 change, so this one needs
to be backed out as well.

Cc: Pawel Laszczak <pawell@cadence.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Reported-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/ac+LEWMCQpLSnfoD@nchen-desktop
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+23 -73
+10 -14
drivers/usb/cdns3/cdns3-plat.c
··· 75 75 if (cdns->pdata && cdns->pdata->override_apb_timeout) 76 76 cdns->override_apb_timeout = cdns->pdata->override_apb_timeout; 77 77 78 - cdns->no_drd = device_property_read_bool(dev, "no_drd"); 79 78 platform_set_drvdata(pdev, cdns); 80 79 81 80 ret = platform_get_irq_byname(pdev, "host"); ··· 107 108 108 109 cdns->dev_regs = regs; 109 110 110 - if (!cdns->no_drd) { 111 - cdns->otg_irq = platform_get_irq_byname(pdev, "otg"); 112 - if (cdns->otg_irq < 0) 113 - return dev_err_probe(dev, cdns->otg_irq, 114 - "Failed to get otg IRQ\n"); 111 + cdns->otg_irq = platform_get_irq_byname(pdev, "otg"); 112 + if (cdns->otg_irq < 0) 113 + return dev_err_probe(dev, cdns->otg_irq, 114 + "Failed to get otg IRQ\n"); 115 115 116 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otg"); 117 - if (!res) { 118 - dev_err(dev, "couldn't get otg resource\n"); 119 - return -ENXIO; 120 - } 121 - 122 - cdns->otg_res = *res; 116 + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otg"); 117 + if (!res) { 118 + dev_err(dev, "couldn't get otg resource\n"); 119 + return -ENXIO; 123 120 } 124 121 125 122 cdns->phyrst_a_enable = device_property_read_bool(dev, "cdns,phyrst-a-enable"); 123 + 124 + cdns->otg_res = *res; 126 125 127 126 cdns->wakeup_irq = platform_get_irq_byname_optional(pdev, "wakeup"); 128 127 if (cdns->wakeup_irq == -EPROBE_DEFER) ··· 158 161 goto err_cdns_init; 159 162 160 163 cdns->gadget_init = cdns3_plat_gadget_init; 161 - 162 164 ret = cdns_core_init_role(cdns); 163 165 if (ret) 164 166 goto err_cdns_init;
+9 -38
drivers/usb/cdns3/cdnsp-pci.c
··· 19 19 20 20 struct cdnsp_wrap { 21 21 struct platform_device *plat_dev; 22 - struct property_entry prop[3]; 23 22 struct resource dev_res[6]; 24 23 int devfn; 25 24 }; ··· 29 30 #define RES_HOST_ID 3 30 31 #define RES_DEV_ID 4 31 32 #define RES_DRD_ID 5 32 - /* DRD PCI configuration - 64-bit addressing */ 33 - /* First PCI function */ 33 + 34 34 #define PCI_BAR_HOST 0 35 - #define PCI_BAR_DEV 2 36 - /* Second PCI function */ 37 35 #define PCI_BAR_OTG 0 38 - /* Device only PCI configuration - 32-bit addressing */ 39 - /* First PCI function */ 40 - #define PCI_BAR_ONLY_DEV 1 36 + #define PCI_BAR_DEV 2 41 37 42 38 #define PCI_DEV_FN_HOST_DEVICE 0 43 39 #define PCI_DEV_FN_OTG 1 ··· 65 71 struct cdnsp_wrap *wrap; 66 72 struct resource *res; 67 73 struct pci_dev *func; 68 - bool no_drd = false; 69 74 int ret = 0; 70 75 71 76 /* ··· 75 82 pdev->devfn != PCI_DEV_FN_OTG)) 76 83 return -EINVAL; 77 84 78 - if (pdev->device == PCI_DEVICE_ID_CDNS_UDC_USBSSP) 79 - no_drd = true; 80 - 81 85 func = cdnsp_get_second_fun(pdev); 82 - if (!func && !no_drd) 86 + if (!func) 83 87 return -EINVAL; 84 88 85 - if ((func && func->class == PCI_CLASS_SERIAL_USB_XHCI) || 89 + if (func->class == PCI_CLASS_SERIAL_USB_XHCI || 86 90 pdev->class == PCI_CLASS_SERIAL_USB_XHCI) { 87 91 ret = -EINVAL; 88 92 goto put_pci; ··· 93 103 94 104 pci_set_master(pdev); 95 105 96 - if (func && pci_is_enabled(func)) { 106 + if (pci_is_enabled(func)) { 97 107 wrap = pci_get_drvdata(func); 98 108 } else { 99 109 wrap = kzalloc_obj(*wrap); ··· 106 116 res = wrap->dev_res; 107 117 108 118 if (pdev->devfn == PCI_DEV_FN_HOST_DEVICE) { 109 - int bar_dev = no_drd ? PCI_BAR_ONLY_DEV : PCI_BAR_DEV; 110 - 111 119 /* Function 0: host(BAR_0) + device(BAR_2). */ 112 120 dev_dbg(&pdev->dev, "Initialize Device resources\n"); 113 - 114 - res[RES_DEV_ID].start = pci_resource_start(pdev, bar_dev); 115 - res[RES_DEV_ID].end = pci_resource_end(pdev, bar_dev); 121 + res[RES_DEV_ID].start = pci_resource_start(pdev, PCI_BAR_DEV); 122 + res[RES_DEV_ID].end = pci_resource_end(pdev, PCI_BAR_DEV); 116 123 res[RES_DEV_ID].name = "dev"; 117 124 res[RES_DEV_ID].flags = IORESOURCE_MEM; 118 125 dev_dbg(&pdev->dev, "USBSSP-DEV physical base addr: %pa\n", ··· 145 158 wrap->dev_res[RES_IRQ_OTG_ID].flags = IORESOURCE_IRQ; 146 159 } 147 160 148 - if (no_drd || pci_is_enabled(func)) { 149 - u8 idx = 0; 150 - 161 + if (pci_is_enabled(func)) { 151 162 /* set up platform device info */ 152 163 pdata.override_apb_timeout = CHICKEN_APB_TIMEOUT_VALUE; 153 - if (no_drd) { 154 - wrap->prop[idx++] = PROPERTY_ENTRY_STRING("dr_mode", "peripheral"); 155 - wrap->prop[idx++] = PROPERTY_ENTRY_BOOL("no_drd"); 156 - } else { 157 - wrap->prop[idx++] = PROPERTY_ENTRY_STRING("dr_mode", "otg"); 158 - wrap->prop[idx++] = PROPERTY_ENTRY_BOOL("usb-role-switch"); 159 - } 160 - 161 - wrap->prop[idx] = (struct property_entry){ }; 162 164 memset(&plat_info, 0, sizeof(plat_info)); 163 165 plat_info.parent = &pdev->dev; 164 166 plat_info.fwnode = pdev->dev.fwnode; ··· 158 182 plat_info.dma_mask = pdev->dma_mask; 159 183 plat_info.data = &pdata; 160 184 plat_info.size_data = sizeof(pdata); 161 - plat_info.properties = wrap->prop; 162 185 wrap->devfn = pdev->devfn; 163 186 /* register platform device */ 164 187 wrap->plat_dev = platform_device_register_full(&plat_info); ··· 185 210 if (wrap->devfn == pdev->devfn) 186 211 platform_device_unregister(wrap->plat_dev); 187 212 188 - if (!func || !pci_is_enabled(func)) 213 + if (!pci_is_enabled(func)) 189 214 kfree(wrap); 190 215 191 216 pci_dev_put(func); 192 217 } 193 218 194 219 static const struct pci_device_id cdnsp_pci_ids[] = { 195 - { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC_USBSSP), 196 - .class = PCI_CLASS_SERIAL_USB_DEVICE }, 197 - { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC_USBSSP), 198 - .class = PCI_CLASS_SERIAL_USB_CDNS }, 199 220 { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP), 200 221 .class = PCI_CLASS_SERIAL_USB_DEVICE }, 201 222 { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP),
+1 -2
drivers/usb/cdns3/core.c
··· 71 71 static void cdns_exit_roles(struct cdns *cdns) 72 72 { 73 73 cdns_role_stop(cdns); 74 - if (!cdns->no_drd) 75 - cdns_drd_exit(cdns); 74 + cdns_drd_exit(cdns); 76 75 } 77 76 78 77 /**
+1 -4
drivers/usb/cdns3/core.h
··· 80 80 * @pdata: platform data from glue layer 81 81 * @lock: spinlock structure 82 82 * @xhci_plat_data: xhci private data structure pointer 83 - * @gadget_init: pointer to gadget initialization function 84 83 * @override_apb_timeout: hold value of APB timeout. For value 0 the default 85 84 * value in CHICKEN_BITS_3 will be preserved. 86 - * @no_drd: DRD register block is inaccessible - driver handles only 87 - * device mode. 85 + * @gadget_init: pointer to gadget initialization function 88 86 */ 89 87 struct cdns { 90 88 struct device *dev; ··· 122 124 struct xhci_plat_priv *xhci_plat_data; 123 125 int (*gadget_init)(struct cdns *cdns); 124 126 u32 override_apb_timeout; 125 - bool no_drd; 126 127 }; 127 128 128 129 int cdns_hw_role_switch(struct cdns *cdns);
+2 -14
drivers/usb/cdns3/drd.c
··· 107 107 { 108 108 u32 reg; 109 109 110 - if (cdns->version != CDNSP_CONTROLLER_V2 || cdns->no_drd) 110 + if (cdns->version != CDNSP_CONTROLLER_V2) 111 111 return; 112 112 113 113 reg = readl(&cdns->otg_cdnsp_regs->override); ··· 120 120 { 121 121 u32 reg; 122 122 123 - if (cdns->version != CDNSP_CONTROLLER_V2 || cdns->no_drd) 123 + if (cdns->version != CDNSP_CONTROLLER_V2) 124 124 return; 125 125 126 126 reg = readl(&cdns->otg_cdnsp_regs->override); ··· 234 234 u32 ready_bit; 235 235 int ret, val; 236 236 237 - if (cdns->no_drd) 238 - return 0; 239 - 240 237 /* switch OTG core */ 241 238 writel(OTGCMD_DEV_BUS_REQ | reg, &cdns->otg_regs->cmd); 242 239 ··· 264 267 void cdns_drd_gadget_off(struct cdns *cdns) 265 268 { 266 269 u32 val; 267 - 268 - if (cdns->no_drd) 269 - return; 270 270 271 271 /* 272 272 * Driver should wait at least 10us after disabling Device ··· 391 397 void __iomem *regs; 392 398 u32 state, reg; 393 399 int ret; 394 - 395 - if (cdns->no_drd) { 396 - cdns->version = CDNSP_CONTROLLER_V2; 397 - cdns->dr_mode = USB_DR_MODE_PERIPHERAL; 398 - return 0; 399 - } 400 400 401 401 regs = devm_ioremap_resource(cdns->dev, &cdns->otg_res); 402 402 if (IS_ERR(regs))
-1
include/linux/pci_ids.h
··· 2424 2424 #define PCI_DEVICE_ID_CDNS_USBSS 0x0100 2425 2425 #define PCI_DEVICE_ID_CDNS_USB 0x0120 2426 2426 #define PCI_DEVICE_ID_CDNS_USBSSP 0x0200 2427 - #define PCI_DEVICE_ID_CDNS_UDC_USBSSP 0x0400 2428 2427 2429 2428 #define PCI_VENDOR_ID_ARECA 0x17d3 2430 2429 #define PCI_DEVICE_ID_ARECA_1110 0x1110