blob: 56852a418f017f4b067636f07c700bad869a66fb [file] [log] [blame]
Ajay Dudani232ce812009-12-02 00:14:11 -08001/*
2 * Copyright (c) 2008, Google Inc.
3 * All rights reserved.
Ajay Dudani1a23bb22009-12-03 13:56:24 -08004 * Copyright (c) 2009, Code Aurora Forum. All rights reserved.
Ajay Dudani232ce812009-12-02 00:14:11 -08005 *
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 Uddarajuc009e4d2010-09-08 17:06:45 -070035#include <reg.h>
Ajay Dudani232ce812009-12-02 00:14:11 -080036#include <dev/fbcon.h>
37#include <kernel/thread.h>
38#include <platform/debug.h>
Chandan Uddarajuc009e4d2010-09-08 17:06:45 -070039#include <mddi_hw.h>
40#include "gpio_hw.h"
Ajay Dudani232ce812009-12-02 00:14:11 -080041
42void platform_init_interrupts(void);
43void platform_init_timer();
44
45void uart3_clock_init(void);
46void uart_init(void);
47
48struct fbcon_config *lcdc_init(void);
49
50void platform_early_init(void)
51{
52 //uart3_clock_init();
53 //uart_init();
54
55 platform_init_interrupts();
56 platform_init_timer();
57}
58
59void platform_init(void)
60{
61 struct fbcon_config *fb_cfg;
62
63 dprintf(INFO, "platform_init()\n");
64 acpu_clock_init();
Subbaraman Narayanamurthy4cc29732010-10-18 15:57:58 -070065 adm_enable_clock();
Chandan Uddaraju24120502009-12-12 19:17:04 -080066}
67
Chandan Uddarajuc009e4d2010-09-08 17:06:45 -070068void 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 Uddaraju24120502009-12-12 19:17:04 -080097void display_init(void)
98{
Shashank Mittal37040832010-08-24 15:57:57 -070099 struct fbcon_config *fb_cfg;
Chandan Uddarajuc009e4d2010-09-08 17:06:45 -0700100
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 Mittal37040832010-08-24 15:57:57 -0700111 mdp_clock_init(122880000);
112 fb_cfg = lcdc_init();
113 panel_poweron();
114 fbcon_setup(fb_cfg);
115#endif
Ajay Dudani232ce812009-12-02 00:14:11 -0800116}
Shashank Mittal58317a72010-10-11 17:02:57 -0700117
118void display_shutdown(void)
119{
120#if DISPLAY_TYPE_LCDC
121 /* Turning off LCDC */
122 lcdc_shutdown();
123#endif
124}
125