Commit bec6f00f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull USB fixes from Greg KH:
 "Here are some small USB driver fixes for 6.15-rc6. Included in here
  are:

   - typec driver fixes

   - usbtmc ioctl fixes

   - xhci driver fixes

   - cdnsp driver fixes

   - some gadget driver fixes

  Nothing really major, just all little stuff that people have reported
  being issues. All of these have been in linux-next this week with no
  reported issues"

* tag 'usb-6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  xhci: dbc: Avoid event polling busyloop if pending rx transfers are inactive.
  usb: xhci: Don't trust the EP Context cycle bit when moving HW dequeue
  usb: usbtmc: Fix erroneous generic_read ioctl return
  usb: usbtmc: Fix erroneous wait_srq ioctl return
  usb: usbtmc: Fix erroneous get_stb ioctl error returns
  usb: typec: tcpm: delay SNK_TRY_WAIT_DEBOUNCE to SRC_TRYWAIT transition
  USB: usbtmc: use interruptible sleep in usbtmc_read
  usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version
  usb: typec: ucsi: displayport: Fix NULL pointer access
  usb: typec: ucsi: displayport: Fix deadlock
  usb: misc: onboard_usb_dev: fix support for Cypress HX3 hubs
  usb: uhci-platform: Make the clock really optional
  usb: dwc3: gadget: Make gadget_wakeup asynchronous
  usb: gadget: Use get_status callback to set remote wakeup capability
  usb: gadget: f_ecm: Add get_status callback
  usb: host: tegra: Prevent host controller crash when OTG port is used
  usb: cdnsp: Fix issue with resuming from L1
  usb: gadget: tegra-xudc: ACK ST_RC after clearing CTRL_RUN
parents 067dd587 cab63934
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -139,6 +139,26 @@ static void cdnsp_clear_port_change_bit(struct cdnsp_device *pdev,
	       (portsc & PORT_CHANGE_BITS), port_regs);
}

static void cdnsp_set_apb_timeout_value(struct cdnsp_device *pdev)
{
	struct cdns *cdns = dev_get_drvdata(pdev->dev);
	__le32 __iomem *reg;
	void __iomem *base;
	u32 offset = 0;
	u32 val;

	if (!cdns->override_apb_timeout)
		return;

	base = &pdev->cap_regs->hc_capbase;
	offset = cdnsp_find_next_ext_cap(base, offset, D_XEC_PRE_REGS_CAP);
	reg = base + offset + REG_CHICKEN_BITS_3_OFFSET;

	val  = le32_to_cpu(readl(reg));
	val = CHICKEN_APB_TIMEOUT_SET(val, cdns->override_apb_timeout);
	writel(cpu_to_le32(val), reg);
}

static void cdnsp_set_chicken_bits_2(struct cdnsp_device *pdev, u32 bit)
{
	__le32 __iomem *reg;
@@ -1773,6 +1793,8 @@ static void cdnsp_get_rev_cap(struct cdnsp_device *pdev)
	reg += cdnsp_find_next_ext_cap(reg, 0, RTL_REV_CAP);
	pdev->rev_cap  = reg;

	pdev->rtl_revision = readl(&pdev->rev_cap->rtl_revision);

	dev_info(pdev->dev, "Rev: %08x/%08x, eps: %08x, buff: %08x/%08x\n",
		 readl(&pdev->rev_cap->ctrl_revision),
		 readl(&pdev->rev_cap->rtl_revision),
@@ -1798,6 +1820,15 @@ static int cdnsp_gen_setup(struct cdnsp_device *pdev)
	pdev->hci_version = HC_VERSION(pdev->hcc_params);
	pdev->hcc_params = readl(&pdev->cap_regs->hcc_params);

	/*
	 * Override the APB timeout value to give the controller more time for
	 * enabling UTMI clock and synchronizing APB and UTMI clock domains.
	 * This fix is platform specific and is required to fixes issue with
	 * reading incorrect value from PORTSC register after resuming
	 * from L1 state.
	 */
	cdnsp_set_apb_timeout_value(pdev);

	cdnsp_get_rev_cap(pdev);

	/* Make sure the Device Controller is halted. */
+6 −0
Original line number Diff line number Diff line
@@ -520,6 +520,9 @@ struct cdnsp_rev_cap {
#define REG_CHICKEN_BITS_2_OFFSET	0x48
#define CHICKEN_XDMA_2_TP_CACHE_DIS	BIT(28)

#define REG_CHICKEN_BITS_3_OFFSET       0x4C
#define CHICKEN_APB_TIMEOUT_SET(p, val) (((p) & ~GENMASK(21, 0)) | (val))

/* XBUF Extended Capability ID. */
#define XBUF_CAP_ID			0xCB
#define XBUF_RX_TAG_MASK_0_OFFSET	0x1C
@@ -1357,6 +1360,7 @@ struct cdnsp_port {
 * @rev_cap: Controller Capabilities Registers.
 * @hcs_params1: Cached register copies of read-only HCSPARAMS1
 * @hcc_params: Cached register copies of read-only HCCPARAMS1
 * @rtl_revision: Cached controller rtl revision.
 * @setup: Temporary buffer for setup packet.
 * @ep0_preq: Internal allocated request used during enumeration.
 * @ep0_stage: ep0 stage during enumeration process.
@@ -1411,6 +1415,8 @@ struct cdnsp_device {
	__u32 hcs_params1;
	__u32 hcs_params3;
	__u32 hcc_params;
	#define RTL_REVISION_NEW_LPM 0x2700
	__u32 rtl_revision;
	/* Lock used in interrupt thread context. */
	spinlock_t lock;
	struct usb_ctrlrequest setup;
+10 −2
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#define PCI_DRIVER_NAME		"cdns-pci-usbssp"
#define PLAT_DRIVER_NAME	"cdns-usbssp"

#define CHICKEN_APB_TIMEOUT_VALUE       0x1C20

static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
{
	/*
@@ -139,6 +141,14 @@ static int cdnsp_pci_probe(struct pci_dev *pdev,
		cdnsp->otg_irq = pdev->irq;
	}

	/*
	 * Cadence PCI based platform require some longer timeout for APB
	 * to fixes domain clock synchronization issue after resuming
	 * controller from L1 state.
	 */
	cdnsp->override_apb_timeout = CHICKEN_APB_TIMEOUT_VALUE;
	pci_set_drvdata(pdev, cdnsp);

	if (pci_is_enabled(func)) {
		cdnsp->dev = dev;
		cdnsp->gadget_init = cdnsp_gadget_init;
@@ -148,8 +158,6 @@ static int cdnsp_pci_probe(struct pci_dev *pdev,
			goto free_cdnsp;
	}

	pci_set_drvdata(pdev, cdnsp);

	device_wakeup_enable(&pdev->dev);
	if (pci_dev_run_wake(pdev))
		pm_runtime_put_noidle(&pdev->dev);
+2 −1
Original line number Diff line number Diff line
@@ -308,6 +308,7 @@ static bool cdnsp_ring_ep_doorbell(struct cdnsp_device *pdev,

	writel(db_value, reg_addr);

	if (pdev->rtl_revision < RTL_REVISION_NEW_LPM)
		cdnsp_force_l0_go(pdev);

	/* Doorbell was set. */
+3 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ struct cdns3_platform_data {
 * @pdata: platform data from glue layer
 * @lock: spinlock structure
 * @xhci_plat_data: xhci private data structure pointer
 * @override_apb_timeout: hold value of APB timeout. For value 0 the default
 *                        value in CHICKEN_BITS_3 will be preserved.
 * @gadget_init: pointer to gadget initialization function
 */
struct cdns {
@@ -117,6 +119,7 @@ struct cdns {
	struct cdns3_platform_data	*pdata;
	spinlock_t			lock;
	struct xhci_plat_priv		*xhci_plat_data;
	u32                             override_apb_timeout;

	int (*gadget_init)(struct cdns *cdns);
};
Loading