Lines Matching refs:whcrc

63 struct whcrc {  struct
96 struct whcrc *whcrc = uwb_rc->priv; in whcrc_cmd() local
97 struct device *dev = &whcrc->umc_dev->dev; in whcrc_cmd()
109 if (le_readl(whcrc->rc_base + URCSTS) & URCSTS_HALTED) { in whcrc_cmd()
115 result = wait_event_timeout(whcrc->cmd_wq, in whcrc_cmd()
116 !(le_readl(whcrc->rc_base + URCCMD) & URCCMD_ACTIVE), HZ/2); in whcrc_cmd()
122 memmove(whcrc->cmd_buf, cmd, cmd_size); in whcrc_cmd()
123 le_writeq(whcrc->cmd_dma_buf, whcrc->rc_base + URCCMDADDR); in whcrc_cmd()
125 spin_lock(&whcrc->irq_lock); in whcrc_cmd()
126 urccmd = le_readl(whcrc->rc_base + URCCMD); in whcrc_cmd()
129 whcrc->rc_base + URCCMD); in whcrc_cmd()
130 spin_unlock(&whcrc->irq_lock); in whcrc_cmd()
137 struct whcrc *whcrc = rc->priv; in whcrc_reset() local
139 return umc_controller_reset(whcrc->umc_dev); in whcrc_reset()
157 void whcrc_enable_events(struct whcrc *whcrc) in whcrc_enable_events() argument
161 le_writeq(whcrc->evt_dma_buf, whcrc->rc_base + URCEVTADDR); in whcrc_enable_events()
163 spin_lock(&whcrc->irq_lock); in whcrc_enable_events()
164 urccmd = le_readl(whcrc->rc_base + URCCMD) & ~URCCMD_ACTIVE; in whcrc_enable_events()
165 le_writel(urccmd | URCCMD_EARV, whcrc->rc_base + URCCMD); in whcrc_enable_events()
166 spin_unlock(&whcrc->irq_lock); in whcrc_enable_events()
171 struct whcrc *whcrc = container_of(work, struct whcrc, event_work); in whcrc_event_work() local
175 urcevtaddr = le_readq(whcrc->rc_base + URCEVTADDR); in whcrc_event_work()
178 uwb_rc_neh_grok(whcrc->uwb_rc, whcrc->evt_buf, size); in whcrc_event_work()
179 whcrc_enable_events(whcrc); in whcrc_event_work()
191 struct whcrc *whcrc = _whcrc; in whcrc_irq_cb() local
192 struct device *dev = &whcrc->umc_dev->dev; in whcrc_irq_cb()
195 urcsts = le_readl(whcrc->rc_base + URCSTS); in whcrc_irq_cb()
198 le_writel(urcsts & URCSTS_INT_MASK, whcrc->rc_base + URCSTS); in whcrc_irq_cb()
206 schedule_work(&whcrc->event_work); in whcrc_irq_cb()
208 wake_up_all(&whcrc->cmd_wq); in whcrc_irq_cb()
218 int whcrc_setup_rc_umc(struct whcrc *whcrc) in whcrc_setup_rc_umc() argument
221 struct device *dev = &whcrc->umc_dev->dev; in whcrc_setup_rc_umc()
222 struct umc_dev *umc_dev = whcrc->umc_dev; in whcrc_setup_rc_umc()
224 whcrc->area = umc_dev->resource.start; in whcrc_setup_rc_umc()
225 whcrc->rc_len = resource_size(&umc_dev->resource); in whcrc_setup_rc_umc()
227 if (request_mem_region(whcrc->area, whcrc->rc_len, KBUILD_MODNAME) == NULL) { in whcrc_setup_rc_umc()
229 whcrc->rc_len, whcrc->area, result); in whcrc_setup_rc_umc()
233 whcrc->rc_base = ioremap_nocache(whcrc->area, whcrc->rc_len); in whcrc_setup_rc_umc()
234 if (whcrc->rc_base == NULL) { in whcrc_setup_rc_umc()
236 whcrc->rc_len, whcrc->area, result); in whcrc_setup_rc_umc()
241 KBUILD_MODNAME, whcrc); in whcrc_setup_rc_umc()
249 whcrc->cmd_buf = dma_alloc_coherent(&umc_dev->dev, PAGE_SIZE, in whcrc_setup_rc_umc()
250 &whcrc->cmd_dma_buf, GFP_KERNEL); in whcrc_setup_rc_umc()
251 if (whcrc->cmd_buf == NULL) { in whcrc_setup_rc_umc()
256 whcrc->evt_buf = dma_alloc_coherent(&umc_dev->dev, PAGE_SIZE, in whcrc_setup_rc_umc()
257 &whcrc->evt_dma_buf, GFP_KERNEL); in whcrc_setup_rc_umc()
258 if (whcrc->evt_buf == NULL) { in whcrc_setup_rc_umc()
265 dma_free_coherent(&umc_dev->dev, PAGE_SIZE, whcrc->cmd_buf, in whcrc_setup_rc_umc()
266 whcrc->cmd_dma_buf); in whcrc_setup_rc_umc()
268 free_irq(umc_dev->irq, whcrc); in whcrc_setup_rc_umc()
270 iounmap(whcrc->rc_base); in whcrc_setup_rc_umc()
272 release_mem_region(whcrc->area, whcrc->rc_len); in whcrc_setup_rc_umc()
282 void whcrc_release_rc_umc(struct whcrc *whcrc) in whcrc_release_rc_umc() argument
284 struct umc_dev *umc_dev = whcrc->umc_dev; in whcrc_release_rc_umc()
286 dma_free_coherent(&umc_dev->dev, PAGE_SIZE, whcrc->evt_buf, in whcrc_release_rc_umc()
287 whcrc->evt_dma_buf); in whcrc_release_rc_umc()
288 dma_free_coherent(&umc_dev->dev, PAGE_SIZE, whcrc->cmd_buf, in whcrc_release_rc_umc()
289 whcrc->cmd_dma_buf); in whcrc_release_rc_umc()
290 free_irq(umc_dev->irq, whcrc); in whcrc_release_rc_umc()
291 iounmap(whcrc->rc_base); in whcrc_release_rc_umc()
292 release_mem_region(whcrc->area, whcrc->rc_len); in whcrc_release_rc_umc()
305 struct whcrc *whcrc = rc->priv; in whcrc_start_rc() local
306 struct device *dev = &whcrc->umc_dev->dev; in whcrc_start_rc()
309 le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD); in whcrc_start_rc()
310 if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0, in whcrc_start_rc()
315 le_writel(0, whcrc->rc_base + URCINTR); in whcrc_start_rc()
316 le_writel(URCCMD_RS, whcrc->rc_base + URCCMD); in whcrc_start_rc()
317 if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0, in whcrc_start_rc()
320 whcrc_enable_events(whcrc); in whcrc_start_rc()
321 le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR); in whcrc_start_rc()
336 struct whcrc *whcrc = rc->priv; in whcrc_stop_rc() local
337 struct umc_dev *umc_dev = whcrc->umc_dev; in whcrc_stop_rc()
339 le_writel(0, whcrc->rc_base + URCINTR); in whcrc_stop_rc()
340 cancel_work_sync(&whcrc->event_work); in whcrc_stop_rc()
342 le_writel(0, whcrc->rc_base + URCCMD); in whcrc_stop_rc()
343 whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS, in whcrc_stop_rc()
347 static void whcrc_init(struct whcrc *whcrc) in whcrc_init() argument
349 spin_lock_init(&whcrc->irq_lock); in whcrc_init()
350 init_waitqueue_head(&whcrc->cmd_wq); in whcrc_init()
351 INIT_WORK(&whcrc->event_work, whcrc_event_work); in whcrc_init()
367 struct whcrc *whcrc; in whcrc_probe() local
376 whcrc = kzalloc(sizeof(*whcrc), GFP_KERNEL); in whcrc_probe()
377 if (whcrc == NULL) { in whcrc_probe()
381 whcrc_init(whcrc); in whcrc_probe()
382 whcrc->umc_dev = umc_dev; in whcrc_probe()
384 result = whcrc_setup_rc_umc(whcrc); in whcrc_probe()
389 whcrc->uwb_rc = uwb_rc; in whcrc_probe()
397 result = uwb_rc_add(uwb_rc, dev, whcrc); in whcrc_probe()
400 umc_set_drvdata(umc_dev, whcrc); in whcrc_probe()
404 whcrc_release_rc_umc(whcrc); in whcrc_probe()
406 kfree(whcrc); in whcrc_probe()
424 struct whcrc *whcrc = umc_get_drvdata(umc_dev); in whcrc_remove() local
425 struct uwb_rc *uwb_rc = whcrc->uwb_rc; in whcrc_remove()
429 whcrc_release_rc_umc(whcrc); in whcrc_remove()
430 kfree(whcrc); in whcrc_remove()
436 struct whcrc *whcrc = umc_get_drvdata(umc); in whcrc_pre_reset() local
437 struct uwb_rc *uwb_rc = whcrc->uwb_rc; in whcrc_pre_reset()
445 struct whcrc *whcrc = umc_get_drvdata(umc); in whcrc_post_reset() local
446 struct uwb_rc *uwb_rc = whcrc->uwb_rc; in whcrc_post_reset()