Lines Matching +full:overrun +full:- +full:throttle +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0+
36 struct device_node *np = ofdev->dev.of_node; in of_platform_serial_setup()
37 struct uart_port *port = &up->port; in of_platform_serial_setup()
43 pm_runtime_enable(&ofdev->dev); in of_platform_serial_setup()
44 pm_runtime_get_sync(&ofdev->dev); in of_platform_serial_setup()
46 if (of_property_read_u32(np, "clock-frequency", &clk)) { in of_platform_serial_setup()
49 info->clk = devm_clk_get(&ofdev->dev, NULL); in of_platform_serial_setup()
50 if (IS_ERR(info->clk)) { in of_platform_serial_setup()
51 ret = PTR_ERR(info->clk); in of_platform_serial_setup()
52 if (ret != -EPROBE_DEFER) in of_platform_serial_setup()
53 dev_warn(&ofdev->dev, in of_platform_serial_setup()
58 ret = clk_prepare_enable(info->clk); in of_platform_serial_setup()
62 clk = clk_get_rate(info->clk); in of_platform_serial_setup()
64 /* If current-speed was set, then try not to change it. */ in of_platform_serial_setup()
65 if (of_property_read_u32(np, "current-speed", &spd) == 0) in of_platform_serial_setup()
66 port->custom_divisor = clk / (16 * spd); in of_platform_serial_setup()
70 dev_warn(&ofdev->dev, "invalid address\n"); in of_platform_serial_setup()
74 port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | in of_platform_serial_setup()
76 spin_lock_init(&port->lock); in of_platform_serial_setup()
79 port->iotype = UPIO_PORT; in of_platform_serial_setup()
80 port->iobase = resource.start; in of_platform_serial_setup()
82 port->mapbase = resource.start; in of_platform_serial_setup()
83 port->mapsize = resource_size(&resource); in of_platform_serial_setup()
86 if (of_property_read_u32(np, "reg-offset", &prop) == 0) in of_platform_serial_setup()
87 port->mapbase += prop; in of_platform_serial_setup()
89 port->iotype = UPIO_MEM; in of_platform_serial_setup()
90 if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { in of_platform_serial_setup()
93 port->iotype = UPIO_MEM; in of_platform_serial_setup()
96 port->iotype = UPIO_MEM16; in of_platform_serial_setup()
99 port->iotype = of_device_is_big_endian(np) ? in of_platform_serial_setup()
103 dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n", in of_platform_serial_setup()
105 ret = -EINVAL; in of_platform_serial_setup()
109 port->flags |= UPF_IOREMAP; in of_platform_serial_setup()
113 if (of_device_is_compatible(np, "mrvl,mmp-uart")) in of_platform_serial_setup()
114 port->regshift = 2; in of_platform_serial_setup()
117 if (of_property_read_u32(np, "reg-shift", &prop) == 0) in of_platform_serial_setup()
118 port->regshift = prop; in of_platform_serial_setup()
121 if (of_property_read_u32(np, "fifo-size", &prop) == 0) in of_platform_serial_setup()
122 port->fifosize = prop; in of_platform_serial_setup()
127 port->line = ret; in of_platform_serial_setup()
131 if (irq == -EPROBE_DEFER) { in of_platform_serial_setup()
132 ret = -EPROBE_DEFER; in of_platform_serial_setup()
139 port->irq = irq; in of_platform_serial_setup()
141 info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); in of_platform_serial_setup()
142 if (IS_ERR(info->rst)) { in of_platform_serial_setup()
143 ret = PTR_ERR(info->rst); in of_platform_serial_setup()
147 ret = reset_control_deassert(info->rst); in of_platform_serial_setup()
151 port->type = type; in of_platform_serial_setup()
152 port->uartclk = clk; in of_platform_serial_setup()
154 if (of_property_read_bool(np, "no-loopback-test")) in of_platform_serial_setup()
155 port->flags |= UPF_SKIP_TEST; in of_platform_serial_setup()
157 port->dev = &ofdev->dev; in of_platform_serial_setup()
158 port->rs485_config = serial8250_em485_config; in of_platform_serial_setup()
159 up->rs485_start_tx = serial8250_em485_start_tx; in of_platform_serial_setup()
160 up->rs485_stop_tx = serial8250_em485_stop_tx; in of_platform_serial_setup()
164 port->iotype = UPIO_AU; in of_platform_serial_setup()
170 of_device_is_compatible(np, "fsl,16550-FIFO64"))) { in of_platform_serial_setup()
171 port->handle_irq = fsl8250_handle_irq; in of_platform_serial_setup()
172 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); in of_platform_serial_setup()
177 clk_disable_unprepare(info->clk); in of_platform_serial_setup()
179 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_setup()
180 pm_runtime_disable(&ofdev->dev); in of_platform_serial_setup()
195 port_type = (unsigned long)of_device_get_match_data(&ofdev->dev); in of_platform_serial_probe()
197 return -EINVAL; in of_platform_serial_probe()
199 if (of_property_read_bool(ofdev->dev.of_node, "used-by-rtas")) in of_platform_serial_probe()
200 return -EBUSY; in of_platform_serial_probe()
204 return -ENOMEM; in of_platform_serial_probe()
215 if ((of_property_read_u32(ofdev->dev.of_node, "tx-threshold", in of_platform_serial_probe()
218 port8250.tx_loadsz = port8250.port.fifosize - tx_threshold; in of_platform_serial_probe()
220 if (of_property_read_bool(ofdev->dev.of_node, "auto-flow-control")) in of_platform_serial_probe()
223 if (of_property_read_u32(ofdev->dev.of_node, in of_platform_serial_probe()
224 "overrun-throttle-ms", in of_platform_serial_probe()
232 info->type = port_type; in of_platform_serial_probe()
233 info->line = ret; in of_platform_serial_probe()
238 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_probe()
239 pm_runtime_disable(&ofdev->dev); in of_platform_serial_probe()
240 clk_disable_unprepare(info->clk); in of_platform_serial_probe()
253 serial8250_unregister_port(info->line); in of_platform_serial_remove()
255 reset_control_assert(info->rst); in of_platform_serial_remove()
256 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_remove()
257 pm_runtime_disable(&ofdev->dev); in of_platform_serial_remove()
258 clk_disable_unprepare(info->clk); in of_platform_serial_remove()
267 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_serial_suspend()
268 struct uart_port *port = &port8250->port; in of_serial_suspend()
270 serial8250_suspend_port(info->line); in of_serial_suspend()
274 clk_disable_unprepare(info->clk); in of_serial_suspend()
282 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_serial_resume()
283 struct uart_port *port = &port8250->port; in of_serial_resume()
287 clk_prepare_enable(info->clk); in of_serial_resume()
290 serial8250_resume_port(info->line); in of_serial_resume()
307 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, },
308 { .compatible = "ralink,rt2880-uart", .data = (void *)PORT_RT2880, },
309 { .compatible = "intel,xscale-uart", .data = (void *)PORT_XSCALE, },
310 { .compatible = "altr,16550-FIFO32",
312 { .compatible = "altr,16550-FIFO64",
314 { .compatible = "altr,16550-FIFO128",
316 { .compatible = "mediatek,mtk-btif",
318 { .compatible = "mrvl,mmp-uart",
320 { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, },
321 { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, },