Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125121
b: refs/heads/master
c: 56968d0
h: refs/heads/master
i:
  125119: 437cb9f
v: v3
  • Loading branch information
David Vrabel committed Nov 25, 2008
1 parent 13f5227 commit e72c91d
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 65d76f368295973a35d195c9b13053502a67b6bc
refs/heads/master: 56968d0c1a920eb165c06318f5c458724e1df0af
21 changes: 18 additions & 3 deletions trunk/drivers/usb/host/whci/asl.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,26 @@ void asl_stop(struct whc *whc)
1000, "stop ASL");
}

/**
* asl_update - request an ASL update and wait for the hardware to be synced
* @whc: the WHCI HC
* @wusbcmd: WUSBCMD value to start the update.
*
* If the WUSB HC is inactive (i.e., the ASL is stopped) then the
* update must be skipped as the hardware may not respond to update
* requests.
*/
void asl_update(struct whc *whc, uint32_t wusbcmd)
{
whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
wait_event(whc->async_list_wq,
(le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0);
struct wusbhc *wusbhc = &whc->wusbhc;

mutex_lock(&wusbhc->mutex);
if (wusbhc->active) {
whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
wait_event(whc->async_list_wq,
(le_readl(whc->base + WUSBCMD) & WUSBCMD_ASYNC_UPDATED) == 0);
}
mutex_unlock(&wusbhc->mutex);
}

/**
Expand Down
21 changes: 18 additions & 3 deletions trunk/drivers/usb/host/whci/pzl.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,26 @@ void pzl_stop(struct whc *whc)
1000, "stop PZL");
}

/**
* pzl_update - request a PZL update and wait for the hardware to be synced
* @whc: the WHCI HC
* @wusbcmd: WUSBCMD value to start the update.
*
* If the WUSB HC is inactive (i.e., the PZL is stopped) then the
* update must be skipped as the hardware may not respond to update
* requests.
*/
void pzl_update(struct whc *whc, uint32_t wusbcmd)
{
whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
wait_event(whc->periodic_list_wq,
(le_readl(whc->base + WUSBCMD) & WUSBCMD_PERIODIC_UPDATED) == 0);
struct wusbhc *wusbhc = &whc->wusbhc;

mutex_lock(&wusbhc->mutex);
if (wusbhc->active) {
whc_write_wusbcmd(whc, wusbcmd, wusbcmd);
wait_event(whc->periodic_list_wq,
(le_readl(whc->base + WUSBCMD) & WUSBCMD_PERIODIC_UPDATED) == 0);
}
mutex_unlock(&wusbhc->mutex);
}

static void update_pzl_hw_view(struct whc *whc)
Expand Down
24 changes: 9 additions & 15 deletions trunk/drivers/usb/wusbcore/devconnect.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,21 +484,15 @@ static void __wusbhc_keep_alive(struct wusbhc *wusbhc)
*/
static void wusbhc_keep_alive_run(struct work_struct *ws)
{
struct delayed_work *dw =
container_of(ws, struct delayed_work, work);
struct wusbhc *wusbhc =
container_of(dw, struct wusbhc, keep_alive_timer);

d_fnstart(5, wusbhc->dev, "(wusbhc %p)\n", wusbhc);
if (wusbhc->active) {
mutex_lock(&wusbhc->mutex);
__wusbhc_keep_alive(wusbhc);
mutex_unlock(&wusbhc->mutex);
queue_delayed_work(wusbd, &wusbhc->keep_alive_timer,
(wusbhc->trust_timeout * CONFIG_HZ)/1000/2);
}
d_fnend(5, wusbhc->dev, "(wusbhc %p) = void\n", wusbhc);
return;
struct delayed_work *dw = container_of(ws, struct delayed_work, work);
struct wusbhc *wusbhc = container_of(dw, struct wusbhc, keep_alive_timer);

mutex_lock(&wusbhc->mutex);
__wusbhc_keep_alive(wusbhc);
mutex_unlock(&wusbhc->mutex);

queue_delayed_work(wusbd, &wusbhc->keep_alive_timer,
msecs_to_jiffies(wusbhc->trust_timeout / 2));
}

/*
Expand Down
37 changes: 27 additions & 10 deletions trunk/drivers/usb/wusbcore/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,27 @@ void wusbhc_mmcie_rm(struct wusbhc *wusbhc, struct wuie_hdr *wuie)
}
EXPORT_SYMBOL_GPL(wusbhc_mmcie_rm);

static int wusbhc_mmc_start(struct wusbhc *wusbhc)
{
int ret;

mutex_lock(&wusbhc->mutex);
ret = wusbhc->start(wusbhc);
if (ret >= 0)
wusbhc->active = 1;
mutex_unlock(&wusbhc->mutex);

return ret;
}

static void wusbhc_mmc_stop(struct wusbhc *wusbhc)
{
mutex_lock(&wusbhc->mutex);
wusbhc->active = 0;
wusbhc->stop(wusbhc, WUSB_CHANNEL_STOP_DELAY_MS);
mutex_unlock(&wusbhc->mutex);
}

/*
* wusbhc_start - start transmitting MMCs and accepting connections
* @wusbhc: the HC to start
Expand Down Expand Up @@ -198,12 +219,12 @@ int wusbhc_start(struct wusbhc *wusbhc)
dev_err(dev, "Cannot set DNTS parameters: %d\n", result);
goto error_set_num_dnts;
}
result = wusbhc->start(wusbhc);
result = wusbhc_mmc_start(wusbhc);
if (result < 0) {
dev_err(dev, "error starting wusbch: %d\n", result);
goto error_wusbhc_start;
}
wusbhc->active = 1;

return 0;

error_wusbhc_start:
Expand All @@ -225,15 +246,11 @@ int wusbhc_start(struct wusbhc *wusbhc)
*/
void wusbhc_stop(struct wusbhc *wusbhc)
{
if (wusbhc->active) {
wusbhc->active = 0;
wusbhc->stop(wusbhc, WUSB_CHANNEL_STOP_DELAY_MS);
wusbhc_sec_stop(wusbhc);
wusbhc_devconnect_stop(wusbhc);
wusbhc_rsv_terminate(wusbhc);
}
wusbhc_mmc_stop(wusbhc);
wusbhc_sec_stop(wusbhc);
wusbhc_devconnect_stop(wusbhc);
wusbhc_rsv_terminate(wusbhc);
}
EXPORT_SYMBOL_GPL(wusbhc_stop);

/*
* Set/reset/update a new CHID
Expand Down

0 comments on commit e72c91d

Please sign in to comment.