Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. |
| 6 | * |
| 7 | * 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> |
| 35 | #include <kernel/thread.h> |
| 36 | #include <platform/debug.h> |
| 37 | #include <mddi.h> |
| 38 | #include <dev/fbcon.h> |
| 39 | |
| 40 | static struct fbcon_config *fb_config; |
| 41 | |
| 42 | void platform_init_interrupts(void); |
| 43 | void platform_init_timer(); |
| 44 | |
| 45 | void uart3_clock_init(void); |
| 46 | void uart_init(void); |
| 47 | |
| 48 | void acpu_clock_init(void); |
| 49 | |
| 50 | void mddi_clock_init(unsigned num, unsigned rate); |
| 51 | |
| 52 | void platform_early_init(void) |
| 53 | { |
Shashank Mittal | 2fad67f | 2011-04-08 19:45:10 -0700 | [diff] [blame] | 54 | #if WITH_DEBUG_UART |
| 55 | uart1_clock_init(); |
| 56 | uart_init(); |
| 57 | #endif |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 58 | platform_init_interrupts(); |
| 59 | platform_init_timer(); |
| 60 | } |
| 61 | |
| 62 | void platform_init(void) |
| 63 | { |
| 64 | dprintf(INFO, "platform_init()\n"); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 65 | acpu_clock_init(); |
Shashank Mittal | 246f8d0 | 2011-01-21 17:12:27 -0800 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | void display_init(void) |
| 69 | { |
| 70 | #if DISPLAY_TYPE_MDDI |
| 71 | fb_config = mddi_init(); |
| 72 | ASSERT(fb_config); |
| 73 | fbcon_setup(fb_config); |
| 74 | #endif |
| 75 | #if DISPLAY_TYPE_LCDC |
| 76 | fb_config = lcdc_init(); |
| 77 | ASSERT(fb_config); |
| 78 | fbcon_setup(fb_config); |
| 79 | #endif |
| 80 | } |
Amol Jadi | 4421e65 | 2011-06-16 15:00:48 -0700 | [diff] [blame] | 81 | |
| 82 | void platform_uninit(void) |
| 83 | { |
| 84 | platform_uninit_timer(); |
| 85 | #if DISPLAY_SPLASH_SCREEN |
| 86 | display_shutdown(); |
| 87 | #endif |
| 88 | } |