Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
Ajay Dudani | 1a23bb2 | 2009-12-03 13:56:24 -0800 | [diff] [blame] | 4 | * Copyright (c) 2009, Code Aurora Forum. All rights reserved. |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * * Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * * Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in |
| 13 | * the documentation and/or other materials provided with the |
| 14 | * distribution. |
| 15 | * * Neither the name of Google, Inc. nor the names of its contributors |
| 16 | * may be used to endorse or promote products derived from this |
| 17 | * software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 23 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 26 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 27 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 29 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | * SUCH DAMAGE. |
| 31 | */ |
| 32 | |
| 33 | #include <debug.h> |
| 34 | |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 35 | #include <reg.h> |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 36 | #include <dev/fbcon.h> |
| 37 | #include <kernel/thread.h> |
| 38 | #include <platform/debug.h> |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 39 | #include <mddi_hw.h> |
| 40 | #include "gpio_hw.h" |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 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 | struct fbcon_config *lcdc_init(void); |
| 49 | |
| 50 | void platform_early_init(void) |
| 51 | { |
| 52 | //uart3_clock_init(); |
| 53 | //uart_init(); |
| 54 | |
| 55 | platform_init_interrupts(); |
| 56 | platform_init_timer(); |
| 57 | } |
| 58 | |
| 59 | void platform_init(void) |
| 60 | { |
| 61 | struct fbcon_config *fb_cfg; |
| 62 | |
| 63 | dprintf(INFO, "platform_init()\n"); |
| 64 | acpu_clock_init(); |
Subbaraman Narayanamurthy | 4cc2973 | 2010-10-18 15:57:58 -0700 | [diff] [blame] | 65 | adm_enable_clock(); |
Chandan Uddaraju | 2412050 | 2009-12-12 19:17:04 -0800 | [diff] [blame] | 66 | } |
| 67 | |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 68 | void mdp4_display_intf_sel(int output, int intf) |
| 69 | { |
| 70 | unsigned bits, mask; |
| 71 | unsigned dma2_cfg_reg; |
| 72 | bits = readl(MSM_MDP_BASE1 + 0x0038); |
| 73 | mask = 0x03; /* 2 bits */ |
| 74 | intf &= 0x03; /* 2 bits */ |
| 75 | |
| 76 | switch (output) { |
| 77 | case EXTERNAL_INTF_SEL: |
| 78 | intf <<= 4; |
| 79 | mask <<= 4; |
| 80 | break; |
| 81 | case SECONDARY_INTF_SEL: |
| 82 | intf &= 0x02; /* only MDDI and EBI2 support */ |
| 83 | intf <<= 2; |
| 84 | mask <<= 2; |
| 85 | break; |
| 86 | default: |
| 87 | break; |
| 88 | } |
| 89 | |
| 90 | bits &= ~mask; |
| 91 | bits |= intf; |
| 92 | writel(bits, MSM_MDP_BASE1 + 0x0038); /* MDP_DISP_INTF_SEL */ |
| 93 | } |
| 94 | |
| 95 | |
| 96 | |
Chandan Uddaraju | 2412050 | 2009-12-12 19:17:04 -0800 | [diff] [blame] | 97 | void display_init(void) |
| 98 | { |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 99 | struct fbcon_config *fb_cfg; |
Chandan Uddaraju | c009e4d | 2010-09-08 17:06:45 -0700 | [diff] [blame] | 100 | |
| 101 | #if DISPLAY_TYPE_MDDI |
| 102 | mddi_clock_init(0, 480000000); |
| 103 | mddi_panel_poweron(); |
| 104 | /* We need to config GPIO 38 for Sleep clock with Spl Fun 2 */ |
| 105 | toshiba_pmic_gpio_init(GPIO38_GPIO_CNTRL); |
| 106 | fb_cfg = mddi_init(); |
| 107 | fbcon_setup(fb_cfg); |
| 108 | #endif |
| 109 | |
| 110 | #if DISPLAY_TYPE_LCDC |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 111 | mdp_clock_init(122880000); |
| 112 | fb_cfg = lcdc_init(); |
| 113 | panel_poweron(); |
| 114 | fbcon_setup(fb_cfg); |
| 115 | #endif |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 116 | } |
Shashank Mittal | 58317a7 | 2010-10-11 17:02:57 -0700 | [diff] [blame^] | 117 | |
| 118 | void display_shutdown(void) |
| 119 | { |
| 120 | #if DISPLAY_TYPE_LCDC |
| 121 | /* Turning off LCDC */ |
| 122 | lcdc_shutdown(); |
| 123 | #endif |
| 124 | } |
| 125 | |