amba-pl011.c (dd84cfff3cc3b79c9d616f85bd1178df135cbd1a) | amba-pl011.c (0139da50dc53f0ce2804e83566d290c7e626fd17) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Driver for AMBA serial ports 4 * 5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 6 * 7 * Copyright 1999 ARM Limited 8 * Copyright (C) 2000 Deep Blue Solutions Ltd. --- 2183 unchanged lines hidden (view full) --- 2192 ret = -EINVAL; 2193 if (ser->baud_base < 9600) 2194 ret = -EINVAL; 2195 if (port->mapbase != (unsigned long) ser->iomem_base) 2196 ret = -EINVAL; 2197 return ret; 2198} 2199 | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Driver for AMBA serial ports 4 * 5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 6 * 7 * Copyright 1999 ARM Limited 8 * Copyright (C) 2000 Deep Blue Solutions Ltd. --- 2183 unchanged lines hidden (view full) --- 2192 ret = -EINVAL; 2193 if (ser->baud_base < 9600) 2194 ret = -EINVAL; 2195 if (port->mapbase != (unsigned long) ser->iomem_base) 2196 ret = -EINVAL; 2197 return ret; 2198} 2199 |
2200static int pl011_rs485_config(struct uart_port *port, | 2200static int pl011_rs485_config(struct uart_port *port, struct ktermios *termios, |
2201 struct serial_rs485 *rs485) 2202{ 2203 struct uart_amba_port *uap = 2204 container_of(port, struct uart_amba_port, port); 2205 2206 if (port->rs485.flags & SER_RS485_ENABLED) 2207 pl011_rs485_tx_stop(uap); 2208 --- 467 unchanged lines hidden (view full) --- 2676 return i; 2677 2678 return -EBUSY; 2679} 2680 2681static int pl011_get_rs485_mode(struct uart_amba_port *uap) 2682{ 2683 struct uart_port *port = &uap->port; | 2201 struct serial_rs485 *rs485) 2202{ 2203 struct uart_amba_port *uap = 2204 container_of(port, struct uart_amba_port, port); 2205 2206 if (port->rs485.flags & SER_RS485_ENABLED) 2207 pl011_rs485_tx_stop(uap); 2208 --- 467 unchanged lines hidden (view full) --- 2676 return i; 2677 2678 return -EBUSY; 2679} 2680 2681static int pl011_get_rs485_mode(struct uart_amba_port *uap) 2682{ 2683 struct uart_port *port = &uap->port; |
2684 struct serial_rs485 *rs485 = &port->rs485; | |
2685 int ret; 2686 2687 ret = uart_get_rs485_mode(port); 2688 if (ret) 2689 return ret; 2690 | 2684 int ret; 2685 2686 ret = uart_get_rs485_mode(port); 2687 if (ret) 2688 return ret; 2689 |
2691 /* clamp the delays to [0, 100ms] */ 2692 rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U); 2693 rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U); 2694 | |
2695 return 0; 2696} 2697 2698static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, 2699 struct resource *mmiobase, int index) 2700{ 2701 void __iomem *base; 2702 int ret; --- 43 unchanged lines hidden (view full) --- 2746 2747 ret = uart_add_one_port(&amba_reg, &uap->port); 2748 if (ret) 2749 pl011_unregister_port(uap); 2750 2751 return ret; 2752} 2753 | 2690 return 0; 2691} 2692 2693static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, 2694 struct resource *mmiobase, int index) 2695{ 2696 void __iomem *base; 2697 int ret; --- 43 unchanged lines hidden (view full) --- 2741 2742 ret = uart_add_one_port(&amba_reg, &uap->port); 2743 if (ret) 2744 pl011_unregister_port(uap); 2745 2746 return ret; 2747} 2748 |
2749static const struct serial_rs485 pl011_rs485_supported = { 2750 .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND | 2751 SER_RS485_RX_DURING_TX, 2752 .delay_rts_before_send = 1, 2753 .delay_rts_after_send = 1, 2754}; 2755 |
|
2754static int pl011_probe(struct amba_device *dev, const struct amba_id *id) 2755{ 2756 struct uart_amba_port *uap; 2757 struct vendor_data *vendor = id->data; 2758 int portnr, ret; 2759 2760 portnr = pl011_find_free_port(); 2761 if (portnr < 0) --- 10 unchanged lines hidden (view full) --- 2772 2773 uap->reg_offset = vendor->reg_offset; 2774 uap->vendor = vendor; 2775 uap->fifosize = vendor->get_fifosize(dev); 2776 uap->port.iotype = vendor->access_32b ? UPIO_MEM32 : UPIO_MEM; 2777 uap->port.irq = dev->irq[0]; 2778 uap->port.ops = &amba_pl011_pops; 2779 uap->port.rs485_config = pl011_rs485_config; | 2756static int pl011_probe(struct amba_device *dev, const struct amba_id *id) 2757{ 2758 struct uart_amba_port *uap; 2759 struct vendor_data *vendor = id->data; 2760 int portnr, ret; 2761 2762 portnr = pl011_find_free_port(); 2763 if (portnr < 0) --- 10 unchanged lines hidden (view full) --- 2774 2775 uap->reg_offset = vendor->reg_offset; 2776 uap->vendor = vendor; 2777 uap->fifosize = vendor->get_fifosize(dev); 2778 uap->port.iotype = vendor->access_32b ? UPIO_MEM32 : UPIO_MEM; 2779 uap->port.irq = dev->irq[0]; 2780 uap->port.ops = &amba_pl011_pops; 2781 uap->port.rs485_config = pl011_rs485_config; |
2782 uap->port.rs485_supported = pl011_rs485_supported; |
|
2780 snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); 2781 2782 ret = pl011_setup_port(&dev->dev, uap, &dev->res, portnr); 2783 if (ret) 2784 return ret; 2785 2786 amba_set_drvdata(dev, uap); 2787 --- 183 unchanged lines hidden --- | 2783 snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); 2784 2785 ret = pl011_setup_port(&dev->dev, uap, &dev->res, portnr); 2786 if (ret) 2787 return ret; 2788 2789 amba_set_drvdata(dev, uap); 2790 --- 183 unchanged lines hidden --- |