]> git.karo-electronics.de Git - linux-beck.git/commitdiff
USB: EHCI: remove ehci_port_power() routine
authorAlan Stern <stern@rowland.harvard.edu>
Wed, 31 Oct 2012 17:21:06 +0000 (13:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Oct 2012 19:48:07 +0000 (12:48 -0700)
This patch (as1623) removes the ehci_port_power() routine and all the
places that call it.  There's no reason for ehci-hcd to change the
port power settings; the hub driver takes care of all that stuff.

There is one exception: When the controller is resumed from
hibernation or following a loss of power, the ports that are supposed
to be handed over to a companion controller must be powered on first.
Otherwise the handover won't work.  This process is not visible to the
hub driver, so it has to be handled in ehci-hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 files changed:
arch/arm/mach-cns3xxx/cns3420vb.c
arch/mips/ath79/dev-usb.c
arch/mips/loongson1/common/platform.c
drivers/usb/chipidea/host.c
drivers/usb/host/ehci-atmel.c
drivers/usb/host/ehci-fsl.c
drivers/usb/host/ehci-grlib.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/ehci-msm.c
drivers/usb/host/ehci-mxc.c
drivers/usb/host/ehci-octeon.c
drivers/usb/host/ehci-omap.c
drivers/usb/host/ehci-orion.c
drivers/usb/host/ehci-pci.c
drivers/usb/host/ehci-platform.c
drivers/usb/host/ehci-pmcmsp.c
drivers/usb/host/ehci-sh.c
drivers/usb/host/ehci-spear.c
drivers/usb/host/ehci-tegra.c
include/linux/usb/ehci_pdriver.h

index 8a00cee8222802bdfacda361921f0f94b0497afd..ae305397003c767422c5237dd5d255e8f75ab9fd 100644 (file)
@@ -162,7 +162,6 @@ static void csn3xxx_usb_power_off(struct platform_device *pdev)
 }
 
 static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
-       .port_power_off = 1,
        .power_on       = csn3xxx_usb_power_on,
        .power_off      = csn3xxx_usb_power_off,
 };
index 072bb9be2304b2225e7a49ce44e860dc052504f5..bd2bc108e1b50a6052adad7619ecee6f6acf1511 100644 (file)
@@ -50,13 +50,11 @@ static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32);
 
 static struct usb_ehci_pdata ath79_ehci_pdata_v1 = {
        .has_synopsys_hc_bug    = 1,
-       .port_power_off         = 1,
 };
 
 static struct usb_ehci_pdata ath79_ehci_pdata_v2 = {
        .caps_offset            = 0x100,
        .has_tt                 = 1,
-       .port_power_off         = 1,
 };
 
 static struct platform_device ath79_ehci_device = {
index 2874bf224418348f42432c631f1928ab417ecca0..0412ad61e2908fb99552b1d2cd1ac6a27ead90bb 100644 (file)
@@ -109,7 +109,6 @@ static struct resource ls1x_ehci_resources[] = {
 };
 
 static struct usb_ehci_pdata ls1x_ehci_pdata = {
-       .port_power_off = 1,
 };
 
 struct platform_device ls1x_ehci_device = {
index ebff9f4f56ec172875b9c333de12c514b1b719e3..ebc041ff9cd5cee66c4e47445188882e8db24591 100644 (file)
 #include "bits.h"
 #include "host.h"
 
-static int ci_ehci_setup(struct usb_hcd *hcd)
-{
-       struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int ret;
-
-       hcd->has_tt = 1;
-
-       ret = ehci_setup(hcd);
-       if (ret)
-               return ret;
-
-       ehci_port_power(ehci, 0);
-
-       return ret;
-}
-
 static const struct hc_driver ci_ehci_hc_driver = {
        .description    = "ehci_hcd",
        .product_desc   = "ChipIdea HDRC EHCI",
@@ -61,7 +45,7 @@ static const struct hc_driver ci_ehci_hc_driver = {
        /*
         * basic lifecycle operations
         */
-       .reset          = ci_ehci_setup,
+       .reset          = ehci_setup,
        .start          = ehci_run,
        .stop           = ehci_stop,
        .shutdown       = ehci_shutdown,
index 411bb74152ebe2ba3b063fb0e5e3445626d61af1..d23321ec0e46121082c97a8e0b6d67074fd19d3c 100644 (file)
@@ -53,18 +53,11 @@ static void atmel_stop_ehci(struct platform_device *pdev)
 static int ehci_atmel_setup(struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int retval;
 
        /* registers start at offset 0x0 */
        ehci->caps = hcd->regs;
 
-       retval = ehci_setup(hcd);
-       if (retval)
-               return retval;
-
-       ehci_port_power(ehci, 0);
-
-       return retval;
+       return ehci_setup(hcd);
 }
 
 static const struct hc_driver ehci_atmel_hc_driver = {
index 0d2f35ca93f1d5e7091cc77122e70b162f22679d..fd9b5424b860a20e7d04c54fe3cf4fc76ca3be2d 100644 (file)
@@ -349,7 +349,6 @@ static int ehci_fsl_reinit(struct ehci_hcd *ehci)
 {
        if (ehci_fsl_usb_setup(ehci))
                return -EINVAL;
-       ehci_port_power(ehci, 0);
 
        return 0;
 }
index 3180cb3624d9839d90846c1dceea48ab5ac817c1..da4269550fba35d41b1569cc65baca7287324b5f 100644 (file)
 
 #define GRUSBHC_HCIVERSION 0x0100 /* Known value of cap. reg. HCIVERSION */
 
-/* called during probe() after chip reset completes */
-static int ehci_grlib_setup(struct usb_hcd *hcd)
-{
-       struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int             retval;
-
-       retval = ehci_setup(hcd);
-       if (retval)
-               return retval;
-
-       ehci_port_power(ehci, 1);
-
-       return retval;
-}
-
-
 static const struct hc_driver ehci_grlib_hc_driver = {
        .description            = hcd_name,
        .product_desc           = "GRLIB GRUSBHC EHCI",
@@ -64,7 +48,7 @@ static const struct hc_driver ehci_grlib_hc_driver = {
        /*
         * basic lifecycle operations
         */
-       .reset                  = ehci_grlib_setup,
+       .reset                  = ehci_setup,
        .start                  = ehci_run,
        .stop                   = ehci_stop,
        .shutdown               = ehci_shutdown,
index 68dd1c99b1f54b822ba8c08dd3a70c9d305e10dd..ab4a769a4104b448266782b3ad7b997a30d9d992 100644 (file)
@@ -371,24 +371,6 @@ static void ehci_shutdown(struct usb_hcd *hcd)
        hrtimer_cancel(&ehci->hrtimer);
 }
 
-static void ehci_port_power (struct ehci_hcd *ehci, int is_on)
-{
-       unsigned port;
-
-       if (!HCS_PPC (ehci->hcs_params))
-               return;
-
-       ehci_dbg (ehci, "...power%s ports...\n", is_on ? "up" : "down");
-       for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; )
-               (void) ehci_hub_control(ehci_to_hcd(ehci),
-                               is_on ? SetPortFeature : ClearPortFeature,
-                               USB_PORT_FEAT_POWER,
-                               port--, NULL, 0);
-       /* Flush those writes */
-       ehci_readl(ehci, &ehci->regs->command);
-       msleep(20);
-}
-
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -1184,9 +1166,6 @@ static int __maybe_unused ehci_resume(struct usb_hcd *hcd, bool hibernated)
        ehci->rh_state = EHCI_RH_SUSPENDED;
        spin_unlock_irq(&ehci->lock);
 
-       /* here we "know" root ports should always stay powered */
-       ehci_port_power(ehci, 1);
-
        return 1;
 }
 
index a2c56cdd2c3a40a8d63054d06bd05402dda53049..a59c61fea09f3fe9bb76c12a622821bfe7db88b3 100644 (file)
@@ -56,6 +56,19 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
        if (!ehci->owned_ports)
                return;
 
+       /* Make sure the ports are powered */
+       port = HCS_N_PORTS(ehci->hcs_params);
+       while (port--) {
+               if (test_bit(port, &ehci->owned_ports)) {
+                       reg = &ehci->regs->port_status[port];
+                       status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
+                       if (!(status & PORT_POWER)) {
+                               status |= PORT_POWER;
+                               ehci_writel(ehci, status, reg);
+                       }
+               }
+       }
+
        /* Give the connections some time to appear */
        msleep(20);
 
index 4af4dc5b618c5710bd4f6226361916763122ac53..7fa1ba4de78965a6f410d645fd3ff91ab935d09e 100644 (file)
@@ -53,7 +53,6 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
        /* Disable streaming mode and select host mode */
        writel(0x13, USB_USBMODE);
 
-       ehci_port_power(ehci, 1);
        return 0;
 }
 
index 4a08fc0b27c9e541da76b9598120b646ab7aa9a5..a37224a4a49b88c06f9f2ddba55cec404531ab1f 100644 (file)
@@ -40,16 +40,10 @@ struct ehci_mxc_priv {
 static int ehci_mxc_setup(struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int retval;
 
        hcd->has_tt = 1;
 
-       retval = ehci_setup(hcd);
-       if (retval)
-               return retval;
-
-       ehci_port_power(ehci, 0);
-       return 0;
+       return ehci_setup(hcd);
 }
 
 static const struct hc_driver ehci_mxc_hc_driver = {
index ba26957abf462095d6d1d74d682aa31f3545a836..a89750fff4ff09d38d9dc1090590c1efd68f8d24 100644 (file)
@@ -159,9 +159,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, hcd);
 
-       /* root ports should always stay powered */
-       ehci_port_power(ehci, 1);
-
        return 0;
 err3:
        ehci_octeon_stop();
index d7fe287d067803e484d56efdf53060546634ea1e..44e7d0f638e8f943507ce473f36595c27314537d 100644 (file)
@@ -146,9 +146,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)
                        gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
        }
 
-       /* root ports should always stay powered */
-       ehci_port_power(ehci, 1);
-
        return rc;
 }
 
index 9c2717d66730ad74d9f99ef2aa0795b25c716a1b..96da679becef3a5d98da4b3da9833f6e3ebeeed0 100644 (file)
@@ -101,20 +101,6 @@ static void orion_usb_phy_v1_setup(struct usb_hcd *hcd)
        wrl(USB_MODE, 0x13);
 }
 
-static int ehci_orion_setup(struct usb_hcd *hcd)
-{
-       struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int retval;
-
-       retval = ehci_setup(hcd);
-       if (retval)
-               return retval;
-
-       ehci_port_power(ehci, 0);
-
-       return retval;
-}
-
 static const struct hc_driver ehci_orion_hc_driver = {
        .description = hcd_name,
        .product_desc = "Marvell Orion EHCI",
@@ -129,7 +115,7 @@ static const struct hc_driver ehci_orion_hc_driver = {
        /*
         * basic lifecycle operations
         */
-       .reset = ehci_orion_setup,
+       .reset = ehci_setup,
        .start = ehci_run,
        .stop = ehci_stop,
        .shutdown = ehci_shutdown,
index e17330ae0aee5f8f2ee39240772ba183a5fdbeff..c92dcaee0d4d21cd7e4dfe158df025db6df26403 100644 (file)
@@ -297,7 +297,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
                ehci_warn(ehci, "selective suspend/wakeup unavailable\n");
 #endif
 
-       ehci_port_power(ehci, 1);
        retval = ehci_pci_reinit(ehci, pdev);
 done:
        return retval;
index 272728c48c9e6e2aa6b4cf7604a8d9280e195b0c..6e6c23bdb4842ea6fa92ce4751375a64e1c55dab 100644 (file)
@@ -40,11 +40,6 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
 
        if (pdata->no_io_watchdog)
                ehci->need_io_watchdog = 0;
-       if (pdata->port_power_on)
-               ehci_port_power(ehci, 1);
-       if (pdata->port_power_off)
-               ehci_port_power(ehci, 0);
-
        return 0;
 }
 
index 087aee2a904f0fecc9221702f400918367690648..363890ee41d2bcb640231b9d12b1d01b09a694b4 100644 (file)
@@ -90,7 +90,6 @@ static int ehci_msp_setup(struct usb_hcd *hcd)
                return retval;
 
        usb_hcd_tdi_set_mode(ehci);
-       ehci_port_power(ehci, 0);
 
        return retval;
 }
index 6081e1ed3ac9d9e8338c233829103661d1d46a99..0c90a24fa989286a36f76f54e41350cf26a65d3f 100644 (file)
@@ -21,17 +21,10 @@ struct ehci_sh_priv {
 static int ehci_sh_reset(struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int ret;
 
        ehci->caps = hcd->regs;
 
-       ret = ehci_setup(hcd);
-       if (unlikely(ret))
-               return ret;
-
-       ehci_port_power(ehci, 0);
-
-       return ret;
+       return ehci_setup(hcd);
 }
 
 static const struct hc_driver ehci_sh_hc_driver = {
index c718a065e154d675d634b48269160086148bfbe1..719ca48a471ac407ab68b2fa7892b20730bc2e34 100644 (file)
@@ -37,18 +37,11 @@ static void spear_stop_ehci(struct spear_ehci *ehci)
 static int ehci_spear_setup(struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int retval = 0;
 
        /* registers start at offset 0x0 */
        ehci->caps = hcd->regs;
 
-       retval = ehci_setup(hcd);
-       if (retval)
-               return retval;
-
-       ehci_port_power(ehci, 0);
-
-       return retval;
+       return ehci_setup(hcd);
 }
 
 static const struct hc_driver ehci_spear_hc_driver = {
index 2de089001ae98890c0cf70a74c647ece79582606..94ee3212094e81524e87836573115e4041c0b622 100644 (file)
@@ -280,7 +280,6 @@ static void tegra_ehci_shutdown(struct usb_hcd *hcd)
 static int tegra_ehci_setup(struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-       int retval;
 
        /* EHCI registers start at offset 0x100 */
        ehci->caps = hcd->regs + 0x100;
@@ -288,12 +287,7 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
        /* switch to host mode */
        hcd->has_tt = 1;
 
-       retval = ehci_setup(hcd);
-       if (retval)
-               return retval;
-
-       ehci_port_power(ehci, 1);
-       return retval;
+       return ehci_setup(hcd);
 }
 
 struct dma_aligned_buffer {
index 67ac74bde6d0d533bb36e12697e424ddfb69e2b6..99238b096f7e5ae4647ec49b14d828263853a4b2 100644 (file)
@@ -41,8 +41,6 @@ struct usb_ehci_pdata {
        unsigned        has_synopsys_hc_bug:1;
        unsigned        big_endian_desc:1;
        unsigned        big_endian_mmio:1;
-       unsigned        port_power_on:1;
-       unsigned        port_power_off:1;
        unsigned        no_io_watchdog:1;
 
        /* Turn on all power and clocks */