Lines Matching +full:auto +full:- +full:baud
1 // SPDX-License-Identifier: GPL-2.0+
50 static unsigned int npcm_get_divisor(struct uart_port *port, unsigned int baud, in npcm_get_divisor() argument
53 return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud + 2) - 2; in npcm_get_divisor()
58 port->get_divisor = npcm_get_divisor; in npcm_setup()
59 port->startup = npcm_startup; in npcm_setup()
72 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_platform_serial_clk_notifier_cb()
76 serial8250_update_uartclk(&port8250->port, ndata->new_rate); in of_platform_serial_clk_notifier_cb()
91 struct device *dev = &ofdev->dev; in of_platform_serial_setup()
92 struct device_node *np = dev->of_node; in of_platform_serial_setup()
93 struct uart_port *port = &up->port; in of_platform_serial_setup()
99 pm_runtime_enable(&ofdev->dev); in of_platform_serial_setup()
100 pm_runtime_get_sync(&ofdev->dev); in of_platform_serial_setup()
108 port->dev = &ofdev->dev; in of_platform_serial_setup()
109 port->flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_FIXED_TYPE; in of_platform_serial_setup()
110 spin_lock_init(&port->lock); in of_platform_serial_setup()
113 port->iotype = UPIO_PORT; in of_platform_serial_setup()
114 port->iobase = resource.start; in of_platform_serial_setup()
116 port->mapbase = resource.start; in of_platform_serial_setup()
117 port->mapsize = resource_size(&resource); in of_platform_serial_setup()
118 port->flags |= UPF_IOREMAP; in of_platform_serial_setup()
126 if (!port->uartclk) { in of_platform_serial_setup()
127 info->clk = devm_clk_get_enabled(dev, NULL); in of_platform_serial_setup()
128 if (IS_ERR(info->clk)) { in of_platform_serial_setup()
129 ret = dev_err_probe(dev, PTR_ERR(info->clk), "failed to get clock\n"); in of_platform_serial_setup()
133 port->uartclk = clk_get_rate(info->clk); in of_platform_serial_setup()
135 /* If current-speed was set, then try not to change it. */ in of_platform_serial_setup()
136 if (of_property_read_u32(np, "current-speed", &spd) == 0) in of_platform_serial_setup()
137 port->custom_divisor = port->uartclk / (16 * spd); in of_platform_serial_setup()
140 if (of_device_is_compatible(np, "mrvl,mmp-uart")) in of_platform_serial_setup()
141 port->regshift = 2; in of_platform_serial_setup()
143 info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); in of_platform_serial_setup()
144 if (IS_ERR(info->rst)) { in of_platform_serial_setup()
145 ret = PTR_ERR(info->rst); in of_platform_serial_setup()
149 ret = reset_control_deassert(info->rst); in of_platform_serial_setup()
153 port->type = type; in of_platform_serial_setup()
154 port->rs485_config = serial8250_em485_config; in of_platform_serial_setup()
155 port->rs485_supported = serial8250_em485_supported; in of_platform_serial_setup()
156 up->rs485_start_tx = serial8250_em485_start_tx; in of_platform_serial_setup()
157 up->rs485_stop_tx = serial8250_em485_stop_tx; in of_platform_serial_setup()
176 of_device_is_compatible(np, "fsl,16550-FIFO64"))) { in of_platform_serial_setup()
177 port->handle_irq = fsl8250_handle_irq; in of_platform_serial_setup()
178 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); in of_platform_serial_setup()
183 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_setup()
184 pm_runtime_disable(&ofdev->dev); in of_platform_serial_setup()
200 of_device_is_compatible(ofdev->dev.of_node, "brcm,bcm7271-uart")) in of_platform_serial_probe()
201 return -ENODEV; in of_platform_serial_probe()
203 port_type = (unsigned long)of_device_get_match_data(&ofdev->dev); in of_platform_serial_probe()
205 return -EINVAL; in of_platform_serial_probe()
207 if (of_property_read_bool(ofdev->dev.of_node, "used-by-rtas")) in of_platform_serial_probe()
208 return -EBUSY; in of_platform_serial_probe()
212 return -ENOMEM; in of_platform_serial_probe()
223 if ((of_property_read_u32(ofdev->dev.of_node, "tx-threshold", in of_platform_serial_probe()
226 port8250.tx_loadsz = port8250.port.fifosize - tx_threshold; in of_platform_serial_probe()
228 if (of_property_read_bool(ofdev->dev.of_node, "auto-flow-control")) in of_platform_serial_probe()
231 if (of_property_read_u32(ofdev->dev.of_node, in of_platform_serial_probe()
232 "overrun-throttle-ms", in of_platform_serial_probe()
240 info->type = port_type; in of_platform_serial_probe()
241 info->line = ret; in of_platform_serial_probe()
244 if (info->clk) { in of_platform_serial_probe()
245 info->clk_notifier.notifier_call = of_platform_serial_clk_notifier_cb; in of_platform_serial_probe()
246 ret = clk_notifier_register(info->clk, &info->clk_notifier); in of_platform_serial_probe()
255 serial8250_unregister_port(info->line); in of_platform_serial_probe()
257 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_probe()
258 pm_runtime_disable(&ofdev->dev); in of_platform_serial_probe()
271 if (info->clk) in of_platform_serial_remove()
272 clk_notifier_unregister(info->clk, &info->clk_notifier); in of_platform_serial_remove()
274 serial8250_unregister_port(info->line); in of_platform_serial_remove()
276 reset_control_assert(info->rst); in of_platform_serial_remove()
277 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_remove()
278 pm_runtime_disable(&ofdev->dev); in of_platform_serial_remove()
286 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_serial_suspend()
287 struct uart_port *port = &port8250->port; in of_serial_suspend()
289 serial8250_suspend_port(info->line); in of_serial_suspend()
293 clk_disable_unprepare(info->clk); in of_serial_suspend()
301 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_serial_resume()
302 struct uart_port *port = &port8250->port; in of_serial_resume()
306 clk_prepare_enable(info->clk); in of_serial_resume()
309 serial8250_resume_port(info->line); in of_serial_resume()
326 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, },
327 { .compatible = "ralink,rt2880-uart", .data = (void *)PORT_RT2880, },
328 { .compatible = "intel,xscale-uart", .data = (void *)PORT_XSCALE, },
329 { .compatible = "altr,16550-FIFO32",
331 { .compatible = "altr,16550-FIFO64",
333 { .compatible = "altr,16550-FIFO128",
335 { .compatible = "fsl,16550-FIFO64",
337 { .compatible = "mediatek,mtk-btif",
339 { .compatible = "mrvl,mmp-uart",
341 { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, },
342 { .compatible = "nuvoton,wpcm450-uart", .data = (void *)PORT_NPCM, },
343 { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, },