1 |
2 |
drasko |
/*
|
2 |
|
|
* PB11MPCORE platform-specific initialisation and setup
|
3 |
|
|
*
|
4 |
|
|
* Copyright (C) 2007 Bahadir Balban
|
5 |
|
|
*/
|
6 |
|
|
#include <l4/generic/platform.h>
|
7 |
|
|
#include <l4/generic/space.h>
|
8 |
|
|
#include <l4/generic/irq.h>
|
9 |
|
|
#include INC_ARCH(linker.h)
|
10 |
|
|
#include INC_SUBARCH(mm.h)
|
11 |
|
|
#include INC_SUBARCH(mmu_ops.h)
|
12 |
|
|
#include INC_GLUE(memory.h)
|
13 |
|
|
#include INC_GLUE(memlayout.h)
|
14 |
|
|
#include INC_PLAT(offsets.h)
|
15 |
|
|
#include INC_PLAT(platform.h)
|
16 |
|
|
#include INC_PLAT(uart.h)
|
17 |
|
|
#include INC_PLAT(irq.h)
|
18 |
|
|
#include INC_ARCH(asm.h)
|
19 |
|
|
|
20 |
|
|
/*
|
21 |
|
|
* The devices that are used by the kernel are mapped
|
22 |
|
|
* independent of these capabilities, but these provide a
|
23 |
|
|
* concise description of what is used by the kernel.
|
24 |
|
|
*/
|
25 |
|
|
int platform_setup_device_caps(struct kernel_resources *kres)
|
26 |
|
|
{
|
27 |
|
|
struct capability *uart[4], *timer[4];
|
28 |
|
|
|
29 |
|
|
/* Setup capabilities for userspace uarts and timers */
|
30 |
|
|
uart[1] = alloc_bootmem(sizeof(*uart[1]), 0);
|
31 |
|
|
uart[1]->start = __pfn(PLATFORM_UART1_BASE);
|
32 |
|
|
uart[1]->end = uart[1]->start + 1;
|
33 |
|
|
uart[1]->size = uart[1]->end - uart[1]->start;
|
34 |
|
|
cap_set_devtype(uart[1], CAP_DEVTYPE_UART);
|
35 |
|
|
cap_set_devnum(uart[1], 1);
|
36 |
|
|
link_init(&uart[1]->list);
|
37 |
|
|
cap_list_insert(uart[1], &kres->devmem_free);
|
38 |
|
|
|
39 |
|
|
uart[2] = alloc_bootmem(sizeof(*uart[2]), 0);
|
40 |
|
|
uart[2]->start = __pfn(PLATFORM_UART2_BASE);
|
41 |
|
|
uart[2]->end = uart[2]->start + 1;
|
42 |
|
|
uart[2]->size = uart[2]->end - uart[2]->start;
|
43 |
|
|
cap_set_devtype(uart[2], CAP_DEVTYPE_UART);
|
44 |
|
|
cap_set_devnum(uart[2], 2);
|
45 |
|
|
link_init(&uart[2]->list);
|
46 |
|
|
cap_list_insert(uart[2], &kres->devmem_free);
|
47 |
|
|
|
48 |
|
|
uart[3] = alloc_bootmem(sizeof(*uart[3]), 0);
|
49 |
|
|
uart[3]->start = __pfn(PLATFORM_UART3_BASE);
|
50 |
|
|
uart[3]->end = uart[3]->start + 1;
|
51 |
|
|
uart[3]->size = uart[3]->end - uart[3]->start;
|
52 |
|
|
cap_set_devtype(uart[3], CAP_DEVTYPE_UART);
|
53 |
|
|
cap_set_devnum(uart[3], 3);
|
54 |
|
|
link_init(&uart[3]->list);
|
55 |
|
|
cap_list_insert(uart[3], &kres->devmem_free);
|
56 |
|
|
|
57 |
|
|
/* Setup timer1 capability as free */
|
58 |
|
|
timer[1] = alloc_bootmem(sizeof(*timer[1]), 0);
|
59 |
|
|
timer[1]->start = __pfn(PLATFORM_TIMER1_BASE);
|
60 |
|
|
timer[1]->end = timer[1]->start + 1;
|
61 |
|
|
timer[1]->size = timer[1]->end - timer[1]->start;
|
62 |
|
|
cap_set_devtype(timer[1], CAP_DEVTYPE_TIMER);
|
63 |
|
|
cap_set_devnum(timer[1], 1);
|
64 |
|
|
link_init(&timer[1]->list);
|
65 |
|
|
cap_list_insert(timer[1], &kres->devmem_free);
|
66 |
|
|
|
67 |
|
|
/* Setup timer2 capability as free */
|
68 |
|
|
timer[2] = alloc_bootmem(sizeof(*timer[2]), 0);
|
69 |
|
|
timer[2]->start = __pfn(PLATFORM_TIMER2_BASE);
|
70 |
|
|
timer[2]->end = timer[2]->start + 1;
|
71 |
|
|
timer[2]->size = timer[2]->end - timer[2]->start;
|
72 |
|
|
cap_set_devtype(timer[2], CAP_DEVTYPE_TIMER);
|
73 |
|
|
cap_set_devnum(timer[2], 1);
|
74 |
|
|
link_init(&timer[2]->list);
|
75 |
|
|
cap_list_insert(timer[2], &kres->devmem_free);
|
76 |
|
|
|
77 |
|
|
/* Setup timer3 capability as free */
|
78 |
|
|
timer[3] = alloc_bootmem(sizeof(*timer[3]), 0);
|
79 |
|
|
timer[3]->start = __pfn(PLATFORM_TIMER3_BASE);
|
80 |
|
|
timer[3]->end = timer[3]->start + 1;
|
81 |
|
|
timer[3]->size = timer[3]->end - timer[3]->start;
|
82 |
|
|
cap_set_devtype(timer[3], CAP_DEVTYPE_TIMER);
|
83 |
|
|
cap_set_devnum(timer[3], 1);
|
84 |
|
|
link_init(&timer[3]->list);
|
85 |
|
|
cap_list_insert(timer[3], &kres->devmem_free);
|
86 |
|
|
|
87 |
|
|
return 0;
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
void init_platform_irq_controller()
|
91 |
|
|
{
|
92 |
|
|
#if 0
|
93 |
|
|
add_boot_mapping(PB926_VIC_BASE, PLATFORM_IRQCTRL_BASE, PAGE_SIZE,
|
94 |
|
|
MAP_IO_DEFAULT);
|
95 |
|
|
add_boot_mapping(PB926_SIC_BASE, PLATFORM_SIRQCTRL_BASE, PAGE_SIZE,
|
96 |
|
|
MAP_IO_DEFAULT);
|
97 |
|
|
irq_controllers_init();
|
98 |
|
|
#endif
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
void init_platform_devices()
|
102 |
|
|
{
|
103 |
|
|
/* We need SYSCTRL1 for initializing TIMER2 and 3 */
|
104 |
|
|
add_boot_mapping(PLATFORM_SYSCTRL1_BASE, PLATFORM_SYSCTRL1_VBASE,
|
105 |
|
|
PAGE_SIZE, MAP_IO_DEFAULT);
|
106 |
|
|
|
107 |
|
|
/* Add userspace devices here as you develop their irq handlers */
|
108 |
|
|
add_boot_mapping(PLATFORM_TIMER1_BASE, PLATFORM_TIMER1_VBASE,
|
109 |
|
|
PAGE_SIZE, MAP_IO_DEFAULT);
|
110 |
|
|
|
111 |
|
|
add_boot_mapping(PLATFORM_TIMER2_BASE, PLATFORM_TIMER2_VBASE,
|
112 |
|
|
PAGE_SIZE, MAP_IO_DEFAULT);
|
113 |
|
|
|
114 |
|
|
add_boot_mapping(PLATFORM_TIMER3_BASE, PLATFORM_TIMER3_VBASE,
|
115 |
|
|
PAGE_SIZE, MAP_IO_DEFAULT);
|
116 |
|
|
}
|
117 |
|
|
|