Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: EHCI: remove ehci_port_power() routine

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>

authored by

Alan Stern and committed by
Greg Kroah-Hartman
c73cee71 4968f951

+21 -129
-1
arch/arm/mach-cns3xxx/cns3420vb.c
··· 162 162 } 163 163 164 164 static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = { 165 - .port_power_off = 1, 166 165 .power_on = csn3xxx_usb_power_on, 167 166 .power_off = csn3xxx_usb_power_off, 168 167 };
-2
arch/mips/ath79/dev-usb.c
··· 50 50 51 51 static struct usb_ehci_pdata ath79_ehci_pdata_v1 = { 52 52 .has_synopsys_hc_bug = 1, 53 - .port_power_off = 1, 54 53 }; 55 54 56 55 static struct usb_ehci_pdata ath79_ehci_pdata_v2 = { 57 56 .caps_offset = 0x100, 58 57 .has_tt = 1, 59 - .port_power_off = 1, 60 58 }; 61 59 62 60 static struct platform_device ath79_ehci_device = {
-1
arch/mips/loongson1/common/platform.c
··· 109 109 }; 110 110 111 111 static struct usb_ehci_pdata ls1x_ehci_pdata = { 112 - .port_power_off = 1, 113 112 }; 114 113 115 114 struct platform_device ls1x_ehci_device = {
+1 -17
drivers/usb/chipidea/host.c
··· 31 31 #include "bits.h" 32 32 #include "host.h" 33 33 34 - static int ci_ehci_setup(struct usb_hcd *hcd) 35 - { 36 - struct ehci_hcd *ehci = hcd_to_ehci(hcd); 37 - int ret; 38 - 39 - hcd->has_tt = 1; 40 - 41 - ret = ehci_setup(hcd); 42 - if (ret) 43 - return ret; 44 - 45 - ehci_port_power(ehci, 0); 46 - 47 - return ret; 48 - } 49 - 50 34 static const struct hc_driver ci_ehci_hc_driver = { 51 35 .description = "ehci_hcd", 52 36 .product_desc = "ChipIdea HDRC EHCI", ··· 45 61 /* 46 62 * basic lifecycle operations 47 63 */ 48 - .reset = ci_ehci_setup, 64 + .reset = ehci_setup, 49 65 .start = ehci_run, 50 66 .stop = ehci_stop, 51 67 .shutdown = ehci_shutdown,
+1 -8
drivers/usb/host/ehci-atmel.c
··· 53 53 static int ehci_atmel_setup(struct usb_hcd *hcd) 54 54 { 55 55 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 56 - int retval; 57 56 58 57 /* registers start at offset 0x0 */ 59 58 ehci->caps = hcd->regs; 60 59 61 - retval = ehci_setup(hcd); 62 - if (retval) 63 - return retval; 64 - 65 - ehci_port_power(ehci, 0); 66 - 67 - return retval; 60 + return ehci_setup(hcd); 68 61 } 69 62 70 63 static const struct hc_driver ehci_atmel_hc_driver = {
-1
drivers/usb/host/ehci-fsl.c
··· 349 349 { 350 350 if (ehci_fsl_usb_setup(ehci)) 351 351 return -EINVAL; 352 - ehci_port_power(ehci, 0); 353 352 354 353 return 0; 355 354 }
+1 -17
drivers/usb/host/ehci-grlib.c
··· 34 34 35 35 #define GRUSBHC_HCIVERSION 0x0100 /* Known value of cap. reg. HCIVERSION */ 36 36 37 - /* called during probe() after chip reset completes */ 38 - static int ehci_grlib_setup(struct usb_hcd *hcd) 39 - { 40 - struct ehci_hcd *ehci = hcd_to_ehci(hcd); 41 - int retval; 42 - 43 - retval = ehci_setup(hcd); 44 - if (retval) 45 - return retval; 46 - 47 - ehci_port_power(ehci, 1); 48 - 49 - return retval; 50 - } 51 - 52 - 53 37 static const struct hc_driver ehci_grlib_hc_driver = { 54 38 .description = hcd_name, 55 39 .product_desc = "GRLIB GRUSBHC EHCI", ··· 48 64 /* 49 65 * basic lifecycle operations 50 66 */ 51 - .reset = ehci_grlib_setup, 67 + .reset = ehci_setup, 52 68 .start = ehci_run, 53 69 .stop = ehci_stop, 54 70 .shutdown = ehci_shutdown,
-21
drivers/usb/host/ehci-hcd.c
··· 371 371 hrtimer_cancel(&ehci->hrtimer); 372 372 } 373 373 374 - static void ehci_port_power (struct ehci_hcd *ehci, int is_on) 375 - { 376 - unsigned port; 377 - 378 - if (!HCS_PPC (ehci->hcs_params)) 379 - return; 380 - 381 - ehci_dbg (ehci, "...power%s ports...\n", is_on ? "up" : "down"); 382 - for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; ) 383 - (void) ehci_hub_control(ehci_to_hcd(ehci), 384 - is_on ? SetPortFeature : ClearPortFeature, 385 - USB_PORT_FEAT_POWER, 386 - port--, NULL, 0); 387 - /* Flush those writes */ 388 - ehci_readl(ehci, &ehci->regs->command); 389 - msleep(20); 390 - } 391 - 392 374 /*-------------------------------------------------------------------------*/ 393 375 394 376 /* ··· 1165 1183 1166 1184 ehci->rh_state = EHCI_RH_SUSPENDED; 1167 1185 spin_unlock_irq(&ehci->lock); 1168 - 1169 - /* here we "know" root ports should always stay powered */ 1170 - ehci_port_power(ehci, 1); 1171 1186 1172 1187 return 1; 1173 1188 }
+13
drivers/usb/host/ehci-hub.c
··· 56 56 if (!ehci->owned_ports) 57 57 return; 58 58 59 + /* Make sure the ports are powered */ 60 + port = HCS_N_PORTS(ehci->hcs_params); 61 + while (port--) { 62 + if (test_bit(port, &ehci->owned_ports)) { 63 + reg = &ehci->regs->port_status[port]; 64 + status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS; 65 + if (!(status & PORT_POWER)) { 66 + status |= PORT_POWER; 67 + ehci_writel(ehci, status, reg); 68 + } 69 + } 70 + } 71 + 59 72 /* Give the connections some time to appear */ 60 73 msleep(20); 61 74
-1
drivers/usb/host/ehci-msm.c
··· 53 53 /* Disable streaming mode and select host mode */ 54 54 writel(0x13, USB_USBMODE); 55 55 56 - ehci_port_power(ehci, 1); 57 56 return 0; 58 57 } 59 58
+1 -7
drivers/usb/host/ehci-mxc.c
··· 40 40 static int ehci_mxc_setup(struct usb_hcd *hcd) 41 41 { 42 42 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 43 - int retval; 44 43 45 44 hcd->has_tt = 1; 46 45 47 - retval = ehci_setup(hcd); 48 - if (retval) 49 - return retval; 50 - 51 - ehci_port_power(ehci, 0); 52 - return 0; 46 + return ehci_setup(hcd); 53 47 } 54 48 55 49 static const struct hc_driver ehci_mxc_hc_driver = {
-3
drivers/usb/host/ehci-octeon.c
··· 159 159 160 160 platform_set_drvdata(pdev, hcd); 161 161 162 - /* root ports should always stay powered */ 163 - ehci_port_power(ehci, 1); 164 - 165 162 return 0; 166 163 err3: 167 164 ehci_octeon_stop();
-3
drivers/usb/host/ehci-omap.c
··· 146 146 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); 147 147 } 148 148 149 - /* root ports should always stay powered */ 150 - ehci_port_power(ehci, 1); 151 - 152 149 return rc; 153 150 } 154 151
+1 -15
drivers/usb/host/ehci-orion.c
··· 101 101 wrl(USB_MODE, 0x13); 102 102 } 103 103 104 - static int ehci_orion_setup(struct usb_hcd *hcd) 105 - { 106 - struct ehci_hcd *ehci = hcd_to_ehci(hcd); 107 - int retval; 108 - 109 - retval = ehci_setup(hcd); 110 - if (retval) 111 - return retval; 112 - 113 - ehci_port_power(ehci, 0); 114 - 115 - return retval; 116 - } 117 - 118 104 static const struct hc_driver ehci_orion_hc_driver = { 119 105 .description = hcd_name, 120 106 .product_desc = "Marvell Orion EHCI", ··· 115 129 /* 116 130 * basic lifecycle operations 117 131 */ 118 - .reset = ehci_orion_setup, 132 + .reset = ehci_setup, 119 133 .start = ehci_run, 120 134 .stop = ehci_stop, 121 135 .shutdown = ehci_shutdown,
-1
drivers/usb/host/ehci-pci.c
··· 297 297 ehci_warn(ehci, "selective suspend/wakeup unavailable\n"); 298 298 #endif 299 299 300 - ehci_port_power(ehci, 1); 301 300 retval = ehci_pci_reinit(ehci, pdev); 302 301 done: 303 302 return retval;
-5
drivers/usb/host/ehci-platform.c
··· 40 40 41 41 if (pdata->no_io_watchdog) 42 42 ehci->need_io_watchdog = 0; 43 - if (pdata->port_power_on) 44 - ehci_port_power(ehci, 1); 45 - if (pdata->port_power_off) 46 - ehci_port_power(ehci, 0); 47 - 48 43 return 0; 49 44 } 50 45
-1
drivers/usb/host/ehci-pmcmsp.c
··· 90 90 return retval; 91 91 92 92 usb_hcd_tdi_set_mode(ehci); 93 - ehci_port_power(ehci, 0); 94 93 95 94 return retval; 96 95 }
+1 -8
drivers/usb/host/ehci-sh.c
··· 21 21 static int ehci_sh_reset(struct usb_hcd *hcd) 22 22 { 23 23 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 24 - int ret; 25 24 26 25 ehci->caps = hcd->regs; 27 26 28 - ret = ehci_setup(hcd); 29 - if (unlikely(ret)) 30 - return ret; 31 - 32 - ehci_port_power(ehci, 0); 33 - 34 - return ret; 27 + return ehci_setup(hcd); 35 28 } 36 29 37 30 static const struct hc_driver ehci_sh_hc_driver = {
+1 -8
drivers/usb/host/ehci-spear.c
··· 37 37 static int ehci_spear_setup(struct usb_hcd *hcd) 38 38 { 39 39 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 40 - int retval = 0; 41 40 42 41 /* registers start at offset 0x0 */ 43 42 ehci->caps = hcd->regs; 44 43 45 - retval = ehci_setup(hcd); 46 - if (retval) 47 - return retval; 48 - 49 - ehci_port_power(ehci, 0); 50 - 51 - return retval; 44 + return ehci_setup(hcd); 52 45 } 53 46 54 47 static const struct hc_driver ehci_spear_hc_driver = {
+1 -7
drivers/usb/host/ehci-tegra.c
··· 280 280 static int tegra_ehci_setup(struct usb_hcd *hcd) 281 281 { 282 282 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 283 - int retval; 284 283 285 284 /* EHCI registers start at offset 0x100 */ 286 285 ehci->caps = hcd->regs + 0x100; ··· 287 288 /* switch to host mode */ 288 289 hcd->has_tt = 1; 289 290 290 - retval = ehci_setup(hcd); 291 - if (retval) 292 - return retval; 293 - 294 - ehci_port_power(ehci, 1); 295 - return retval; 291 + return ehci_setup(hcd); 296 292 } 297 293 298 294 struct dma_aligned_buffer {
-2
include/linux/usb/ehci_pdriver.h
··· 41 41 unsigned has_synopsys_hc_bug:1; 42 42 unsigned big_endian_desc:1; 43 43 unsigned big_endian_mmio:1; 44 - unsigned port_power_on:1; 45 - unsigned port_power_off:1; 46 44 unsigned no_io_watchdog:1; 47 45 48 46 /* Turn on all power and clocks */