|
@@ -195,6 +195,7 @@ int wusbhc_start(struct wusbhc *wusbhc)
|
|
|
struct device *dev = wusbhc->dev;
|
|
|
|
|
|
WARN_ON(wusbhc->wuie_host_info != NULL);
|
|
|
+ BUG_ON(wusbhc->uwb_rc == NULL);
|
|
|
|
|
|
result = wusbhc_rsv_establish(wusbhc);
|
|
|
if (result < 0) {
|
|
@@ -276,12 +277,38 @@ int wusbhc_chid_set(struct wusbhc *wusbhc, const struct wusb_ckhdid *chid)
|
|
|
}
|
|
|
wusbhc->chid = *chid;
|
|
|
}
|
|
|
+
|
|
|
+ /* register with UWB if we haven't already since we are about to start
|
|
|
+ the radio. */
|
|
|
+ if ((chid) && (wusbhc->uwb_rc == NULL)) {
|
|
|
+ wusbhc->uwb_rc = uwb_rc_get_by_grandpa(wusbhc->dev->parent);
|
|
|
+ if (wusbhc->uwb_rc == NULL) {
|
|
|
+ result = -ENODEV;
|
|
|
+ dev_err(wusbhc->dev, "Cannot get associated UWB Host Controller\n");
|
|
|
+ goto error_rc_get;
|
|
|
+ }
|
|
|
+
|
|
|
+ result = wusbhc_pal_register(wusbhc);
|
|
|
+ if (result < 0) {
|
|
|
+ dev_err(wusbhc->dev, "Cannot register as a UWB PAL\n");
|
|
|
+ goto error_pal_register;
|
|
|
+ }
|
|
|
+ }
|
|
|
mutex_unlock(&wusbhc->mutex);
|
|
|
|
|
|
if (chid)
|
|
|
result = uwb_radio_start(&wusbhc->pal);
|
|
|
else
|
|
|
uwb_radio_stop(&wusbhc->pal);
|
|
|
+
|
|
|
+ return result;
|
|
|
+
|
|
|
+error_pal_register:
|
|
|
+ uwb_rc_put(wusbhc->uwb_rc);
|
|
|
+ wusbhc->uwb_rc = NULL;
|
|
|
+error_rc_get:
|
|
|
+ mutex_unlock(&wusbhc->mutex);
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(wusbhc_chid_set);
|