Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280791
b: refs/heads/master
c: df7c1ca
h: refs/heads/master
i:
  280789: a521338
  280787: aad70ac
  280783: ac02f1b
v: v3
  • Loading branch information
Geoff Levand committed Dec 8, 2011
1 parent 5d98f6d commit db85beb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9187bef2fa395e85d5e22c4792b553d98410ccd6
refs/heads/master: df7c1ca229ebffe14a6fb3f13d16b1dd2a1731cb
50 changes: 50 additions & 0 deletions trunk/drivers/usb/host/ehci-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
#include <asm/system.h>
#include <asm/unaligned.h>

#if defined(CONFIG_PPC_PS3)
#include <asm/firmware.h>
#endif

/*-------------------------------------------------------------------------*/

/*
Expand Down Expand Up @@ -230,12 +234,58 @@ static int ehci_halt (struct ehci_hcd *ehci)
STS_HALT, STS_HALT, 16 * 125);
}

#if defined(CONFIG_USB_SUSPEND) && defined(CONFIG_PPC_PS3)

/*
* The EHCI controller of the Cell Super Companion Chip used in the
* PS3 will stop the root hub after all root hub ports are suspended.
* When in this condition handshake will return -ETIMEDOUT. The
* STS_HLT bit will not be set, so inspection of the frame index is
* used here to test for the condition. If the condition is found
* return success to allow the USB suspend to complete.
*/

static int handshake_for_broken_root_hub(struct ehci_hcd *ehci,
void __iomem *ptr, u32 mask, u32 done,
int usec)
{
unsigned int old_index;
int error;

if (!firmware_has_feature(FW_FEATURE_PS3_LV1))
return -ETIMEDOUT;

old_index = ehci_read_frame_index(ehci);

error = handshake(ehci, ptr, mask, done, usec);

if (error == -ETIMEDOUT && ehci_read_frame_index(ehci) == old_index)
return 0;

return error;
}

#else

static int handshake_for_broken_root_hub(struct ehci_hcd *ehci,
void __iomem *ptr, u32 mask, u32 done,
int usec)
{
return -ETIMEDOUT;
}

#endif

static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
u32 mask, u32 done, int usec)
{
int error;

error = handshake(ehci, ptr, mask, done, usec);
if (error == -ETIMEDOUT)
error = handshake_for_broken_root_hub(ehci, ptr, mask, done,
usec);

if (error) {
ehci_halt(ehci);
ehci->rh_state = EHCI_RH_HALTED;
Expand Down

0 comments on commit db85beb

Please sign in to comment.