H A D | mpc52xx_lpbfifo.c | 58 static struct mpc52xx_lpbfifo lpbfifo; variable in typeref:struct:mpc52xx_lpbfifo 76 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); mpc52xx_lpbfifo_kick() 79 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000001); mpc52xx_lpbfifo_kick() 95 reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA; mpc52xx_lpbfifo_kick() 102 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000301); mpc52xx_lpbfifo_kick() 112 out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1e4); mpc52xx_lpbfifo_kick() 113 out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 7); mpc52xx_lpbfifo_kick() 114 lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task; mpc52xx_lpbfifo_kick() 116 out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1ff); mpc52xx_lpbfifo_kick() 117 out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 0); mpc52xx_lpbfifo_kick() 118 lpbfifo.bcom_cur_task = lpbfifo.bcom_rx_task; mpc52xx_lpbfifo_kick() 121 if (lpbfifo.dma_irqs_enabled) { mpc52xx_lpbfifo_kick() 122 disable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task)); mpc52xx_lpbfifo_kick() 123 lpbfifo.dma_irqs_enabled = 0; mpc52xx_lpbfifo_kick() 126 if (!lpbfifo.dma_irqs_enabled) { mpc52xx_lpbfifo_kick() 127 enable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task)); mpc52xx_lpbfifo_kick() 128 lpbfifo.dma_irqs_enabled = 1; mpc52xx_lpbfifo_kick() 133 bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task); mpc52xx_lpbfifo_kick() 151 bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL); mpc52xx_lpbfifo_kick() 159 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, bit_fields); mpc52xx_lpbfifo_kick() 163 out_be32(lpbfifo.regs + LPBFIFO_REG_START_ADDRESS, mpc52xx_lpbfifo_kick() 165 out_be32(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, transfer_size); mpc52xx_lpbfifo_kick() 170 out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields); mpc52xx_lpbfifo_kick() 173 if (!lpbfifo.req->defer_xfer_start) mpc52xx_lpbfifo_kick() 174 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); mpc52xx_lpbfifo_kick() 176 bcom_enable(lpbfifo.bcom_cur_task); mpc52xx_lpbfifo_kick() 223 u32 status = in_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS); mpc52xx_lpbfifo_irq() 232 spin_lock_irqsave(&lpbfifo.lock, flags); mpc52xx_lpbfifo_irq() 235 req = lpbfifo.req; mpc52xx_lpbfifo_irq() 237 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_irq() 247 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_irq() 258 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); mpc52xx_lpbfifo_irq() 264 count = in_be32(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS); mpc52xx_lpbfifo_irq() 269 reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA; mpc52xx_lpbfifo_irq() 286 out_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS, 0x01); mpc52xx_lpbfifo_irq() 299 bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL); mpc52xx_lpbfifo_irq() 306 lpbfifo.req = NULL; mpc52xx_lpbfifo_irq() 312 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_irq() 333 spin_lock_irqsave(&lpbfifo.lock, flags); mpc52xx_lpbfifo_bcom_irq() 336 req = lpbfifo.req; mpc52xx_lpbfifo_bcom_irq() 338 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_bcom_irq() 345 if (!bcom_buffer_done(lpbfifo.bcom_cur_task)) { mpc52xx_lpbfifo_bcom_irq() 346 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_bcom_irq() 355 bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL); mpc52xx_lpbfifo_bcom_irq() 362 lpbfifo.req = NULL; mpc52xx_lpbfifo_bcom_irq() 366 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_bcom_irq() 379 struct mpc52xx_lpbfifo_request *req = lpbfifo.req; mpc52xx_lpbfifo_poll() 401 if (!lpbfifo.regs) mpc52xx_lpbfifo_submit() 404 spin_lock_irqsave(&lpbfifo.lock, flags); mpc52xx_lpbfifo_submit() 407 if (lpbfifo.req) { mpc52xx_lpbfifo_submit() 408 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_submit() 413 lpbfifo.req = req; mpc52xx_lpbfifo_submit() 420 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_submit() 429 if (!lpbfifo.regs) mpc52xx_lpbfifo_start_xfer() 432 spin_lock_irqsave(&lpbfifo.lock, flags); mpc52xx_lpbfifo_start_xfer() 438 if (lpbfifo.req && !lpbfifo.req->defer_xfer_start) { mpc52xx_lpbfifo_start_xfer() 439 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_start_xfer() 447 if (lpbfifo.req && lpbfifo.req == req && mpc52xx_lpbfifo_start_xfer() 448 lpbfifo.req->defer_xfer_start) { mpc52xx_lpbfifo_start_xfer() 449 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01); mpc52xx_lpbfifo_start_xfer() 452 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_start_xfer() 461 spin_lock_irqsave(&lpbfifo.lock, flags); mpc52xx_lpbfifo_abort() 462 if (lpbfifo.req == req) { mpc52xx_lpbfifo_abort() 464 bcom_gen_bd_rx_reset(lpbfifo.bcom_rx_task); mpc52xx_lpbfifo_abort() 465 bcom_gen_bd_tx_reset(lpbfifo.bcom_tx_task); mpc52xx_lpbfifo_abort() 466 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); mpc52xx_lpbfifo_abort() 467 lpbfifo.req = NULL; mpc52xx_lpbfifo_abort() 469 spin_unlock_irqrestore(&lpbfifo.lock, flags); mpc52xx_lpbfifo_abort() 478 if (lpbfifo.dev != NULL) mpc52xx_lpbfifo_probe() 481 lpbfifo.irq = irq_of_parse_and_map(op->dev.of_node, 0); mpc52xx_lpbfifo_probe() 482 if (!lpbfifo.irq) mpc52xx_lpbfifo_probe() 487 lpbfifo.regs_phys = res.start; mpc52xx_lpbfifo_probe() 488 lpbfifo.regs = of_iomap(op->dev.of_node, 0); mpc52xx_lpbfifo_probe() 489 if (!lpbfifo.regs) mpc52xx_lpbfifo_probe() 492 spin_lock_init(&lpbfifo.lock); mpc52xx_lpbfifo_probe() 495 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); mpc52xx_lpbfifo_probe() 498 rc = request_irq(lpbfifo.irq, mpc52xx_lpbfifo_irq, 0, mpc52xx_lpbfifo_probe() 499 "mpc52xx-lpbfifo", &lpbfifo); mpc52xx_lpbfifo_probe() 504 lpbfifo.bcom_rx_task = mpc52xx_lpbfifo_probe() 508 if (!lpbfifo.bcom_rx_task) mpc52xx_lpbfifo_probe() 511 rc = request_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), mpc52xx_lpbfifo_probe() 513 "mpc52xx-lpbfifo-rx", &lpbfifo); mpc52xx_lpbfifo_probe() 517 lpbfifo.dma_irqs_enabled = 1; mpc52xx_lpbfifo_probe() 520 lpbfifo.bcom_tx_task = mpc52xx_lpbfifo_probe() 523 if (!lpbfifo.bcom_tx_task) mpc52xx_lpbfifo_probe() 526 lpbfifo.dev = &op->dev; mpc52xx_lpbfifo_probe() 530 free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo); mpc52xx_lpbfifo_probe() local 532 bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task); mpc52xx_lpbfifo_probe() 535 iounmap(lpbfifo.regs); mpc52xx_lpbfifo_probe() 536 lpbfifo.regs = NULL; mpc52xx_lpbfifo_probe() 545 if (lpbfifo.dev != &op->dev) mpc52xx_lpbfifo_remove() 549 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000); mpc52xx_lpbfifo_remove() 552 free_irq(bcom_get_task_irq(lpbfifo.bcom_tx_task), &lpbfifo); mpc52xx_lpbfifo_remove() local 553 bcom_gen_bd_tx_release(lpbfifo.bcom_tx_task); mpc52xx_lpbfifo_remove() 556 free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo); mpc52xx_lpbfifo_remove() local 557 bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task); mpc52xx_lpbfifo_remove() 559 free_irq(lpbfifo.irq, &lpbfifo); mpc52xx_lpbfifo_remove() 560 iounmap(lpbfifo.regs); mpc52xx_lpbfifo_remove() 561 lpbfifo.regs = NULL; mpc52xx_lpbfifo_remove() 562 lpbfifo.dev = NULL; mpc52xx_lpbfifo_remove() 568 { .compatible = "fsl,mpc5200-lpbfifo", }, 574 .name = "mpc52xx-lpbfifo",
|