/* * Start the wireless host controller. * * Start device notification. * * Put hc into run state, set DNTS parameters. */ static int whc_start(struct usb_hcd *usb_hcd) { struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); struct whc *whc = wusbhc_to_whc(wusbhc); u8 bcid; int ret; mutex_lock(&wusbhc->mutex); le_writel(WUSBINTR_GEN_CMD_DONE | WUSBINTR_HOST_ERR | WUSBINTR_ASYNC_SCHED_SYNCED | WUSBINTR_DNTS_INT | WUSBINTR_ERR_INT | WUSBINTR_INT, whc->base + WUSBINTR); /* set cluster ID */ bcid = wusb_cluster_id_get(); ret = whc_set_cluster_id(whc, bcid); if (ret < 0) goto out; wusbhc->cluster_id = bcid; /* start HC */ whc_write_wusbcmd(whc, WUSBCMD_RUN, WUSBCMD_RUN); usb_hcd->uses_new_polling = 1; set_bit(HCD_FLAG_POLL_RH, &usb_hcd->flags); usb_hcd->state = HC_STATE_RUNNING; out: mutex_unlock(&wusbhc->mutex); return ret; }
int whc_bwa_set(struct wusbhc *wusbhc, s8 stream_index, const struct uwb_mas_bm *mas_bm) { struct whc *whc = wusbhc_to_whc(wusbhc); if (stream_index >= 0) whc_write_wusbcmd(whc, WUSBCMD_WUSBSI_MASK, WUSBCMD_WUSBSI(stream_index)); return whc_do_gencmd(whc, WUSBGENCMDSTS_SET_MAS, 0, (void *)mas_bm, sizeof(*mas_bm)); }
/* * Stop the wireless host controller. * * Stop device notification. * * Wait for pending transfer to stop? Put hc into stop state? */ static void whc_stop(struct usb_hcd *usb_hcd) { struct wusbhc *wusbhc = usb_hcd_to_wusbhc(usb_hcd); struct whc *whc = wusbhc_to_whc(wusbhc); mutex_lock(&wusbhc->mutex); /* stop HC */ le_writel(0, whc->base + WUSBINTR); whc_write_wusbcmd(whc, WUSBCMD_RUN, 0); whci_wait_for(&whc->umc->dev, whc->base + WUSBSTS, WUSBSTS_HCHALTED, WUSBSTS_HCHALTED, 100, "HC to halt"); wusb_cluster_id_put(wusbhc->cluster_id); mutex_unlock(&wusbhc->mutex); }
int whc_set_cluster_id(struct whc *whc, u8 bcid) { whc_write_wusbcmd(whc, WUSBCMD_BCID_MASK, WUSBCMD_BCID(bcid)); return 0; }