Lines Matching +full:bcm7271 +full:- +full:uart
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 if (prop >= port->mapsize) { in of_platform_serial_setup()
88 dev_warn(&ofdev->dev, "reg-offset %u exceeds region size %pa\n", in of_platform_serial_setup()
89 prop, &port->mapsize); in of_platform_serial_setup()
90 ret = -EINVAL; in of_platform_serial_setup()
94 port->mapbase += prop; in of_platform_serial_setup()
95 port->mapsize -= prop; in of_platform_serial_setup()
98 port->iotype = UPIO_MEM; in of_platform_serial_setup()
99 if (of_property_read_u32(np, "reg-io-width", &prop) == 0) { in of_platform_serial_setup()
102 port->iotype = UPIO_MEM; in of_platform_serial_setup()
105 port->iotype = UPIO_MEM16; in of_platform_serial_setup()
108 port->iotype = of_device_is_big_endian(np) ? in of_platform_serial_setup()
112 dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n", in of_platform_serial_setup()
114 ret = -EINVAL; in of_platform_serial_setup()
118 port->flags |= UPF_IOREMAP; in of_platform_serial_setup()
122 if (of_device_is_compatible(np, "mrvl,mmp-uart")) in of_platform_serial_setup()
123 port->regshift = 2; in of_platform_serial_setup()
126 if (of_property_read_u32(np, "reg-shift", &prop) == 0) in of_platform_serial_setup()
127 port->regshift = prop; in of_platform_serial_setup()
130 if (of_property_read_u32(np, "fifo-size", &prop) == 0) in of_platform_serial_setup()
131 port->fifosize = prop; in of_platform_serial_setup()
136 port->line = ret; in of_platform_serial_setup()
140 if (irq == -EPROBE_DEFER) { in of_platform_serial_setup()
141 ret = -EPROBE_DEFER; in of_platform_serial_setup()
148 port->irq = irq; in of_platform_serial_setup()
150 info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); in of_platform_serial_setup()
151 if (IS_ERR(info->rst)) { in of_platform_serial_setup()
152 ret = PTR_ERR(info->rst); in of_platform_serial_setup()
156 ret = reset_control_deassert(info->rst); in of_platform_serial_setup()
160 port->type = type; in of_platform_serial_setup()
161 port->uartclk = clk; in of_platform_serial_setup()
163 if (of_property_read_bool(np, "no-loopback-test")) in of_platform_serial_setup()
164 port->flags |= UPF_SKIP_TEST; in of_platform_serial_setup()
166 port->dev = &ofdev->dev; in of_platform_serial_setup()
167 port->rs485_config = serial8250_em485_config; in of_platform_serial_setup()
168 port->rs485_supported = serial8250_em485_supported; in of_platform_serial_setup()
169 up->rs485_start_tx = serial8250_em485_start_tx; in of_platform_serial_setup()
170 up->rs485_stop_tx = serial8250_em485_stop_tx; in of_platform_serial_setup()
174 port->iotype = UPIO_AU; in of_platform_serial_setup()
180 of_device_is_compatible(np, "fsl,16550-FIFO64"))) { in of_platform_serial_setup()
181 port->handle_irq = fsl8250_handle_irq; in of_platform_serial_setup()
182 port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); in of_platform_serial_setup()
187 clk_disable_unprepare(info->clk); in of_platform_serial_setup()
189 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_setup()
190 pm_runtime_disable(&ofdev->dev); in of_platform_serial_setup()
206 of_device_is_compatible(ofdev->dev.of_node, "brcm,bcm7271-uart")) in of_platform_serial_probe()
207 return -ENODEV; in of_platform_serial_probe()
209 port_type = (unsigned long)of_device_get_match_data(&ofdev->dev); in of_platform_serial_probe()
211 return -EINVAL; in of_platform_serial_probe()
213 if (of_property_read_bool(ofdev->dev.of_node, "used-by-rtas")) in of_platform_serial_probe()
214 return -EBUSY; in of_platform_serial_probe()
218 return -ENOMEM; in of_platform_serial_probe()
229 if ((of_property_read_u32(ofdev->dev.of_node, "tx-threshold", in of_platform_serial_probe()
232 port8250.tx_loadsz = port8250.port.fifosize - tx_threshold; in of_platform_serial_probe()
234 if (of_property_read_bool(ofdev->dev.of_node, "auto-flow-control")) in of_platform_serial_probe()
237 if (of_property_read_u32(ofdev->dev.of_node, in of_platform_serial_probe()
238 "overrun-throttle-ms", in of_platform_serial_probe()
246 info->type = port_type; in of_platform_serial_probe()
247 info->line = ret; in of_platform_serial_probe()
252 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_probe()
253 pm_runtime_disable(&ofdev->dev); in of_platform_serial_probe()
254 clk_disable_unprepare(info->clk); in of_platform_serial_probe()
267 serial8250_unregister_port(info->line); in of_platform_serial_remove()
269 reset_control_assert(info->rst); in of_platform_serial_remove()
270 pm_runtime_put_sync(&ofdev->dev); in of_platform_serial_remove()
271 pm_runtime_disable(&ofdev->dev); in of_platform_serial_remove()
272 clk_disable_unprepare(info->clk); in of_platform_serial_remove()
281 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_serial_suspend()
282 struct uart_port *port = &port8250->port; in of_serial_suspend()
284 serial8250_suspend_port(info->line); in of_serial_suspend()
288 clk_disable_unprepare(info->clk); in of_serial_suspend()
296 struct uart_8250_port *port8250 = serial8250_get_port(info->line); in of_serial_resume()
297 struct uart_port *port = &port8250->port; in of_serial_resume()
301 clk_prepare_enable(info->clk); in of_serial_resume()
304 serial8250_resume_port(info->line); in of_serial_resume()
321 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, },
322 { .compatible = "ralink,rt2880-uart", .data = (void *)PORT_RT2880, },
323 { .compatible = "intel,xscale-uart", .data = (void *)PORT_XSCALE, },
324 { .compatible = "altr,16550-FIFO32",
326 { .compatible = "altr,16550-FIFO64",
328 { .compatible = "altr,16550-FIFO128",
330 { .compatible = "fsl,16550-FIFO64",
332 { .compatible = "mediatek,mtk-btif",
334 { .compatible = "mrvl,mmp-uart",
336 { .compatible = "ti,da830-uart", .data = (void *)PORT_DA830, },
337 { .compatible = "nuvoton,wpcm450-uart", .data = (void *)PORT_NPCM, },
338 { .compatible = "nuvoton,npcm750-uart", .data = (void *)PORT_NPCM, },