Lines Matching refs:port
48 static void esp32s3_acm_write(struct uart_port *port, unsigned long reg, u32 v) in esp32s3_acm_write() argument
50 writel(v, port->membase + reg); in esp32s3_acm_write()
53 static u32 esp32s3_acm_read(struct uart_port *port, unsigned long reg) in esp32s3_acm_read() argument
55 return readl(port->membase + reg); in esp32s3_acm_read()
58 static u32 esp32s3_acm_tx_fifo_free(struct uart_port *port) in esp32s3_acm_tx_fifo_free() argument
60 u32 status = esp32s3_acm_read(port, USB_SERIAL_JTAG_EP1_CONF_REG); in esp32s3_acm_tx_fifo_free()
65 static u32 esp32s3_acm_tx_fifo_cnt(struct uart_port *port) in esp32s3_acm_tx_fifo_cnt() argument
67 u32 status = esp32s3_acm_read(port, USB_SERIAL_JTAG_IN_EP1_ST_REG); in esp32s3_acm_tx_fifo_cnt()
72 static u32 esp32s3_acm_rx_fifo_cnt(struct uart_port *port) in esp32s3_acm_rx_fifo_cnt() argument
74 u32 status = esp32s3_acm_read(port, USB_SERIAL_JTAG_OUT_EP1_ST_REG); in esp32s3_acm_rx_fifo_cnt()
80 static unsigned int esp32s3_acm_tx_empty(struct uart_port *port) in esp32s3_acm_tx_empty() argument
82 return esp32s3_acm_tx_fifo_cnt(port) == 0 ? TIOCSER_TEMT : 0; in esp32s3_acm_tx_empty()
85 static void esp32s3_acm_set_mctrl(struct uart_port *port, unsigned int mctrl) in esp32s3_acm_set_mctrl() argument
89 static unsigned int esp32s3_acm_get_mctrl(struct uart_port *port) in esp32s3_acm_get_mctrl() argument
94 static void esp32s3_acm_stop_tx(struct uart_port *port) in esp32s3_acm_stop_tx() argument
98 int_ena = esp32s3_acm_read(port, USB_SERIAL_JTAG_INT_ENA_REG); in esp32s3_acm_stop_tx()
100 esp32s3_acm_write(port, USB_SERIAL_JTAG_INT_ENA_REG, int_ena); in esp32s3_acm_stop_tx()
103 static void esp32s3_acm_rxint(struct uart_port *port) in esp32s3_acm_rxint() argument
105 struct tty_port *tty_port = &port->state->port; in esp32s3_acm_rxint()
106 u32 rx_fifo_cnt = esp32s3_acm_rx_fifo_cnt(port); in esp32s3_acm_rxint()
113 spin_lock_irqsave(&port->lock, flags); in esp32s3_acm_rxint()
116 u32 rx = esp32s3_acm_read(port, USB_SERIAL_JTAG_EP1_REG); in esp32s3_acm_rxint()
118 ++port->icount.rx; in esp32s3_acm_rxint()
121 spin_unlock_irqrestore(&port->lock, flags); in esp32s3_acm_rxint()
126 static void esp32s3_acm_push(struct uart_port *port) in esp32s3_acm_push() argument
128 if (esp32s3_acm_tx_fifo_free(port)) in esp32s3_acm_push()
129 esp32s3_acm_write(port, USB_SERIAL_JTAG_EP1_CONF_REG, in esp32s3_acm_push()
133 static void esp32s3_acm_put_char(struct uart_port *port, u8 c) in esp32s3_acm_put_char() argument
135 esp32s3_acm_write(port, USB_SERIAL_JTAG_EP1_REG, c); in esp32s3_acm_put_char()
138 static void esp32s3_acm_put_char_sync(struct uart_port *port, u8 c) in esp32s3_acm_put_char_sync() argument
142 while (!esp32s3_acm_tx_fifo_free(port)) { in esp32s3_acm_put_char_sync()
144 dev_warn(port->dev, "timeout waiting for TX FIFO\n"); in esp32s3_acm_put_char_sync()
149 esp32s3_acm_put_char(port, c); in esp32s3_acm_put_char_sync()
150 esp32s3_acm_push(port); in esp32s3_acm_put_char_sync()
153 static void esp32s3_acm_transmit_buffer(struct uart_port *port) in esp32s3_acm_transmit_buffer() argument
159 if (!esp32s3_acm_tx_fifo_free(port)) in esp32s3_acm_transmit_buffer()
162 tx_fifo_used = esp32s3_acm_tx_fifo_cnt(port); in esp32s3_acm_transmit_buffer()
163 pending = uart_port_tx_limited(port, ch, in esp32s3_acm_transmit_buffer()
165 true, esp32s3_acm_put_char(port, ch), in esp32s3_acm_transmit_buffer()
170 int_ena = esp32s3_acm_read(port, USB_SERIAL_JTAG_INT_ENA_REG); in esp32s3_acm_transmit_buffer()
172 esp32s3_acm_write(port, USB_SERIAL_JTAG_INT_ENA_REG, int_ena); in esp32s3_acm_transmit_buffer()
174 esp32s3_acm_push(port); in esp32s3_acm_transmit_buffer()
177 static void esp32s3_acm_txint(struct uart_port *port) in esp32s3_acm_txint() argument
179 esp32s3_acm_transmit_buffer(port); in esp32s3_acm_txint()
184 struct uart_port *port = dev_id; in esp32s3_acm_int() local
187 status = esp32s3_acm_read(port, USB_SERIAL_JTAG_INT_ST_REG); in esp32s3_acm_int()
188 esp32s3_acm_write(port, USB_SERIAL_JTAG_INT_CLR_REG, status); in esp32s3_acm_int()
191 esp32s3_acm_rxint(port); in esp32s3_acm_int()
193 esp32s3_acm_txint(port); in esp32s3_acm_int()
198 static void esp32s3_acm_start_tx(struct uart_port *port) in esp32s3_acm_start_tx() argument
200 esp32s3_acm_transmit_buffer(port); in esp32s3_acm_start_tx()
203 static void esp32s3_acm_stop_rx(struct uart_port *port) in esp32s3_acm_stop_rx() argument
207 int_ena = esp32s3_acm_read(port, USB_SERIAL_JTAG_INT_ENA_REG); in esp32s3_acm_stop_rx()
209 esp32s3_acm_write(port, USB_SERIAL_JTAG_INT_ENA_REG, int_ena); in esp32s3_acm_stop_rx()
212 static int esp32s3_acm_startup(struct uart_port *port) in esp32s3_acm_startup() argument
216 ret = request_irq(port->irq, esp32s3_acm_int, 0, DRIVER_NAME, port); in esp32s3_acm_startup()
219 esp32s3_acm_write(port, USB_SERIAL_JTAG_INT_ENA_REG, in esp32s3_acm_startup()
225 static void esp32s3_acm_shutdown(struct uart_port *port) in esp32s3_acm_shutdown() argument
227 esp32s3_acm_write(port, USB_SERIAL_JTAG_INT_ENA_REG, 0); in esp32s3_acm_shutdown()
228 free_irq(port->irq, port); in esp32s3_acm_shutdown()
231 static void esp32s3_acm_set_termios(struct uart_port *port, in esp32s3_acm_set_termios() argument
237 static const char *esp32s3_acm_type(struct uart_port *port) in esp32s3_acm_type() argument
243 static void esp32s3_acm_config_port(struct uart_port *port, int flags) in esp32s3_acm_config_port() argument
246 port->type = PORT_GENERIC; in esp32s3_acm_config_port()
250 static void esp32s3_acm_poll_put_char(struct uart_port *port, unsigned char c) in esp32s3_acm_poll_put_char() argument
252 esp32s3_acm_put_char_sync(port, c); in esp32s3_acm_poll_put_char()
255 static int esp32s3_acm_poll_get_char(struct uart_port *port) in esp32s3_acm_poll_get_char() argument
257 if (esp32s3_acm_rx_fifo_cnt(port)) in esp32s3_acm_poll_get_char()
258 return esp32s3_acm_read(port, USB_SERIAL_JTAG_EP1_REG); in esp32s3_acm_poll_get_char()
282 static void esp32s3_acm_string_write(struct uart_port *port, const char *s, in esp32s3_acm_string_write() argument
285 uart_console_write(port, s, count, esp32s3_acm_put_char_sync); in esp32s3_acm_string_write()
291 struct uart_port *port = esp32s3_acm_ports[co->index]; in esp32s3_acm_console_write() local
295 if (port->sysrq) in esp32s3_acm_console_write()
298 locked = spin_trylock_irqsave(&port->lock, flags); in esp32s3_acm_console_write()
300 spin_lock_irqsave(&port->lock, flags); in esp32s3_acm_console_write()
302 esp32s3_acm_string_write(port, s, count); in esp32s3_acm_console_write()
305 spin_unlock_irqrestore(&port->lock, flags); in esp32s3_acm_console_write()
323 uart_console_write(&dev->port, s, n, esp32s3_acm_put_char_sync); in esp32s3_acm_earlycon_write()
333 int c = esp32s3_acm_poll_get_char(&dev->port); in esp32s3_acm_earlycon_read()
346 if (!device->port.membase) in esp32s3_acm_early_console_setup()
370 struct uart_port *port; in esp32s3_acm_probe() local
374 port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); in esp32s3_acm_probe()
375 if (!port) in esp32s3_acm_probe()
389 port->line = ret; in esp32s3_acm_probe()
395 port->mapbase = res->start; in esp32s3_acm_probe()
396 port->membase = devm_ioremap_resource(&pdev->dev, res); in esp32s3_acm_probe()
397 if (IS_ERR(port->membase)) in esp32s3_acm_probe()
398 return PTR_ERR(port->membase); in esp32s3_acm_probe()
400 port->dev = &pdev->dev; in esp32s3_acm_probe()
401 port->type = PORT_GENERIC; in esp32s3_acm_probe()
402 port->iotype = UPIO_MEM; in esp32s3_acm_probe()
403 port->irq = platform_get_irq(pdev, 0); in esp32s3_acm_probe()
404 port->ops = &esp32s3_acm_pops; in esp32s3_acm_probe()
405 port->flags = UPF_BOOT_AUTOCONF; in esp32s3_acm_probe()
406 port->has_sysrq = 1; in esp32s3_acm_probe()
407 port->fifosize = ESP32S3_ACM_TX_FIFO_SIZE; in esp32s3_acm_probe()
409 esp32s3_acm_ports[port->line] = port; in esp32s3_acm_probe()
411 platform_set_drvdata(pdev, port); in esp32s3_acm_probe()
413 return uart_add_one_port(&esp32s3_acm_reg, port); in esp32s3_acm_probe()
418 struct uart_port *port = platform_get_drvdata(pdev); in esp32s3_acm_remove() local
420 uart_remove_one_port(&esp32s3_acm_reg, port); in esp32s3_acm_remove()