summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/dwc3/dwc3-generic.c1
-rw-r--r--drivers/usb/dwc3/dwc3-meson-g12a.c3
-rw-r--r--drivers/usb/eth/r8152.c26
-rw-r--r--drivers/usb/eth/r8152.h5
-rw-r--r--drivers/usb/host/dwc3-sti-glue.c2
-rw-r--r--drivers/usb/host/xhci-ring.c18
7 files changed, 45 insertions, 12 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index fedc0134f5..6e291198ab 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -60,7 +60,7 @@ config DM_USB_GADGET
mode)
config SPL_DM_USB_GADGET
- bool "Enable driver model for USB Gadget in sPL"
+ bool "Enable driver model for USB Gadget in SPL"
depends on SPL_DM_USB
help
Enable driver model for USB Gadget in SPL
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 459add80c5..ba9f9a4e0b 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -449,6 +449,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
{ .compatible = "rockchip,rk3328-dwc3" },
{ .compatible = "rockchip,rk3399-dwc3" },
{ .compatible = "qcom,dwc3" },
+ { .compatible = "intel,tangier-dwc3" },
{ }
};
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index acc7866b64..36955b5b69 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -269,9 +269,6 @@ int dwc3_meson_g12a_force_mode(struct udevice *dev, enum usb_dr_mode mode)
if (!priv->phys[USB2_OTG_PHY].dev)
return -EINVAL;
- if (mode == priv->otg_mode)
- return 0;
-
if (mode == USB_DR_MODE_HOST)
debug("%s: switching to Host Mode\n", __func__);
else
diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c
index e20cf69c76..4677da9f29 100644
--- a/drivers/usb/eth/r8152.c
+++ b/drivers/usb/eth/r8152.c
@@ -447,6 +447,12 @@ static void rtl8152_set_rx_mode(struct r8152 *tp)
ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data);
}
+static inline void r8153b_rx_agg_chg_indicate(struct r8152 *tp)
+{
+ ocp_write_byte(tp, MCU_TYPE_USB, USB_UPT_RXDMA_OWN,
+ OWN_UPDATE | OWN_CLEAR);
+}
+
static int rtl_enable(struct r8152 *tp)
{
u32 ocp_data;
@@ -457,6 +463,15 @@ static int rtl_enable(struct r8152 *tp)
ocp_data |= PLA_CR_RE | PLA_CR_TE;
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, ocp_data);
+ switch (tp->version) {
+ case RTL_VER_08:
+ case RTL_VER_09:
+ r8153b_rx_agg_chg_indicate(tp);
+ break;
+ default:
+ break;
+ }
+
rxdy_gated_en(tp, false);
rtl8152_set_rx_mode(tp);
@@ -525,8 +540,6 @@ static void r8153_set_rx_early_size(struct r8152 *tp)
debug("** %s Invalid Device\n", __func__);
break;
}
-
- ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, ocp_data);
}
static int rtl8153_enable(struct r8152 *tp)
@@ -1647,7 +1660,7 @@ int r8152_eth_probe(struct usb_device *dev, unsigned int ifnum,
if (usb_set_interface(dev, iface_desc->bInterfaceNumber, 0) ||
!ss->ep_in || !ss->ep_out || !ss->ep_int) {
debug("Problems with device\n");
- return 0;
+ goto error;
}
dev->privptr = (void *)ss;
@@ -1659,7 +1672,7 @@ int r8152_eth_probe(struct usb_device *dev, unsigned int ifnum,
r8152b_get_version(tp);
if (rtl_ops_init(tp))
- return 0;
+ goto error;
tp->rtl_ops.init(tp);
tp->rtl_ops.up(tp);
@@ -1669,6 +1682,11 @@ int r8152_eth_probe(struct usb_device *dev, unsigned int ifnum,
DUPLEX_FULL);
return 1;
+
+error:
+ cfree(ss->dev_priv);
+ ss->dev_priv = 0;
+ return 0;
}
int r8152_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
diff --git a/drivers/usb/eth/r8152.h b/drivers/usb/eth/r8152.h
index fa57e42502..45172c055f 100644
--- a/drivers/usb/eth/r8152.h
+++ b/drivers/usb/eth/r8152.h
@@ -92,6 +92,7 @@
#define USB_PM_CTRL_STATUS 0xd432 /* RTL8153A */
#define USB_RX_EXTRA_AGGR_TMR 0xd432 /* RTL8153B */
#define USB_TX_DMA 0xd434
+#define USB_UPT_RXDMA_OWN 0xd437
#define USB_TOLERANCE 0xd490
#define USB_LPM_CTRL 0xd41a
#define USB_BMU_RESET 0xd4b0
@@ -346,6 +347,10 @@
#define BMU_RESET_EP_IN 0x01
#define BMU_RESET_EP_OUT 0x02
+/* USB_UPT_RXDMA_OWN */
+#define OWN_UPDATE BIT(0)
+#define OWN_CLEAR BIT(1)
+
/* USB_UPS_CTRL */
#define POWER_CUT 0x0100
diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
index deb820a0f8..80e543496d 100644
--- a/drivers/usb/host/dwc3-sti-glue.c
+++ b/drivers/usb/host/dwc3-sti-glue.c
@@ -3,7 +3,7 @@
* STiH407 family DWC3 specific Glue layer
*
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
- * Author(s): Patrice Chotard, <patrice.chotard@st.com> for STMicroelectronics.
+ * Author(s): Patrice Chotard, <patrice.chotard@foss.st.com> for STMicroelectronics.
*/
#include <common.h>
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 13065d7ca9..d708fc928b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -580,10 +580,13 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
int ret;
u32 trb_fields[4];
u64 val_64 = virt_to_phys(buffer);
+ void *last_transfer_trb_addr;
+ int available_length;
debug("dev=%p, pipe=%lx, buffer=%p, length=%d\n",
udev, pipe, buffer, length);
+ available_length = length;
ep_index = usb_pipe_ep_index(pipe);
virt_dev = ctrl->devs[slot_id];
@@ -697,7 +700,7 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
trb_fields[2] = length_field;
trb_fields[3] = field | TRB_TYPE(TRB_NORMAL);
- queue_trb(ctrl, ring, (num_trbs > 1), trb_fields);
+ last_transfer_trb_addr = queue_trb(ctrl, ring, (num_trbs > 1), trb_fields);
--num_trbs;
@@ -710,6 +713,7 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
giveback_first_trb(udev, ep_index, start_cycle, start_trb);
+again:
event = xhci_wait_for_event(ctrl, TRB_TRANSFER);
if (!event) {
debug("XHCI bulk transfer timed out, aborting...\n");
@@ -718,12 +722,20 @@ int xhci_bulk_tx(struct usb_device *udev, unsigned long pipe,
udev->act_len = 0;
return -ETIMEDOUT;
}
- field = le32_to_cpu(event->trans_event.flags);
+ if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer))
+ != (uintptr_t)last_transfer_trb_addr) {
+ available_length -=
+ (int)EVENT_TRB_LEN(le32_to_cpu(event->trans_event.transfer_len));
+ xhci_acknowledge_event(ctrl);
+ goto again;
+ }
+
+ field = le32_to_cpu(event->trans_event.flags);
BUG_ON(TRB_TO_SLOT_ID(field) != slot_id);
BUG_ON(TRB_TO_EP_INDEX(field) != ep_index);
- record_transfer_result(udev, event, length);
+ record_transfer_result(udev, event, available_length);
xhci_acknowledge_event(ctrl);
xhci_inval_cache((uintptr_t)buffer, length);