]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/bootstrap/server/src/platform/tegra2.cc
8a3ff7aa5f34531a33da2fbe2fdd4cbbe089c4dd
[l4.git] / l4 / pkg / bootstrap / server / src / platform / tegra2.cc
1 /*!
2  * \file
3  * \brief  Support for Tegra 2 platforms
4  *
5  * \date   2010-05
6  * \author Adam Lackorznynski <adam@os.inf.tu-dresden.de>
7  *
8  */
9 /*
10  * (c) 2010 Author(s)
11  *     economic rights: Technische Universität Dresden (Germany)
12  *
13  * This file is part of TUD:OS and distributed under the terms of the
14  * GNU General Public License 2.
15  * Please see the COPYING-GPL-2 file for details.
16  */
17
18 /* Init-code from http://android.git.kernel.org/?p=kernel/tegra.git */
19
20 #include "support.h"
21 #include <l4/drivers/uart_pxa.h>
22
23 namespace {
24 class Platform_arm_tegra2 : public Platform_single_region_ram
25 {
26   void some_delay(int d) const
27     {
28       for (int i = 0; i <  d; i++)
29         asm volatile("":::"memory");
30     }
31
32   bool probe() { return true; }
33
34   void init()
35   {
36     volatile unsigned long *addr;
37
38     addr = (volatile unsigned long *)0x600060a0;
39     *addr = 0x5011b00c;
40
41     /* PLLP_OUTA_0 */
42     addr = (volatile unsigned long *)0x600060a4;
43     *addr = 0x10031c03;
44
45     /* PLLP_OUTB_0 */
46     addr = (volatile unsigned long *)0x600060a8;
47     *addr = 0x06030a03;
48
49     /* PLLP_MISC_0 */
50     addr = (volatile unsigned long *)0x600060ac;
51     *addr = 0x00000800;
52
53     some_delay(1000000);
54
55     /* UARTD clock source is PLLP_OUT0 */
56     addr = (volatile unsigned long *)0x600061c0;
57     *addr = 0;
58
59     /* Enable clock to UARTD */
60     addr = (volatile unsigned long *)0x60006018;
61     *addr |= 2;
62     some_delay(5000);
63
64     /* Deassert reset to UARTD */
65     addr = (volatile unsigned long *)0x6000600c;
66     *addr &= ~2;
67
68     some_delay(5000);
69
70     static L4::Uart_16550 _uart(13478400);
71     static L4::Io_register_block_mmio r(0x70006300, 2);
72     _uart.startup(&r);
73     _uart.change_mode(3, 115200);
74     set_stdio_uart(&_uart);
75   }
76 };
77 }
78
79 REGISTER_PLATFORM(Platform_arm_tegra2);