Lines Matching refs:p

75 static unsigned int dw8250_get_divisor(struct uart_port *p, unsigned int baud,  in dw8250_get_divisor()  argument
79 struct dw8250_port_data *d = p->private_data; in dw8250_get_divisor()
81 quot = p->uartclk / base_baud; in dw8250_get_divisor()
82 rem = p->uartclk % base_baud; in dw8250_get_divisor()
88 static void dw8250_set_divisor(struct uart_port *p, unsigned int baud, in dw8250_set_divisor() argument
91 dw8250_writel_ext(p, DW_UART_DLF, quot_frac); in dw8250_set_divisor()
92 serial8250_do_set_divisor(p, baud, quot, quot_frac); in dw8250_set_divisor()
95 void dw8250_do_set_termios(struct uart_port *p, struct ktermios *termios, in dw8250_do_set_termios() argument
98 p->status &= ~UPSTAT_AUTOCTS; in dw8250_do_set_termios()
100 p->status |= UPSTAT_AUTOCTS; in dw8250_do_set_termios()
102 serial8250_do_set_termios(p, termios, old); in dw8250_do_set_termios()
105 p->ignore_status_mask |= DW_UART_LSR_ADDR_RCVD; in dw8250_do_set_termios()
106 p->read_status_mask |= DW_UART_LSR_ADDR_RCVD; in dw8250_do_set_termios()
117 static void dw8250_wait_re_deassert(struct uart_port *p) in dw8250_wait_re_deassert() argument
119 ndelay(p->frame_time); in dw8250_wait_re_deassert()
122 static void dw8250_update_rar(struct uart_port *p, u32 addr) in dw8250_update_rar() argument
124 u32 re_en = dw8250_readl_ext(p, DW_UART_RE_EN); in dw8250_update_rar()
131 dw8250_writel_ext(p, DW_UART_RE_EN, 0); in dw8250_update_rar()
132 dw8250_wait_re_deassert(p); in dw8250_update_rar()
133 dw8250_writel_ext(p, DW_UART_RAR, addr); in dw8250_update_rar()
135 dw8250_writel_ext(p, DW_UART_RE_EN, re_en); in dw8250_update_rar()
138 static void dw8250_rs485_set_addr(struct uart_port *p, struct serial_rs485 *rs485, in dw8250_rs485_set_addr() argument
141 u32 lcr = dw8250_readl_ext(p, DW_UART_LCR_EXT); in dw8250_rs485_set_addr()
149 u32 delta = p->rs485.flags ^ rs485->flags; in dw8250_rs485_set_addr()
155 if (unlikely(&p->rs485 == rs485)) in dw8250_rs485_set_addr()
159 (p->rs485.addr_recv != rs485->addr_recv)) in dw8250_rs485_set_addr()
160 dw8250_update_rar(p, rs485->addr_recv); in dw8250_rs485_set_addr()
171 dw8250_writel_ext(p, DW_UART_TAR, rs485->addr_dest); in dw8250_rs485_set_addr()
177 dw8250_writel_ext(p, DW_UART_LCR_EXT, lcr); in dw8250_rs485_set_addr()
180 static int dw8250_rs485_config(struct uart_port *p, struct ktermios *termios, in dw8250_rs485_config() argument
185 tcr = dw8250_readl_ext(p, DW_UART_TCR); in dw8250_rs485_config()
195 dw8250_writel_ext(p, DW_UART_DE_EN, 1); in dw8250_rs485_config()
196 dw8250_writel_ext(p, DW_UART_RE_EN, 1); in dw8250_rs485_config()
210 if (device_property_read_bool(p->dev, "rs485-rx-active-high")) in dw8250_rs485_config()
213 dw8250_writel_ext(p, DW_UART_TCR, tcr); in dw8250_rs485_config()
217 dw8250_rs485_set_addr(p, rs485, termios); in dw8250_rs485_config()
226 static bool dw8250_detect_rs485_hw(struct uart_port *p) in dw8250_detect_rs485_hw() argument
230 dw8250_writel_ext(p, DW_UART_RE_EN, 1); in dw8250_detect_rs485_hw()
231 reg = dw8250_readl_ext(p, DW_UART_RE_EN); in dw8250_detect_rs485_hw()
232 dw8250_writel_ext(p, DW_UART_RE_EN, 0); in dw8250_detect_rs485_hw()
242 void dw8250_setup_port(struct uart_port *p) in dw8250_setup_port() argument
244 struct dw8250_port_data *pd = p->private_data; in dw8250_setup_port()
245 struct uart_8250_port *up = up_to_u8250p(p); in dw8250_setup_port()
248 pd->hw_rs485_support = dw8250_detect_rs485_hw(p); in dw8250_setup_port()
250 p->rs485_config = dw8250_rs485_config; in dw8250_setup_port()
252 p->rs485_supported = dw8250_rs485_supported; in dw8250_setup_port()
254 p->rs485_config = serial8250_em485_config; in dw8250_setup_port()
255 p->rs485_supported = serial8250_em485_supported; in dw8250_setup_port()
265 reg = dw8250_readl_ext(p, DW_UART_UCV); in dw8250_setup_port()
269 dev_dbg(p->dev, "Designware UART version %c.%c%c\n", in dw8250_setup_port()
273 old_dlf = dw8250_readl_ext(p, DW_UART_DLF); in dw8250_setup_port()
274 dw8250_writel_ext(p, DW_UART_DLF, ~0U); in dw8250_setup_port()
275 reg = dw8250_readl_ext(p, DW_UART_DLF); in dw8250_setup_port()
276 dw8250_writel_ext(p, DW_UART_DLF, old_dlf); in dw8250_setup_port()
280 p->get_divisor = dw8250_get_divisor; in dw8250_setup_port()
281 p->set_divisor = dw8250_set_divisor; in dw8250_setup_port()
284 reg = dw8250_readl_ext(p, DW_UART_CPR); in dw8250_setup_port()
287 dev_dbg(p->dev, "CPR is not available, using 0x%08x instead\n", reg); in dw8250_setup_port()
294 p->type = PORT_16550A; in dw8250_setup_port()
295 p->flags |= UPF_FIXED_TYPE; in dw8250_setup_port()
296 p->fifosize = DW_UART_CPR_FIFO_SIZE(reg); in dw8250_setup_port()