OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [src/] [platform/] [pba9/] [platform.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Copyright (C) 2007 Bahadir Balban
3
 */
4
#include <l4/generic/platform.h>
5
#include <l4/generic/space.h>
6
#include <l4/generic/irq.h>
7
#include <l4/generic/bootmem.h>
8
#include INC_ARCH(linker.h)
9
#include INC_SUBARCH(mm.h)
10
#include INC_SUBARCH(mmu_ops.h)
11
#include INC_GLUE(memory.h)
12
#include INC_GLUE(memlayout.h)
13
#include INC_PLAT(offsets.h)
14
#include INC_PLAT(platform.h)
15
#include INC_PLAT(irq.h)
16
#include INC_ARCH(asm.h)
17
#include INC_GLUE(mapping.h)
18
#include <l4/generic/capability.h>
19
#include <l4/generic/cap-types.h>
20
#include <l4/drivers/irq/gic/gic.h>
21
 
22
/*
23
 * FIXME: This is not a platform specific
24
 * call, we will move this out later
25
 */
26
void device_cap_init(struct kernel_resources *kres, int devtype,
27
                     int devnum, unsigned long base)
28
{
29
        struct capability *cap;
30
 
31
        cap =  alloc_bootmem(sizeof(*cap), 0);
32
        cap_set_devtype(cap, devtype);
33
        cap_set_devnum(cap, devnum);
34
        cap->start = __pfn(base);
35
        cap->end = cap->start + 1;
36
        cap->size = cap->end - cap->start;
37
        link_init(&cap->list);
38
        cap_list_insert(cap, &kres->devmem_free);
39
}
40
 
41
/*
42
 * The devices that are used by the kernel are mapped
43
 * independent of these capabilities, but these provide a
44
 * concise description of what is used by the kernel.
45
 */
46
int platform_setup_device_caps(struct kernel_resources *kres)
47
{
48
        device_cap_init(kres, CAP_DEVTYPE_UART, 1, PLATFORM_UART1_BASE);
49
        device_cap_init(kres, CAP_DEVTYPE_UART, 2, PLATFORM_UART2_BASE);
50
        device_cap_init(kres, CAP_DEVTYPE_UART, 3, PLATFORM_UART3_BASE);
51
        device_cap_init(kres, CAP_DEVTYPE_TIMER, 1, PLATFORM_TIMER1_BASE);
52
        device_cap_init(kres, CAP_DEVTYPE_KEYBOARD, 0, PLATFORM_KEYBOARD0_BASE);
53
        device_cap_init(kres, CAP_DEVTYPE_MOUSE, 0, PLATFORM_MOUSE0_BASE);
54
        device_cap_init(kres, CAP_DEVTYPE_CLCD, 0, PLATFORM_CLCD0_BASE);
55
 
56
        return 0;
57
}
58
 
59
void init_platform_irq_controller()
60
{
61
        /* TODO: we need to map 64KB ?*/
62
        add_boot_mapping(MPCORE_PRIVATE_BASE, MPCORE_PRIVATE_VBASE,
63
                         PAGE_SIZE * 2, MAP_IO_DEFAULT);
64
 
65
        gic_dist_init(0, GIC0_DIST_VBASE);
66
        gic_cpu_init(0, GIC0_CPU_VBASE);
67
        irq_controllers_init();
68
}
69
 
70
void init_platform_devices()
71
{
72
        /* TIMER23 */
73
        add_boot_mapping(PLATFORM_TIMER1_BASE, PLATFORM_TIMER1_VBASE,
74
                         PAGE_SIZE, MAP_IO_DEFAULT);
75
 
76
        /* KEYBOARD - KMI0 */
77
        add_boot_mapping(PLATFORM_KEYBOARD0_BASE, PLATFORM_KEYBOARD0_VBASE,
78
                         PAGE_SIZE, MAP_IO_DEFAULT);
79
 
80
        /* MOUSE - KMI1 */
81
        add_boot_mapping(PLATFORM_MOUSE0_BASE, PLATFORM_MOUSE0_VBASE,
82
                         PAGE_SIZE, MAP_IO_DEFAULT);
83
 
84
        /* CLCD */
85
        add_boot_mapping(PLATFORM_CLCD0_BASE, PLATFORM_CLCD0_VBASE,
86
                         PAGE_SIZE, MAP_IO_DEFAULT);
87
 
88
}
89
 

powered by: WebSVN 2.1.0

© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.