blob: a96a1e469c4d9ebc0a7e109b7b18314dea536200 [file] [log] [blame]
Brian Swetland2500aa12009-01-01 04:33:55 -08001/*
2 * Copyright (c) 2008, Google Inc.
3 * All rights reserved.
4 *
Shashank Mittal4f99a882010-02-01 13:58:50 -08005 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
6 *
Brian Swetland2500aa12009-01-01 04:33:55 -08007 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google, Inc. nor the names of its contributors
17 * may be used to endorse or promote products derived from this
18 * software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#include <debug.h>
Brian Swetland2500aa12009-01-01 04:33:55 -080035#include <kernel/thread.h>
36#include <platform/debug.h>
Chandan Uddaraju2943fd62010-06-21 10:56:39 -070037#include <mddi.h>
Dima Zavin36785e32009-01-28 17:26:43 -080038#include <dev/fbcon.h>
Amol Jadi9ef9b732011-05-23 16:00:17 -070039#include <arch/arm/mmu.h>
40
41#define MB (1024*1024)
Dima Zavin36785e32009-01-28 17:26:43 -080042
43static struct fbcon_config *fb_config;
Brian Swetland2500aa12009-01-01 04:33:55 -080044
45void platform_init_interrupts(void);
46void platform_init_timer();
47
Brian Swetlandf4acf732009-01-29 17:25:44 -080048void uart3_clock_init(void);
49void uart_init(void);
50
Chandan Uddarajufcc15f52009-11-17 21:02:46 -080051void acpu_clock_init(void);
52
Dima Zavin36785e32009-01-28 17:26:43 -080053void mddi_clock_init(unsigned num, unsigned rate);
54
Brian Swetland2500aa12009-01-01 04:33:55 -080055void platform_early_init(void)
56{
Chandan Uddarajucdde2bd2009-11-18 15:20:12 -080057 //uart3_clock_init();
Bikas Gurungd1aa5902010-10-01 23:45:33 -070058 //uart_init();
Brian Swetlandf4acf732009-01-29 17:25:44 -080059
Brian Swetland2500aa12009-01-01 04:33:55 -080060 platform_init_interrupts();
61 platform_init_timer();
62}
63
64void platform_init(void)
65{
66 dprintf(INFO, "platform_init()\n");
Dima Zavin36785e32009-01-28 17:26:43 -080067
Chandan Uddarajufcc15f52009-11-17 21:02:46 -080068 acpu_clock_init();
Chandan Uddaraju24120502009-12-12 19:17:04 -080069}
Chandan Uddarajufcc15f52009-11-17 21:02:46 -080070
Chandan Uddaraju24120502009-12-12 19:17:04 -080071void display_init(void)
72{
Chandan Uddaraju96f581d2009-11-24 22:38:40 -080073#if DISPLAY_TYPE_MDDI
Dima Zavin36785e32009-01-28 17:26:43 -080074 fb_config = mddi_init();
75 ASSERT(fb_config);
76 fbcon_setup(fb_config);
Chandan Uddaraju96f581d2009-11-24 22:38:40 -080077#endif
Shashank Mittal4f99a882010-02-01 13:58:50 -080078#if DISPLAY_TYPE_LCDC
79 fb_config = lcdc_init();
80 ASSERT(fb_config);
81 fbcon_setup(fb_config);
82#endif
Brian Swetland2500aa12009-01-01 04:33:55 -080083}
Amol Jadi9ef9b732011-05-23 16:00:17 -070084
85
86/* Setup memory for this platform */
87void platform_init_mmu_mappings(void)
88{
89 uint32_t sections = 1152;
90
91 /* Map io mapped peripherals as device non-shared memory */
92 while (sections--)
93 {
94 arm_mmu_map_section(0x88000000 + sections*MB,
95 0x88000000 + sections*MB,
96 (MMU_MEMORY_TYPE_DEVICE_NON_SHARED |
97 MMU_MEMORY_AP_READ_WRITE));
98 }
99}