Lines Matching full:bc
86 static void enable_tx_interrupt(struct ehv_bc_data *bc) in enable_tx_interrupt() argument
88 if (!bc->tx_irq_enabled) { in enable_tx_interrupt()
89 enable_irq(bc->tx_irq); in enable_tx_interrupt()
90 bc->tx_irq_enabled = 1; in enable_tx_interrupt()
94 static void disable_tx_interrupt(struct ehv_bc_data *bc) in disable_tx_interrupt() argument
96 if (bc->tx_irq_enabled) { in disable_tx_interrupt()
97 disable_irq_nosync(bc->tx_irq); in disable_tx_interrupt()
98 bc->tx_irq_enabled = 0; in disable_tx_interrupt()
122 pr_err("ehv-bc: no 'interrupts' property in %pOF node\n", np); in find_console_handle()
131 pr_err("ehv-bc: no 'hv-handle' property in %pOFn node\n", in find_console_handle()
217 udbg_printf("ehv-bc: early console using byte channel handle %u\n", in udbg_init_ehv_bc()
316 pr_debug("ehv-bc: stdout is not a byte channel\n"); in ehv_bc_console_init()
325 pr_warn("ehv-bc: udbg handle %u is not the stdout handle\n", in ehv_bc_console_init()
336 pr_info("ehv-bc: registered console driver for byte channel %u\n", in ehv_bc_console_init()
352 struct ehv_bc_data *bc = data; in ehv_bc_tty_rx_isr() local
362 ev_byte_channel_poll(bc->handle, &rx_count, &tx_count); in ehv_bc_tty_rx_isr()
363 count = tty_buffer_request_room(&bc->port, rx_count); in ehv_bc_tty_rx_isr()
377 ev_byte_channel_receive(bc->handle, &len, buffer); in ehv_bc_tty_rx_isr()
384 ret = tty_insert_flip_string(&bc->port, buffer, len); in ehv_bc_tty_rx_isr()
399 tty_flip_buffer_push(&bc->port); in ehv_bc_tty_rx_isr()
410 static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc) in ehv_bc_tx_dequeue() argument
417 spin_lock_irqsave(&bc->lock, flags); in ehv_bc_tx_dequeue()
419 CIRC_CNT_TO_END(bc->head, bc->tail, BUF_SIZE), in ehv_bc_tx_dequeue()
422 ret = local_ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail); in ehv_bc_tx_dequeue()
426 bc->tail = (bc->tail + len) & (BUF_SIZE - 1); in ehv_bc_tx_dequeue()
428 count = CIRC_CNT(bc->head, bc->tail, BUF_SIZE); in ehv_bc_tx_dequeue()
429 spin_unlock_irqrestore(&bc->lock, flags); in ehv_bc_tx_dequeue()
432 spin_lock_irqsave(&bc->lock, flags); in ehv_bc_tx_dequeue()
433 if (CIRC_CNT(bc->head, bc->tail, BUF_SIZE)) in ehv_bc_tx_dequeue()
439 enable_tx_interrupt(bc); in ehv_bc_tx_dequeue()
441 disable_tx_interrupt(bc); in ehv_bc_tx_dequeue()
442 spin_unlock_irqrestore(&bc->lock, flags); in ehv_bc_tx_dequeue()
453 struct ehv_bc_data *bc = data; in ehv_bc_tty_tx_isr() local
455 ehv_bc_tx_dequeue(bc); in ehv_bc_tty_tx_isr()
456 tty_port_tty_wakeup(&bc->port); in ehv_bc_tty_tx_isr()
475 struct ehv_bc_data *bc = ttys->driver_data; in ehv_bc_tty_write() local
480 spin_lock_irqsave(&bc->lock, flags); in ehv_bc_tty_write()
481 len = CIRC_SPACE_TO_END(bc->head, bc->tail, BUF_SIZE); in ehv_bc_tty_write()
485 memcpy(bc->buf + bc->head, s, len); in ehv_bc_tty_write()
486 bc->head = (bc->head + len) & (BUF_SIZE - 1); in ehv_bc_tty_write()
488 spin_unlock_irqrestore(&bc->lock, flags); in ehv_bc_tty_write()
497 ehv_bc_tx_dequeue(bc); in ehv_bc_tty_write()
504 * why we initialize bc->ttys in ehv_bc_tty_port_activate() instead.
513 struct ehv_bc_data *bc = &bcs[ttys->index]; in ehv_bc_tty_open() local
515 if (!bc->dev) in ehv_bc_tty_open()
518 return tty_port_open(&bc->port, ttys, filp); in ehv_bc_tty_open()
528 struct ehv_bc_data *bc = &bcs[ttys->index]; in ehv_bc_tty_close() local
530 if (bc->dev) in ehv_bc_tty_close()
531 tty_port_close(&bc->port, ttys, filp); in ehv_bc_tty_close()
543 struct ehv_bc_data *bc = ttys->driver_data; in ehv_bc_tty_write_room() local
547 spin_lock_irqsave(&bc->lock, flags); in ehv_bc_tty_write_room()
548 count = CIRC_SPACE(bc->head, bc->tail, BUF_SIZE); in ehv_bc_tty_write_room()
549 spin_unlock_irqrestore(&bc->lock, flags); in ehv_bc_tty_write_room()
568 struct ehv_bc_data *bc = ttys->driver_data; in ehv_bc_tty_throttle() local
570 disable_irq(bc->rx_irq); in ehv_bc_tty_throttle()
582 struct ehv_bc_data *bc = ttys->driver_data; in ehv_bc_tty_unthrottle() local
587 enable_irq(bc->rx_irq); in ehv_bc_tty_unthrottle()
592 struct ehv_bc_data *bc = ttys->driver_data; in ehv_bc_tty_hangup() local
594 ehv_bc_tx_dequeue(bc); in ehv_bc_tty_hangup()
595 tty_port_hangup(&bc->port); in ehv_bc_tty_hangup()
625 struct ehv_bc_data *bc = container_of(port, struct ehv_bc_data, port); in ehv_bc_tty_port_activate() local
628 ttys->driver_data = bc; in ehv_bc_tty_port_activate()
630 ret = request_irq(bc->rx_irq, ehv_bc_tty_rx_isr, 0, "ehv-bc", bc); in ehv_bc_tty_port_activate()
632 dev_err(bc->dev, "could not request rx irq %u (ret=%i)\n", in ehv_bc_tty_port_activate()
633 bc->rx_irq, ret); in ehv_bc_tty_port_activate()
638 bc->tx_irq_enabled = 1; in ehv_bc_tty_port_activate()
640 ret = request_irq(bc->tx_irq, ehv_bc_tty_tx_isr, 0, "ehv-bc", bc); in ehv_bc_tty_port_activate()
642 dev_err(bc->dev, "could not request tx irq %u (ret=%i)\n", in ehv_bc_tty_port_activate()
643 bc->tx_irq, ret); in ehv_bc_tty_port_activate()
644 free_irq(bc->rx_irq, bc); in ehv_bc_tty_port_activate()
651 disable_tx_interrupt(bc); in ehv_bc_tty_port_activate()
658 struct ehv_bc_data *bc = container_of(port, struct ehv_bc_data, port); in ehv_bc_tty_port_shutdown() local
660 free_irq(bc->tx_irq, bc); in ehv_bc_tty_port_shutdown()
661 free_irq(bc->rx_irq, bc); in ehv_bc_tty_port_shutdown()
672 struct ehv_bc_data *bc; in ehv_bc_tty_probe() local
692 bc = &bcs[i]; in ehv_bc_tty_probe()
694 bc->handle = handle; in ehv_bc_tty_probe()
695 bc->head = 0; in ehv_bc_tty_probe()
696 bc->tail = 0; in ehv_bc_tty_probe()
697 spin_lock_init(&bc->lock); in ehv_bc_tty_probe()
699 bc->rx_irq = irq_of_parse_and_map(np, 0); in ehv_bc_tty_probe()
700 bc->tx_irq = irq_of_parse_and_map(np, 1); in ehv_bc_tty_probe()
701 if (!bc->rx_irq || !bc->tx_irq) { in ehv_bc_tty_probe()
708 tty_port_init(&bc->port); in ehv_bc_tty_probe()
709 bc->port.ops = &ehv_bc_tty_port_ops; in ehv_bc_tty_probe()
711 bc->dev = tty_port_register_device(&bc->port, ehv_bc_driver, i, in ehv_bc_tty_probe()
713 if (IS_ERR(bc->dev)) { in ehv_bc_tty_probe()
714 ret = PTR_ERR(bc->dev); in ehv_bc_tty_probe()
719 dev_set_drvdata(&pdev->dev, bc); in ehv_bc_tty_probe()
722 ehv_bc_driver->name, i, bc->handle); in ehv_bc_tty_probe()
727 tty_port_destroy(&bc->port); in ehv_bc_tty_probe()
728 irq_dispose_mapping(bc->tx_irq); in ehv_bc_tty_probe()
729 irq_dispose_mapping(bc->rx_irq); in ehv_bc_tty_probe()
731 memset(bc, 0, sizeof(struct ehv_bc_data)); in ehv_bc_tty_probe()
742 .name = "ehv-bc",
772 * array, then you can use pointer math (e.g. "bc - bcs") to get its in ehv_bc_init()
786 driver->driver_name = "ehv-bc"; in ehv_bc_init()
795 pr_err("ehv-bc: could not register tty driver (ret=%i)\n", ret); in ehv_bc_init()
803 pr_err("ehv-bc: could not register platform driver (ret=%i)\n", in ehv_bc_init()