]> Git Repo - J-u-boot.git/commitdiff
Merge tag 'u-boot-atmel-fixes-2021.04-a' of https://gitlab.denx.de/u-boot/custodians...
authorTom Rini <[email protected]>
Fri, 12 Feb 2021 14:09:10 +0000 (09:09 -0500)
committerTom Rini <[email protected]>
Fri, 12 Feb 2021 14:09:10 +0000 (09:09 -0500)
First set of u-boot-atmel fixes for 2021.04 cycle:

This small PR includes just two fixes but very important: one revert in
the clk subsystem which fixes the boot on many old boards
(sama5d2_xplained, sama5d4_xplained), which currently crash at boot; and
one small fix related to debug serial on sama7g5ek board.

arch/arm/dts/stm32mp15-u-boot.dtsi
doc/device-tree-bindings/usb/mediatek,mtk-xhci.txt
drivers/usb/gadget/dwc2_udc_otg.c
drivers/usb/host/xhci-mtk.c
drivers/usb/host/xhci-pci.c
drivers/usb/host/xhci-ring.c

index d0aa5eabe5ef054e01f233263f29294b2552c781..43a7909978d8b4020186d395758c20fa8ad10250 100644 (file)
        resets = <&rcc UART8_R>;
 };
 
-&usbotg_hs {
-       compatible = "st,stm32mp1-hsotg", "snps,dwc2";
-};
index 0447468a2d186815fffab1361cfc4cfa6484929b..2a298f7b1684b9ba1bb982204fd61fbd20120e2d 100644 (file)
@@ -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 {
index e3871e381e1493633432162532367e7717c63199..ecac80fc116666c14c0af42b4d6f4669de0f3f4d 100644 (file)
@@ -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 },
        {},
 };
index d301acc9a89b72aab0513d48b8a0cd6dd3166c87..18b4f55d8962396a910d1c103907c925272437e5 100644 (file)
@@ -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;
 }
 
index 2b445f21b558556889bd12c585ca61e5984f26a1..6c5024d3f1903a21a432607be93225ded8981448 100644 (file)
@@ -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);
 }
index d708fc928b247d1b9e63b9d83221047ead318849..d6c47d579bc2f7760a017667c2a48120589b6ce0 100644 (file)
@@ -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);
This page took 0.049934 seconds and 4 git commands to generate.