Lines Matching refs:vuart

66 static inline u8 aspeed_vuart_readb(struct aspeed_vuart *vuart, u8 reg)  in aspeed_vuart_readb()  argument
68 return readb(vuart->port->port.membase + reg); in aspeed_vuart_readb()
71 static inline void aspeed_vuart_writeb(struct aspeed_vuart *vuart, u8 val, u8 reg) in aspeed_vuart_writeb() argument
73 writeb(val, vuart->port->port.membase + reg); in aspeed_vuart_writeb()
79 struct aspeed_vuart *vuart = dev_get_drvdata(dev); in lpc_address_show() local
82 addr = (aspeed_vuart_readb(vuart, ASPEED_VUART_ADDRH) << 8) | in lpc_address_show()
83 (aspeed_vuart_readb(vuart, ASPEED_VUART_ADDRL)); in lpc_address_show()
88 static int aspeed_vuart_set_lpc_address(struct aspeed_vuart *vuart, u32 addr) in aspeed_vuart_set_lpc_address() argument
93 aspeed_vuart_writeb(vuart, addr >> 8, ASPEED_VUART_ADDRH); in aspeed_vuart_set_lpc_address()
94 aspeed_vuart_writeb(vuart, addr >> 0, ASPEED_VUART_ADDRL); in aspeed_vuart_set_lpc_address()
103 struct aspeed_vuart *vuart = dev_get_drvdata(dev); in lpc_address_store() local
111 err = aspeed_vuart_set_lpc_address(vuart, val); in lpc_address_store()
120 struct aspeed_vuart *vuart = dev_get_drvdata(dev); in sirq_show() local
123 reg = aspeed_vuart_readb(vuart, ASPEED_VUART_GCRB); in sirq_show()
130 static int aspeed_vuart_set_sirq(struct aspeed_vuart *vuart, u32 sirq) in aspeed_vuart_set_sirq() argument
140 reg = aspeed_vuart_readb(vuart, ASPEED_VUART_GCRB); in aspeed_vuart_set_sirq()
143 aspeed_vuart_writeb(vuart, reg, ASPEED_VUART_GCRB); in aspeed_vuart_set_sirq()
151 struct aspeed_vuart *vuart = dev_get_drvdata(dev); in sirq_store() local
159 err = aspeed_vuart_set_sirq(vuart, val); in sirq_store()
168 struct aspeed_vuart *vuart = dev_get_drvdata(dev); in sirq_polarity_show() local
171 reg = aspeed_vuart_readb(vuart, ASPEED_VUART_GCRA); in sirq_polarity_show()
177 static void aspeed_vuart_set_sirq_polarity(struct aspeed_vuart *vuart, in aspeed_vuart_set_sirq_polarity() argument
180 u8 reg = aspeed_vuart_readb(vuart, ASPEED_VUART_GCRA); in aspeed_vuart_set_sirq_polarity()
187 aspeed_vuart_writeb(vuart, reg, ASPEED_VUART_GCRA); in aspeed_vuart_set_sirq_polarity()
194 struct aspeed_vuart *vuart = dev_get_drvdata(dev); in sirq_polarity_store() local
202 aspeed_vuart_set_sirq_polarity(vuart, val != 0); in sirq_polarity_store()
220 static void aspeed_vuart_set_enabled(struct aspeed_vuart *vuart, bool enabled) in aspeed_vuart_set_enabled() argument
222 u8 reg = aspeed_vuart_readb(vuart, ASPEED_VUART_GCRA); in aspeed_vuart_set_enabled()
229 aspeed_vuart_writeb(vuart, reg, ASPEED_VUART_GCRA); in aspeed_vuart_set_enabled()
232 static void aspeed_vuart_set_host_tx_discard(struct aspeed_vuart *vuart, in aspeed_vuart_set_host_tx_discard() argument
237 reg = aspeed_vuart_readb(vuart, ASPEED_VUART_GCRA); in aspeed_vuart_set_host_tx_discard()
245 aspeed_vuart_writeb(vuart, reg, ASPEED_VUART_GCRA); in aspeed_vuart_set_host_tx_discard()
251 struct aspeed_vuart *vuart = uart_8250_port->port.private_data; in aspeed_vuart_startup() local
258 aspeed_vuart_set_host_tx_discard(vuart, false); in aspeed_vuart_startup()
266 struct aspeed_vuart *vuart = uart_8250_port->port.private_data; in aspeed_vuart_shutdown() local
268 aspeed_vuart_set_host_tx_discard(vuart, true); in aspeed_vuart_shutdown()
308 struct aspeed_vuart *vuart = from_timer(vuart, timer, unthrottle_timer); in aspeed_vuart_unthrottle_exp() local
309 struct uart_8250_port *up = vuart->port; in aspeed_vuart_unthrottle_exp()
312 mod_timer(&vuart->unthrottle_timer, in aspeed_vuart_unthrottle_exp()
352 struct aspeed_vuart *vuart = port->private_data; in aspeed_vuart_handle_irq() local
355 if (!timer_pending(&vuart->unthrottle_timer)) in aspeed_vuart_handle_irq()
356 mod_timer(&vuart->unthrottle_timer, in aspeed_vuart_handle_irq()
383 struct aspeed_vuart *vuart, struct device_node *syscon_np, in aspeed_vuart_auto_configure_sirq_polarity() argument
391 dev_warn(vuart->dev, in aspeed_vuart_auto_configure_sirq_polarity()
396 dev_warn(vuart->dev, "could not read hw strap table\n"); in aspeed_vuart_auto_configure_sirq_polarity()
400 aspeed_vuart_set_sirq_polarity(vuart, (value & reg_mask) == 0); in aspeed_vuart_auto_configure_sirq_polarity()
419 struct aspeed_vuart *vuart; in aspeed_vuart_probe() local
427 vuart = devm_kzalloc(&pdev->dev, sizeof(*vuart), GFP_KERNEL); in aspeed_vuart_probe()
428 if (!vuart) in aspeed_vuart_probe()
431 vuart->dev = &pdev->dev; in aspeed_vuart_probe()
432 timer_setup(&vuart->unthrottle_timer, aspeed_vuart_unthrottle_exp, 0); in aspeed_vuart_probe()
439 port.port.private_data = vuart; in aspeed_vuart_probe()
451 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); in aspeed_vuart_probe()
456 vuart->clk = devm_clk_get(&pdev->dev, NULL); in aspeed_vuart_probe()
457 if (IS_ERR(vuart->clk)) { in aspeed_vuart_probe()
460 rc = PTR_ERR(vuart->clk); in aspeed_vuart_probe()
464 rc = clk_prepare_enable(vuart->clk); in aspeed_vuart_probe()
468 clk = clk_get_rate(vuart->clk); in aspeed_vuart_probe()
513 vuart->line = rc; in aspeed_vuart_probe()
514 vuart->port = serial8250_get_port(vuart->line); in aspeed_vuart_probe()
524 vuart, sirq_polarity_sense_args.np, in aspeed_vuart_probe()
534 rc = aspeed_vuart_set_lpc_address(vuart, prop); in aspeed_vuart_probe()
546 rc = aspeed_vuart_set_sirq(vuart, sirq[0]); in aspeed_vuart_probe()
559 aspeed_vuart_set_sirq_polarity(vuart, sirq_polarity); in aspeed_vuart_probe()
561 aspeed_vuart_set_enabled(vuart, true); in aspeed_vuart_probe()
562 aspeed_vuart_set_host_tx_discard(vuart, true); in aspeed_vuart_probe()
563 platform_set_drvdata(pdev, vuart); in aspeed_vuart_probe()
568 clk_disable_unprepare(vuart->clk); in aspeed_vuart_probe()
571 sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); in aspeed_vuart_probe()
577 struct aspeed_vuart *vuart = platform_get_drvdata(pdev); in aspeed_vuart_remove() local
579 del_timer_sync(&vuart->unthrottle_timer); in aspeed_vuart_remove()
580 aspeed_vuart_set_enabled(vuart, false); in aspeed_vuart_remove()
581 serial8250_unregister_port(vuart->line); in aspeed_vuart_remove()
582 sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); in aspeed_vuart_remove()
583 clk_disable_unprepare(vuart->clk); in aspeed_vuart_remove()