aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-hub.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-06-25 12:19:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-26 22:42:11 -0400
commita46af4ebf9ffec35eea0390e89935197b833dc61 (patch)
treec349a8e2e75b334a41cb379d5dc7744a25f5e9c6 /drivers/usb/host/ehci-hub.c
parentcf61fdb944534ffa84a824bb8c31a3826cdc169d (diff)
USB: EHCI: define extension registers like normal ones
This patch (as1562) cleans up the definitions of the EHCI extended registers to be consistent with the definitions of the standard registers. This makes the code look a lot nicer, with no functional change. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci-hub.c')
-rw-r--r--drivers/usb/host/ehci-hub.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index dd5eef6af6df..db05e358677a 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -149,10 +149,8 @@ static __maybe_unused void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
149 if (ehci->has_hostpc) { 149 if (ehci->has_hostpc) {
150 port = HCS_N_PORTS(ehci->hcs_params); 150 port = HCS_N_PORTS(ehci->hcs_params);
151 while (port--) { 151 while (port--) {
152 u32 __iomem *hostpc_reg; 152 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port];
153 153
154 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
155 + HOSTPC0 + 4 * port);
156 temp = ehci_readl(ehci, hostpc_reg); 154 temp = ehci_readl(ehci, hostpc_reg);
157 ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg); 155 ehci_writel(ehci, temp & ~HOSTPC_PHCD, hostpc_reg);
158 } 156 }
@@ -185,10 +183,8 @@ static __maybe_unused void ehci_adjust_port_wakeup_flags(struct ehci_hcd *ehci,
185 if (ehci->has_hostpc) { 183 if (ehci->has_hostpc) {
186 port = HCS_N_PORTS(ehci->hcs_params); 184 port = HCS_N_PORTS(ehci->hcs_params);
187 while (port--) { 185 while (port--) {
188 u32 __iomem *hostpc_reg; 186 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port];
189 187
190 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
191 + HOSTPC0 + 4 * port);
192 temp = ehci_readl(ehci, hostpc_reg); 188 temp = ehci_readl(ehci, hostpc_reg);
193 ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg); 189 ehci_writel(ehci, temp | HOSTPC_PHCD, hostpc_reg);
194 } 190 }
@@ -285,11 +281,9 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
285 281
286 port = HCS_N_PORTS(ehci->hcs_params); 282 port = HCS_N_PORTS(ehci->hcs_params);
287 while (port--) { 283 while (port--) {
288 u32 __iomem *hostpc_reg; 284 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[port];
289 u32 t3; 285 u32 t3;
290 286
291 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
292 + HOSTPC0 + 4 * port);
293 t3 = ehci_readl(ehci, hostpc_reg); 287 t3 = ehci_readl(ehci, hostpc_reg);
294 ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg); 288 ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg);
295 t3 = ehci_readl(ehci, hostpc_reg); 289 t3 = ehci_readl(ehci, hostpc_reg);
@@ -388,10 +382,9 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
388 i = HCS_N_PORTS(ehci->hcs_params); 382 i = HCS_N_PORTS(ehci->hcs_params);
389 while (i--) { 383 while (i--) {
390 if (test_bit(i, &ehci->bus_suspended)) { 384 if (test_bit(i, &ehci->bus_suspended)) {
391 u32 __iomem *hostpc_reg; 385 u32 __iomem *hostpc_reg =
386 &ehci->regs->hostpc[i];
392 387
393 hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs
394 + HOSTPC0 + 4 * i);
395 temp = ehci_readl(ehci, hostpc_reg); 388 temp = ehci_readl(ehci, hostpc_reg);
396 ehci_writel(ehci, temp & ~HOSTPC_PHCD, 389 ehci_writel(ehci, temp & ~HOSTPC_PHCD,
397 hostpc_reg); 390 hostpc_reg);
@@ -667,7 +660,7 @@ static int ehci_hub_control (
667 int ports = HCS_N_PORTS (ehci->hcs_params); 660 int ports = HCS_N_PORTS (ehci->hcs_params);
668 u32 __iomem *status_reg = &ehci->regs->port_status[ 661 u32 __iomem *status_reg = &ehci->regs->port_status[
669 (wIndex & 0xff) - 1]; 662 (wIndex & 0xff) - 1];
670 u32 __iomem *hostpc_reg = NULL; 663 u32 __iomem *hostpc_reg = &ehci->regs->hostpc[(wIndex & 0xff) - 1];
671 u32 temp, temp1, status; 664 u32 temp, temp1, status;
672 unsigned long flags; 665 unsigned long flags;
673 int retval = 0; 666 int retval = 0;
@@ -680,9 +673,6 @@ static int ehci_hub_control (
680 * power, "this is the one", etc. EHCI spec supports this. 673 * power, "this is the one", etc. EHCI spec supports this.
681 */ 674 */
682 675
683 if (ehci->has_hostpc)
684 hostpc_reg = (u32 __iomem *)((u8 *)ehci->regs
685 + HOSTPC0 + 4 * ((wIndex & 0xff) - 1));
686 spin_lock_irqsave (&ehci->lock, flags); 676 spin_lock_irqsave (&ehci->lock, flags);
687 switch (typeReq) { 677 switch (typeReq) {
688 case ClearHubFeature: 678 case ClearHubFeature:
@@ -734,7 +724,7 @@ static int ehci_hub_control (
734 goto error; 724 goto error;
735 725
736 /* clear phy low-power mode before resume */ 726 /* clear phy low-power mode before resume */
737 if (hostpc_reg) { 727 if (ehci->has_hostpc) {
738 temp1 = ehci_readl(ehci, hostpc_reg); 728 temp1 = ehci_readl(ehci, hostpc_reg);
739 ehci_writel(ehci, temp1 & ~HOSTPC_PHCD, 729 ehci_writel(ehci, temp1 & ~HOSTPC_PHCD,
740 hostpc_reg); 730 hostpc_reg);
@@ -984,7 +974,7 @@ static int ehci_hub_control (
984 temp &= ~PORT_WKCONN_E; 974 temp &= ~PORT_WKCONN_E;
985 temp |= PORT_WKDISC_E | PORT_WKOC_E; 975 temp |= PORT_WKDISC_E | PORT_WKOC_E;
986 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); 976 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
987 if (hostpc_reg) { 977 if (ehci->has_hostpc) {
988 spin_unlock_irqrestore(&ehci->lock, flags); 978 spin_unlock_irqrestore(&ehci->lock, flags);
989 msleep(5);/* 5ms for HCD enter low pwr mode */ 979 msleep(5);/* 5ms for HCD enter low pwr mode */
990 spin_lock_irqsave(&ehci->lock, flags); 980 spin_lock_irqsave(&ehci->lock, flags);