blob: 6ff55e2f6e32a460abb2136c0a6952df0fd847f5 [file] [log] [blame]
Dhaval Patel0f3cbeb2015-03-17 11:52:12 -07001/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
Channagoud Kadabied60a8b2014-06-27 15:35:09 -07002 *
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
29#ifndef __MSM8996_CLOCK_H
30#define __MSM8996_CLOCK_H
31
32#include <clock.h>
33#include <clock_lib2.h>
34
35#define UART_DM_CLK_RX_TX_BIT_RATE 0xCC
36
Dhaval Patel0f3cbeb2015-03-17 11:52:12 -070037#define REG_MM(off) (MSM_MMSS_CLK_CTL_BASE + (off))
38
39#define VIDEO_GDSCR REG_MM(0x1024)
40#define MMAGIC_VIDEO_GDSCR REG_MM(0x119c)
41#define MDSS_GDSCR REG_MM(0x2304)
42#define MMAGIC_MDSS_GDSCR REG_MM(0x247C)
43#define MMAGIC_BIMC_GDSCR REG_MM(0x529C)
44#define GDSC_POWER_ON_BIT BIT(31)
45#define GDSC_EN_FEW_WAIT_MASK (0x0F << 16)
46#define GDSC_EN_FEW_WAIT_256_MASK BIT(19)
47
48#define VSYNC_CMD_RCGR REG_MM(0x2080)
49#define VSYNC_CFG_RCGR REG_MM(0x2084)
50#define MDSS_VSYNC_CBCR REG_MM(0x2328)
51#define MDP_CMD_RCGR REG_MM(0x2040)
52#define MDP_CFG_RCGR REG_MM(0x2044)
53#define MDP_CBCR REG_MM(0x231C)
54
55#define MMSS_AHB_CMD_RCGR REG_MM(0x5000)
56#define MMSS_AHB_CFG_RCGR REG_MM(0x5004)
57
58#define MMSS_MMAGIC_AHB_CBCR REG_MM(0x5024)
59#define SMMU_MDP_AHB_CBCR REG_MM(0x2454)
60#define MDSS_AHB_CBCR REG_MM(0x2308)
61
62#define AXI_CMD_RCGR REG_MM(0x5040)
63#define AXI_CFG_RCGR REG_MM(0x5044)
64#define MMSS_S0_AXI_CBCR REG_MM(0x5064)
65#define MMSS_MMAGIC_AXI_CBCR REG_MM(0x506C)
66#define MMAGIC_MDSS_AXI_CBCR REG_MM(0x2474)
67#define MMAGIC_BIMC_AXI_CBCR REG_MM(0x5294)
68#define SMMU_MDP_AXI_CBCR REG_MM(0x2458)
69#define MDSS_AXI_CBCR REG_MM(0x2310)
70
71#define DSI_BYTE0_CMD_RCGR REG_MM(0x2120)
72#define DSI_BYTE0_CFG_RCGR REG_MM(0x2124)
73#define DSI_BYTE0_CBCR REG_MM(0x233C)
74#define DSI_ESC0_CMD_RCGR REG_MM(0x2160)
75#define DSI_ESC0_CFG_RCGR REG_MM(0x2164)
76#define DSI_ESC0_CBCR REG_MM(0x2344)
77#define DSI_PIXEL0_CMD_RCGR REG_MM(0x2000)
78#define DSI_PIXEL0_CFG_RCGR REG_MM(0x2004)
79#define DSI_PIXEL0_CBCR REG_MM(0x2314)
80#define DSI_PIXEL0_M REG_MM(0x2008)
81#define DSI_PIXEL0_N REG_MM(0x200C)
82#define DSI_PIXEL0_D REG_MM(0x2010)
83
84#define DSI0_PHY_PLL_OUT BIT(8)
Aravind Venkateswaran9586be62015-05-20 00:51:06 -070085#define DSI1_PHY_PLL_OUT BIT(9)
Dhaval Patel0f3cbeb2015-03-17 11:52:12 -070086#define PIXEL_SRC_DIV_1_5 BIT(1)
87
88#define DSI_BYTE1_CMD_RCGR REG_MM(0x2140)
89#define DSI_BYTE1_CFG_RCGR REG_MM(0x2144)
90#define DSI_BYTE1_CBCR REG_MM(0x2340)
91#define DSI_ESC1_CMD_RCGR REG_MM(0x2180)
92#define DSI_ESC1_CFG_RCGR REG_MM(0x2184)
93#define DSI_ESC1_CBCR REG_MM(0x2348)
94#define DSI_PIXEL1_CMD_RCGR REG_MM(0x2020)
95#define DSI_PIXEL1_CFG_RCGR REG_MM(0x2024)
96#define DSI_PIXEL1_CBCR REG_MM(0x2318)
97#define DSI_PIXEL1_M REG_MM(0x2028)
98#define DSI_PIXEL1_N REG_MM(0x202C)
99#define DSI_PIXEL1_D REG_MM(0x2030)
100
101#define MMSS_DSI_CLKS_FLAG_DSI0 BIT(0)
102#define MMSS_DSI_CLKS_FLAG_DSI1 BIT(1)
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700103
104void platform_clock_init(void);
105
106void clock_init_mmc(uint32_t interface);
107void clock_config_mmc(uint32_t interface, uint32_t freq);
108void clock_config_uart_dm(uint8_t id);
109void hsusb_clock_init(void);
110void clock_config_ce(uint8_t instance);
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700111void clock_ce_enable(uint8_t instance);
112void clock_ce_disable(uint8_t instance);
113void clock_usb30_init(void);
Tanya Finkel0df43632016-05-31 13:02:35 +0300114void clock_usb20_init(void);
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700115void clock_reset_usb_phy();
116
Aravind Venkateswaran9586be62015-05-20 00:51:06 -0700117void mmss_dsi_clock_enable(uint32_t cfg_rcgr, uint32_t dual_dsi);
Dhaval Patel0f3cbeb2015-03-17 11:52:12 -0700118void mmss_dsi_clock_disable(uint32_t dual_dsi);
119void mmss_bus_clock_enable(void);
120void mmss_bus_clock_disable(void);
121void mdp_clock_enable(void);
122void mdp_clock_disable(void);
123void mmss_gdsc_enable();
124void mmss_gdsc_disable();
125void video_gdsc_enable();
126void video_gdsc_disable();
Siddharth Zaveri1cf08b92015-12-02 17:09:14 -0500127void clock_config_blsp_i2c(uint8_t blsp_id, uint8_t qup_id);
Dhaval Patel0f3cbeb2015-03-17 11:52:12 -0700128
Channagoud Kadabied60a8b2014-06-27 15:35:09 -0700129#endif