diff options
author | Sascha Hauer <sascha@saschahauer.de> | 2005-08-31 16:48:47 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-08-31 16:48:47 -0400 |
commit | 0f302dc35412dc67035efc188b9d5c40711b4222 (patch) | |
tree | 57cbbe8e722e6a82bfd8bb3b8227898c54615c72 /drivers/serial/serial_core.c | |
parent | b129a8ccd53f74c43e4c83c8e0031a4990040830 (diff) |
[ARM] 2866/1: add i.MX set_mctrl / get_mctrl functions
Patch from Sascha Hauer
This patch adds support for setting and getting RTS / CTS via
set_mtctrl / get_mctrl functions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/serial_core.c')
-rw-r--r-- | drivers/serial/serial_core.c | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index ac3a0bf924d..dea156a62d0 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2289,143 +2289,11 @@ int uart_match_port(struct uart_port *port1, struct uart_port *port2) | |||
2289 | } | 2289 | } |
2290 | EXPORT_SYMBOL(uart_match_port); | 2290 | EXPORT_SYMBOL(uart_match_port); |
2291 | 2291 | ||
2292 | /* | ||
2293 | * Try to find an unused uart_state slot for a port. | ||
2294 | */ | ||
2295 | static struct uart_state * | ||
2296 | uart_find_match_or_unused(struct uart_driver *drv, struct uart_port *port) | ||
2297 | { | ||
2298 | int i; | ||
2299 | |||
2300 | /* | ||
2301 | * First, find a port entry which matches. Note: if we do | ||
2302 | * find a matching entry, and it has a non-zero use count, | ||
2303 | * then we can't register the port. | ||
2304 | */ | ||
2305 | for (i = 0; i < drv->nr; i++) | ||
2306 | if (uart_match_port(drv->state[i].port, port)) | ||
2307 | return &drv->state[i]; | ||
2308 | |||
2309 | /* | ||
2310 | * We didn't find a matching entry, so look for the first | ||
2311 | * free entry. We look for one which hasn't been previously | ||
2312 | * used (indicated by zero iobase). | ||
2313 | */ | ||
2314 | for (i = 0; i < drv->nr; i++) | ||
2315 | if (drv->state[i].port->type == PORT_UNKNOWN && | ||
2316 | drv->state[i].port->iobase == 0 && | ||
2317 | drv->state[i].count == 0) | ||
2318 | return &drv->state[i]; | ||
2319 | |||
2320 | /* | ||
2321 | * That also failed. Last resort is to find any currently | ||
2322 | * entry which doesn't have a real port associated with it. | ||
2323 | */ | ||
2324 | for (i = 0; i < drv->nr; i++) | ||
2325 | if (drv->state[i].port->type == PORT_UNKNOWN && | ||
2326 | drv->state[i].count == 0) | ||
2327 | return &drv->state[i]; | ||
2328 | |||
2329 | return NULL; | ||
2330 | } | ||
2331 | |||
2332 | /** | ||
2333 | * uart_register_port: register uart settings with a port | ||
2334 | * @drv: pointer to the uart low level driver structure for this port | ||
2335 | * @port: uart port structure describing the port | ||
2336 | * | ||
2337 | * Register UART settings with the specified low level driver. Detect | ||
2338 | * the type of the port if UPF_BOOT_AUTOCONF is set, and detect the | ||
2339 | * IRQ if UPF_AUTO_IRQ is set. | ||
2340 | * | ||
2341 | * We try to pick the same port for the same IO base address, so that | ||
2342 | * when a modem is plugged in, unplugged and plugged back in, it gets | ||
2343 | * allocated the same port. | ||
2344 | * | ||
2345 | * Returns negative error, or positive line number. | ||
2346 | */ | ||
2347 | int uart_register_port(struct uart_driver *drv, struct uart_port *port) | ||
2348 | { | ||
2349 | struct uart_state *state; | ||
2350 | int ret; | ||
2351 | |||
2352 | down(&port_sem); | ||
2353 | |||
2354 | state = uart_find_match_or_unused(drv, port); | ||
2355 | |||
2356 | if (state) { | ||
2357 | /* | ||
2358 | * Ok, we've found a line that we can use. | ||
2359 | * | ||
2360 | * If we find a port that matches this one, and it appears | ||
2361 | * to be in-use (even if it doesn't have a type) we shouldn't | ||
2362 | * alter it underneath itself - the port may be open and | ||
2363 | * trying to do useful work. | ||
2364 | */ | ||
2365 | if (uart_users(state) != 0) { | ||
2366 | ret = -EBUSY; | ||
2367 | goto out; | ||
2368 | } | ||
2369 | |||
2370 | /* | ||
2371 | * If the port is already initialised, don't touch it. | ||
2372 | */ | ||
2373 | if (state->port->type == PORT_UNKNOWN) { | ||
2374 | state->port->iobase = port->iobase; | ||
2375 | state->port->membase = port->membase; | ||
2376 | state->port->irq = port->irq; | ||
2377 | state->port->uartclk = port->uartclk; | ||
2378 | state->port->fifosize = port->fifosize; | ||
2379 | state->port->regshift = port->regshift; | ||
2380 | state->port->iotype = port->iotype; | ||
2381 | state->port->flags = port->flags; | ||
2382 | state->port->line = state - drv->state; | ||
2383 | state->port->mapbase = port->mapbase; | ||
2384 | |||
2385 | uart_configure_port(drv, state, state->port); | ||
2386 | } | ||
2387 | |||
2388 | ret = state->port->line; | ||
2389 | } else | ||
2390 | ret = -ENOSPC; | ||
2391 | out: | ||
2392 | up(&port_sem); | ||
2393 | return ret; | ||
2394 | } | ||
2395 | |||
2396 | /** | ||
2397 | * uart_unregister_port - de-allocate a port | ||
2398 | * @drv: pointer to the uart low level driver structure for this port | ||
2399 | * @line: line index previously returned from uart_register_port() | ||
2400 | * | ||
2401 | * Hang up the specified line associated with the low level driver, | ||
2402 | * and mark the port as unused. | ||
2403 | */ | ||
2404 | void uart_unregister_port(struct uart_driver *drv, int line) | ||
2405 | { | ||
2406 | struct uart_state *state; | ||
2407 | |||
2408 | if (line < 0 || line >= drv->nr) { | ||
2409 | printk(KERN_ERR "Attempt to unregister "); | ||
2410 | printk("%s%d", drv->dev_name, line); | ||
2411 | printk("\n"); | ||
2412 | return; | ||
2413 | } | ||
2414 | |||
2415 | state = drv->state + line; | ||
2416 | |||
2417 | down(&port_sem); | ||
2418 | uart_unconfigure_port(drv, state); | ||
2419 | up(&port_sem); | ||
2420 | } | ||
2421 | |||
2422 | EXPORT_SYMBOL(uart_write_wakeup); | 2292 | EXPORT_SYMBOL(uart_write_wakeup); |
2423 | EXPORT_SYMBOL(uart_register_driver); | 2293 | EXPORT_SYMBOL(uart_register_driver); |
2424 | EXPORT_SYMBOL(uart_unregister_driver); | 2294 | EXPORT_SYMBOL(uart_unregister_driver); |
2425 | EXPORT_SYMBOL(uart_suspend_port); | 2295 | EXPORT_SYMBOL(uart_suspend_port); |
2426 | EXPORT_SYMBOL(uart_resume_port); | 2296 | EXPORT_SYMBOL(uart_resume_port); |
2427 | EXPORT_SYMBOL(uart_register_port); | ||
2428 | EXPORT_SYMBOL(uart_unregister_port); | ||
2429 | EXPORT_SYMBOL(uart_add_one_port); | 2297 | EXPORT_SYMBOL(uart_add_one_port); |
2430 | EXPORT_SYMBOL(uart_remove_one_port); | 2298 | EXPORT_SYMBOL(uart_remove_one_port); |
2431 | 2299 | ||