diff options
author | Tom Rini <trini@konsulko.com> | 2021-02-10 20:40:08 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-02-10 20:40:08 -0500 |
commit | 80c7e4cf76d204d4b726b0cc57a557a9d9c1c453 (patch) | |
tree | 914461025f7b6f5373d97d342735464c903c1624 | |
parent | c7182c02cefb11431a79a8abb4d8a821e4a478b5 (diff) | |
parent | db8fb2ffc4f3f63b9005f676ab3879a06de6cdda (diff) | |
download | u-boot-80c7e4cf76d204d4b726b0cc57a557a9d9c1c453.zip u-boot-80c7e4cf76d204d4b726b0cc57a557a9d9c1c453.tar.gz u-boot-80c7e4cf76d204d4b726b0cc57a557a9d9c1c453.tar.bz2 |
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usbWIP/11Feb2021
- MediaTek updates
- xhci fixes
- dwc2 stm32 compatible update
-rw-r--r-- | arch/arm/dts/stm32mp15-u-boot.dtsi | 3 | ||||
-rw-r--r-- | doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/dwc2_udc_otg.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/xhci-mtk.c | 23 | ||||
-rw-r--r-- | drivers/usb/host/xhci-pci.c | 15 | ||||
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 4 |
6 files changed, 39 insertions, 12 deletions
diff --git a/arch/arm/dts/stm32mp15-u-boot.dtsi b/arch/arm/dts/stm32mp15-u-boot.dtsi index d0aa5ea..43a7909 100644 --- a/arch/arm/dts/stm32mp15-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15-u-boot.dtsi @@ -228,6 +228,3 @@ resets = <&rcc UART8_R>; }; -&usbotg_hs { - compatible = "st,stm32mp1-hsotg", "snps,dwc2"; -}; diff --git a/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt b/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt index 0447468..2a298f7 100644 --- a/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt +++ b/doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt @@ -25,6 +25,10 @@ Required properties: Optional properties: - vbus-supply : reference to the VBUS regulator; + - mediatek,u3p-dis-msk : mask to disable u3ports, bit0 for u3port0, + bit1 for u3port1, ... etc; + - mediatek,u2p-dis-msk : mask to disable u2ports, bit0 for u2port0, + bit1 for u2port1, ... etc; Example: xhci: usb@1a0c0000 { diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index e3871e3..ecac80f 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -1176,7 +1176,7 @@ static int dwc2_udc_otg_remove(struct udevice *dev) static const struct udevice_id dwc2_udc_otg_ids[] = { { .compatible = "snps,dwc2" }, { .compatible = "brcm,bcm2835-usb" }, - { .compatible = "st,stm32mp1-hsotg", + { .compatible = "st,stm32mp15-hsotg", .data = (ulong)dwc2_set_stm32mp1_hsotg_params }, {}, }; diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index d301acc..18b4f55 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -61,10 +61,13 @@ struct mtk_xhci { struct phy_bulk phys; int num_u2ports; int num_u3ports; + u32 u3p_dis_msk; + u32 u2p_dis_msk; }; static int xhci_mtk_host_enable(struct mtk_xhci *mtk) { + int u3_ports_disabed = 0; u32 value; u32 check_val; int ret; @@ -73,15 +76,23 @@ static int xhci_mtk_host_enable(struct mtk_xhci *mtk) /* power on host ip */ clrbits_le32(mtk->ippc + IPPC_IP_PW_CTRL1, CTRL1_IP_HOST_PDN); - /* power on and enable all u3 ports */ + /* power on and enable u3 ports except skipped ones */ for (i = 0; i < mtk->num_u3ports; i++) { + if (BIT(i) & mtk->u3p_dis_msk) { + u3_ports_disabed++; + continue; + } + clrsetbits_le32(mtk->ippc + IPPC_U3_CTRL(i), CTRL_U3_PORT_PDN | CTRL_U3_PORT_DIS, CTRL_U3_PORT_HOST_SEL); } - /* power on and enable all u2 ports */ + /* power on and enable u2 ports except skipped ones */ for (i = 0; i < mtk->num_u2ports; i++) { + if (BIT(i) & mtk->u2p_dis_msk) + continue; + clrsetbits_le32(mtk->ippc + IPPC_U2_CTRL(i), CTRL_U2_PORT_PDN | CTRL_U2_PORT_DIS, CTRL_U2_PORT_HOST_SEL); @@ -94,7 +105,7 @@ static int xhci_mtk_host_enable(struct mtk_xhci *mtk) check_val = STS1_SYSPLL_STABLE | STS1_REF_RST | STS1_SYS125_RST | STS1_XHCI_RST; - if (mtk->num_u3ports) + if (mtk->num_u3ports > u3_ports_disabed) check_val |= STS1_U3_MAC_RST; ret = readl_poll_timeout(mtk->ippc + IPPC_IP_PW_STS1, value, @@ -176,6 +187,12 @@ static int xhci_mtk_ofdata_get(struct mtk_xhci *mtk) if (ret) debug("can't get vbus regulator %d!\n", ret); + /* optional properties to disable ports, ignore the error */ + dev_read_u32(dev, "mediatek,u3p-dis-msk", &mtk->u3p_dis_msk); + dev_read_u32(dev, "mediatek,u2p-dis-msk", &mtk->u2p_dis_msk); + dev_info(dev, "ports disabled mask: u3p-0x%x, u2p-0x%x\n", + mtk->u3p_dis_msk, mtk->u2p_dis_msk); + return 0; } diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 2b445f2..6c5024d 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c @@ -13,8 +13,8 @@ #include <usb.h> #include <usb/xhci.h> -static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr, - struct xhci_hcor **ret_hcor) +static int xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr, + struct xhci_hcor **ret_hcor) { struct xhci_hccr *hccr; struct xhci_hcor *hcor; @@ -22,6 +22,11 @@ static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr, hccr = (struct xhci_hccr *)dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM); + if (!hccr) { + printf("xhci-pci init cannot map PCI mem bar\n"); + return -EIO; + } + hcor = (struct xhci_hcor *)((uintptr_t) hccr + HC_LENGTH(xhci_readl(&hccr->cr_capbase))); @@ -35,14 +40,18 @@ static void xhci_pci_init(struct udevice *dev, struct xhci_hccr **ret_hccr, dm_pci_read_config32(dev, PCI_COMMAND, &cmd); cmd |= PCI_COMMAND_MASTER; dm_pci_write_config32(dev, PCI_COMMAND, cmd); + return 0; } static int xhci_pci_probe(struct udevice *dev) { struct xhci_hccr *hccr; struct xhci_hcor *hcor; + int ret; - xhci_pci_init(dev, &hccr, &hcor); + ret = xhci_pci_init(dev, &hccr, &hcor); + if (ret) + return ret; return xhci_register(dev, hccr, hcor); } diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index d708fc9..d6c47d5 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -723,8 +723,8 @@ again: return -ETIMEDOUT; } - if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer)) - != (uintptr_t)last_transfer_trb_addr) { + if ((uintptr_t)(le64_to_cpu(event->trans_event.buffer)) != + (uintptr_t)virt_to_phys(last_transfer_trb_addr)) { available_length -= (int)EVENT_TRB_LEN(le32_to_cpu(event->trans_event.transfer_len)); xhci_acknowledge_event(ctrl); |