]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: usb: allow to de-activate some ports on EHCI root hub
authorVincent Palatin <vpalatin@chromium.org>
Fri, 16 Nov 2012 20:22:44 +0000 (12:22 -0800)
committerGerrit <chrome-bot@google.com>
Wed, 5 Dec 2012 18:50:59 +0000 (10:50 -0800)
To optimize power consumption and sometimes avoid electrical conflicts
on the board, we might want to avoid activating some of the ports on
the root hub.
The platform specific part of the driver can optionally provide a bitmap
of the enabled ports. By default, all ports are enabled.

This might be reverted once we have another mechanism to control VBUS
regulator on the next hardware revision.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BUG=chrome-os-partner:14490
TEST=boot on Spring, verify that port 0 regulator is not enabled and
port 1 is detecting a USB key correctly.
boot on Snow, verify that port 0 is detecting a USB key

Change-Id: Ib08d18a105e366b37f5117a6f7c0e1e56e04dce5
Reviewed-on: https://gerrit.chromium.org/gerrit/38222
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Documentation/devicetree/bindings/usb/exynos-ehci.txt [new file with mode: 0644]
drivers/usb/host/ehci-hub.c
drivers/usb/host/ehci-s5p.c
drivers/usb/host/ehci.h

diff --git a/Documentation/devicetree/bindings/usb/exynos-ehci.txt b/Documentation/devicetree/bindings/usb/exynos-ehci.txt
new file mode 100644 (file)
index 0000000..b109c47
--- /dev/null
@@ -0,0 +1,22 @@
+Exynos USB EHCI controllers
+
+Required properties:
+  - compatible : should be "samsung,exynos-ehci".
+  - reg : should contain at least address and length of the standard EHCI
+    register set for the device.
+  - interrupts : one EHCI interrupt should be described here.
+
+Optional properties:
+  - samsung,vbus-gpio : OF gpio specification of the pin which needs to be
+    activated for the bus to be powered.
+  - samsung,port_used_bitmap : defined which port should be enabled on the
+    root hub.
+
+Example:
+       ehci {
+               compatible = "samsung,exynos-ehci";
+               reg = <0x12110000 0x100>;
+               interrupts = <0 71 0>;
+               samsung,vbus-gpio = <&gpx1 1 1 3 3>;
+               samsung,port_used_bitmap = <0x2>;
+       };
index 38fe076231522875bec58c60ec74fc7b14932960..0bd483c7c9c0523547670a9842cc945735a3c9c5 100644 (file)
@@ -966,6 +966,12 @@ static int ehci_hub_control (
                if (!wIndex || wIndex > ports)
                        goto error;
                wIndex--;
+
+               /* test if the port is configured to be ignored */
+               if (ehci->port_used_bitmap &&
+                               !(ehci->port_used_bitmap & (1 << wIndex)))
+                       goto error_exit;
+
                temp = ehci_readl(ehci, status_reg);
                if (temp & PORT_OWNER)
                        break;
index 176e3205e0aa82218e43094c60b9973312b42496..33af5239ac294d8b9f13ad2b855a0fa345d6fa63 100644 (file)
@@ -171,6 +171,12 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev)
        ehci->regs = hcd->regs +
                HC_LENGTH(ehci, readl(&ehci->caps->hc_capbase));
 
+       /* populate port enabled bitmap if provided by the device tree */
+       ehci->port_used_bitmap = -1UL;
+       if (pdev->dev.of_node)
+               of_property_read_u32(pdev->dev.of_node,
+                       "samsung,port_used_bitmap", &ehci->port_used_bitmap);
+
        /* DMA burst Enable */
        writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs));
 
index 2694ed6558d2d954c03a4ba3b77eabdc64f9c7f6..88920bd03fdf0288bf22905219eda6a1daf9d80d 100644 (file)
@@ -179,6 +179,9 @@ struct ehci_hcd {                   /* one per controller */
         * OTG controllers and transceivers need software interaction
         */
        struct usb_phy  *transceiver;
+
+       /* if non null: bitmap of all ports in use on the root hub */
+       u32 port_used_bitmap;
 };
 
 /* convert between an HCD pointer and the corresponding EHCI_HCD */