Lines Matching refs:lpbfifo

58 static struct mpc52xx_lpbfifo lpbfifo;  variable
78 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); in mpc52xx_lpbfifo_kick()
81 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000001); in mpc52xx_lpbfifo_kick()
97 reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA; in mpc52xx_lpbfifo_kick()
104 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000301); in mpc52xx_lpbfifo_kick()
114 out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1e4); in mpc52xx_lpbfifo_kick()
115 out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 7); in mpc52xx_lpbfifo_kick()
116 lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task; in mpc52xx_lpbfifo_kick()
118 out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1ff); in mpc52xx_lpbfifo_kick()
119 out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 0); in mpc52xx_lpbfifo_kick()
120 lpbfifo.bcom_cur_task = lpbfifo.bcom_rx_task; in mpc52xx_lpbfifo_kick()
123 if (lpbfifo.dma_irqs_enabled) { in mpc52xx_lpbfifo_kick()
124 disable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task)); in mpc52xx_lpbfifo_kick()
125 lpbfifo.dma_irqs_enabled = 0; in mpc52xx_lpbfifo_kick()
128 if (!lpbfifo.dma_irqs_enabled) { in mpc52xx_lpbfifo_kick()
129 enable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task)); in mpc52xx_lpbfifo_kick()
130 lpbfifo.dma_irqs_enabled = 1; in mpc52xx_lpbfifo_kick()
135 bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); in mpc52xx_lpbfifo_kick()
153 bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); in mpc52xx_lpbfifo_kick()
161 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, bit_fields); in mpc52xx_lpbfifo_kick()
165 out_be32(lpbfifo.regs + LPBFIFO_REG_START_ADDRESS, in mpc52xx_lpbfifo_kick()
167 out_be32(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, transfer_size); in mpc52xx_lpbfifo_kick()
172 out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields); in mpc52xx_lpbfifo_kick()
175 if (!lpbfifo.req->defer_xfer_start) in mpc52xx_lpbfifo_kick()
176 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); in mpc52xx_lpbfifo_kick()
178 bcom_enable(lpbfifo.bcom_cur_task); in mpc52xx_lpbfifo_kick()
229 u32 status = in_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS); in mpc52xx_lpbfifo_irq()
238 spin_lock_irqsave(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_irq()
241 req = lpbfifo.req; in mpc52xx_lpbfifo_irq()
243 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_irq()
253 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_irq()
264 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); in mpc52xx_lpbfifo_irq()
270 count = in_be32(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS); in mpc52xx_lpbfifo_irq()
275 reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA; in mpc52xx_lpbfifo_irq()
292 out_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS, 0x01); in mpc52xx_lpbfifo_irq()
305 bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL); in mpc52xx_lpbfifo_irq()
312 lpbfifo.req = NULL; in mpc52xx_lpbfifo_irq()
318 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_irq()
343 spin_lock_irqsave(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_bcom_irq()
346 req = lpbfifo.req; in mpc52xx_lpbfifo_bcom_irq()
348 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_bcom_irq()
355 if (!bcom_buffer_done(lpbfifo.bcom_cur_task)) { in mpc52xx_lpbfifo_bcom_irq()
356 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_bcom_irq()
365 bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL); in mpc52xx_lpbfifo_bcom_irq()
372 lpbfifo.req = NULL; in mpc52xx_lpbfifo_bcom_irq()
376 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_bcom_irq()
389 struct mpc52xx_lpbfifo_request *req = lpbfifo.req; in mpc52xx_lpbfifo_poll()
413 if (!lpbfifo.regs) in mpc52xx_lpbfifo_submit()
416 spin_lock_irqsave(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_submit()
419 if (lpbfifo.req) { in mpc52xx_lpbfifo_submit()
420 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_submit()
425 lpbfifo.req = req; in mpc52xx_lpbfifo_submit()
432 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_submit()
441 if (!lpbfifo.regs) in mpc52xx_lpbfifo_start_xfer()
444 spin_lock_irqsave(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_start_xfer()
450 if (lpbfifo.req && !lpbfifo.req->defer_xfer_start) { in mpc52xx_lpbfifo_start_xfer()
451 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_start_xfer()
459 if (lpbfifo.req && lpbfifo.req == req && in mpc52xx_lpbfifo_start_xfer()
460 lpbfifo.req->defer_xfer_start) { in mpc52xx_lpbfifo_start_xfer()
461 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); in mpc52xx_lpbfifo_start_xfer()
464 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_start_xfer()
473 spin_lock_irqsave(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_abort()
474 if (lpbfifo.req == req) { in mpc52xx_lpbfifo_abort()
476 bcom_gen_bd_rx_reset(lpbfifo.bcom_rx_task); in mpc52xx_lpbfifo_abort()
477 bcom_gen_bd_tx_reset(lpbfifo.bcom_tx_task); in mpc52xx_lpbfifo_abort()
478 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); in mpc52xx_lpbfifo_abort()
479 lpbfifo.req = NULL; in mpc52xx_lpbfifo_abort()
481 spin_unlock_irqrestore(&lpbfifo.lock, flags); in mpc52xx_lpbfifo_abort()
490 if (lpbfifo.dev != NULL) in mpc52xx_lpbfifo_probe()
493 lpbfifo.irq = irq_of_parse_and_map(op->dev.of_node, 0); in mpc52xx_lpbfifo_probe()
494 if (!lpbfifo.irq) in mpc52xx_lpbfifo_probe()
499 lpbfifo.regs_phys = res.start; in mpc52xx_lpbfifo_probe()
500 lpbfifo.regs = of_iomap(op->dev.of_node, 0); in mpc52xx_lpbfifo_probe()
501 if (!lpbfifo.regs) in mpc52xx_lpbfifo_probe()
504 spin_lock_init(&lpbfifo.lock); in mpc52xx_lpbfifo_probe()
507 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); in mpc52xx_lpbfifo_probe()
510 rc = request_irq(lpbfifo.irq, mpc52xx_lpbfifo_irq, 0, in mpc52xx_lpbfifo_probe()
511 "mpc52xx-lpbfifo", &lpbfifo); in mpc52xx_lpbfifo_probe()
516 lpbfifo.bcom_rx_task = in mpc52xx_lpbfifo_probe()
520 if (!lpbfifo.bcom_rx_task) in mpc52xx_lpbfifo_probe()
523 rc = request_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), in mpc52xx_lpbfifo_probe()
525 "mpc52xx-lpbfifo-rx", &lpbfifo); in mpc52xx_lpbfifo_probe()
529 lpbfifo.dma_irqs_enabled = 1; in mpc52xx_lpbfifo_probe()
532 lpbfifo.bcom_tx_task = in mpc52xx_lpbfifo_probe()
535 if (!lpbfifo.bcom_tx_task) in mpc52xx_lpbfifo_probe()
538 lpbfifo.dev = &op->dev; in mpc52xx_lpbfifo_probe()
542 free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo); in mpc52xx_lpbfifo_probe()
544 bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task); in mpc52xx_lpbfifo_probe()
546 free_irq(lpbfifo.irq, &lpbfifo); in mpc52xx_lpbfifo_probe()
548 iounmap(lpbfifo.regs); in mpc52xx_lpbfifo_probe()
549 lpbfifo.regs = NULL; in mpc52xx_lpbfifo_probe()
558 if (lpbfifo.dev != &op->dev) in mpc52xx_lpbfifo_remove()
562 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); in mpc52xx_lpbfifo_remove()
565 free_irq(bcom_get_task_irq(lpbfifo.bcom_tx_task), &lpbfifo); in mpc52xx_lpbfifo_remove()
566 bcom_gen_bd_tx_release(lpbfifo.bcom_tx_task); in mpc52xx_lpbfifo_remove()
569 free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo); in mpc52xx_lpbfifo_remove()
570 bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task); in mpc52xx_lpbfifo_remove()
572 free_irq(lpbfifo.irq, &lpbfifo); in mpc52xx_lpbfifo_remove()
573 iounmap(lpbfifo.regs); in mpc52xx_lpbfifo_remove()
574 lpbfifo.regs = NULL; in mpc52xx_lpbfifo_remove()
575 lpbfifo.dev = NULL; in mpc52xx_lpbfifo_remove()