Lines Matching +full:start +full:- +full:up

1 // SPDX-License-Identifier: GPL-2.0+
17 static int rsa8250_request_resource(struct uart_8250_port *up) in rsa8250_request_resource() argument
19 struct uart_port *port = &up->port; in rsa8250_request_resource()
20 unsigned long start = UART_RSA_BASE << port->regshift; in rsa8250_request_resource() local
21 unsigned int size = 8 << port->regshift; in rsa8250_request_resource()
23 switch (port->iotype) { in rsa8250_request_resource()
26 start += port->iobase; in rsa8250_request_resource()
27 if (!request_region(start, size, "serial-rsa")) in rsa8250_request_resource()
28 return -EBUSY; in rsa8250_request_resource()
31 return -EINVAL; in rsa8250_request_resource()
35 static void rsa8250_release_resource(struct uart_8250_port *up) in rsa8250_release_resource() argument
37 struct uart_port *port = &up->port; in rsa8250_release_resource()
38 unsigned long offset = UART_RSA_BASE << port->regshift; in rsa8250_release_resource()
39 unsigned int size = 8 << port->regshift; in rsa8250_release_resource()
41 switch (port->iotype) { in rsa8250_release_resource()
44 release_region(port->iobase + offset, size); in rsa8250_release_resource()
53 struct uart_8250_port *up = up_to_u8250p(port); in univ8250_config_port() local
56 up->probe &= ~UART_PROBE_RSA; in univ8250_config_port()
57 if (port->type == PORT_RSA) { in univ8250_config_port()
58 if (rsa8250_request_resource(up) == 0) in univ8250_config_port()
59 up->probe |= UART_PROBE_RSA; in univ8250_config_port()
62 if (probe_rsa[i] == up->port.iobase) { in univ8250_config_port()
63 if (rsa8250_request_resource(up) == 0) in univ8250_config_port()
64 up->probe |= UART_PROBE_RSA; in univ8250_config_port()
70 univ8250_port_base_ops->config_port(port, flags); in univ8250_config_port()
72 if (port->type != PORT_RSA && up->probe & UART_PROBE_RSA) in univ8250_config_port()
73 rsa8250_release_resource(up); in univ8250_config_port()
78 struct uart_8250_port *up = up_to_u8250p(port); in univ8250_request_port() local
81 ret = univ8250_port_base_ops->request_port(port); in univ8250_request_port()
82 if (ret == 0 && port->type == PORT_RSA) { in univ8250_request_port()
83 ret = rsa8250_request_resource(up); in univ8250_request_port()
85 univ8250_port_base_ops->release_port(port); in univ8250_request_port()
93 struct uart_8250_port *up = up_to_u8250p(port); in univ8250_release_port() local
95 if (port->type == PORT_RSA) in univ8250_release_port()
96 rsa8250_release_resource(up); in univ8250_release_port()
97 univ8250_port_base_ops->release_port(port); in univ8250_release_port()
102 ops->config_port = univ8250_config_port; in univ8250_rsa_support()
103 ops->request_port = univ8250_request_port; in univ8250_rsa_support()
104 ops->release_port = univ8250_release_port; in univ8250_rsa_support()
114 static int __rsa_enable(struct uart_8250_port *up) in __rsa_enable() argument
119 mode = serial_in(up, UART_RSA_MSR); in __rsa_enable()
123 serial_out(up, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO); in __rsa_enable()
124 mode = serial_in(up, UART_RSA_MSR); in __rsa_enable()
129 up->port.uartclk = SERIAL_RSA_BAUD_BASE * 16; in __rsa_enable()
135 * If this is an RSA port, see if we can kick it up to the higher speed clock.
137 void rsa_enable(struct uart_8250_port *up) in rsa_enable() argument
139 if (up->port.type != PORT_RSA) in rsa_enable()
142 if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16) { in rsa_enable()
143 uart_port_lock_irq(&up->port); in rsa_enable()
144 __rsa_enable(up); in rsa_enable()
145 uart_port_unlock_irq(&up->port); in rsa_enable()
147 if (up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16) in rsa_enable()
148 serial_out(up, UART_RSA_FRR, 0); in rsa_enable()
157 void rsa_disable(struct uart_8250_port *up) in rsa_disable() argument
162 if (up->port.type != PORT_RSA) in rsa_disable()
165 if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16) in rsa_disable()
168 uart_port_lock_irq(&up->port); in rsa_disable()
169 mode = serial_in(up, UART_RSA_MSR); in rsa_disable()
173 serial_out(up, UART_RSA_MSR, mode & ~UART_RSA_MSR_FIFO); in rsa_disable()
174 mode = serial_in(up, UART_RSA_MSR); in rsa_disable()
179 up->port.uartclk = SERIAL_RSA_BAUD_BASE_LO * 16; in rsa_disable()
180 uart_port_unlock_irq(&up->port); in rsa_disable()
184 void rsa_autoconfig(struct uart_8250_port *up) in rsa_autoconfig() argument
187 if (up->port.type != PORT_16550A) in rsa_autoconfig()
189 if (!(up->probe & UART_PROBE_RSA)) in rsa_autoconfig()
192 if (__rsa_enable(up)) in rsa_autoconfig()
193 up->port.type = PORT_RSA; in rsa_autoconfig()
197 void rsa_reset(struct uart_8250_port *up) in rsa_reset() argument
199 if (up->port.type != PORT_RSA) in rsa_reset()
202 serial_out(up, UART_RSA_FRR, 0); in rsa_reset()
225 0444, -1, 0); in rsa8250_options()