• Home
  • Raw
  • Download

Lines Matching +full:tegra194 +full:- +full:tcu

1 // SPDX-License-Identifier: GPL-2.0
52 static void tegra_tcu_write_one(struct tegra_tcu *tcu, u32 value, in tegra_tcu_write_one() argument
59 mbox_send_message(tcu->tx, msg); in tegra_tcu_write_one()
60 mbox_flush(tcu->tx, 1000); in tegra_tcu_write_one()
63 static void tegra_tcu_write(struct tegra_tcu *tcu, const char *s, in tegra_tcu_write() argument
83 tegra_tcu_write_one(tcu, value, 3); in tegra_tcu_write()
89 tegra_tcu_write_one(tcu, value, written); in tegra_tcu_write()
94 struct tegra_tcu *tcu = port->private_data; in tegra_tcu_uart_start_tx() local
95 struct circ_buf *xmit = &port->state->xmit; in tegra_tcu_uart_start_tx()
99 count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); in tegra_tcu_uart_start_tx()
103 tegra_tcu_write(tcu, &xmit->buf[xmit->tail], count); in tegra_tcu_uart_start_tx()
150 struct tegra_tcu *tcu = container_of(cons, struct tegra_tcu, console); in tegra_tcu_console_write() local
152 tegra_tcu_write(tcu, s, count); in tegra_tcu_console_write()
163 struct tegra_tcu *tcu = container_of(cl, struct tegra_tcu, rx_client); in tegra_tcu_receive() local
164 struct tty_port *port = &tcu->port.state->port; in tegra_tcu_receive()
180 struct tegra_tcu *tcu; in tegra_tcu_probe() local
183 tcu = devm_kzalloc(&pdev->dev, sizeof(*tcu), GFP_KERNEL); in tegra_tcu_probe()
184 if (!tcu) in tegra_tcu_probe()
185 return -ENOMEM; in tegra_tcu_probe()
187 tcu->tx_client.dev = &pdev->dev; in tegra_tcu_probe()
188 tcu->rx_client.dev = &pdev->dev; in tegra_tcu_probe()
189 tcu->rx_client.rx_callback = tegra_tcu_receive; in tegra_tcu_probe()
191 tcu->tx = mbox_request_channel_byname(&tcu->tx_client, "tx"); in tegra_tcu_probe()
192 if (IS_ERR(tcu->tx)) { in tegra_tcu_probe()
193 err = PTR_ERR(tcu->tx); in tegra_tcu_probe()
194 dev_err(&pdev->dev, "failed to get tx mailbox: %d\n", err); in tegra_tcu_probe()
198 tcu->rx = mbox_request_channel_byname(&tcu->rx_client, "rx"); in tegra_tcu_probe()
199 if (IS_ERR(tcu->rx)) { in tegra_tcu_probe()
200 err = PTR_ERR(tcu->rx); in tegra_tcu_probe()
201 dev_err(&pdev->dev, "failed to get rx mailbox: %d\n", err); in tegra_tcu_probe()
207 strcpy(tcu->console.name, "ttyTCU"); in tegra_tcu_probe()
208 tcu->console.device = uart_console_device; in tegra_tcu_probe()
209 tcu->console.flags = CON_PRINTBUFFER | CON_ANYTIME; in tegra_tcu_probe()
210 tcu->console.index = -1; in tegra_tcu_probe()
211 tcu->console.write = tegra_tcu_console_write; in tegra_tcu_probe()
212 tcu->console.setup = tegra_tcu_console_setup; in tegra_tcu_probe()
213 tcu->console.data = &tcu->driver; in tegra_tcu_probe()
217 tcu->driver.owner = THIS_MODULE; in tegra_tcu_probe()
218 tcu->driver.driver_name = "tegra-tcu"; in tegra_tcu_probe()
219 tcu->driver.dev_name = "ttyTCU"; in tegra_tcu_probe()
221 tcu->driver.cons = &tcu->console; in tegra_tcu_probe()
223 tcu->driver.nr = 1; in tegra_tcu_probe()
225 err = uart_register_driver(&tcu->driver); in tegra_tcu_probe()
227 dev_err(&pdev->dev, "failed to register UART driver: %d\n", in tegra_tcu_probe()
233 port = &tcu->port; in tegra_tcu_probe()
234 spin_lock_init(&port->lock); in tegra_tcu_probe()
235 port->dev = &pdev->dev; in tegra_tcu_probe()
236 port->type = PORT_TEGRA_TCU; in tegra_tcu_probe()
237 port->ops = &tegra_tcu_uart_ops; in tegra_tcu_probe()
238 port->fifosize = 1; in tegra_tcu_probe()
239 port->iotype = UPIO_MEM; in tegra_tcu_probe()
240 port->flags = UPF_BOOT_AUTOCONF; in tegra_tcu_probe()
241 port->private_data = tcu; in tegra_tcu_probe()
243 err = uart_add_one_port(&tcu->driver, port); in tegra_tcu_probe()
245 dev_err(&pdev->dev, "failed to add UART port: %d\n", err); in tegra_tcu_probe()
249 platform_set_drvdata(pdev, tcu); in tegra_tcu_probe()
251 register_console(&tcu->console); in tegra_tcu_probe()
257 uart_unregister_driver(&tcu->driver); in tegra_tcu_probe()
259 mbox_free_channel(tcu->rx); in tegra_tcu_probe()
261 mbox_free_channel(tcu->tx); in tegra_tcu_probe()
268 struct tegra_tcu *tcu = platform_get_drvdata(pdev); in tegra_tcu_remove() local
271 unregister_console(&tcu->console); in tegra_tcu_remove()
273 uart_remove_one_port(&tcu->driver, &tcu->port); in tegra_tcu_remove()
274 uart_unregister_driver(&tcu->driver); in tegra_tcu_remove()
275 mbox_free_channel(tcu->rx); in tegra_tcu_remove()
276 mbox_free_channel(tcu->tx); in tegra_tcu_remove()
282 { .compatible = "nvidia,tegra194-tcu" },
288 .name = "tegra-tcu",