]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/bootstrap/server/src/support_tegra2.cc
update
[l4.git] / l4 / pkg / bootstrap / server / src / support_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_base
25 {
26 private:
27   void some_delay(int d) const
28     {
29       for (int i = 0; i <  d; i++)
30         asm volatile("":::"memory");
31     }
32
33 public:
34   bool probe() { return true; }
35
36   void init()
37   {
38     volatile unsigned long *addr;
39
40     addr = (volatile unsigned long *)0x600060a0;
41     *addr = 0x5011b00c;
42
43     /* PLLP_OUTA_0 */
44     addr = (volatile unsigned long *)0x600060a4;
45     *addr = 0x10031c03;
46
47     /* PLLP_OUTB_0 */
48     addr = (volatile unsigned long *)0x600060a8;
49     *addr = 0x06030a03;
50
51     /* PLLP_MISC_0 */
52     addr = (volatile unsigned long *)0x600060ac;
53     *addr = 0x00000800;
54
55     some_delay(1000000);
56
57     /* UARTD clock source is PLLP_OUT0 */
58     addr = (volatile unsigned long *)0x600061c0;
59     *addr = 0;
60
61     /* Enable clock to UARTD */
62     addr = (volatile unsigned long *)0x60006018;
63     *addr |= 2;
64     some_delay(5000);
65
66     /* Deassert reset to UARTD */
67     addr = (volatile unsigned long *)0x6000600c;
68     *addr &= ~2;
69
70     some_delay(5000);
71
72     static L4::Uart_pxa _uart(1, 1);
73     _uart.startup(0x70006300);
74     _uart.change_mode(3, 7876);
75     set_stdio_uart(&_uart);
76   }
77
78   void setup_memory_map(l4util_mb_info_t *,
79                         Region_list *ram, Region_list *)
80   {
81     ram->add(Region::n(0x0,        448 << 20, ".ram", Region::Ram));
82     ram->add(Region::n(512 << 20, 1024 << 20, ".ram", Region::Ram));
83   }
84 };
85 }
86
87 REGISTER_PLATFORM(Platform_arm_tegra2);