diff options
Diffstat (limited to 'arch/microblaze/kernel/prom.c')
-rw-r--r-- | arch/microblaze/kernel/prom.c | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index 427b13b4740f..b15cc219b1d9 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -42,19 +42,14 @@ | |||
42 | #include <asm/sections.h> | 42 | #include <asm/sections.h> |
43 | #include <asm/pci-bridge.h> | 43 | #include <asm/pci-bridge.h> |
44 | 44 | ||
45 | void __init early_init_dt_scan_chosen_arch(unsigned long node) | ||
46 | { | ||
47 | /* No Microblaze specific code here */ | ||
48 | } | ||
49 | |||
50 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) | 45 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) |
51 | { | 46 | { |
52 | memblock_add(base, size); | 47 | memblock_add(base, size); |
53 | } | 48 | } |
54 | 49 | ||
55 | u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | 50 | void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) |
56 | { | 51 | { |
57 | return memblock_alloc(size, align); | 52 | return __va(memblock_alloc(size, align)); |
58 | } | 53 | } |
59 | 54 | ||
60 | #ifdef CONFIG_EARLY_PRINTK | 55 | #ifdef CONFIG_EARLY_PRINTK |
@@ -64,24 +59,23 @@ static int __init early_init_dt_scan_serial(unsigned long node, | |||
64 | { | 59 | { |
65 | unsigned long l; | 60 | unsigned long l; |
66 | char *p; | 61 | char *p; |
67 | int *addr; | 62 | const __be32 *addr; |
68 | 63 | ||
69 | pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname); | 64 | pr_debug("search \"serial\", depth: %d, uname: %s\n", depth, uname); |
70 | 65 | ||
71 | /* find all serial nodes */ | 66 | /* find all serial nodes */ |
72 | if (strncmp(uname, "serial", 6) != 0) | 67 | if (strncmp(uname, "serial", 6) != 0) |
73 | return 0; | 68 | return 0; |
74 | 69 | ||
75 | early_init_dt_check_for_initrd(node); | ||
76 | |||
77 | /* find compatible node with uartlite */ | 70 | /* find compatible node with uartlite */ |
78 | p = of_get_flat_dt_prop(node, "compatible", &l); | 71 | p = of_get_flat_dt_prop(node, "compatible", &l); |
79 | if ((strncmp(p, "xlnx,xps-uartlite", 17) != 0) && | 72 | if ((strncmp(p, "xlnx,xps-uartlite", 17) != 0) && |
80 | (strncmp(p, "xlnx,opb-uartlite", 17) != 0)) | 73 | (strncmp(p, "xlnx,opb-uartlite", 17) != 0) && |
74 | (strncmp(p, "xlnx,axi-uartlite", 17) != 0)) | ||
81 | return 0; | 75 | return 0; |
82 | 76 | ||
83 | addr = of_get_flat_dt_prop(node, "reg", &l); | 77 | addr = of_get_flat_dt_prop(node, "reg", &l); |
84 | return *addr; /* return address */ | 78 | return be32_to_cpup(addr); /* return address */ |
85 | } | 79 | } |
86 | 80 | ||
87 | /* this function is looking for early uartlite console - Microblaze specific */ | 81 | /* this function is looking for early uartlite console - Microblaze specific */ |
@@ -89,6 +83,40 @@ int __init early_uartlite_console(void) | |||
89 | { | 83 | { |
90 | return of_scan_flat_dt(early_init_dt_scan_serial, NULL); | 84 | return of_scan_flat_dt(early_init_dt_scan_serial, NULL); |
91 | } | 85 | } |
86 | |||
87 | /* MS this is Microblaze specifig function */ | ||
88 | static int __init early_init_dt_scan_serial_full(unsigned long node, | ||
89 | const char *uname, int depth, void *data) | ||
90 | { | ||
91 | unsigned long l; | ||
92 | 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 | |||
101 | early_init_dt_check_for_initrd(node); | ||
102 | |||
103 | /* find compatible node with uartlite */ | ||
104 | p = of_get_flat_dt_prop(node, "compatible", &l); | ||
105 | |||
106 | if ((strncmp(p, "xlnx,xps-uart16550", 18) != 0) && | ||
107 | (strncmp(p, "xlnx,axi-uart16550", 18) != 0)) | ||
108 | return 0; | ||
109 | |||
110 | addr = *(u32 *)of_get_flat_dt_prop(node, "reg", &l); | ||
111 | addr += *(u32 *)of_get_flat_dt_prop(node, "reg-offset", &l); | ||
112 | return be32_to_cpu(addr); /* return address */ | ||
113 | } | ||
114 | |||
115 | /* this function is looking for early uartlite console - Microblaze specific */ | ||
116 | int __init early_uart16550_console(void) | ||
117 | { | ||
118 | return of_scan_flat_dt(early_init_dt_scan_serial_full, NULL); | ||
119 | } | ||
92 | #endif | 120 | #endif |
93 | 121 | ||
94 | void __init early_init_devtree(void *params) | 122 | void __init early_init_devtree(void *params) |
@@ -102,7 +130,7 @@ void __init early_init_devtree(void *params) | |||
102 | * device-tree, including the platform type, initrd location and | 130 | * device-tree, including the platform type, initrd location and |
103 | * size, TCE reserve, and more ... | 131 | * size, TCE reserve, and more ... |
104 | */ | 132 | */ |
105 | of_scan_flat_dt(early_init_dt_scan_chosen, NULL); | 133 | of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line); |
106 | 134 | ||
107 | /* Scan memory nodes and rebuild MEMBLOCKs */ | 135 | /* Scan memory nodes and rebuild MEMBLOCKs */ |
108 | memblock_init(); | 136 | memblock_init(); |