blob: ac611eb10accaf1e5fb8654d5b0b76574e384bfc [file] [log] [blame]
Ajay Singh Parmar6cf16292015-02-13 17:13:38 -08001/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
Channagoud Kadabi123c9722014-02-06 13:22:50 -08002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
Channagoud Kadabi608b6a72014-04-14 13:58:03 -070029#ifndef __MSM8994_CLOCK_H
30#define __MSM8994_CLOCK_H
Channagoud Kadabi123c9722014-02-06 13:22:50 -080031
32#include <clock.h>
33#include <clock_lib2.h>
34
35#define UART_DM_CLK_RX_TX_BIT_RATE 0xCC
36
Channagoud Kadabib4c64b82014-07-24 17:18:46 -070037#define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off))
38
39#define MDP_GDSCR REG_MM(0x2304)
40#define GDSC_POWER_ON_BIT BIT(31)
41#define GDSC_POWER_ON_STATUS_BIT BIT(29)
42#define GDSC_EN_FEW_WAIT_MASK (0x0F << 16)
43#define GDSC_EN_FEW_WAIT_256_MASK BIT(19)
44
45#define VSYNC_CMD_RCGR REG_MM(0x2080)
46#define VSYNC_CFG_RCGR REG_MM(0x2084)
47#define MDSS_VSYNC_CBCR REG_MM(0x2328)
48#define MDP_CMD_RCGR REG_MM(0x2040)
49#define MDP_CFG_RCGR REG_MM(0x2044)
50#define MDP_CBCR REG_MM(0x231C)
51#define MDP_LUT_CBCR REG_MM(0x2320)
52#define MDP_AHB_CBCR REG_MM(0x2308)
Ajay Singh Parmar6cf16292015-02-13 17:13:38 -080053#define MDSS_HDMI_AHB_CBCR REG_MM(0x230C)
54#define MDSS_HDMI_CBCR REG_MM(0x2338)
55#define MDSS_EXTPCLK_CBCR REG_MM(0x2324)
56#define EXTPCLK_CMD_RCGR REG_MM(0x2060)
57#define EXTPCLK_CFG_RCGR REG_MM(0x2064)
58#define HDMI_CMD_RCGR REG_MM(0x2100)
59#define HDMI_CFG_RCGR REG_MM(0x2104)
Channagoud Kadabib4c64b82014-07-24 17:18:46 -070060
61#define MDP_AXI_CMD_RCGR REG_MM(0x5040)
62#define MDP_AXI_CFG_RCGR REG_MM(0x5044)
63
64#define MDP_AXI_CBCR REG_MM(0x2310)
65#define MMSS_S0_AXI_CBCR REG_MM(0x5064)
66#define MMSS_MMSSNOC_AXI_CBCR REG_MM(0x506C)
67
68#define DSI_BYTE0_CMD_RCGR REG_MM(0x2120)
69#define DSI_BYTE0_CFG_RCGR REG_MM(0x2124)
70#define DSI_BYTE0_CBCR REG_MM(0x233C)
71#define DSI_ESC0_CMD_RCGR REG_MM(0x2160)
72#define DSI_ESC0_CFG_RCGR REG_MM(0x2164)
73#define DSI_ESC0_CBCR REG_MM(0x2344)
74#define DSI_PIXEL0_CMD_RCGR REG_MM(0x2000)
75#define DSI_PIXEL0_CFG_RCGR REG_MM(0x2004)
76#define DSI_PIXEL0_CBCR REG_MM(0x2314)
77#define DSI_PIXEL0_M REG_MM(0x2008)
78#define DSI_PIXEL0_N REG_MM(0x200C)
79#define DSI_PIXEL0_D REG_MM(0x2010)
80
81#define DSI0_PHY_PLL_OUT BIT(8)
Padmanabhan Komanduru3ccc0552015-04-27 16:46:33 -070082#define DSI1_PHY_PLL_OUT BIT(9)
Channagoud Kadabib4c64b82014-07-24 17:18:46 -070083#define PIXEL_SRC_DIV_1_5 BIT(1)
84
85#define DSI_BYTE1_CMD_RCGR REG_MM(0x2140)
86#define DSI_BYTE1_CFG_RCGR REG_MM(0x2144)
87#define DSI_BYTE1_CBCR REG_MM(0x2340)
88#define DSI_ESC1_CMD_RCGR REG_MM(0x2180)
89#define DSI_ESC1_CFG_RCGR REG_MM(0x2184)
90#define DSI_ESC1_CBCR REG_MM(0x2348)
91#define DSI_PIXEL1_CMD_RCGR REG_MM(0x2020)
92#define DSI_PIXEL1_CFG_RCGR REG_MM(0x2024)
93#define DSI_PIXEL1_CBCR REG_MM(0x2318)
94#define DSI_PIXEL1_M REG_MM(0x2028)
95#define DSI_PIXEL1_N REG_MM(0x202C)
96#define DSI_PIXEL1_D REG_MM(0x2030)
97
98#define MDSS_EDPPIXEL_CBCR REG_MM(0x232C)
99#define MDSS_EDPLINK_CBCR REG_MM(0x2330)
100#define MDSS_EDPAUX_CBCR REG_MM(0x2334)
101#define EDPPIXEL_M REG_MM(0x20A8)
102#define EDPPIXEL_N REG_MM(0x20AC)
103#define EDPPIXEL_D REG_MM(0x20B0)
104#define EDPPIXEL_CFG_RCGR REG_MM(0x20A4)
105#define EDPPIXEL_CMD_RCGR REG_MM(0x20A0)
106#define EDPLINK_CFG_RCGR REG_MM(0x20C4)
107#define EDPLINK_CMD_RCGR REG_MM(0x20C0)
108#define EDPAUX_CFG_RCGR REG_MM(0x20E4)
109#define EDPAUX_CMD_RCGR REG_MM(0x20E0)
Channagoud Kadabi123c9722014-02-06 13:22:50 -0800110
Aravind Venkateswaranf3554322014-12-08 12:03:48 -0800111#define MMSS_DSI_CLKS_FLAG_DSI0 BIT(0)
112#define MMSS_DSI_CLKS_FLAG_DSI1 BIT(1)
113
Channagoud Kadabi123c9722014-02-06 13:22:50 -0800114void platform_clock_init(void);
115
116void clock_init_mmc(uint32_t interface);
117void clock_config_mmc(uint32_t interface, uint32_t freq);
118void clock_config_uart_dm(uint8_t id);
119void hsusb_clock_init(void);
120void clock_config_ce(uint8_t instance);
121void mdp_clock_init(void);
122void clock_ce_enable(uint8_t instance);
123void clock_ce_disable(uint8_t instance);
Channagoud Kadabi3dcc4ed2014-04-10 14:59:41 -0700124void clock_usb30_init(void);
Channagoud Kadabi123c9722014-02-06 13:22:50 -0800125
Padmanabhan Komanduru3ccc0552015-04-27 16:46:33 -0700126void mmss_dsi_clock_enable(uint32_t cfg_rcgr, uint32_t dual_dsi,
Veera Sundaram Sankaranbacb4012014-12-16 18:16:44 -0800127 uint8_t pclk0_m, uint8_t pclk0_n, uint8_t pclk0_d);
128void mmss_dsi_clock_disable(uint32_t dual_dsi);
129void mmss_bus_clock_enable(void);
130void mmss_bus_clock_disable(void);
131void mdp_clock_enable(void);
132void mdp_clock_disable(void);
Casey Piper4b5cd7b2015-03-26 16:12:10 -0700133void hdmi_core_ahb_clk_enable(void);
134void hdmi_pixel_clk_enable(uint32_t rate);
135void hdmi_pixel_clk_disable(void);
136void hdmi_core_ahb_clk_disable(void);
Veera Sundaram Sankaranbacb4012014-12-16 18:16:44 -0800137
Channagoud Kadabi123c9722014-02-06 13:22:50 -0800138#endif