diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 13:03:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 13:03:52 -0400 |
commit | 132d68d37d33f1d0b9c1f507c8b4d64c27ecec8a (patch) | |
tree | b3c05972e5579e1574873fe745fb1358c62a269c /drivers/usb/mtu3/mtu3_core.c | |
parent | 80f232121b69cc69a31ccb2b38c1665d770b0710 (diff) | |
parent | 3515468a87a47781f6af818773650513ff14656a (diff) |
Merge tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB/PHY updates from Greg KH:
"Here is the big set of USB and PHY driver patches for 5.2-rc1
There is the usual set of:
- USB gadget updates
- PHY driver updates and additions
- USB serial driver updates and fixes
- typec updates and new chips supported
- mtu3 driver updates
- xhci driver updates
- other tiny driver updates
Nothing really interesting, just constant forward progress.
All of these have been in linux-next for a while with no reported
issues. The usb-gadget and usb-serial trees were merged a bit "late",
but both of them had been in linux-next before they got merged here
last Friday"
* tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (206 commits)
USB: serial: f81232: implement break control
USB: serial: f81232: add high baud rate support
USB: serial: f81232: clear overrun flag
USB: serial: f81232: fix interrupt worker not stop
usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA
usb: dwc3: Fix default lpm_nyet_threshold value
usb: dwc3: debug: Print GET_STATUS(device) tracepoint
usb: dwc3: Do core validation early on probe
usb: dwc3: gadget: Set lpm_capable
usb: gadget: atmel: tie wake lock to running clock
usb: gadget: atmel: support USB suspend
usb: gadget: atmel_usba_udc: simplify setting of interrupt-enabled mask
dwc2: gadget: Fix completed transfer size calculation in DDMA
usb: dwc2: Set lpm mode parameters depend on HW configuration
usb: dwc2: Fix channel disable flow
usb: dwc2: Set actual frame number for completed ISOC transfer
usb: gadget: do not use __constant_cpu_to_le16
usb: dwc2: gadget: Increase descriptors count for ISOC's
usb: introduce usb_ep_type_string() function
usb: dwc3: move synchronize_irq() out of the spinlock protected block
...
Diffstat (limited to 'drivers/usb/mtu3/mtu3_core.c')
-rw-r--r-- | drivers/usb/mtu3/mtu3_core.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 4fee200795a5..f8bd1d57e795 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | 17 | ||
18 | #include "mtu3.h" | 18 | #include "mtu3.h" |
19 | #include "mtu3_debug.h" | ||
20 | #include "mtu3_trace.h" | ||
19 | 21 | ||
20 | static int ep_fifo_alloc(struct mtu3_ep *mep, u32 seg_size) | 22 | static int ep_fifo_alloc(struct mtu3_ep *mep, u32 seg_size) |
21 | { | 23 | { |
@@ -299,6 +301,7 @@ int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep, | |||
299 | int interval, int burst, int mult) | 301 | int interval, int burst, int mult) |
300 | { | 302 | { |
301 | void __iomem *mbase = mtu->mac_base; | 303 | void __iomem *mbase = mtu->mac_base; |
304 | bool gen2cp = mtu->gen2cp; | ||
302 | int epnum = mep->epnum; | 305 | int epnum = mep->epnum; |
303 | u32 csr0, csr1, csr2; | 306 | u32 csr0, csr1, csr2; |
304 | int fifo_sgsz, fifo_addr; | 307 | int fifo_sgsz, fifo_addr; |
@@ -319,7 +322,7 @@ int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep, | |||
319 | 322 | ||
320 | num_pkts = (burst + 1) * (mult + 1) - 1; | 323 | num_pkts = (burst + 1) * (mult + 1) - 1; |
321 | csr1 = TX_SS_BURST(burst) | TX_SLOT(mep->slot); | 324 | csr1 = TX_SS_BURST(burst) | TX_SLOT(mep->slot); |
322 | csr1 |= TX_MAX_PKT(num_pkts) | TX_MULT(mult); | 325 | csr1 |= TX_MAX_PKT(gen2cp, num_pkts) | TX_MULT(gen2cp, mult); |
323 | 326 | ||
324 | csr2 = TX_FIFOADDR(fifo_addr >> 4); | 327 | csr2 = TX_FIFOADDR(fifo_addr >> 4); |
325 | csr2 |= TX_FIFOSEGSIZE(fifo_sgsz); | 328 | csr2 |= TX_FIFOSEGSIZE(fifo_sgsz); |
@@ -355,7 +358,7 @@ int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep, | |||
355 | 358 | ||
356 | num_pkts = (burst + 1) * (mult + 1) - 1; | 359 | num_pkts = (burst + 1) * (mult + 1) - 1; |
357 | csr1 = RX_SS_BURST(burst) | RX_SLOT(mep->slot); | 360 | csr1 = RX_SS_BURST(burst) | RX_SLOT(mep->slot); |
358 | csr1 |= RX_MAX_PKT(num_pkts) | RX_MULT(mult); | 361 | csr1 |= RX_MAX_PKT(gen2cp, num_pkts) | RX_MULT(gen2cp, mult); |
359 | 362 | ||
360 | csr2 = RX_FIFOADDR(fifo_addr >> 4); | 363 | csr2 = RX_FIFOADDR(fifo_addr >> 4); |
361 | csr2 |= RX_FIFOSEGSIZE(fifo_sgsz); | 364 | csr2 |= RX_FIFOSEGSIZE(fifo_sgsz); |
@@ -600,6 +603,10 @@ static void mtu3_regs_init(struct mtu3 *mtu) | |||
600 | mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON); | 603 | mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON); |
601 | /* enable automatical HWRW from L1 */ | 604 | /* enable automatical HWRW from L1 */ |
602 | mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE); | 605 | mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE); |
606 | |||
607 | /* use new QMU format when HW version >= 0x1003 */ | ||
608 | if (mtu->gen2cp) | ||
609 | mtu3_writel(mbase, U3D_QFCR, ~0x0); | ||
603 | } | 610 | } |
604 | 611 | ||
605 | static irqreturn_t mtu3_link_isr(struct mtu3 *mtu) | 612 | static irqreturn_t mtu3_link_isr(struct mtu3 *mtu) |
@@ -650,6 +657,8 @@ static irqreturn_t mtu3_link_isr(struct mtu3 *mtu) | |||
650 | break; | 657 | break; |
651 | } | 658 | } |
652 | dev_dbg(mtu->dev, "%s: %s\n", __func__, usb_speed_string(udev_speed)); | 659 | dev_dbg(mtu->dev, "%s: %s\n", __func__, usb_speed_string(udev_speed)); |
660 | mtu3_dbg_trace(mtu->dev, "link speed %s", | ||
661 | usb_speed_string(udev_speed)); | ||
653 | 662 | ||
654 | mtu->g.speed = udev_speed; | 663 | mtu->g.speed = udev_speed; |
655 | mtu->g.ep0->maxpacket = maxpkt; | 664 | mtu->g.ep0->maxpacket = maxpkt; |
@@ -672,6 +681,7 @@ static irqreturn_t mtu3_u3_ltssm_isr(struct mtu3 *mtu) | |||
672 | ltssm &= mtu3_readl(mbase, U3D_LTSSM_INTR_ENABLE); | 681 | ltssm &= mtu3_readl(mbase, U3D_LTSSM_INTR_ENABLE); |
673 | mtu3_writel(mbase, U3D_LTSSM_INTR, ltssm); /* W1C */ | 682 | mtu3_writel(mbase, U3D_LTSSM_INTR, ltssm); /* W1C */ |
674 | dev_dbg(mtu->dev, "=== LTSSM[%x] ===\n", ltssm); | 683 | dev_dbg(mtu->dev, "=== LTSSM[%x] ===\n", ltssm); |
684 | trace_mtu3_u3_ltssm_isr(ltssm); | ||
675 | 685 | ||
676 | if (ltssm & (HOT_RST_INTR | WARM_RST_INTR)) | 686 | if (ltssm & (HOT_RST_INTR | WARM_RST_INTR)) |
677 | mtu3_gadget_reset(mtu); | 687 | mtu3_gadget_reset(mtu); |
@@ -702,6 +712,7 @@ static irqreturn_t mtu3_u2_common_isr(struct mtu3 *mtu) | |||
702 | u2comm &= mtu3_readl(mbase, U3D_COMMON_USB_INTR_ENABLE); | 712 | u2comm &= mtu3_readl(mbase, U3D_COMMON_USB_INTR_ENABLE); |
703 | mtu3_writel(mbase, U3D_COMMON_USB_INTR, u2comm); /* W1C */ | 713 | mtu3_writel(mbase, U3D_COMMON_USB_INTR, u2comm); /* W1C */ |
704 | dev_dbg(mtu->dev, "=== U2COMM[%x] ===\n", u2comm); | 714 | dev_dbg(mtu->dev, "=== U2COMM[%x] ===\n", u2comm); |
715 | trace_mtu3_u2_common_isr(u2comm); | ||
705 | 716 | ||
706 | if (u2comm & SUSPEND_INTR) | 717 | if (u2comm & SUSPEND_INTR) |
707 | mtu3_gadget_suspend(mtu); | 718 | mtu3_gadget_suspend(mtu); |
@@ -749,13 +760,15 @@ static irqreturn_t mtu3_irq(int irq, void *data) | |||
749 | 760 | ||
750 | static int mtu3_hw_init(struct mtu3 *mtu) | 761 | static int mtu3_hw_init(struct mtu3 *mtu) |
751 | { | 762 | { |
752 | u32 cap_dev; | 763 | u32 value; |
753 | int ret; | 764 | int ret; |
754 | 765 | ||
755 | mtu->hw_version = mtu3_readl(mtu->ippc_base, U3D_SSUSB_HW_ID); | 766 | value = mtu3_readl(mtu->ippc_base, U3D_SSUSB_IP_TRUNK_VERS); |
767 | mtu->hw_version = IP_TRUNK_VERS(value); | ||
768 | mtu->gen2cp = !!(mtu->hw_version >= MTU3_TRUNK_VERS_1003); | ||
756 | 769 | ||
757 | cap_dev = mtu3_readl(mtu->ippc_base, U3D_SSUSB_IP_DEV_CAP); | 770 | value = mtu3_readl(mtu->ippc_base, U3D_SSUSB_IP_DEV_CAP); |
758 | mtu->is_u3_ip = !!SSUSB_IP_DEV_U3_PORT_NUM(cap_dev); | 771 | mtu->is_u3_ip = !!SSUSB_IP_DEV_U3_PORT_NUM(value); |
759 | 772 | ||
760 | dev_info(mtu->dev, "IP version 0x%x(%s IP)\n", mtu->hw_version, | 773 | dev_info(mtu->dev, "IP version 0x%x(%s IP)\n", mtu->hw_version, |
761 | mtu->is_u3_ip ? "U3" : "U2"); | 774 | mtu->is_u3_ip ? "U3" : "U2"); |
@@ -893,6 +906,8 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) | |||
893 | if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) | 906 | if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) |
894 | mtu3_stop(mtu); | 907 | mtu3_stop(mtu); |
895 | 908 | ||
909 | ssusb_dev_debugfs_init(ssusb); | ||
910 | |||
896 | dev_dbg(dev, " %s() done...\n", __func__); | 911 | dev_dbg(dev, " %s() done...\n", __func__); |
897 | 912 | ||
898 | return 0; | 913 | return 0; |