EHCI: maintain the ehci->command value properly
The ehci-hcd driver is a little haphazard about keeping track of the state of the USBCMD register. The ehci->command field is supposed to hold the register's value (apart from a few special bits) at all times, but it isn't maintained properly. This patch (as1543) cleans up the situation. It keeps ehci->command up-to-date, and uses that value rather than reading the register from the hardware whenever possible. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
09091a4d5f
commit
3d9545cc37
@@ -481,7 +481,6 @@ static int tt_no_collision (
|
||||
|
||||
static int enable_periodic (struct ehci_hcd *ehci)
|
||||
{
|
||||
u32 cmd;
|
||||
int status;
|
||||
|
||||
if (ehci->periodic_sched++)
|
||||
@@ -497,8 +496,8 @@ static int enable_periodic (struct ehci_hcd *ehci)
|
||||
return status;
|
||||
}
|
||||
|
||||
cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE;
|
||||
ehci_writel(ehci, cmd, &ehci->regs->command);
|
||||
ehci->command |= CMD_PSE;
|
||||
ehci_writel(ehci, ehci->command, &ehci->regs->command);
|
||||
/* posted write ... PSS happens later */
|
||||
|
||||
/* make sure ehci_work scans these */
|
||||
@@ -511,7 +510,6 @@ static int enable_periodic (struct ehci_hcd *ehci)
|
||||
|
||||
static int disable_periodic (struct ehci_hcd *ehci)
|
||||
{
|
||||
u32 cmd;
|
||||
int status;
|
||||
|
||||
if (--ehci->periodic_sched)
|
||||
@@ -537,8 +535,8 @@ static int disable_periodic (struct ehci_hcd *ehci)
|
||||
return status;
|
||||
}
|
||||
|
||||
cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE;
|
||||
ehci_writel(ehci, cmd, &ehci->regs->command);
|
||||
ehci->command &= ~CMD_PSE;
|
||||
ehci_writel(ehci, ehci->command, &ehci->regs->command);
|
||||
/* posted write ... */
|
||||
|
||||
free_cached_lists(ehci);
|
||||
|
Reference in New Issue
Block a user