Skip to content

Commit

Permalink
Merge tag 'usb-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are some small USB driver fixes for 5.11-rc5.  They resolve:

   - xhci issues for some reported problems

   - ehci driver issue for one specific device

   - USB gadget fixes for some reported problems

   - cdns3 driver fixes for issues reported

   - MAINTAINERS file update

   - thunderbolt minor fix

  All of these have been in linux-next with no reported issues"

* tag 'usb-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  usb: bdc: Make bdc pci driver depend on BROKEN
  xhci: tegra: Delay for disabling LFPS detector
  xhci: make sure TRB is fully written before giving it to the controller
  usb: udc: core: Use lock when write to soft_connect
  USB: gadget: dummy-hcd: Fix errors in port-reset handling
  usb: gadget: aspeed: fix stop dma register setting.
  USB: ehci: fix an interrupt calltrace error
  ehci: fix EHCI host controller initialization sequence
  MAINTAINERS: update Peter Chen's email address
  thunderbolt: Drop duplicated 0x prefix from format string
  MAINTAINERS: Update address for Cadence USB3 driver
  usb: cdns3: imx: improve driver .remove API
  usb: cdns3: imx: fix can't create core device the second time issue
  usb: cdns3: imx: fix writing read-only memory issue
  • Loading branch information
torvalds committed Jan 24, 2021
2 parents e680613 + ef02684 commit 8f3bfd2
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 23 deletions.
6 changes: 3 additions & 3 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,7 @@ F: Documentation/devicetree/bindings/mtd/cadence-nand-controller.txt
F: drivers/mtd/nand/raw/cadence-nand-controller.c

CADENCE USB3 DRD IP DRIVER
M: Peter Chen <peter.chen@nxp.com>
M: Peter Chen <peter.chen@kernel.org>
M: Pawel Laszczak <[email protected]>
R: Roger Quadros <[email protected]>
R: Aswath Govindraju <[email protected]>
Expand Down Expand Up @@ -4161,7 +4161,7 @@ S: Maintained
F: Documentation/translations/zh_CN/

CHIPIDEA USB HIGH SPEED DUAL ROLE CONTROLLER
M: Peter Chen <[email protected]>
M: Peter Chen <[email protected]>
L: [email protected]
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
Expand Down Expand Up @@ -18420,7 +18420,7 @@ F: Documentation/usb/ohci.rst
F: drivers/usb/host/ohci*

USB OTG FSM (Finite State Machine)
M: Peter Chen <[email protected]>
M: Peter Chen <[email protected]>
L: [email protected]
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb.git
Expand Down
2 changes: 1 addition & 1 deletion drivers/thunderbolt/icm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2316,7 +2316,7 @@ static int icm_usb4_switch_nvm_authenticate_status(struct tb_switch *sw,

if (auth && auth->reply.route_hi == sw->config.route_hi &&
auth->reply.route_lo == sw->config.route_lo) {
tb_dbg(tb, "NVM_AUTH found for %llx flags 0x%#x status %#x\n",
tb_dbg(tb, "NVM_AUTH found for %llx flags %#x status %#x\n",
tb_route(sw), auth->reply.hdr.flags, auth->reply.status);
if (auth->reply.hdr.flags & ICM_FLAGS_ERROR)
ret = -EIO;
Expand Down
22 changes: 11 additions & 11 deletions drivers/usb/cdns3/cdns3-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ static int cdns_imx_probe(struct platform_device *pdev)
}

data->num_clks = ARRAY_SIZE(imx_cdns3_core_clks);
data->clks = (struct clk_bulk_data *)imx_cdns3_core_clks;
data->clks = devm_kmemdup(dev, imx_cdns3_core_clks,
sizeof(imx_cdns3_core_clks), GFP_KERNEL);
if (!data->clks)
return -ENOMEM;

ret = devm_clk_bulk_get(dev, data->num_clks, data->clks);
if (ret)
return ret;
Expand Down Expand Up @@ -214,20 +218,16 @@ static int cdns_imx_probe(struct platform_device *pdev)
return ret;
}

static int cdns_imx_remove_core(struct device *dev, void *data)
{
struct platform_device *pdev = to_platform_device(dev);

platform_device_unregister(pdev);

return 0;
}

static int cdns_imx_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct cdns_imx *data = dev_get_drvdata(dev);

device_for_each_child(dev, NULL, cdns_imx_remove_core);
pm_runtime_get_sync(dev);
of_platform_depopulate(dev);
clk_bulk_disable_unprepare(data->num_clks, data->clks);
pm_runtime_disable(dev);
pm_runtime_put_noidle(dev);
platform_set_drvdata(pdev, NULL);

return 0;
Expand Down
5 changes: 4 additions & 1 deletion drivers/usb/gadget/udc/aspeed-vhub/epn.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@ static void ast_vhub_stop_active_req(struct ast_vhub_ep *ep,
u32 state, reg, loops;

/* Stop DMA activity */
writel(0, ep->epn.regs + AST_VHUB_EP_DMA_CTLSTAT);
if (ep->epn.desc_mode)
writel(VHUB_EP_DMA_CTRL_RESET, ep->epn.regs + AST_VHUB_EP_DMA_CTLSTAT);
else
writel(0, ep->epn.regs + AST_VHUB_EP_DMA_CTLSTAT);

/* Wait for it to complete */
for (loops = 0; loops < 1000; loops++) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/gadget/udc/bdc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if USB_BDC_UDC
comment "Platform Support"
config USB_BDC_PCI
tristate "BDC support for PCIe based platforms"
depends on USB_PCI
depends on USB_PCI && BROKEN
default USB_BDC_UDC
help
Enable support for platforms which have BDC connected through PCIe, such as Lego3 FPGA platform.
Expand Down
13 changes: 10 additions & 3 deletions drivers/usb/gadget/udc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1529,10 +1529,13 @@ static ssize_t soft_connect_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t n)
{
struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
ssize_t ret;

mutex_lock(&udc_lock);
if (!udc->driver) {
dev_err(dev, "soft-connect without a gadget driver\n");
return -EOPNOTSUPP;
ret = -EOPNOTSUPP;
goto out;
}

if (sysfs_streq(buf, "connect")) {
Expand All @@ -1543,10 +1546,14 @@ static ssize_t soft_connect_store(struct device *dev,
usb_gadget_udc_stop(udc);
} else {
dev_err(dev, "unsupported command '%s'\n", buf);
return -EINVAL;
ret = -EINVAL;
goto out;
}

return n;
ret = n;
out:
mutex_unlock(&udc_lock);
return ret;
}
static DEVICE_ATTR_WO(soft_connect);

Expand Down
10 changes: 7 additions & 3 deletions drivers/usb/gadget/udc/dummy_hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2270,17 +2270,20 @@ static int dummy_hub_control(
}
fallthrough;
case USB_PORT_FEAT_RESET:
if (!(dum_hcd->port_status & USB_PORT_STAT_CONNECTION))
break;
/* if it's already enabled, disable */
if (hcd->speed == HCD_USB3) {
dum_hcd->port_status = 0;
dum_hcd->port_status =
(USB_SS_PORT_STAT_POWER |
USB_PORT_STAT_CONNECTION |
USB_PORT_STAT_RESET);
} else
} else {
dum_hcd->port_status &= ~(USB_PORT_STAT_ENABLE
| USB_PORT_STAT_LOW_SPEED
| USB_PORT_STAT_HIGH_SPEED);
dum_hcd->port_status |= USB_PORT_STAT_RESET;
}
/*
* We want to reset device status. All but the
* Self powered feature
Expand All @@ -2292,7 +2295,8 @@ static int dummy_hub_control(
* interval? Is it still 50msec as for HS?
*/
dum_hcd->re_timeout = jiffies + msecs_to_jiffies(50);
fallthrough;
set_link_state(dum_hcd);
break;
case USB_PORT_FEAT_C_CONNECTION:
case USB_PORT_FEAT_C_RESET:
case USB_PORT_FEAT_C_ENABLE:
Expand Down
12 changes: 12 additions & 0 deletions drivers/usb/host/ehci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ static int ehci_run (struct usb_hcd *hcd)
struct ehci_hcd *ehci = hcd_to_ehci (hcd);
u32 temp;
u32 hcc_params;
int rc;

hcd->uses_new_polling = 1;

Expand Down Expand Up @@ -629,9 +630,20 @@ static int ehci_run (struct usb_hcd *hcd)
down_write(&ehci_cf_port_reset_rwsem);
ehci->rh_state = EHCI_RH_RUNNING;
ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);

/* Wait until HC become operational */
ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
msleep(5);
rc = ehci_handshake(ehci, &ehci->regs->status, STS_HALT, 0, 100 * 1000);

up_write(&ehci_cf_port_reset_rwsem);

if (rc) {
ehci_err(ehci, "USB %x.%x, controller refused to start: %d\n",
((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), rc);
return rc;
}

ehci->last_periodic_enable = ktime_get_real();

temp = HC_VERSION(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/host/ehci-hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)

unlink_empty_async_suspended(ehci);

/* Some Synopsys controllers mistakenly leave IAA turned on */
ehci_writel(ehci, STS_IAA, &ehci->regs->status);

/* Any IAA cycle that started before the suspend is now invalid */
end_iaa_cycle(ehci);
ehci_handle_start_intr_unlinks(ehci);
Expand Down
2 changes: 2 additions & 0 deletions drivers/usb/host/xhci-ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,8 @@ static void queue_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
trb->field[0] = cpu_to_le32(field1);
trb->field[1] = cpu_to_le32(field2);
trb->field[2] = cpu_to_le32(field3);
/* make sure TRB is fully written before giving it to the controller */
wmb();
trb->field[3] = cpu_to_le32(field4);

trace_xhci_queue_trb(ring, trb);
Expand Down
7 changes: 7 additions & 0 deletions drivers/usb/host/xhci-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,13 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
enable);
if (err < 0)
break;

/*
* wait 500us for LFPS detector to be disabled before
* sending ACK
*/
if (!enable)
usleep_range(500, 1000);
}

if (err < 0) {
Expand Down

0 comments on commit 8f3bfd2

Please sign in to comment.