43 #include <linux/module.h>
44 #include <linux/pci.h>
45 #include <linux/sched.h>
48 #include <linux/slab.h>
100 if (cmd_size >= 4096)
110 dev_err(dev,
"requesting reset of halted radio controller\n");
118 dev_err(dev,
"device is not ready to execute commands\n");
135 static int whcrc_reset(
struct uwb_rc *
rc)
137 struct whcrc *whcrc = rc->
priv;
157 void whcrc_enable_events(
struct whcrc *whcrc)
179 whcrc_enable_events(whcrc);
191 struct whcrc *whcrc = _whcrc;
198 le_writel(urcsts & URCSTS_INT_MASK, whcrc->
rc_base +
URCSTS);
201 dev_err(dev,
"host system error -- hardware halted\n");
218 int whcrc_setup_rc_umc(
struct whcrc *whcrc)
228 dev_err(dev,
"can't request URC region (%zu bytes @ 0x%lx): %d\n",
230 goto error_request_region;
235 dev_err(dev,
"can't ioremap registers (%zu bytes @ 0x%lx): %d\n",
237 goto error_ioremap_nocache;
241 KBUILD_MODNAME, whcrc);
243 dev_err(dev,
"can't allocate IRQ %d: %d\n",
244 umc_dev->
irq, result);
245 goto error_request_irq;
252 dev_err(dev,
"Can't allocate cmd transfer buffer\n");
253 goto error_cmd_buffer;
259 dev_err(dev,
"Can't allocate evt transfer buffer\n");
260 goto error_evt_buffer;
271 error_ioremap_nocache:
273 error_request_region:
282 void whcrc_release_rc_umc(
struct whcrc *whcrc)
284 struct umc_dev *umc_dev = whcrc->
umc_dev;
303 static int whcrc_start_rc(
struct uwb_rc *
rc)
305 struct whcrc *whcrc = rc->
priv;
311 5000,
"hardware reset") < 0)
318 5000,
"radio controller start") < 0)
320 whcrc_enable_events(whcrc);
334 void whcrc_stop_rc(
struct uwb_rc *rc)
336 struct whcrc *whcrc = rc->
priv;
337 struct umc_dev *umc_dev = whcrc->
umc_dev;
344 URCSTS_HALTED, URCSTS_HALTED, 100,
"radio controller stop");
347 static void whcrc_init(
struct whcrc *whcrc)
363 int whcrc_probe(
struct umc_dev *umc_dev)
366 struct uwb_rc *uwb_rc;
372 if (uwb_rc ==
NULL) {
373 dev_err(dev,
"unable to allocate RC instance\n");
378 dev_err(dev,
"unable to allocate WHC-RC instance\n");
384 result = whcrc_setup_rc_umc(whcrc);
386 dev_err(dev,
"Can't setup RC UMC interface: %d\n", result);
387 goto error_setup_rc_umc;
392 uwb_rc->
cmd = whcrc_cmd;
393 uwb_rc->
reset = whcrc_reset;
394 uwb_rc->
start = whcrc_start_rc;
395 uwb_rc->
stop = whcrc_stop_rc;
400 umc_set_drvdata(umc_dev, whcrc);
404 whcrc_release_rc_umc(whcrc);
422 static void whcrc_remove(
struct umc_dev *umc_dev)
424 struct whcrc *whcrc = umc_get_drvdata(umc_dev);
425 struct uwb_rc *uwb_rc = whcrc->
uwb_rc;
427 umc_set_drvdata(umc_dev,
NULL);
429 whcrc_release_rc_umc(whcrc);
434 static int whcrc_pre_reset(
struct umc_dev *umc)
436 struct whcrc *whcrc = umc_get_drvdata(umc);
437 struct uwb_rc *uwb_rc = whcrc->
uwb_rc;
443 static int whcrc_post_reset(
struct umc_dev *umc)
445 struct whcrc *whcrc = umc_get_drvdata(umc);
446 struct uwb_rc *uwb_rc = whcrc->
uwb_rc;
461 .probe = whcrc_probe,
462 .remove = whcrc_remove,
463 .pre_reset = whcrc_pre_reset,
464 .post_reset = whcrc_post_reset,
467 static int __init whcrc_driver_init(
void)
473 static void __exit whcrc_driver_exit(
void)