Lines Matching +full:tx +full:- +full:mailbox +full:- +full:count

1 // SPDX-License-Identifier: GPL-2.0
30 struct mbox_chan *tx, *rx; member
52 unsigned int count) in tegra_tcu_write_one() argument
56 value |= TCU_MBOX_NUM_BYTES(count); in tegra_tcu_write_one()
58 mbox_send_message(tcu->tx, msg); in tegra_tcu_write_one()
59 mbox_flush(tcu->tx, 1000); in tegra_tcu_write_one()
63 unsigned int count) in tegra_tcu_write() argument
69 while (i < count) { in tegra_tcu_write()
93 struct tegra_tcu *tcu = port->private_data; in tegra_tcu_uart_start_tx()
94 struct circ_buf *xmit = &port->state->xmit; in tegra_tcu_uart_start_tx()
95 unsigned long count; in tegra_tcu_uart_start_tx() local
98 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in tegra_tcu_uart_start_tx()
99 if (!count) in tegra_tcu_uart_start_tx()
102 tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); in tegra_tcu_uart_start_tx()
103 uart_xmit_advance(port, count); in tegra_tcu_uart_start_tx()
147 unsigned int count) in tegra_tcu_console_write() argument
151 tegra_tcu_write(tcu, s, count); in tegra_tcu_console_write()
163 struct tty_port *port = &tcu->port.state->port; in tegra_tcu_receive()
182 tcu = devm_kzalloc(&pdev->dev, sizeof(*tcu), GFP_KERNEL); in tegra_tcu_probe()
184 return -ENOMEM; in tegra_tcu_probe()
186 tcu->tx_client.dev = &pdev->dev; in tegra_tcu_probe()
187 tcu->rx_client.dev = &pdev->dev; in tegra_tcu_probe()
188 tcu->rx_client.rx_callback = tegra_tcu_receive; in tegra_tcu_probe()
190 tcu->tx = mbox_request_channel_byname(&tcu->tx_client, "tx"); in tegra_tcu_probe()
191 if (IS_ERR(tcu->tx)) { in tegra_tcu_probe()
192 err = PTR_ERR(tcu->tx); in tegra_tcu_probe()
193 dev_err(&pdev->dev, "failed to get tx mailbox: %d\n", err); in tegra_tcu_probe()
199 strcpy(tcu->console.name, "ttyTCU"); in tegra_tcu_probe()
200 tcu->console.device = uart_console_device; in tegra_tcu_probe()
201 tcu->console.flags = CON_PRINTBUFFER | CON_ANYTIME; in tegra_tcu_probe()
202 tcu->console.index = -1; in tegra_tcu_probe()
203 tcu->console.write = tegra_tcu_console_write; in tegra_tcu_probe()
204 tcu->console.setup = tegra_tcu_console_setup; in tegra_tcu_probe()
205 tcu->console.data = &tcu->driver; in tegra_tcu_probe()
209 tcu->driver.owner = THIS_MODULE; in tegra_tcu_probe()
210 tcu->driver.driver_name = "tegra-tcu"; in tegra_tcu_probe()
211 tcu->driver.dev_name = "ttyTCU"; in tegra_tcu_probe()
213 tcu->driver.cons = &tcu->console; in tegra_tcu_probe()
215 tcu->driver.nr = 1; in tegra_tcu_probe()
217 err = uart_register_driver(&tcu->driver); in tegra_tcu_probe()
219 dev_err(&pdev->dev, "failed to register UART driver: %d\n", in tegra_tcu_probe()
225 port = &tcu->port; in tegra_tcu_probe()
226 spin_lock_init(&port->lock); in tegra_tcu_probe()
227 port->dev = &pdev->dev; in tegra_tcu_probe()
228 port->type = PORT_TEGRA_TCU; in tegra_tcu_probe()
229 port->ops = &tegra_tcu_uart_ops; in tegra_tcu_probe()
230 port->fifosize = 1; in tegra_tcu_probe()
231 port->iotype = UPIO_MEM; in tegra_tcu_probe()
232 port->flags = UPF_BOOT_AUTOCONF; in tegra_tcu_probe()
233 port->private_data = tcu; in tegra_tcu_probe()
235 err = uart_add_one_port(&tcu->driver, port); in tegra_tcu_probe()
237 dev_err(&pdev->dev, "failed to add UART port: %d\n", err); in tegra_tcu_probe()
242 * Request RX channel after creating port to ensure tcu->port in tegra_tcu_probe()
245 tcu->rx = mbox_request_channel_byname(&tcu->rx_client, "rx"); in tegra_tcu_probe()
246 if (IS_ERR(tcu->rx)) { in tegra_tcu_probe()
247 err = PTR_ERR(tcu->rx); in tegra_tcu_probe()
248 dev_err(&pdev->dev, "failed to get rx mailbox: %d\n", err); in tegra_tcu_probe()
254 register_console(&tcu->console); in tegra_tcu_probe()
260 uart_remove_one_port(&tcu->driver, &tcu->port); in tegra_tcu_probe()
262 uart_unregister_driver(&tcu->driver); in tegra_tcu_probe()
264 mbox_free_channel(tcu->tx); in tegra_tcu_probe()
274 unregister_console(&tcu->console); in tegra_tcu_remove()
276 mbox_free_channel(tcu->rx); in tegra_tcu_remove()
277 uart_remove_one_port(&tcu->driver, &tcu->port); in tegra_tcu_remove()
278 uart_unregister_driver(&tcu->driver); in tegra_tcu_remove()
279 mbox_free_channel(tcu->tx); in tegra_tcu_remove()
285 { .compatible = "nvidia,tegra194-tcu" },
292 .name = "tegra-tcu",