diff options
Diffstat (limited to 'drivers/serial/uartlite.c')
-rw-r--r-- | drivers/serial/uartlite.c | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index c00a627ef89e..ed13b9fac1af 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c | |||
@@ -23,9 +23,13 @@ | |||
23 | #define ULITE_MINOR 187 | 23 | #define ULITE_MINOR 187 |
24 | #define ULITE_NR_UARTS 4 | 24 | #define ULITE_NR_UARTS 4 |
25 | 25 | ||
26 | /* For register details see datasheet: | 26 | /* --------------------------------------------------------------------- |
27 | http://www.xilinx.com/bvdocs/ipcenter/data_sheet/opb_uartlite.pdf | 27 | * Register definitions |
28 | */ | 28 | * |
29 | * For register details see datasheet: | ||
30 | * http://www.xilinx.com/bvdocs/ipcenter/data_sheet/opb_uartlite.pdf | ||
31 | */ | ||
32 | |||
29 | #define ULITE_RX 0x00 | 33 | #define ULITE_RX 0x00 |
30 | #define ULITE_TX 0x04 | 34 | #define ULITE_TX 0x04 |
31 | #define ULITE_STATUS 0x08 | 35 | #define ULITE_STATUS 0x08 |
@@ -49,6 +53,10 @@ | |||
49 | 53 | ||
50 | static struct uart_port ulite_ports[ULITE_NR_UARTS]; | 54 | static struct uart_port ulite_ports[ULITE_NR_UARTS]; |
51 | 55 | ||
56 | /* --------------------------------------------------------------------- | ||
57 | * Core UART driver operations | ||
58 | */ | ||
59 | |||
52 | static int ulite_receive(struct uart_port *port, int stat) | 60 | static int ulite_receive(struct uart_port *port, int stat) |
53 | { | 61 | { |
54 | struct tty_struct *tty = port->info->tty; | 62 | struct tty_struct *tty = port->info->tty; |
@@ -308,6 +316,10 @@ static struct uart_ops ulite_ops = { | |||
308 | .verify_port = ulite_verify_port | 316 | .verify_port = ulite_verify_port |
309 | }; | 317 | }; |
310 | 318 | ||
319 | /* --------------------------------------------------------------------- | ||
320 | * Console driver operations | ||
321 | */ | ||
322 | |||
311 | #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE | 323 | #ifdef CONFIG_SERIAL_UARTLITE_CONSOLE |
312 | static void ulite_console_wait_tx(struct uart_port *port) | 324 | static void ulite_console_wait_tx(struct uart_port *port) |
313 | { | 325 | { |
@@ -413,6 +425,19 @@ static struct uart_driver ulite_uart_driver = { | |||
413 | #endif | 425 | #endif |
414 | }; | 426 | }; |
415 | 427 | ||
428 | /* --------------------------------------------------------------------- | ||
429 | * Port assignment functions (mapping devices to uart_port structures) | ||
430 | */ | ||
431 | |||
432 | /** ulite_assign: register a uartlite device with the driver | ||
433 | * | ||
434 | * @dev: pointer to device structure | ||
435 | * @id: requested id number. Pass -1 for automatic port assignment | ||
436 | * @base: base address of uartlite registers | ||
437 | * @irq: irq number for uartlite | ||
438 | * | ||
439 | * Returns: 0 on success, <0 otherwise | ||
440 | */ | ||
416 | static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) | 441 | static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) |
417 | { | 442 | { |
418 | struct uart_port *port; | 443 | struct uart_port *port; |
@@ -465,6 +490,10 @@ static int __devinit ulite_assign(struct device *dev, int id, u32 base, int irq) | |||
465 | return 0; | 490 | return 0; |
466 | } | 491 | } |
467 | 492 | ||
493 | /** ulite_release: register a uartlite device with the driver | ||
494 | * | ||
495 | * @dev: pointer to device structure | ||
496 | */ | ||
468 | static int __devinit ulite_release(struct device *dev) | 497 | static int __devinit ulite_release(struct device *dev) |
469 | { | 498 | { |
470 | struct uart_port *port = dev_get_drvdata(dev); | 499 | struct uart_port *port = dev_get_drvdata(dev); |
@@ -479,6 +508,10 @@ static int __devinit ulite_release(struct device *dev) | |||
479 | return rc; | 508 | return rc; |
480 | } | 509 | } |
481 | 510 | ||
511 | /* --------------------------------------------------------------------- | ||
512 | * Platform bus binding | ||
513 | */ | ||
514 | |||
482 | static int __devinit ulite_probe(struct platform_device *pdev) | 515 | static int __devinit ulite_probe(struct platform_device *pdev) |
483 | { | 516 | { |
484 | struct resource *res, *res2; | 517 | struct resource *res, *res2; |
@@ -508,6 +541,10 @@ static struct platform_driver ulite_platform_driver = { | |||
508 | }, | 541 | }, |
509 | }; | 542 | }; |
510 | 543 | ||
544 | /* --------------------------------------------------------------------- | ||
545 | * Module setup/teardown | ||
546 | */ | ||
547 | |||
511 | int __init ulite_init(void) | 548 | int __init ulite_init(void) |
512 | { | 549 | { |
513 | int ret; | 550 | int ret; |