Commit 749da5f8 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: straighten out port feature vs. port status usage

This patch (as1349b) clears up the confusion in many USB host
controller drivers between port features and port statuses.  In mosty
cases it's true that the status bit is in the position given by the
corresponding feature value, but that's not always true and it's not
guaranteed in the USB spec.

There's no functional change, just replacing expressions of the form
(1 << USB_PORT_FEAT_x) with USB_PORT_STAT_x, which has the same value.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 288ead45
...@@ -3037,7 +3037,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, ...@@ -3037,7 +3037,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
/* maybe switch power back on (e.g. root hub was reset) */ /* maybe switch power back on (e.g. root hub was reset) */
if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
&& !(portstatus & (1 << USB_PORT_FEAT_POWER))) && !(portstatus & USB_PORT_STAT_POWER))
set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
if (portstatus & USB_PORT_STAT_ENABLE) if (portstatus & USB_PORT_STAT_ENABLE)
......
...@@ -659,7 +659,7 @@ static int ehci_hub_control ( ...@@ -659,7 +659,7 @@ static int ehci_hub_control (
* Even if OWNER is set, so the port is owned by the * Even if OWNER is set, so the port is owned by the
* companion controller, khubd needs to be able to clear * companion controller, khubd needs to be able to clear
* the port-change status bits (especially * the port-change status bits (especially
* USB_PORT_FEAT_C_CONNECTION). * USB_PORT_STAT_C_CONNECTION).
*/ */
switch (wValue) { switch (wValue) {
...@@ -729,12 +729,12 @@ static int ehci_hub_control ( ...@@ -729,12 +729,12 @@ static int ehci_hub_control (
// wPortChange bits // wPortChange bits
if (temp & PORT_CSC) if (temp & PORT_CSC)
status |= 1 << USB_PORT_FEAT_C_CONNECTION; status |= USB_PORT_STAT_C_CONNECTION << 16;
if (temp & PORT_PEC) if (temp & PORT_PEC)
status |= 1 << USB_PORT_FEAT_C_ENABLE; status |= USB_PORT_STAT_C_ENABLE << 16;
if ((temp & PORT_OCC) && !ignore_oc){ if ((temp & PORT_OCC) && !ignore_oc){
status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT; status |= USB_PORT_STAT_C_OVERCURRENT << 16;
/* /*
* Hubs should disable port power on over-current. * Hubs should disable port power on over-current.
...@@ -791,7 +791,7 @@ static int ehci_hub_control ( ...@@ -791,7 +791,7 @@ static int ehci_hub_control (
if ((temp & PORT_RESET) if ((temp & PORT_RESET)
&& time_after_eq(jiffies, && time_after_eq(jiffies,
ehci->reset_done[wIndex])) { ehci->reset_done[wIndex])) {
status |= 1 << USB_PORT_FEAT_C_RESET; status |= USB_PORT_STAT_C_RESET << 16;
ehci->reset_done [wIndex] = 0; ehci->reset_done [wIndex] = 0;
/* force reset to complete */ /* force reset to complete */
...@@ -833,7 +833,7 @@ static int ehci_hub_control ( ...@@ -833,7 +833,7 @@ static int ehci_hub_control (
*/ */
if (temp & PORT_CONNECT) { if (temp & PORT_CONNECT) {
status |= 1 << USB_PORT_FEAT_CONNECTION; status |= USB_PORT_STAT_CONNECTION;
// status may be from integrated TT // status may be from integrated TT
if (ehci->has_hostpc) { if (ehci->has_hostpc) {
temp1 = ehci_readl(ehci, hostpc_reg); temp1 = ehci_readl(ehci, hostpc_reg);
...@@ -842,11 +842,11 @@ static int ehci_hub_control ( ...@@ -842,11 +842,11 @@ static int ehci_hub_control (
status |= ehci_port_speed(ehci, temp); status |= ehci_port_speed(ehci, temp);
} }
if (temp & PORT_PE) if (temp & PORT_PE)
status |= 1 << USB_PORT_FEAT_ENABLE; status |= USB_PORT_STAT_ENABLE;
/* maybe the port was unsuspended without our knowledge */ /* maybe the port was unsuspended without our knowledge */
if (temp & (PORT_SUSPEND|PORT_RESUME)) { if (temp & (PORT_SUSPEND|PORT_RESUME)) {
status |= 1 << USB_PORT_FEAT_SUSPEND; status |= USB_PORT_STAT_SUSPEND;
} else if (test_bit(wIndex, &ehci->suspended_ports)) { } else if (test_bit(wIndex, &ehci->suspended_ports)) {
clear_bit(wIndex, &ehci->suspended_ports); clear_bit(wIndex, &ehci->suspended_ports);
ehci->reset_done[wIndex] = 0; ehci->reset_done[wIndex] = 0;
...@@ -855,13 +855,13 @@ static int ehci_hub_control ( ...@@ -855,13 +855,13 @@ static int ehci_hub_control (
} }
if (temp & PORT_OC) if (temp & PORT_OC)
status |= 1 << USB_PORT_FEAT_OVER_CURRENT; status |= USB_PORT_STAT_OVERCURRENT;
if (temp & PORT_RESET) if (temp & PORT_RESET)
status |= 1 << USB_PORT_FEAT_RESET; status |= USB_PORT_STAT_RESET;
if (temp & PORT_POWER) if (temp & PORT_POWER)
status |= 1 << USB_PORT_FEAT_POWER; status |= USB_PORT_STAT_POWER;
if (test_bit(wIndex, &ehci->port_c_suspend)) if (test_bit(wIndex, &ehci->port_c_suspend))
status |= 1 << USB_PORT_FEAT_C_SUSPEND; status |= USB_PORT_STAT_C_SUSPEND << 16;
#ifndef VERBOSE_DEBUG #ifndef VERBOSE_DEBUG
if (status & ~0xffff) /* only if wPortChange is interesting */ if (status & ~0xffff) /* only if wPortChange is interesting */
......
...@@ -1265,7 +1265,7 @@ static int isp1362_urb_enqueue(struct usb_hcd *hcd, ...@@ -1265,7 +1265,7 @@ static int isp1362_urb_enqueue(struct usb_hcd *hcd,
/* don't submit to a dead or disabled port */ /* don't submit to a dead or disabled port */
if (!((isp1362_hcd->rhport[0] | isp1362_hcd->rhport[1]) & if (!((isp1362_hcd->rhport[0] | isp1362_hcd->rhport[1]) &
(1 << USB_PORT_FEAT_ENABLE)) || USB_PORT_STAT_ENABLE) ||
!HC_IS_RUNNING(hcd->state)) { !HC_IS_RUNNING(hcd->state)) {
kfree(ep); kfree(ep);
retval = -ENODEV; retval = -ENODEV;
......
...@@ -1923,7 +1923,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -1923,7 +1923,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
* Even if OWNER is set, so the port is owned by the * Even if OWNER is set, so the port is owned by the
* companion controller, khubd needs to be able to clear * companion controller, khubd needs to be able to clear
* the port-change status bits (especially * the port-change status bits (especially
* USB_PORT_FEAT_C_CONNECTION). * USB_PORT_STAT_C_CONNECTION).
*/ */
switch (wValue) { switch (wValue) {
...@@ -1987,7 +1987,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -1987,7 +1987,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
/* wPortChange bits */ /* wPortChange bits */
if (temp & PORT_CSC) if (temp & PORT_CSC)
status |= 1 << USB_PORT_FEAT_C_CONNECTION; status |= USB_PORT_STAT_C_CONNECTION << 16;
/* whoever resumes must GetPortStatus to complete it!! */ /* whoever resumes must GetPortStatus to complete it!! */
...@@ -2007,7 +2007,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -2007,7 +2007,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
/* resume completed? */ /* resume completed? */
else if (time_after_eq(jiffies, else if (time_after_eq(jiffies,
priv->reset_done)) { priv->reset_done)) {
status |= 1 << USB_PORT_FEAT_C_SUSPEND; status |= USB_PORT_STAT_C_SUSPEND << 16;
priv->reset_done = 0; priv->reset_done = 0;
/* stop resume signaling */ /* stop resume signaling */
...@@ -2031,7 +2031,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -2031,7 +2031,7 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
if ((temp & PORT_RESET) if ((temp & PORT_RESET)
&& time_after_eq(jiffies, && time_after_eq(jiffies,
priv->reset_done)) { priv->reset_done)) {
status |= 1 << USB_PORT_FEAT_C_RESET; status |= USB_PORT_STAT_C_RESET << 16;
priv->reset_done = 0; priv->reset_done = 0;
/* force reset to complete */ /* force reset to complete */
...@@ -2062,18 +2062,18 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -2062,18 +2062,18 @@ static int isp1760_hub_control(struct usb_hcd *hcd, u16 typeReq,
printk(KERN_ERR "Warning: PORT_OWNER is set\n"); printk(KERN_ERR "Warning: PORT_OWNER is set\n");
if (temp & PORT_CONNECT) { if (temp & PORT_CONNECT) {
status |= 1 << USB_PORT_FEAT_CONNECTION; status |= USB_PORT_STAT_CONNECTION;
/* status may be from integrated TT */ /* status may be from integrated TT */
status |= ehci_port_speed(priv, temp); status |= ehci_port_speed(priv, temp);
} }
if (temp & PORT_PE) if (temp & PORT_PE)
status |= 1 << USB_PORT_FEAT_ENABLE; status |= USB_PORT_STAT_ENABLE;
if (temp & (PORT_SUSPEND|PORT_RESUME)) if (temp & (PORT_SUSPEND|PORT_RESUME))
status |= 1 << USB_PORT_FEAT_SUSPEND; status |= USB_PORT_STAT_SUSPEND;
if (temp & PORT_RESET) if (temp & PORT_RESET)
status |= 1 << USB_PORT_FEAT_RESET; status |= USB_PORT_STAT_RESET;
if (temp & PORT_POWER) if (temp & PORT_POWER)
status |= 1 << USB_PORT_FEAT_POWER; status |= USB_PORT_STAT_POWER;
put_unaligned(cpu_to_le32(status), (__le32 *) buf); put_unaligned(cpu_to_le32(status), (__le32 *) buf);
break; break;
......
...@@ -3201,7 +3201,7 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -3201,7 +3201,7 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
* Even if OWNER is set, so the port is owned by the * Even if OWNER is set, so the port is owned by the
* companion controller, khubd needs to be able to clear * companion controller, khubd needs to be able to clear
* the port-change status bits (especially * the port-change status bits (especially
* USB_PORT_FEAT_C_CONNECTION). * USB_PORT_STAT_C_CONNECTION).
*/ */
switch (wValue) { switch (wValue) {
...@@ -3263,11 +3263,11 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -3263,11 +3263,11 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
/* wPortChange bits */ /* wPortChange bits */
if (temp & PORT_CSC) if (temp & PORT_CSC)
status |= 1 << USB_PORT_FEAT_C_CONNECTION; status |= USB_PORT_STAT_C_CONNECTION << 16;
if (temp & PORT_PEC) if (temp & PORT_PEC)
status |= 1 << USB_PORT_FEAT_C_ENABLE; status |= USB_PORT_STAT_C_ENABLE << 16;
if ((temp & PORT_OCC) && !ignore_oc) if ((temp & PORT_OCC) && !ignore_oc)
status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT; status |= USB_PORT_STAT_C_OVERCURRENT << 16;
/* whoever resumes must GetPortStatus to complete it!! */ /* whoever resumes must GetPortStatus to complete it!! */
if (temp & PORT_RESUME) { if (temp & PORT_RESUME) {
...@@ -3285,7 +3285,7 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -3285,7 +3285,7 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
/* resume completed? */ /* resume completed? */
else if (time_after_eq(jiffies, else if (time_after_eq(jiffies,
oxu->reset_done[wIndex])) { oxu->reset_done[wIndex])) {
status |= 1 << USB_PORT_FEAT_C_SUSPEND; status |= USB_PORT_STAT_C_SUSPEND << 16;
oxu->reset_done[wIndex] = 0; oxu->reset_done[wIndex] = 0;
/* stop resume signaling */ /* stop resume signaling */
...@@ -3308,7 +3308,7 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -3308,7 +3308,7 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
if ((temp & PORT_RESET) if ((temp & PORT_RESET)
&& time_after_eq(jiffies, && time_after_eq(jiffies,
oxu->reset_done[wIndex])) { oxu->reset_done[wIndex])) {
status |= 1 << USB_PORT_FEAT_C_RESET; status |= USB_PORT_STAT_C_RESET << 16;
oxu->reset_done[wIndex] = 0; oxu->reset_done[wIndex] = 0;
/* force reset to complete */ /* force reset to complete */
...@@ -3347,20 +3347,20 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq, ...@@ -3347,20 +3347,20 @@ static int oxu_hub_control(struct usb_hcd *hcd, u16 typeReq,
*/ */
if (temp & PORT_CONNECT) { if (temp & PORT_CONNECT) {
status |= 1 << USB_PORT_FEAT_CONNECTION; status |= USB_PORT_STAT_CONNECTION;
/* status may be from integrated TT */ /* status may be from integrated TT */
status |= oxu_port_speed(oxu, temp); status |= oxu_port_speed(oxu, temp);
} }
if (temp & PORT_PE) if (temp & PORT_PE)
status |= 1 << USB_PORT_FEAT_ENABLE; status |= USB_PORT_STAT_ENABLE;
if (temp & (PORT_SUSPEND|PORT_RESUME)) if (temp & (PORT_SUSPEND|PORT_RESUME))
status |= 1 << USB_PORT_FEAT_SUSPEND; status |= USB_PORT_STAT_SUSPEND;
if (temp & PORT_OC) if (temp & PORT_OC)
status |= 1 << USB_PORT_FEAT_OVER_CURRENT; status |= USB_PORT_STAT_OVERCURRENT;
if (temp & PORT_RESET) if (temp & PORT_RESET)
status |= 1 << USB_PORT_FEAT_RESET; status |= USB_PORT_STAT_RESET;
if (temp & PORT_POWER) if (temp & PORT_POWER)
status |= 1 << USB_PORT_FEAT_POWER; status |= USB_PORT_STAT_POWER;
#ifndef OXU_VERBOSE_DEBUG #ifndef OXU_VERBOSE_DEBUG
if (status & ~0xffff) /* only if wPortChange is interesting */ if (status & ~0xffff) /* only if wPortChange is interesting */
......
...@@ -1018,10 +1018,10 @@ static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port, ...@@ -1018,10 +1018,10 @@ static void start_root_hub_sampling(struct r8a66597 *r8a66597, int port,
rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST; rh->old_syssts = r8a66597_read(r8a66597, get_syssts_reg(port)) & LNST;
rh->scount = R8A66597_MAX_SAMPLING; rh->scount = R8A66597_MAX_SAMPLING;
if (connect) if (connect)
rh->port |= 1 << USB_PORT_FEAT_CONNECTION; rh->port |= USB_PORT_STAT_CONNECTION;
else else
rh->port &= ~(1 << USB_PORT_FEAT_CONNECTION); rh->port &= ~USB_PORT_STAT_CONNECTION;
rh->port |= 1 << USB_PORT_FEAT_C_CONNECTION; rh->port |= USB_PORT_STAT_C_CONNECTION << 16;
r8a66597_root_hub_start_polling(r8a66597); r8a66597_root_hub_start_polling(r8a66597);
} }
...@@ -1065,8 +1065,8 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port) ...@@ -1065,8 +1065,8 @@ static void r8a66597_usb_connect(struct r8a66597 *r8a66597, int port)
else if (speed == LSMODE) else if (speed == LSMODE)
rh->port |= USB_PORT_STAT_LOW_SPEED; rh->port |= USB_PORT_STAT_LOW_SPEED;
rh->port &= ~(1 << USB_PORT_FEAT_RESET); rh->port &= USB_PORT_STAT_RESET;
rh->port |= 1 << USB_PORT_FEAT_ENABLE; rh->port |= USB_PORT_STAT_ENABLE;
} }
/* this function must be called with interrupt disabled */ /* this function must be called with interrupt disabled */
...@@ -1705,7 +1705,7 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) ...@@ -1705,7 +1705,7 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port)
u16 tmp; u16 tmp;
struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
if (rh->port & (1 << USB_PORT_FEAT_RESET)) { if (rh->port & USB_PORT_STAT_RESET) {
unsigned long dvstctr_reg = get_dvstctr_reg(port); unsigned long dvstctr_reg = get_dvstctr_reg(port);
tmp = r8a66597_read(r8a66597, dvstctr_reg); tmp = r8a66597_read(r8a66597, dvstctr_reg);
...@@ -1717,7 +1717,7 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port) ...@@ -1717,7 +1717,7 @@ static void r8a66597_root_hub_control(struct r8a66597 *r8a66597, int port)
r8a66597_usb_connect(r8a66597, port); r8a66597_usb_connect(r8a66597, port);
} }
if (!(rh->port & (1 << USB_PORT_FEAT_CONNECTION))) { if (!(rh->port & USB_PORT_STAT_CONNECTION)) {
r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port)); r8a66597_write(r8a66597, ~ATTCH, get_intsts_reg(port));
r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port)); r8a66597_bset(r8a66597, ATTCHE, get_intenb_reg(port));
} }
...@@ -2185,7 +2185,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -2185,7 +2185,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
switch (wValue) { switch (wValue) {
case USB_PORT_FEAT_ENABLE: case USB_PORT_FEAT_ENABLE:
rh->port &= ~(1 << USB_PORT_FEAT_POWER); rh->port &= ~USB_PORT_STAT_POWER;
break; break;
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
break; break;
...@@ -2226,12 +2226,12 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -2226,12 +2226,12 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
break; break;
case USB_PORT_FEAT_POWER: case USB_PORT_FEAT_POWER:
r8a66597_port_power(r8a66597, port, 1); r8a66597_port_power(r8a66597, port, 1);
rh->port |= (1 << USB_PORT_FEAT_POWER); rh->port |= USB_PORT_STAT_POWER;
break; break;
case USB_PORT_FEAT_RESET: { case USB_PORT_FEAT_RESET: {
struct r8a66597_device *dev = rh->dev; struct r8a66597_device *dev = rh->dev;
rh->port |= (1 << USB_PORT_FEAT_RESET); rh->port |= USB_PORT_STAT_RESET;
disable_r8a66597_pipe_all(r8a66597, dev); disable_r8a66597_pipe_all(r8a66597, dev);
free_usb_address(r8a66597, dev, 1); free_usb_address(r8a66597, dev, 1);
...@@ -2269,12 +2269,12 @@ static int r8a66597_bus_suspend(struct usb_hcd *hcd) ...@@ -2269,12 +2269,12 @@ static int r8a66597_bus_suspend(struct usb_hcd *hcd)
struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
unsigned long dvstctr_reg = get_dvstctr_reg(port); unsigned long dvstctr_reg = get_dvstctr_reg(port);
if (!(rh->port & (1 << USB_PORT_FEAT_ENABLE))) if (!(rh->port & USB_PORT_STAT_ENABLE))
continue; continue;
dbg("suspend port = %d", port); dbg("suspend port = %d", port);
r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */ r8a66597_bclr(r8a66597, UACT, dvstctr_reg); /* suspend */
rh->port |= 1 << USB_PORT_FEAT_SUSPEND; rh->port |= USB_PORT_STAT_SUSPEND;
if (rh->dev->udev->do_remote_wakeup) { if (rh->dev->udev->do_remote_wakeup) {
msleep(3); /* waiting last SOF */ msleep(3); /* waiting last SOF */
...@@ -2300,12 +2300,12 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd) ...@@ -2300,12 +2300,12 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd)
struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; struct r8a66597_root_hub *rh = &r8a66597->root_hub[port];
unsigned long dvstctr_reg = get_dvstctr_reg(port); unsigned long dvstctr_reg = get_dvstctr_reg(port);
if (!(rh->port & (1 << USB_PORT_FEAT_SUSPEND))) if (!(rh->port & USB_PORT_STAT_SUSPEND))
continue; continue;
dbg("resume port = %d", port); dbg("resume port = %d", port);
rh->port &= ~(1 << USB_PORT_FEAT_SUSPEND); rh->port &= ~USB_PORT_STAT_SUSPEND;
rh->port |= 1 << USB_PORT_FEAT_C_SUSPEND; rh->port |= USB_PORT_STAT_C_SUSPEND < 16;
r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg); r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg);
msleep(50); msleep(50);
r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg); r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg);
......
...@@ -90,10 +90,10 @@ static void port_power(struct sl811 *sl811, int is_on) ...@@ -90,10 +90,10 @@ static void port_power(struct sl811 *sl811, int is_on)
/* hub is inactive unless the port is powered */ /* hub is inactive unless the port is powered */
if (is_on) { if (is_on) {
if (sl811->port1 & (1 << USB_PORT_FEAT_POWER)) if (sl811->port1 & USB_PORT_STAT_POWER)
return; return;
sl811->port1 = (1 << USB_PORT_FEAT_POWER); sl811->port1 = USB_PORT_STAT_POWER;
sl811->irq_enable = SL11H_INTMASK_INSRMV; sl811->irq_enable = SL11H_INTMASK_INSRMV;
} else { } else {
sl811->port1 = 0; sl811->port1 = 0;
...@@ -407,7 +407,7 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank) ...@@ -407,7 +407,7 @@ static struct sl811h_ep *start(struct sl811 *sl811, u8 bank)
static inline void start_transfer(struct sl811 *sl811) static inline void start_transfer(struct sl811 *sl811)
{ {
if (sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND)) if (sl811->port1 & USB_PORT_STAT_SUSPEND)
return; return;
if (sl811->active_a == NULL) { if (sl811->active_a == NULL) {
sl811->active_a = start(sl811, SL811_EP_A(SL811_HOST_BUF)); sl811->active_a = start(sl811, SL811_EP_A(SL811_HOST_BUF));
...@@ -721,23 +721,23 @@ static irqreturn_t sl811h_irq(struct usb_hcd *hcd) ...@@ -721,23 +721,23 @@ static irqreturn_t sl811h_irq(struct usb_hcd *hcd)
* force the reset and make khubd clean up later. * force the reset and make khubd clean up later.
*/ */
if (irqstat & SL11H_INTMASK_RD) if (irqstat & SL11H_INTMASK_RD)
sl811->port1 &= ~(1 << USB_PORT_FEAT_CONNECTION); sl811->port1 &= ~USB_PORT_STAT_CONNECTION;
else else
sl811->port1 |= 1 << USB_PORT_FEAT_CONNECTION; sl811->port1 |= USB_PORT_STAT_CONNECTION;
sl811->port1 |= 1 << USB_PORT_FEAT_C_CONNECTION; sl811->port1 |= USB_PORT_STAT_C_CONNECTION << 16;
} else if (irqstat & SL11H_INTMASK_RD) { } else if (irqstat & SL11H_INTMASK_RD) {
if (sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND)) { if (sl811->port1 & USB_PORT_STAT_SUSPEND) {
DBG("wakeup\n"); DBG("wakeup\n");
sl811->port1 |= 1 << USB_PORT_FEAT_C_SUSPEND; sl811->port1 |= USB_PORT_STAT_C_SUSPEND << 16;
sl811->stat_wake++; sl811->stat_wake++;
} else } else
irqstat &= ~SL11H_INTMASK_RD; irqstat &= ~SL11H_INTMASK_RD;
} }
if (irqstat) { if (irqstat) {
if (sl811->port1 & (1 << USB_PORT_FEAT_ENABLE)) if (sl811->port1 & USB_PORT_STAT_ENABLE)
start_transfer(sl811); start_transfer(sl811);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
if (retries--) if (retries--)
...@@ -819,7 +819,7 @@ static int sl811h_urb_enqueue( ...@@ -819,7 +819,7 @@ static int sl811h_urb_enqueue(
spin_lock_irqsave(&sl811->lock, flags); spin_lock_irqsave(&sl811->lock, flags);
/* don't submit to a dead or disabled port */ /* don't submit to a dead or disabled port */
if (!(sl811->port1 & (1 << USB_PORT_FEAT_ENABLE)) if (!(sl811->port1 & USB_PORT_STAT_ENABLE)
|| !HC_IS_RUNNING(hcd->state)) { || !HC_IS_RUNNING(hcd->state)) {
retval = -ENODEV; retval = -ENODEV;
kfree(ep); kfree(ep);
...@@ -1119,8 +1119,8 @@ sl811h_timer(unsigned long _sl811) ...@@ -1119,8 +1119,8 @@ sl811h_timer(unsigned long _sl811)
unsigned long flags; unsigned long flags;
u8 irqstat; u8 irqstat;
u8 signaling = sl811->ctrl1 & SL11H_CTL1MASK_FORCE; u8 signaling = sl811->ctrl1 & SL11H_CTL1MASK_FORCE;
const u32 mask = (1 << USB_PORT_FEAT_CONNECTION) const u32 mask = USB_PORT_STAT_CONNECTION
| (1 << USB_PORT_FEAT_ENABLE) | USB_PORT_STAT_ENABLE
| USB_PORT_STAT_LOW_SPEED; | USB_PORT_STAT_LOW_SPEED;
spin_lock_irqsave(&sl811->lock, flags); spin_lock_irqsave(&sl811->lock, flags);
...@@ -1135,8 +1135,8 @@ sl811h_timer(unsigned long _sl811) ...@@ -1135,8 +1135,8 @@ sl811h_timer(unsigned long _sl811)
switch (signaling) { switch (signaling) {
case SL11H_CTL1MASK_SE0: case SL11H_CTL1MASK_SE0:
DBG("end reset\n"); DBG("end reset\n");
sl811->port1 = (1 << USB_PORT_FEAT_C_RESET) sl811->port1 = (USB_PORT_STAT_C_RESET << 16)
| (1 << USB_PORT_FEAT_POWER); | USB_PORT_STAT_POWER;
sl811->ctrl1 = 0; sl811->ctrl1 = 0;
/* don't wrongly ack RD */ /* don't wrongly ack RD */
if (irqstat & SL11H_INTMASK_INSRMV) if (irqstat & SL11H_INTMASK_INSRMV)
...@@ -1144,7 +1144,7 @@ sl811h_timer(unsigned long _sl811) ...@@ -1144,7 +1144,7 @@ sl811h_timer(unsigned long _sl811)
break; break;
case SL11H_CTL1MASK_K: case SL11H_CTL1MASK_K:
DBG("end resume\n"); DBG("end resume\n");
sl811->port1 &= ~(1 << USB_PORT_FEAT_SUSPEND); sl811->port1 &= ~USB_PORT_STAT_SUSPEND;
break; break;
default: default:
DBG("odd timer signaling: %02x\n", signaling); DBG("odd timer signaling: %02x\n", signaling);
...@@ -1154,9 +1154,9 @@ sl811h_timer(unsigned long _sl811) ...@@ -1154,9 +1154,9 @@ sl811h_timer(unsigned long _sl811)
if (irqstat & SL11H_INTMASK_RD) { if (irqstat & SL11H_INTMASK_RD) {
/* usbcore nukes all pending transactions on disconnect */ /* usbcore nukes all pending transactions on disconnect */
if (sl811->port1 & (1 << USB_PORT_FEAT_CONNECTION)) if (sl811->port1 & USB_PORT_STAT_CONNECTION)
sl811->port1 |= (1 << USB_PORT_FEAT_C_CONNECTION) sl811->port1 |= (USB_PORT_STAT_C_CONNECTION << 16)
| (1 << USB_PORT_FEAT_C_ENABLE); | (USB_PORT_STAT_C_ENABLE << 16);
sl811->port1 &= ~mask; sl811->port1 &= ~mask;
sl811->irq_enable = SL11H_INTMASK_INSRMV; sl811->irq_enable = SL11H_INTMASK_INSRMV;
} else { } else {
...@@ -1166,7 +1166,7 @@ sl811h_timer(unsigned long _sl811) ...@@ -1166,7 +1166,7 @@ sl811h_timer(unsigned long _sl811)
sl811->irq_enable = SL11H_INTMASK_INSRMV | SL11H_INTMASK_RD; sl811->irq_enable = SL11H_INTMASK_INSRMV | SL11H_INTMASK_RD;
} }
if (sl811->port1 & (1 << USB_PORT_FEAT_CONNECTION)) { if (sl811->port1 & USB_PORT_STAT_CONNECTION) {
u8 ctrl2 = SL811HS_CTL2_INIT; u8 ctrl2 = SL811HS_CTL2_INIT;
sl811->irq_enable |= SL11H_INTMASK_DONE_A; sl811->irq_enable |= SL11H_INTMASK_DONE_A;
...@@ -1233,7 +1233,7 @@ sl811h_hub_control( ...@@ -1233,7 +1233,7 @@ sl811h_hub_control(
switch (wValue) { switch (wValue) {
case USB_PORT_FEAT_ENABLE: case USB_PORT_FEAT_ENABLE:
sl811->port1 &= (1 << USB_PORT_FEAT_POWER); sl811->port1 &= USB_PORT_STAT_POWER;
sl811->ctrl1 = 0; sl811->ctrl1 = 0;
sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
sl811->irq_enable = SL11H_INTMASK_INSRMV; sl811->irq_enable = SL11H_INTMASK_INSRMV;
...@@ -1241,7 +1241,7 @@ sl811h_hub_control( ...@@ -1241,7 +1241,7 @@ sl811h_hub_control(
sl811->irq_enable); sl811->irq_enable);
break; break;
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
if (!(sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND))) if (!(sl811->port1 & USB_PORT_STAT_SUSPEND))
break; break;
/* 20 msec of resume/K signaling, other irqs blocked */ /* 20 msec of resume/K signaling, other irqs blocked */
...@@ -1290,9 +1290,9 @@ sl811h_hub_control( ...@@ -1290,9 +1290,9 @@ sl811h_hub_control(
goto error; goto error;
switch (wValue) { switch (wValue) {
case USB_PORT_FEAT_SUSPEND: case USB_PORT_FEAT_SUSPEND:
if (sl811->port1 & (1 << USB_PORT_FEAT_RESET)) if (sl811->port1 & USB_PORT_STAT_RESET)
goto error; goto error;
if (!(sl811->port1 & (1 << USB_PORT_FEAT_ENABLE))) if (!(sl811->port1 & USB_PORT_STAT_ENABLE))
goto error; goto error;
DBG("suspend...\n"); DBG("suspend...\n");
...@@ -1303,9 +1303,9 @@ sl811h_hub_control( ...@@ -1303,9 +1303,9 @@ sl811h_hub_control(
port_power(sl811, 1); port_power(sl811, 1);
break; break;
case USB_PORT_FEAT_RESET: case USB_PORT_FEAT_RESET:
if (sl811->port1 & (1 << USB_PORT_FEAT_SUSPEND)) if (sl811->port1 & USB_PORT_STAT_SUSPEND)
goto error; goto error;
if (!(sl811->port1 & (1 << USB_PORT_FEAT_POWER))) if (!(sl811->port1 & USB_PORT_STAT_POWER))
break; break;
/* 50 msec of reset/SE0 signaling, irqs blocked */ /* 50 msec of reset/SE0 signaling, irqs blocked */
...@@ -1314,7 +1314,7 @@ sl811h_hub_control( ...@@ -1314,7 +1314,7 @@ sl811h_hub_control(
sl811->irq_enable); sl811->irq_enable);
sl811->ctrl1 = SL11H_CTL1MASK_SE0; sl811->ctrl1 = SL11H_CTL1MASK_SE0;
sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1);
sl811->port1 |= (1 << USB_PORT_FEAT_RESET); sl811->port1 |= USB_PORT_STAT_RESET;
mod_timer(&sl811->timer, jiffies mod_timer(&sl811->timer, jiffies
+ msecs_to_jiffies(50)); + msecs_to_jiffies(50));
break; break;
......
...@@ -205,27 +205,27 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, ...@@ -205,27 +205,27 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
/* wPortChange bits */ /* wPortChange bits */
if (temp & PORT_CSC) if (temp & PORT_CSC)
status |= 1 << USB_PORT_FEAT_C_CONNECTION; status |= USB_PORT_STAT_C_CONNECTION << 16;
if (temp & PORT_PEC) if (temp & PORT_PEC)
status |= 1 << USB_PORT_FEAT_C_ENABLE; status |= USB_PORT_STAT_C_ENABLE << 16;
if ((temp & PORT_OCC)) if ((temp & PORT_OCC))
status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT; status |= USB_PORT_STAT_C_OVERCURRENT << 16;
/* /*
* FIXME ignoring suspend, reset, and USB 2.1/3.0 specific * FIXME ignoring suspend, reset, and USB 2.1/3.0 specific
* changes * changes
*/ */
if (temp & PORT_CONNECT) { if (temp & PORT_CONNECT) {
status |= 1 << USB_PORT_FEAT_CONNECTION; status |= USB_PORT_STAT_CONNECTION;
status |= xhci_port_speed(temp); status |= xhci_port_speed(temp);
} }
if (temp & PORT_PE) if (temp & PORT_PE)
status |= 1 << USB_PORT_FEAT_ENABLE; status |= USB_PORT_STAT_ENABLE;
if (temp & PORT_OC) if (temp & PORT_OC)
status |= 1 << USB_PORT_FEAT_OVER_CURRENT; status |= USB_PORT_STAT_OVERCURRENT;
if (temp & PORT_RESET) if (temp & PORT_RESET)
status |= 1 << USB_PORT_FEAT_RESET; status |= USB_PORT_STAT_RESET;
if (temp & PORT_POWER) if (temp & PORT_POWER)
status |= 1 << USB_PORT_FEAT_POWER; status |= USB_PORT_STAT_POWER;
xhci_dbg(xhci, "Get port status returned 0x%x\n", status); xhci_dbg(xhci, "Get port status returned 0x%x\n", status);
put_unaligned(cpu_to_le32(status), (__le32 *) buf); put_unaligned(cpu_to_le32(status), (__le32 *) buf);
break; break;
......
...@@ -353,8 +353,7 @@ void musb_hnp_stop(struct musb *musb) ...@@ -353,8 +353,7 @@ void musb_hnp_stop(struct musb *musb)
* which cause occasional OPT A "Did not receive reset after connect" * which cause occasional OPT A "Did not receive reset after connect"
* errors. * errors.
*/ */
musb->port1_status &= musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16);
~(1 << USB_PORT_FEAT_C_CONNECTION);
} }
#endif #endif
...@@ -530,8 +529,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -530,8 +529,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
musb_writeb(mbase, MUSB_DEVCTL, devctl); musb_writeb(mbase, MUSB_DEVCTL, devctl);
} else { } else {
musb->port1_status |= musb->port1_status |=
(1 << USB_PORT_FEAT_OVER_CURRENT) USB_PORT_STAT_OVERCURRENT
| (1 << USB_PORT_FEAT_C_OVER_CURRENT); | (USB_PORT_STAT_C_OVERCURRENT << 16);
} }
break; break;
default: default:
......
...@@ -183,8 +183,8 @@ static void musb_port_reset(struct musb *musb, bool do_reset) ...@@ -183,8 +183,8 @@ static void musb_port_reset(struct musb *musb, bool do_reset)
void musb_root_disconnect(struct musb *musb) void musb_root_disconnect(struct musb *musb)
{ {
musb->port1_status = (1 << USB_PORT_FEAT_POWER) musb->port1_status = USB_PORT_STAT_POWER
| (1 << USB_PORT_FEAT_C_CONNECTION); | (USB_PORT_STAT_C_CONNECTION << 16);
usb_hcd_poll_rh_status(musb_to_hcd(musb)); usb_hcd_poll_rh_status(musb_to_hcd(musb));
musb->is_active = 0; musb->is_active = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment