aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/uartlite.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 12:02:26 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 12:02:26 -0500
commit37969581301e50872a1ae84dc73962b5f7ee6b76 (patch)
tree35bbd6a07f903f248f4bd209b8d194a922415fe0 /drivers/serial/uartlite.c
parent80ff8a805113850a3ffafcc8e6eaa1fdd51b02f3 (diff)
parent24f1a849614ba1805e26a05da7cc8c6bd67490ea (diff)
Merge branch 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (69 commits) [POWERPC] Add SPE registers to core dumps [POWERPC] Use regset code for compat PTRACE_*REGS* calls [POWERPC] Use generic compat_sys_ptrace [POWERPC] Use generic compat_ptrace_request [POWERPC] Use generic ptrace peekdata/pokedata [POWERPC] Use regset code for PTRACE_*REGS* requests [POWERPC] Switch to generic compat_binfmt_elf code [POWERPC] Switch to using user_regset-based core dumps [POWERPC] Add user_regset compat support [POWERPC] Add user_regset_view definitions [POWERPC] Use user_regset accessors for GPRs [POWERPC] ptrace accessors for special regs MSR and TRAP [POWERPC] Use user_regset accessors for SPE regs [POWERPC] Use user_regset accessors for altivec regs [POWERPC] Use user_regset accessors for FP regs [POWERPC] mpc52xx: fix compile error introduce when rebasing patch [POWERPC] 4xx: PCIe indirect DCR spinlock fix. [POWERPC] Add missing native dcr dcr_ind_lock spinlock [POWERPC] 4xx: Fix offset value on Warp board [POWERPC] 4xx: Add 440EPx Sequoia ehci dts entry ...
Diffstat (limited to 'drivers/serial/uartlite.c')
-rw-r--r--drivers/serial/uartlite.c53
1 files changed, 15 insertions, 38 deletions
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
index bacf68dca01a..4e06ab6bcb6e 100644
--- a/drivers/serial/uartlite.c
+++ b/drivers/serial/uartlite.c
@@ -17,10 +17,21 @@
17#include <linux/tty.h> 17#include <linux/tty.h>
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/init.h>
20#include <asm/io.h> 21#include <asm/io.h>
21#if defined(CONFIG_OF) 22#if defined(CONFIG_OF)
23#include <linux/of.h>
22#include <linux/of_device.h> 24#include <linux/of_device.h>
23#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26
27/* Match table for of_platform binding */
28static struct of_device_id ulite_of_match[] __devinitdata = {
29 { .compatible = "xlnx,opb-uartlite-1.00.b", },
30 { .compatible = "xlnx,xps-uartlite-1.00.a", },
31 {}
32};
33MODULE_DEVICE_TABLE(of, ulite_of_match);
34
24#endif 35#endif
25 36
26#define ULITE_NAME "ttyUL" 37#define ULITE_NAME "ttyUL"
@@ -275,6 +286,9 @@ static void ulite_release_port(struct uart_port *port)
275 286
276static int ulite_request_port(struct uart_port *port) 287static int ulite_request_port(struct uart_port *port)
277{ 288{
289 pr_debug("ulite console: port=%p; port->mapbase=%x\n",
290 port, port->mapbase);
291
278 if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) { 292 if (!request_mem_region(port->mapbase, ULITE_REGION, "uartlite")) {
279 dev_err(port->dev, "Memory region busy\n"); 293 dev_err(port->dev, "Memory region busy\n");
280 return -EBUSY; 294 return -EBUSY;
@@ -375,32 +389,6 @@ static void ulite_console_write(struct console *co, const char *s,
375 spin_unlock_irqrestore(&port->lock, flags); 389 spin_unlock_irqrestore(&port->lock, flags);
376} 390}
377 391
378#if defined(CONFIG_OF)
379static inline void __init ulite_console_of_find_device(int id)
380{
381 struct device_node *np;
382 struct resource res;
383 const unsigned int *of_id;
384 int rc;
385
386 for_each_compatible_node(np, NULL, "xilinx,uartlite") {
387 of_id = of_get_property(np, "port-number", NULL);
388 if ((!of_id) || (*of_id != id))
389 continue;
390
391 rc = of_address_to_resource(np, 0, &res);
392 if (rc)
393 continue;
394
395 ulite_ports[id].mapbase = res.start;
396 of_node_put(np);
397 return;
398 }
399}
400#else /* CONFIG_OF */
401static inline void __init ulite_console_of_find_device(int id) { /* do nothing */ }
402#endif /* CONFIG_OF */
403
404static int __init ulite_console_setup(struct console *co, char *options) 392static int __init ulite_console_setup(struct console *co, char *options)
405{ 393{
406 struct uart_port *port; 394 struct uart_port *port;
@@ -414,11 +402,7 @@ static int __init ulite_console_setup(struct console *co, char *options)
414 402
415 port = &ulite_ports[co->index]; 403 port = &ulite_ports[co->index];
416 404
417 /* Check if it is an OF device */ 405 /* Has the device been initialized yet? */
418 if (!port->mapbase)
419 ulite_console_of_find_device(co->index);
420
421 /* Do we have a device now? */
422 if (!port->mapbase) { 406 if (!port->mapbase) {
423 pr_debug("console on ttyUL%i not present\n", co->index); 407 pr_debug("console on ttyUL%i not present\n", co->index);
424 return -ENODEV; 408 return -ENODEV;
@@ -617,13 +601,6 @@ static int __devexit ulite_of_remove(struct of_device *op)
617 return ulite_release(&op->dev); 601 return ulite_release(&op->dev);
618} 602}
619 603
620/* Match table for of_platform binding */
621static struct of_device_id __devinit ulite_of_match[] = {
622 { .type = "serial", .compatible = "xilinx,uartlite", },
623 {},
624};
625MODULE_DEVICE_TABLE(of, ulite_of_match);
626
627static struct of_platform_driver ulite_of_driver = { 604static struct of_platform_driver ulite_of_driver = {
628 .owner = THIS_MODULE, 605 .owner = THIS_MODULE,
629 .name = "uartlite", 606 .name = "uartlite",