aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/prom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/kernel/prom.c')
-rw-r--r--arch/microblaze/kernel/prom.c97
1 files changed, 43 insertions, 54 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index b15cc219b1d9..977484add216 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -53,69 +53,58 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
53} 53}
54 54
55#ifdef CONFIG_EARLY_PRINTK 55#ifdef CONFIG_EARLY_PRINTK
56/* MS this is Microblaze specifig function */ 56char *stdout;
57static int __init early_init_dt_scan_serial(unsigned long node,
58 const char *uname, int depth, void *data)
59{
60 unsigned long l;
61 char *p;
62 const __be32 *addr;
63
64 pr_debug("search \"serial\", depth: %d, uname: %s\n", depth, uname);
65
66/* find all serial nodes */
67 if (strncmp(uname, "serial", 6) != 0)
68 return 0;
69
70/* find compatible node with uartlite */
71 p = of_get_flat_dt_prop(node, "compatible", &l);
72 if ((strncmp(p, "xlnx,xps-uartlite", 17) != 0) &&
73 (strncmp(p, "xlnx,opb-uartlite", 17) != 0) &&
74 (strncmp(p, "xlnx,axi-uartlite", 17) != 0))
75 return 0;
76
77 addr = of_get_flat_dt_prop(node, "reg", &l);
78 return be32_to_cpup(addr); /* return address */
79}
80 57
81/* this function is looking for early uartlite console - Microblaze specific */ 58int __init early_init_dt_scan_chosen_serial(unsigned long node,
82int __init early_uartlite_console(void)
83{
84 return of_scan_flat_dt(early_init_dt_scan_serial, NULL);
85}
86
87/* MS this is Microblaze specifig function */
88static int __init early_init_dt_scan_serial_full(unsigned long node,
89 const char *uname, int depth, void *data) 59 const char *uname, int depth, void *data)
90{ 60{
91 unsigned long l; 61 unsigned long l;
92 char *p; 62 char *p;
93 unsigned int addr;
94
95 pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
96
97/* find all serial nodes */
98 if (strncmp(uname, "serial", 6) != 0)
99 return 0;
100 63
101 early_init_dt_check_for_initrd(node); 64 pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);
102 65
103/* find compatible node with uartlite */ 66 if (depth == 1 && (strcmp(uname, "chosen") == 0 ||
104 p = of_get_flat_dt_prop(node, "compatible", &l); 67 strcmp(uname, "chosen@0") == 0)) {
105 68 p = of_get_flat_dt_prop(node, "linux,stdout-path", &l);
106 if ((strncmp(p, "xlnx,xps-uart16550", 18) != 0) && 69 if (p != NULL && l > 0)
107 (strncmp(p, "xlnx,axi-uart16550", 18) != 0)) 70 stdout = p; /* store pointer to stdout-path */
108 return 0; 71 }
109 72
110 addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l); 73 if (stdout && strstr(stdout, uname)) {
111 addr += *(u32 *)of_get_flat_dt_prop(node, "reg-offset", &l); 74 p = of_get_flat_dt_prop(node, "compatible", &l);
112 return be32_to_cpu(addr); /* return address */ 75 pr_debug("Compatible string: %s\n", p);
76
77 if ((strncmp(p, "xlnx,xps-uart16550", 18) == 0) ||
78 (strncmp(p, "xlnx,axi-uart16550", 18) == 0)) {
79 unsigned int addr;
80
81 *(u32 *)data = UART16550;
82
83 addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l);
84 addr += *(u32 *)of_get_flat_dt_prop(node,
85 "reg-offset", &l);
86 /* clear register offset */
87 return be32_to_cpu(addr) & ~3;
88 }
89 if ((strncmp(p, "xlnx,xps-uartlite", 17) == 0) ||
90 (strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
91 (strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
92 (strncmp(p, "xlnx,mdm", 8) == 0)) {
93 unsigned int *addrp;
94
95 *(u32 *)data = UARTLITE;
96
97 addrp = of_get_flat_dt_prop(node, "reg", &l);
98 return be32_to_cpup(addrp); /* return address */
99 }
100 }
101 return 0;
113} 102}
114 103
115/* this function is looking for early uartlite console - Microblaze specific */ 104/* this function is looking for early console - Microblaze specific */
116int __init early_uart16550_console(void) 105int __init of_early_console(void *version)
117{ 106{
118 return of_scan_flat_dt(early_init_dt_scan_serial_full, NULL); 107 return of_scan_flat_dt(early_init_dt_scan_chosen_serial, version);
119} 108}
120#endif 109#endif
121 110