disp: msm: dsi: add new PHY and PLL version files
Change adds the new files for DSI PHY version 5 and 4nm DSI PLL. Change-Id: I97712d6ce53a60a6fae1c8331b6ba9a5d17b8d34 Signed-off-by: Shashank Babu Chinta Venkata <quic_schintav@quicinc.com>
Bu işleme şunda yer alıyor:
@@ -198,11 +198,13 @@ msm_drm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi_phy.o \
|
||||
dsi/dsi_phy.o \
|
||||
dsi/dsi_phy_hw_v3_0.o \
|
||||
dsi/dsi_phy_hw_v4_0.o \
|
||||
dsi/dsi_phy_hw_v5_0.o \
|
||||
dsi/dsi_phy_timing_calc.o \
|
||||
dsi/dsi_phy_timing_v3_0.o \
|
||||
dsi/dsi_phy_timing_v4_0.o \
|
||||
dsi/dsi_pll.o \
|
||||
dsi/dsi_pll_5nm.o \
|
||||
dsi/dsi_pll_4nm.o \
|
||||
dsi/dsi_ctrl_hw_cmn.o \
|
||||
dsi/dsi_ctrl_hw_2_2.o \
|
||||
dsi/dsi_ctrl.o \
|
||||
|
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
@@ -231,6 +232,35 @@ static void dsi_catalog_phy_4_0_init(struct dsi_phy_hw *phy)
|
||||
phy->ops.commit_phy_timing = dsi_phy_hw_v4_0_commit_phy_timing;
|
||||
}
|
||||
|
||||
/**
|
||||
* dsi_catalog_phy_5_0_init() - catalog init for DSI PHY 7nm
|
||||
*/
|
||||
static void dsi_catalog_phy_5_0_init(struct dsi_phy_hw *phy)
|
||||
{
|
||||
phy->ops.regulator_enable = NULL;
|
||||
phy->ops.regulator_disable = NULL;
|
||||
phy->ops.enable = dsi_phy_hw_v5_0_enable;
|
||||
phy->ops.disable = dsi_phy_hw_v5_0_disable;
|
||||
phy->ops.calculate_timing_params = dsi_phy_hw_calculate_timing_params;
|
||||
phy->ops.ulps_ops.wait_for_lane_idle = dsi_phy_hw_v5_0_wait_for_lane_idle;
|
||||
phy->ops.ulps_ops.ulps_request = dsi_phy_hw_v5_0_ulps_request;
|
||||
phy->ops.ulps_ops.ulps_exit = dsi_phy_hw_v5_0_ulps_exit;
|
||||
phy->ops.ulps_ops.get_lanes_in_ulps = dsi_phy_hw_v5_0_get_lanes_in_ulps;
|
||||
phy->ops.ulps_ops.is_lanes_in_ulps = dsi_phy_hw_v5_0_is_lanes_in_ulps;
|
||||
phy->ops.phy_timing_val = dsi_phy_hw_timing_val_v5_0;
|
||||
phy->ops.phy_lane_reset = dsi_phy_hw_v5_0_lane_reset;
|
||||
phy->ops.toggle_resync_fifo = dsi_phy_hw_v5_0_toggle_resync_fifo;
|
||||
phy->ops.reset_clk_en_sel = dsi_phy_hw_v5_0_reset_clk_en_sel;
|
||||
|
||||
phy->ops.dyn_refresh_ops.dyn_refresh_config = dsi_phy_hw_v5_0_dyn_refresh_config;
|
||||
phy->ops.dyn_refresh_ops.dyn_refresh_pipe_delay = dsi_phy_hw_v5_0_dyn_refresh_pipe_delay;
|
||||
phy->ops.dyn_refresh_ops.dyn_refresh_helper = dsi_phy_hw_v5_0_dyn_refresh_helper;
|
||||
phy->ops.dyn_refresh_ops.dyn_refresh_trigger_sel = dsi_phy_hw_v5_0_dyn_refresh_trigger_sel;
|
||||
phy->ops.dyn_refresh_ops.cache_phy_timings = dsi_phy_hw_v5_0_cache_phy_timings;
|
||||
phy->ops.set_continuous_clk = dsi_phy_hw_v5_0_set_continuous_clk;
|
||||
phy->ops.commit_phy_timing = dsi_phy_hw_v5_0_commit_phy_timing;
|
||||
}
|
||||
|
||||
/**
|
||||
* dsi_catalog_phy_setup() - return catalog info for dsi phy hardware
|
||||
* @ctrl: Pointer to DSI PHY hw object.
|
||||
@@ -267,9 +297,11 @@ int dsi_catalog_phy_setup(struct dsi_phy_hw *phy,
|
||||
case DSI_PHY_VERSION_4_1:
|
||||
case DSI_PHY_VERSION_4_2:
|
||||
case DSI_PHY_VERSION_4_3:
|
||||
case DSI_PHY_VERSION_5_2:
|
||||
dsi_catalog_phy_4_0_init(phy);
|
||||
break;
|
||||
case DSI_PHY_VERSION_5_2:
|
||||
dsi_catalog_phy_5_0_init(phy);
|
||||
break;
|
||||
default:
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
@@ -291,6 +323,10 @@ int dsi_catalog_phy_pll_setup(struct dsi_phy_hw *phy, u32 pll_ver)
|
||||
phy->ops.configure = dsi_pll_5nm_configure;
|
||||
phy->ops.pll_toggle = dsi_pll_5nm_toggle;
|
||||
break;
|
||||
case DSI_PLL_VERSION_4NM:
|
||||
phy->ops.configure = dsi_pll_4nm_configure;
|
||||
phy->ops.pll_toggle = dsi_pll_4nm_toggle;
|
||||
break;
|
||||
default:
|
||||
phy->ops.configure = NULL;
|
||||
phy->ops.pll_toggle = NULL;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _DSI_CATALOG_H_
|
||||
@@ -126,6 +127,24 @@ void dsi_phy_hw_v4_0_set_continuous_clk(struct dsi_phy_hw *phy, bool enable);
|
||||
void dsi_phy_hw_v4_0_commit_phy_timing(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_per_lane_cfgs *timing);
|
||||
|
||||
/* Definitions for 4nm PHY hardware driver */
|
||||
void dsi_phy_hw_v5_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
|
||||
void dsi_phy_hw_v5_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
|
||||
int dsi_phy_hw_v5_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
|
||||
void dsi_phy_hw_v5_0_ulps_request(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg, u32 lanes);
|
||||
void dsi_phy_hw_v5_0_ulps_exit(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg, u32 lanes);
|
||||
u32 dsi_phy_hw_v5_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
|
||||
bool dsi_phy_hw_v5_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
|
||||
int dsi_phy_hw_timing_val_v5_0(struct dsi_phy_per_lane_cfgs *timing_cfg, u32 *timing_val,
|
||||
u32 size);
|
||||
int dsi_phy_hw_v5_0_lane_reset(struct dsi_phy_hw *phy);
|
||||
void dsi_phy_hw_v5_0_toggle_resync_fifo(struct dsi_phy_hw *phy);
|
||||
void dsi_phy_hw_v5_0_reset_clk_en_sel(struct dsi_phy_hw *phy);
|
||||
void dsi_phy_hw_v5_0_set_continuous_clk(struct dsi_phy_hw *phy, bool enable);
|
||||
void dsi_phy_hw_v5_0_commit_phy_timing(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_per_lane_cfgs *timing);
|
||||
|
||||
/* DSI controller common ops */
|
||||
u32 dsi_ctrl_hw_cmn_get_interrupt_status(struct dsi_ctrl_hw *ctrl);
|
||||
u32 dsi_ctrl_hw_cmn_poll_dma_status(struct dsi_ctrl_hw *ctrl);
|
||||
@@ -279,6 +298,16 @@ void dsi_phy_hw_v4_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy,
|
||||
int dsi_phy_hw_v4_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
|
||||
u32 *dst, u32 size);
|
||||
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_trigger_sel(struct dsi_phy_hw *phy,
|
||||
bool is_master);
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_helper(struct dsi_phy_hw *phy, u32 offset);
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_config(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg, bool is_master);
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy,
|
||||
struct dsi_dyn_clk_delay *delay);
|
||||
|
||||
int dsi_phy_hw_v5_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
|
||||
u32 *dst, u32 size);
|
||||
void dsi_ctrl_hw_22_configure_cmddma_window(struct dsi_ctrl_hw *ctrl,
|
||||
struct dsi_ctrl_cmd_dma_info *cmd,
|
||||
u32 line_no, u32 window);
|
||||
@@ -290,6 +319,8 @@ u32 dsi_ctrl_hw_22_log_line_count(struct dsi_ctrl_hw *ctrl, bool cmd_mode);
|
||||
int dsi_catalog_phy_pll_setup(struct dsi_phy_hw *phy, u32 pll_ver);
|
||||
int dsi_pll_5nm_configure(void *pll, bool commit);
|
||||
int dsi_pll_5nm_toggle(void *pll, bool prepare);
|
||||
int dsi_pll_4nm_configure(void *pll, bool commit);
|
||||
int dsi_pll_4nm_toggle(void *pll, bool prepare);
|
||||
|
||||
void dsi_ctrl_hw_22_configure_splitlink(struct dsi_ctrl_hw *ctrl,
|
||||
struct dsi_host_common_cfg *common_cfg, u32 sublink);
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _DSI_PHY_HW_H_
|
||||
@@ -50,11 +51,13 @@ enum dsi_phy_version {
|
||||
|
||||
/**
|
||||
* enum dsi_pll_version - DSI PHY PLL version enumeration
|
||||
* @DSI_PLL_VERSION_4NM: 4nm PLL
|
||||
* @DSI_PLL_VERSION_5NM: 5nm PLL
|
||||
* @DSI_PLL_VERSION_10NM: 10nm PLL
|
||||
* @DSI_PLL_VERSION_UNKNOWN: Unknown PLL version
|
||||
*/
|
||||
enum dsi_pll_version {
|
||||
DSI_PLL_VERSION_4NM,
|
||||
DSI_PLL_VERSION_5NM,
|
||||
DSI_PLL_VERSION_10NM,
|
||||
DSI_PLL_VERSION_UNKNOWN
|
||||
|
881
msm/dsi/dsi_phy_hw_v5_0.c
Normal dosya
881
msm/dsi/dsi_phy_hw_v5_0.c
Normal dosya
@@ -0,0 +1,881 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/math64.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include "dsi_hw.h"
|
||||
#include "dsi_defs.h"
|
||||
#include "dsi_phy_hw.h"
|
||||
#include "dsi_catalog.h"
|
||||
|
||||
#define DSIPHY_CMN_REVISION_ID0 0x000
|
||||
#define DSIPHY_CMN_REVISION_ID1 0x004
|
||||
#define DSIPHY_CMN_REVISION_ID2 0x008
|
||||
#define DSIPHY_CMN_REVISION_ID3 0x00C
|
||||
#define DSIPHY_CMN_CLK_CFG0 0x010
|
||||
#define DSIPHY_CMN_CLK_CFG1 0x014
|
||||
#define DSIPHY_CMN_GLBL_CTRL 0x018
|
||||
#define DSIPHY_CMN_RBUF_CTRL 0x01C
|
||||
#define DSIPHY_CMN_VREG_CTRL_0 0x020
|
||||
#define DSIPHY_CMN_CTRL_0 0x024
|
||||
#define DSIPHY_CMN_CTRL_1 0x028
|
||||
#define DSIPHY_CMN_CTRL_2 0x02C
|
||||
#define DSIPHY_CMN_CTRL_3 0x030
|
||||
#define DSIPHY_CMN_LANE_CFG0 0x034
|
||||
#define DSIPHY_CMN_LANE_CFG1 0x038
|
||||
#define DSIPHY_CMN_PLL_CNTRL 0x03C
|
||||
#define DSIPHY_CMN_DPHY_SOT 0x040
|
||||
#define DSIPHY_CMN_LANE_CTRL0 0x0A0
|
||||
#define DSIPHY_CMN_LANE_CTRL1 0x0A4
|
||||
#define DSIPHY_CMN_LANE_CTRL2 0x0A8
|
||||
#define DSIPHY_CMN_LANE_CTRL3 0x0AC
|
||||
#define DSIPHY_CMN_LANE_CTRL4 0x0B0
|
||||
#define DSIPHY_CMN_TIMING_CTRL_0 0x0B4
|
||||
#define DSIPHY_CMN_TIMING_CTRL_1 0x0B8
|
||||
#define DSIPHY_CMN_TIMING_CTRL_2 0x0Bc
|
||||
#define DSIPHY_CMN_TIMING_CTRL_3 0x0C0
|
||||
#define DSIPHY_CMN_TIMING_CTRL_4 0x0C4
|
||||
#define DSIPHY_CMN_TIMING_CTRL_5 0x0C8
|
||||
#define DSIPHY_CMN_TIMING_CTRL_6 0x0CC
|
||||
#define DSIPHY_CMN_TIMING_CTRL_7 0x0D0
|
||||
#define DSIPHY_CMN_TIMING_CTRL_8 0x0D4
|
||||
#define DSIPHY_CMN_TIMING_CTRL_9 0x0D8
|
||||
#define DSIPHY_CMN_TIMING_CTRL_10 0x0DC
|
||||
#define DSIPHY_CMN_TIMING_CTRL_11 0x0E0
|
||||
#define DSIPHY_CMN_TIMING_CTRL_12 0x0E4
|
||||
#define DSIPHY_CMN_TIMING_CTRL_13 0x0E8
|
||||
#define DSIPHY_CMN_GLBL_HSTX_STR_CTRL_0 0x0EC
|
||||
#define DSIPHY_CMN_GLBL_HSTX_STR_CTRL_1 0x0F0
|
||||
#define DSIPHY_CMN_GLBL_RESCODE_OFFSET_TOP_CTRL 0x0F4
|
||||
#define DSIPHY_CMN_GLBL_RESCODE_OFFSET_BOT_CTRL 0x0F8
|
||||
#define DSIPHY_CMN_GLBL_RESCODE_OFFSET_MID_CTRL 0x0FC
|
||||
#define DSIPHY_CMN_GLBL_LPTX_STR_CTRL 0x100
|
||||
#define DSIPHY_CMN_GLBL_PEMPH_CTRL_0 0x104
|
||||
#define DSIPHY_CMN_GLBL_PEMPH_CTRL_1 0x108
|
||||
#define DSIPHY_CMN_GLBL_STR_SWI_CAL_SEL_CTRL 0x10C
|
||||
#define DSIPHY_CMN_VREG_CTRL_1 0x110
|
||||
#define DSIPHY_CMN_CTRL_4 0x114
|
||||
#define DSIPHY_CMN_PHY_STATUS 0x140
|
||||
#define DSIPHY_CMN_LANE_STATUS0 0x148
|
||||
#define DSIPHY_CMN_LANE_STATUS1 0x14C
|
||||
#define DSIPHY_CMN_GLBL_DIGTOP_SPARE10 0x1AC
|
||||
#define DSIPHY_CMN_SL_DSI_LANE_CTRL1 0x1B4
|
||||
|
||||
/* n = 0..3 for data lanes and n = 4 for clock lane */
|
||||
#define DSIPHY_LNX_CFG0(n) (0x200 + (0x80 * (n)))
|
||||
#define DSIPHY_LNX_CFG1(n) (0x204 + (0x80 * (n)))
|
||||
#define DSIPHY_LNX_CFG2(n) (0x208 + (0x80 * (n)))
|
||||
#define DSIPHY_LNX_TEST_DATAPATH(n) (0x20C + (0x80 * (n)))
|
||||
#define DSIPHY_LNX_PIN_SWAP(n) (0x210 + (0x80 * (n)))
|
||||
#define DSIPHY_LNX_LPRX_CTRL(n) (0x214 + (0x80 * (n)))
|
||||
#define DSIPHY_LNX_TX_DCTRL(n) (0x218 + (0x80 * (n)))
|
||||
|
||||
/* dynamic refresh control registers */
|
||||
#define DSI_DYN_REFRESH_CTRL (0x000)
|
||||
#define DSI_DYN_REFRESH_PIPE_DELAY (0x004)
|
||||
#define DSI_DYN_REFRESH_PIPE_DELAY2 (0x008)
|
||||
#define DSI_DYN_REFRESH_PLL_DELAY (0x00C)
|
||||
#define DSI_DYN_REFRESH_STATUS (0x010)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL0 (0x014)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL1 (0x018)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL2 (0x01C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL3 (0x020)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL4 (0x024)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL5 (0x028)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL6 (0x02C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL7 (0x030)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL8 (0x034)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL9 (0x038)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL10 (0x03C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL11 (0x040)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL12 (0x044)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL13 (0x048)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL14 (0x04C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL15 (0x050)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL16 (0x054)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL17 (0x058)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL18 (0x05C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL19 (0x060)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL20 (0x064)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL21 (0x068)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL22 (0x06C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL23 (0x070)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL24 (0x074)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL25 (0x078)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL26 (0x07C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL27 (0x080)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL28 (0x084)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL29 (0x088)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL30 (0x08C)
|
||||
#define DSI_DYN_REFRESH_PLL_CTRL31 (0x090)
|
||||
#define DSI_DYN_REFRESH_PLL_UPPER_ADDR (0x094)
|
||||
#define DSI_DYN_REFRESH_PLL_UPPER_ADDR2 (0x098)
|
||||
|
||||
static int dsi_phy_hw_v5_0_is_pll_on(struct dsi_phy_hw *phy)
|
||||
{
|
||||
u32 data = 0;
|
||||
|
||||
data = DSI_R32(phy, DSIPHY_CMN_PLL_CNTRL);
|
||||
mb(); /*make sure read happened */
|
||||
return (data & BIT(0));
|
||||
}
|
||||
|
||||
static bool dsi_phy_hw_v5_0_is_split_link_enabled(struct dsi_phy_hw *phy)
|
||||
{
|
||||
u32 reg = 0;
|
||||
|
||||
reg = DSI_R32(phy, DSIPHY_CMN_GLBL_CTRL);
|
||||
mb(); /*make sure read happened */
|
||||
return (reg & BIT(5));
|
||||
}
|
||||
|
||||
static void dsi_phy_hw_v5_0_config_lpcdrx(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg, bool enable)
|
||||
{
|
||||
int phy_lane_0 = dsi_phy_conv_logical_to_phy_lane(&cfg->lane_map, DSI_LOGICAL_LANE_0);
|
||||
|
||||
/*
|
||||
* LPRX and CDRX need to enabled only for physical data lane
|
||||
* corresponding to the logical data lane 0
|
||||
*/
|
||||
|
||||
if (enable)
|
||||
DSI_W32(phy, DSIPHY_LNX_LPRX_CTRL(phy_lane_0), cfg->strength.lane[phy_lane_0][1]);
|
||||
else
|
||||
DSI_W32(phy, DSIPHY_LNX_LPRX_CTRL(phy_lane_0), 0);
|
||||
}
|
||||
|
||||
static void dsi_phy_hw_v5_0_lane_swap_config(struct dsi_phy_hw *phy,
|
||||
struct dsi_lane_map *lane_map)
|
||||
{
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CFG0,
|
||||
(lane_map->lane_map_v2[DSI_LOGICAL_LANE_0] |
|
||||
(lane_map->lane_map_v2[DSI_LOGICAL_LANE_1] << 4)));
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CFG1,
|
||||
(lane_map->lane_map_v2[DSI_LOGICAL_LANE_2] |
|
||||
(lane_map->lane_map_v2[DSI_LOGICAL_LANE_3] << 4)));
|
||||
}
|
||||
|
||||
static void dsi_phy_hw_v5_0_lane_settings(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg)
|
||||
{
|
||||
int i;
|
||||
u8 tx_dctrl[] = {0x40, 0x40, 0x40, 0x46, 0x41};
|
||||
bool split_link_enabled;
|
||||
u32 lanes_per_sublink;
|
||||
|
||||
split_link_enabled = cfg->split_link.enabled;
|
||||
lanes_per_sublink = cfg->split_link.lanes_per_sublink;
|
||||
|
||||
/* Strength ctrl settings */
|
||||
for (i = DSI_LOGICAL_LANE_0; i < DSI_LANE_MAX; i++) {
|
||||
/*
|
||||
* Disable LPRX and CDRX for all lanes. And later on, it will
|
||||
* be only enabled for the physical data lane corresponding
|
||||
* to the logical data lane 0
|
||||
*/
|
||||
DSI_W32(phy, DSIPHY_LNX_LPRX_CTRL(i), 0);
|
||||
DSI_W32(phy, DSIPHY_LNX_PIN_SWAP(i), 0x0);
|
||||
}
|
||||
dsi_phy_hw_v5_0_config_lpcdrx(phy, cfg, true);
|
||||
|
||||
/* other settings */
|
||||
for (i = DSI_LOGICAL_LANE_0; i < DSI_LANE_MAX; i++) {
|
||||
DSI_W32(phy, DSIPHY_LNX_CFG0(i), cfg->lanecfg.lane[i][0]);
|
||||
DSI_W32(phy, DSIPHY_LNX_CFG1(i), cfg->lanecfg.lane[i][1]);
|
||||
DSI_W32(phy, DSIPHY_LNX_CFG2(i), cfg->lanecfg.lane[i][2]);
|
||||
DSI_W32(phy, DSIPHY_LNX_TX_DCTRL(i), tx_dctrl[i]);
|
||||
}
|
||||
|
||||
/* remove below check if cphy splitlink is enabled */
|
||||
if (split_link_enabled && (cfg->phy_type == DSI_PHY_TYPE_CPHY))
|
||||
return;
|
||||
|
||||
/* Configure the splitlink clock lane with clk lane settings */
|
||||
if (split_link_enabled) {
|
||||
DSI_W32(phy, DSIPHY_LNX_LPRX_CTRL(5), 0x0);
|
||||
DSI_W32(phy, DSIPHY_LNX_PIN_SWAP(5), 0x0);
|
||||
DSI_W32(phy, DSIPHY_LNX_CFG0(5), cfg->lanecfg.lane[4][0]);
|
||||
DSI_W32(phy, DSIPHY_LNX_CFG1(5), cfg->lanecfg.lane[4][1]);
|
||||
DSI_W32(phy, DSIPHY_LNX_CFG2(5), cfg->lanecfg.lane[4][2]);
|
||||
DSI_W32(phy, DSIPHY_LNX_TX_DCTRL(5), tx_dctrl[4]);
|
||||
}
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_commit_phy_timing(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_per_lane_cfgs *timing)
|
||||
{
|
||||
/* Commit DSI PHY timings */
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_0, timing->lane_v4[0]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_1, timing->lane_v4[1]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_2, timing->lane_v4[2]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_3, timing->lane_v4[3]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_4, timing->lane_v4[4]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_5, timing->lane_v4[5]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_6, timing->lane_v4[6]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_7, timing->lane_v4[7]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_8, timing->lane_v4[8]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_9, timing->lane_v4[9]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_10, timing->lane_v4[10]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_11, timing->lane_v4[11]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_12, timing->lane_v4[12]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_13, timing->lane_v4[13]);
|
||||
}
|
||||
|
||||
/**
|
||||
* cphy_enable() - Enable CPHY hardware
|
||||
* @phy: Pointer to DSI PHY hardware object.
|
||||
* @cfg: Per lane configurations for timing, strength and lane
|
||||
* configurations.
|
||||
*/
|
||||
static void dsi_phy_hw_cphy_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg)
|
||||
{
|
||||
struct dsi_phy_per_lane_cfgs *timing = &cfg->timing;
|
||||
u32 data;
|
||||
/* For C-PHY, no low power settings for lower clk rate */
|
||||
u32 glbl_str_swi_cal_sel_ctrl = 0;
|
||||
u32 glbl_hstx_str_ctrl_0 = 0;
|
||||
|
||||
/* de-assert digital and pll power down */
|
||||
data = BIT(6) | BIT(5);
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, data);
|
||||
|
||||
/* Assert PLL core reset */
|
||||
DSI_W32(phy, DSIPHY_CMN_PLL_CNTRL, 0x00);
|
||||
|
||||
/* turn off resync FIFO */
|
||||
DSI_W32(phy, DSIPHY_CMN_RBUF_CTRL, 0x00);
|
||||
|
||||
/* program CMN_CTRL_4 for minor_ver greater than 2 chipsets*/
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_4, 0x04);
|
||||
|
||||
/* Configure PHY lane swap */
|
||||
dsi_phy_hw_v5_0_lane_swap_config(phy, &cfg->lane_map);
|
||||
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_CTRL, BIT(6));
|
||||
|
||||
/* Enable LDO */
|
||||
DSI_W32(phy, DSIPHY_CMN_VREG_CTRL_0, 0x45);
|
||||
DSI_W32(phy, DSIPHY_CMN_VREG_CTRL_1, 0x41);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_STR_SWI_CAL_SEL_CTRL, glbl_str_swi_cal_sel_ctrl);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_HSTX_STR_CTRL_0, glbl_hstx_str_ctrl_0);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_PEMPH_CTRL_0, 0x11);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_PEMPH_CTRL_1, 0x01);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_RESCODE_OFFSET_TOP_CTRL, 0x00);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_RESCODE_OFFSET_BOT_CTRL, 0x00);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_LPTX_STR_CTRL, 0x55);
|
||||
|
||||
/* Remove power down from all blocks */
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, 0x7f);
|
||||
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL0, 0x17);
|
||||
|
||||
switch (cfg->pll_source) {
|
||||
case DSI_PLL_SOURCE_STANDALONE:
|
||||
case DSI_PLL_SOURCE_NATIVE:
|
||||
data = 0x0; /* internal PLL */
|
||||
break;
|
||||
case DSI_PLL_SOURCE_NON_NATIVE:
|
||||
data = 0x1; /* external PLL */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DSI_W32(phy, DSIPHY_CMN_CLK_CFG1, (data << 2)); /* set PLL src */
|
||||
|
||||
/* DSI PHY timings */
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_0, timing->lane_v4[0]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_4, timing->lane_v4[4]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_5, timing->lane_v4[5]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_6, timing->lane_v4[6]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_7, timing->lane_v4[7]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_8, timing->lane_v4[8]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_9, timing->lane_v4[9]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_10, timing->lane_v4[10]);
|
||||
DSI_W32(phy, DSIPHY_CMN_TIMING_CTRL_11, timing->lane_v4[11]);
|
||||
|
||||
/* DSI lane settings */
|
||||
dsi_phy_hw_v5_0_lane_settings(phy, cfg);
|
||||
|
||||
DSI_PHY_DBG(phy, "C-Phy enabled\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* dphy_enable() - Enable DPHY hardware
|
||||
* @phy: Pointer to DSI PHY hardware object.
|
||||
* @cfg: Per lane configurations for timing, strength and lane
|
||||
* configurations.
|
||||
*/
|
||||
static void dsi_phy_hw_dphy_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg)
|
||||
{
|
||||
struct dsi_phy_per_lane_cfgs *timing = &cfg->timing;
|
||||
u32 data;
|
||||
bool less_than_1500_mhz = false;
|
||||
u32 vreg_ctrl_0 = 0;
|
||||
u32 glbl_str_swi_cal_sel_ctrl = 0;
|
||||
u32 glbl_hstx_str_ctrl_0 = 0;
|
||||
u32 glbl_rescode_top_ctrl = 0;
|
||||
u32 glbl_rescode_bot_ctrl = 0;
|
||||
bool split_link_enabled;
|
||||
u32 lanes_per_sublink;
|
||||
|
||||
/* Alter PHY configurations if data rate less than 1.5GHZ*/
|
||||
if (cfg->bit_clk_rate_hz <= 1500000000)
|
||||
less_than_1500_mhz = true;
|
||||
|
||||
vreg_ctrl_0 = 0x44;
|
||||
glbl_rescode_top_ctrl = less_than_1500_mhz ? 0x3c : 0x03;
|
||||
glbl_rescode_bot_ctrl = less_than_1500_mhz ? 0x38 : 0x3c;
|
||||
glbl_str_swi_cal_sel_ctrl = 0x00;
|
||||
glbl_hstx_str_ctrl_0 = 0x88;
|
||||
|
||||
|
||||
split_link_enabled = cfg->split_link.enabled;
|
||||
lanes_per_sublink = cfg->split_link.lanes_per_sublink;
|
||||
/* de-assert digital and pll power down */
|
||||
data = BIT(6) | BIT(5);
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, data);
|
||||
|
||||
if (split_link_enabled) {
|
||||
data = DSI_R32(phy, DSIPHY_CMN_GLBL_CTRL);
|
||||
/* set SPLIT_LINK_ENABLE in global control */
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_CTRL, (data | BIT(5)));
|
||||
}
|
||||
/* Assert PLL core reset */
|
||||
DSI_W32(phy, DSIPHY_CMN_PLL_CNTRL, 0x00);
|
||||
|
||||
/* turn off resync FIFO */
|
||||
DSI_W32(phy, DSIPHY_CMN_RBUF_CTRL, 0x00);
|
||||
|
||||
/* program CMN_CTRL_4 for minor_ver greater than 2 chipsets*/
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_4, 0x04);
|
||||
|
||||
/* Configure PHY lane swap */
|
||||
dsi_phy_hw_v5_0_lane_swap_config(phy, &cfg->lane_map);
|
||||
|
||||
/* Enable LDO */
|
||||
DSI_W32(phy, DSIPHY_CMN_VREG_CTRL_0, vreg_ctrl_0);
|
||||
DSI_W32(phy, DSIPHY_CMN_VREG_CTRL_1, 0x19);
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_3, 0x00);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_STR_SWI_CAL_SEL_CTRL,
|
||||
glbl_str_swi_cal_sel_ctrl);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_HSTX_STR_CTRL_0, glbl_hstx_str_ctrl_0);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_PEMPH_CTRL_0, 0x00);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_RESCODE_OFFSET_TOP_CTRL,
|
||||
glbl_rescode_top_ctrl);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_RESCODE_OFFSET_BOT_CTRL,
|
||||
glbl_rescode_bot_ctrl);
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_LPTX_STR_CTRL, 0x55);
|
||||
|
||||
if (split_link_enabled) {
|
||||
if (lanes_per_sublink == 1) {
|
||||
/* remove Lane1 and Lane3 configs */
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, 0xed);
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL0, 0x35);
|
||||
} else {
|
||||
/* enable all together with sublink clock */
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, 0xff);
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL0, 0x3F);
|
||||
}
|
||||
|
||||
DSI_W32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1, 0x03);
|
||||
} else {
|
||||
/* Remove power down from all blocks */
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, 0x7f);
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL0, 0x1F);
|
||||
}
|
||||
|
||||
/* Select full-rate mode */
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_2, 0x40);
|
||||
|
||||
switch (cfg->pll_source) {
|
||||
case DSI_PLL_SOURCE_STANDALONE:
|
||||
case DSI_PLL_SOURCE_NATIVE:
|
||||
data = 0x0; /* internal PLL */
|
||||
break;
|
||||
case DSI_PLL_SOURCE_NON_NATIVE:
|
||||
data = 0x1; /* external PLL */
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
DSI_W32(phy, DSIPHY_CMN_CLK_CFG1, (data << 2)); /* set PLL src */
|
||||
|
||||
/* DSI PHY timings */
|
||||
dsi_phy_hw_v5_0_commit_phy_timing(phy, timing);
|
||||
|
||||
/* DSI lane settings */
|
||||
dsi_phy_hw_v5_0_lane_settings(phy, cfg);
|
||||
|
||||
DSI_PHY_DBG(phy, "D-Phy enabled\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* enable() - Enable PHY hardware
|
||||
* @phy: Pointer to DSI PHY hardware object.
|
||||
* @cfg: Per lane configurations for timing, strength and lane
|
||||
* configurations.
|
||||
*/
|
||||
void dsi_phy_hw_v5_0_enable(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg)
|
||||
{
|
||||
int rc = 0;
|
||||
u32 status;
|
||||
u32 const delay_us = 5;
|
||||
u32 const timeout_us = 1000;
|
||||
|
||||
if (dsi_phy_hw_v5_0_is_pll_on(phy))
|
||||
DSI_PHY_WARN(phy, "PLL turned on before configuring PHY\n");
|
||||
|
||||
/* Request for REFGEN ready */
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_DIGTOP_SPARE10, 0x1);
|
||||
udelay(500);
|
||||
|
||||
/* wait for REFGEN READY */
|
||||
rc = DSI_READ_POLL_TIMEOUT_ATOMIC(phy, DSIPHY_CMN_PHY_STATUS,
|
||||
status, (status & BIT(0)), delay_us, timeout_us);
|
||||
if (rc) {
|
||||
DSI_PHY_ERR(phy, "Ref gen not ready. Aborting\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cfg->phy_type == DSI_PHY_TYPE_CPHY)
|
||||
dsi_phy_hw_cphy_enable(phy, cfg);
|
||||
else /* Default PHY type is DPHY */
|
||||
dsi_phy_hw_dphy_enable(phy, cfg);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* disable() - Disable PHY hardware
|
||||
* @phy: Pointer to DSI PHY hardware object.
|
||||
*/
|
||||
void dsi_phy_hw_v5_0_disable(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg)
|
||||
{
|
||||
u32 data = 0;
|
||||
|
||||
if (dsi_phy_hw_v5_0_is_pll_on(phy))
|
||||
DSI_PHY_WARN(phy, "Turning OFF PHY while PLL is on\n");
|
||||
|
||||
dsi_phy_hw_v5_0_config_lpcdrx(phy, cfg, false);
|
||||
|
||||
/* Turn off REFGEN Vote */
|
||||
DSI_W32(phy, DSIPHY_CMN_GLBL_DIGTOP_SPARE10, 0x0);
|
||||
wmb();
|
||||
/* Delay to ensure HW removes vote before PHY shut down */
|
||||
udelay(2);
|
||||
|
||||
data = DSI_R32(phy, DSIPHY_CMN_CTRL_0);
|
||||
/* disable all lanes and splitlink clk lane*/
|
||||
data &= ~0x9F;
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, data);
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL0, 0);
|
||||
|
||||
/* Turn off all PHY blocks */
|
||||
DSI_W32(phy, DSIPHY_CMN_CTRL_0, 0x00);
|
||||
/* make sure phy is turned off */
|
||||
wmb();
|
||||
DSI_PHY_DBG(phy, "Phy disabled\n");
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_toggle_resync_fifo(struct dsi_phy_hw *phy)
|
||||
{
|
||||
DSI_W32(phy, DSIPHY_CMN_RBUF_CTRL, 0x00);
|
||||
/* ensure that the FIFO is off */
|
||||
wmb();
|
||||
DSI_W32(phy, DSIPHY_CMN_RBUF_CTRL, 0x1);
|
||||
/* ensure that the FIFO is toggled back on */
|
||||
wmb();
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_reset_clk_en_sel(struct dsi_phy_hw *phy)
|
||||
{
|
||||
u32 data = 0;
|
||||
|
||||
/*Turning off CLK_EN_SEL after retime buffer sync */
|
||||
data = DSI_R32(phy, DSIPHY_CMN_CLK_CFG1);
|
||||
data &= ~BIT(4);
|
||||
DSI_W32(phy, DSIPHY_CMN_CLK_CFG1, data);
|
||||
/* ensure that clk_en_sel bit is turned off */
|
||||
wmb();
|
||||
}
|
||||
|
||||
int dsi_phy_hw_v5_0_wait_for_lane_idle(
|
||||
struct dsi_phy_hw *phy, u32 lanes)
|
||||
{
|
||||
int rc = 0, val = 0;
|
||||
u32 stop_state_mask = 0;
|
||||
u32 const sleep_us = 10;
|
||||
u32 const timeout_us = 100;
|
||||
bool split_link_enabled = dsi_phy_hw_v5_0_is_split_link_enabled(phy);
|
||||
|
||||
stop_state_mask = BIT(4); /* clock lane */
|
||||
if (split_link_enabled)
|
||||
stop_state_mask |= BIT(5);
|
||||
if (lanes & DSI_DATA_LANE_0)
|
||||
stop_state_mask |= BIT(0);
|
||||
if (lanes & DSI_DATA_LANE_1)
|
||||
stop_state_mask |= BIT(1);
|
||||
if (lanes & DSI_DATA_LANE_2)
|
||||
stop_state_mask |= BIT(2);
|
||||
if (lanes & DSI_DATA_LANE_3)
|
||||
stop_state_mask |= BIT(3);
|
||||
|
||||
DSI_PHY_DBG(phy, "polling for lanes to be in stop state, mask=0x%08x\n", stop_state_mask);
|
||||
rc = DSI_READ_POLL_TIMEOUT(phy, DSIPHY_CMN_LANE_STATUS1, val,
|
||||
((val & stop_state_mask) == stop_state_mask),
|
||||
sleep_us, timeout_us);
|
||||
if (rc) {
|
||||
DSI_PHY_ERR(phy, "lanes not in stop state, LANE_STATUS=0x%08x\n", val);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_ulps_request(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg, u32 lanes)
|
||||
{
|
||||
u32 reg = 0, sl_lane_ctrl1 = 0;
|
||||
|
||||
if (lanes & DSI_CLOCK_LANE)
|
||||
reg = BIT(4);
|
||||
if (lanes & DSI_DATA_LANE_0)
|
||||
reg |= BIT(0);
|
||||
if (lanes & DSI_DATA_LANE_1)
|
||||
reg |= BIT(1);
|
||||
if (lanes & DSI_DATA_LANE_2)
|
||||
reg |= BIT(2);
|
||||
if (lanes & DSI_DATA_LANE_3)
|
||||
reg |= BIT(3);
|
||||
if (cfg->split_link.enabled)
|
||||
reg |= BIT(7);
|
||||
|
||||
if (cfg->force_clk_lane_hs) {
|
||||
reg |= BIT(5) | BIT(6);
|
||||
if (cfg->split_link.enabled) {
|
||||
sl_lane_ctrl1 = DSI_R32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1);
|
||||
sl_lane_ctrl1 |= BIT(2);
|
||||
DSI_W32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1, sl_lane_ctrl1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ULPS entry request. Wait for short time to make sure
|
||||
* that the lanes enter ULPS. Recommended as per HPG.
|
||||
*/
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL1, reg);
|
||||
usleep_range(100, 110);
|
||||
|
||||
/* disable LPRX and CDRX */
|
||||
dsi_phy_hw_v5_0_config_lpcdrx(phy, cfg, false);
|
||||
|
||||
DSI_PHY_DBG(phy, "ULPS requested for lanes 0x%x\n", lanes);
|
||||
}
|
||||
|
||||
int dsi_phy_hw_v5_0_lane_reset(struct dsi_phy_hw *phy)
|
||||
{
|
||||
int ret = 0, loop = 10, u_dly = 200;
|
||||
u32 ln_status = 0;
|
||||
|
||||
while ((ln_status != 0x1f) && loop) {
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL3, 0x1f);
|
||||
wmb(); /* ensure register is committed */
|
||||
loop--;
|
||||
udelay(u_dly);
|
||||
ln_status = DSI_R32(phy, DSIPHY_CMN_LANE_STATUS1);
|
||||
DSI_PHY_DBG(phy, "trial no: %d\n", loop);
|
||||
}
|
||||
|
||||
if (!loop)
|
||||
DSI_PHY_DBG(phy, "could not reset phy lanes\n");
|
||||
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL3, 0x0);
|
||||
wmb(); /* ensure register is committed */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_ulps_exit(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg, u32 lanes)
|
||||
{
|
||||
u32 reg = 0, sl_lane_ctrl1 = 0;
|
||||
|
||||
if (lanes & DSI_CLOCK_LANE)
|
||||
reg = BIT(4);
|
||||
if (lanes & DSI_DATA_LANE_0)
|
||||
reg |= BIT(0);
|
||||
if (lanes & DSI_DATA_LANE_1)
|
||||
reg |= BIT(1);
|
||||
if (lanes & DSI_DATA_LANE_2)
|
||||
reg |= BIT(2);
|
||||
if (lanes & DSI_DATA_LANE_3)
|
||||
reg |= BIT(3);
|
||||
if (cfg->split_link.enabled)
|
||||
reg |= BIT(5);
|
||||
|
||||
/* enable LPRX and CDRX */
|
||||
dsi_phy_hw_v5_0_config_lpcdrx(phy, cfg, true);
|
||||
|
||||
/* ULPS exit request */
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL2, reg);
|
||||
usleep_range(1000, 1010);
|
||||
|
||||
/* Clear ULPS request flags on all lanes */
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL1, 0);
|
||||
/* Clear ULPS exit flags on all lanes */
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL2, 0);
|
||||
|
||||
/*
|
||||
* Sometimes when exiting ULPS, it is possible that some DSI
|
||||
* lanes are not in the stop state which could lead to DSI
|
||||
* commands not going through. To avoid this, force the lanes
|
||||
* to be in stop state.
|
||||
*/
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL3, reg);
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL3, 0);
|
||||
usleep_range(100, 110);
|
||||
|
||||
if (cfg->force_clk_lane_hs) {
|
||||
reg = BIT(5) | BIT(6);
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL1, reg);
|
||||
if (cfg->split_link.enabled) {
|
||||
sl_lane_ctrl1 = DSI_R32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1);
|
||||
sl_lane_ctrl1 |= BIT(2);
|
||||
DSI_W32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1, sl_lane_ctrl1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 dsi_phy_hw_v5_0_get_lanes_in_ulps(struct dsi_phy_hw *phy)
|
||||
{
|
||||
u32 lanes = 0;
|
||||
|
||||
lanes = DSI_R32(phy, DSIPHY_CMN_LANE_STATUS0);
|
||||
DSI_PHY_DBG(phy, "lanes in ulps = 0x%x\n", lanes);
|
||||
return lanes;
|
||||
}
|
||||
|
||||
bool dsi_phy_hw_v5_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes)
|
||||
{
|
||||
if (lanes & ulps_lanes)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int dsi_phy_hw_timing_val_v5_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
|
||||
u32 *timing_val, u32 size)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (size != DSI_PHY_TIMING_V4_SIZE) {
|
||||
DSI_ERR("Unexpected timing array size %d\n", size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
timing_cfg->lane_v4[i] = timing_val[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_config(struct dsi_phy_hw *phy,
|
||||
struct dsi_phy_cfg *cfg, bool is_master)
|
||||
{
|
||||
u32 reg;
|
||||
bool is_cphy = (cfg->phy_type == DSI_PHY_TYPE_CPHY) ? true : false;
|
||||
|
||||
if (is_master) {
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL19,
|
||||
DSIPHY_CMN_TIMING_CTRL_0, DSIPHY_CMN_TIMING_CTRL_1,
|
||||
cfg->timing.lane_v4[0], cfg->timing.lane_v4[1]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL20,
|
||||
DSIPHY_CMN_TIMING_CTRL_2, DSIPHY_CMN_TIMING_CTRL_3,
|
||||
cfg->timing.lane_v4[2], cfg->timing.lane_v4[3]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL21,
|
||||
DSIPHY_CMN_TIMING_CTRL_4, DSIPHY_CMN_TIMING_CTRL_5,
|
||||
cfg->timing.lane_v4[4], cfg->timing.lane_v4[5]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL22,
|
||||
DSIPHY_CMN_TIMING_CTRL_6, DSIPHY_CMN_TIMING_CTRL_7,
|
||||
cfg->timing.lane_v4[6], cfg->timing.lane_v4[7]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL23,
|
||||
DSIPHY_CMN_TIMING_CTRL_8, DSIPHY_CMN_TIMING_CTRL_9,
|
||||
cfg->timing.lane_v4[8], cfg->timing.lane_v4[9]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL24,
|
||||
DSIPHY_CMN_TIMING_CTRL_10, DSIPHY_CMN_TIMING_CTRL_11,
|
||||
cfg->timing.lane_v4[10], cfg->timing.lane_v4[11]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL25,
|
||||
DSIPHY_CMN_TIMING_CTRL_12, DSIPHY_CMN_TIMING_CTRL_13,
|
||||
cfg->timing.lane_v4[12], cfg->timing.lane_v4[13]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL26,
|
||||
DSIPHY_CMN_CTRL_0, DSIPHY_CMN_LANE_CTRL0, 0x7f,
|
||||
is_cphy ? 0x17 : 0x1f);
|
||||
|
||||
} else {
|
||||
reg = DSI_R32(phy, DSIPHY_CMN_CLK_CFG1);
|
||||
reg &= ~BIT(5);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL0,
|
||||
DSIPHY_CMN_CLK_CFG1, DSIPHY_CMN_PLL_CNTRL, reg, 0x0);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL1,
|
||||
DSIPHY_CMN_RBUF_CTRL, DSIPHY_CMN_TIMING_CTRL_0, 0x0,
|
||||
cfg->timing.lane_v4[0]);
|
||||
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL2,
|
||||
DSIPHY_CMN_TIMING_CTRL_1, DSIPHY_CMN_TIMING_CTRL_2,
|
||||
cfg->timing.lane_v4[1], cfg->timing.lane_v4[2]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL3,
|
||||
DSIPHY_CMN_TIMING_CTRL_3, DSIPHY_CMN_TIMING_CTRL_4,
|
||||
cfg->timing.lane_v4[3], cfg->timing.lane_v4[4]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL4,
|
||||
DSIPHY_CMN_TIMING_CTRL_5, DSIPHY_CMN_TIMING_CTRL_6,
|
||||
cfg->timing.lane_v4[5], cfg->timing.lane_v4[6]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL5,
|
||||
DSIPHY_CMN_TIMING_CTRL_7, DSIPHY_CMN_TIMING_CTRL_8,
|
||||
cfg->timing.lane_v4[7], cfg->timing.lane_v4[8]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL6,
|
||||
DSIPHY_CMN_TIMING_CTRL_9, DSIPHY_CMN_TIMING_CTRL_10,
|
||||
cfg->timing.lane_v4[9], cfg->timing.lane_v4[10]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL7,
|
||||
DSIPHY_CMN_TIMING_CTRL_11, DSIPHY_CMN_TIMING_CTRL_12,
|
||||
cfg->timing.lane_v4[11], cfg->timing.lane_v4[12]);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL8,
|
||||
DSIPHY_CMN_TIMING_CTRL_13, DSIPHY_CMN_CTRL_0,
|
||||
cfg->timing.lane_v4[13], 0x7f);
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_CTRL9,
|
||||
DSIPHY_CMN_LANE_CTRL0, DSIPHY_CMN_CTRL_2,
|
||||
is_cphy ? 0x17 : 0x1f, 0x40);
|
||||
/*
|
||||
* fill with dummy register writes since controller will blindly
|
||||
* send these values to DSI PHY.
|
||||
*/
|
||||
reg = DSI_DYN_REFRESH_PLL_CTRL11;
|
||||
while (reg <= DSI_DYN_REFRESH_PLL_CTRL29) {
|
||||
DSI_DYN_REF_REG_W(phy->dyn_pll_base, reg, DSIPHY_CMN_LANE_CTRL0,
|
||||
DSIPHY_CMN_CTRL_0, is_cphy ? 0x17 : 0x1f, 0x7f);
|
||||
reg += 0x4;
|
||||
}
|
||||
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_UPPER_ADDR, 0);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_UPPER_ADDR2, 0);
|
||||
}
|
||||
|
||||
wmb(); /* make sure all registers are updated */
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy, struct dsi_dyn_clk_delay *delay)
|
||||
{
|
||||
if (!delay)
|
||||
return;
|
||||
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_PIPE_DELAY, delay->pipe_delay);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_PIPE_DELAY2, delay->pipe_delay2);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_PLL_DELAY, delay->pll_delay);
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_trigger_sel(struct dsi_phy_hw *phy, bool is_master)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* Dynamic refresh will take effect at next mdp flush event.
|
||||
* This makes sure that any update to frame timings together
|
||||
* with dfps will take effect in one vsync at next mdp flush.
|
||||
*/
|
||||
if (is_master) {
|
||||
reg = DSI_GEN_R32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL);
|
||||
reg |= BIT(17);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL, reg);
|
||||
}
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_dyn_refresh_helper(struct dsi_phy_hw *phy, u32 offset)
|
||||
{
|
||||
u32 reg;
|
||||
|
||||
/*
|
||||
* if no offset is mentioned then this means we want to clear
|
||||
* the dynamic refresh ctrl register which is the last step
|
||||
* of dynamic refresh sequence.
|
||||
*/
|
||||
if (!offset) {
|
||||
reg = DSI_GEN_R32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL);
|
||||
reg &= ~(BIT(0) | BIT(8) | BIT(13) | BIT(16) | BIT(17));
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL, reg);
|
||||
wmb(); /* ensure dynamic fps is cleared */
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset & BIT(DYN_REFRESH_INTF_SEL)) {
|
||||
reg = DSI_GEN_R32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL);
|
||||
reg |= BIT(13);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL, reg);
|
||||
}
|
||||
|
||||
if (offset & BIT(DYN_REFRESH_SYNC_MODE)) {
|
||||
reg = DSI_GEN_R32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL);
|
||||
reg |= BIT(16);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL, reg);
|
||||
}
|
||||
|
||||
if (offset & BIT(DYN_REFRESH_SWI_CTRL)) {
|
||||
reg = DSI_GEN_R32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL);
|
||||
reg |= BIT(0);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL, reg);
|
||||
}
|
||||
|
||||
if (offset & BIT(DYN_REFRESH_SW_TRIGGER)) {
|
||||
reg = DSI_GEN_R32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL);
|
||||
reg |= BIT(8);
|
||||
DSI_GEN_W32(phy->dyn_pll_base, DSI_DYN_REFRESH_CTRL, reg);
|
||||
wmb(); /* ensure dynamic fps is triggered */
|
||||
}
|
||||
}
|
||||
|
||||
int dsi_phy_hw_v5_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
|
||||
u32 *dst, u32 size)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!timings || !dst || !size)
|
||||
return -EINVAL;
|
||||
|
||||
if (size != DSI_PHY_TIMING_V4_SIZE) {
|
||||
DSI_ERR("size mis-match\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
dst[i] = timings->lane_v4[i];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dsi_phy_hw_v5_0_set_continuous_clk(struct dsi_phy_hw *phy, bool enable)
|
||||
{
|
||||
u32 reg = 0, sl_lane_ctrl1 = 0;
|
||||
bool is_split_link_enabled = dsi_phy_hw_v5_0_is_split_link_enabled(phy);
|
||||
|
||||
reg = DSI_R32(phy, DSIPHY_CMN_LANE_CTRL1);
|
||||
|
||||
if (enable)
|
||||
reg |= BIT(5) | BIT(6);
|
||||
else
|
||||
reg &= ~(BIT(5) | BIT(6));
|
||||
|
||||
DSI_W32(phy, DSIPHY_CMN_LANE_CTRL1, reg);
|
||||
|
||||
if (is_split_link_enabled) {
|
||||
sl_lane_ctrl1 = DSI_R32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1);
|
||||
if (enable)
|
||||
sl_lane_ctrl1 |= BIT(2);
|
||||
else
|
||||
sl_lane_ctrl1 &= ~BIT(2);
|
||||
DSI_W32(phy, DSIPHY_CMN_SL_DSI_LANE_CTRL1, sl_lane_ctrl1);
|
||||
}
|
||||
|
||||
wmb(); /* make sure request is set */
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||
@@ -23,6 +24,9 @@ static int dsi_pll_clock_register(struct platform_device *pdev,
|
||||
case DSI_PLL_5NM:
|
||||
rc = dsi_pll_clock_register_5nm(pdev, pll_res);
|
||||
break;
|
||||
case DSI_PLL_4NM:
|
||||
rc = dsi_pll_clock_register_4nm(pdev, pll_res);
|
||||
break;
|
||||
default:
|
||||
rc = -EINVAL;
|
||||
break;
|
||||
@@ -265,12 +269,10 @@ int dsi_pll_init(struct platform_device *pdev, struct dsi_pll_resource **pll)
|
||||
|
||||
DSI_PLL_INFO(pll_res, "DSI pll label = %s\n", label);
|
||||
|
||||
/**
|
||||
* Currently, Only supports 5nm. Will add
|
||||
* support for other versions as needed.
|
||||
*/
|
||||
|
||||
if (!strcmp(label, "dsi_pll_5nm"))
|
||||
if (!strcmp(label, "dsi_pll_4nm"))
|
||||
pll_res->pll_revision = DSI_PLL_4NM;
|
||||
else if (!strcmp(label, "dsi_pll_5nm"))
|
||||
pll_res->pll_revision = DSI_PLL_5NM;
|
||||
else
|
||||
return -ENOTSUPP;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __DSI_PLL_H
|
||||
@@ -59,6 +60,7 @@ struct lpfr_cfg {
|
||||
};
|
||||
|
||||
enum {
|
||||
DSI_PLL_4NM,
|
||||
DSI_PLL_5NM,
|
||||
DSI_PLL_10NM,
|
||||
DSI_UNKNOWN_PLL,
|
||||
@@ -203,6 +205,7 @@ static inline struct dsi_pll_clk *to_pll_clk_hw(struct clk_hw *hw)
|
||||
|
||||
int dsi_pll_clock_register_5nm(struct platform_device *pdev,
|
||||
struct dsi_pll_resource *pll_res);
|
||||
int dsi_pll_clock_register_4nm(struct platform_device *pdev, struct dsi_pll_resource *pll_res);
|
||||
|
||||
int dsi_pll_init(struct platform_device *pdev,
|
||||
struct dsi_pll_resource **pll_res);
|
||||
|
1487
msm/dsi/dsi_pll_4nm.c
Normal dosya
1487
msm/dsi/dsi_pll_4nm.c
Normal dosya
Dosya farkı çok büyük olduğundan ihmal edildi
Fark Yükle
299
msm/dsi/dsi_pll_4nm.h
Normal dosya
299
msm/dsi/dsi_pll_4nm.h
Normal dosya
@@ -0,0 +1,299 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "dsi_pll.h"
|
||||
|
||||
/* Register Offsets from PLL base address */
|
||||
#define PLL_ANALOG_CONTROLS_ONE 0x0000
|
||||
#define PLL_ANALOG_CONTROLS_TWO 0x0004
|
||||
#define PLL_INT_LOOP_SETTINGS 0x0008
|
||||
#define PLL_INT_LOOP_SETTINGS_TWO 0x000C
|
||||
#define PLL_ANALOG_CONTROLS_THREE 0x0010
|
||||
#define PLL_ANALOG_CONTROLS_FOUR 0x0014
|
||||
#define PLL_ANALOG_CONTROLS_FIVE 0x0018
|
||||
#define PLL_INT_LOOP_CONTROLS 0x001C
|
||||
#define PLL_DSM_DIVIDER 0x0020
|
||||
#define PLL_FEEDBACK_DIVIDER 0x0024
|
||||
#define PLL_SYSTEM_MUXES 0x0028
|
||||
#define PLL_FREQ_UPDATE_CONTROL_OVERRIDES 0x002C
|
||||
#define PLL_CMODE 0x0030
|
||||
#define PLL_PSM_CTRL 0x0034
|
||||
#define PLL_RSM_CTRL 0x0038
|
||||
#define PLL_VCO_TUNE_MAP 0x003C
|
||||
#define PLL_PLL_CNTRL 0x0040
|
||||
#define PLL_CALIBRATION_SETTINGS 0x0044
|
||||
#define PLL_BAND_SEL_CAL_TIMER_LOW 0x0048
|
||||
#define PLL_BAND_SEL_CAL_TIMER_HIGH 0x004C
|
||||
#define PLL_BAND_SEL_CAL_SETTINGS 0x0050
|
||||
#define PLL_BAND_SEL_MIN 0x0054
|
||||
#define PLL_BAND_SEL_MAX 0x0058
|
||||
#define PLL_BAND_SEL_PFILT 0x005C
|
||||
#define PLL_BAND_SEL_IFILT 0x0060
|
||||
#define PLL_BAND_SEL_CAL_SETTINGS_TWO 0x0064
|
||||
#define PLL_BAND_SEL_CAL_SETTINGS_THREE 0x0068
|
||||
#define PLL_BAND_SEL_CAL_SETTINGS_FOUR 0x006C
|
||||
#define PLL_BAND_SEL_ICODE_HIGH 0x0070
|
||||
#define PLL_BAND_SEL_ICODE_LOW 0x0074
|
||||
#define PLL_FREQ_DETECT_SETTINGS_ONE 0x0078
|
||||
#define PLL_FREQ_DETECT_THRESH 0x007C
|
||||
#define PLL_FREQ_DET_REFCLK_HIGH 0x0080
|
||||
#define PLL_FREQ_DET_REFCLK_LOW 0x0084
|
||||
#define PLL_FREQ_DET_PLLCLK_HIGH 0x0088
|
||||
#define PLL_FREQ_DET_PLLCLK_LOW 0x008C
|
||||
#define PLL_PFILT 0x0090
|
||||
#define PLL_IFILT 0x0094
|
||||
#define PLL_PLL_GAIN 0x0098
|
||||
#define PLL_ICODE_LOW 0x009C
|
||||
#define PLL_ICODE_HIGH 0x00A0
|
||||
#define PLL_LOCKDET 0x00A4
|
||||
#define PLL_OUTDIV 0x00A8
|
||||
#define PLL_FASTLOCK_CONTROL 0x00AC
|
||||
#define PLL_PASS_OUT_OVERRIDE_ONE 0x00B0
|
||||
#define PLL_PASS_OUT_OVERRIDE_TWO 0x00B4
|
||||
#define PLL_CORE_OVERRIDE 0x00B8
|
||||
#define PLL_CORE_INPUT_OVERRIDE 0x00BC
|
||||
#define PLL_RATE_CHANGE 0x00C0
|
||||
#define PLL_PLL_DIGITAL_TIMERS 0x00C4
|
||||
#define PLL_PLL_DIGITAL_TIMERS_TWO 0x00C8
|
||||
#define PLL_DECIMAL_DIV_START 0x00CC
|
||||
#define PLL_FRAC_DIV_START_LOW 0x00D0
|
||||
#define PLL_FRAC_DIV_START_MID 0x00D4
|
||||
#define PLL_FRAC_DIV_START_HIGH 0x00D8
|
||||
#define PLL_DEC_FRAC_MUXES 0x00DC
|
||||
#define PLL_DECIMAL_DIV_START_1 0x00E0
|
||||
#define PLL_FRAC_DIV_START_LOW_1 0x00E4
|
||||
#define PLL_FRAC_DIV_START_MID_1 0x00E8
|
||||
#define PLL_FRAC_DIV_START_HIGH_1 0x00EC
|
||||
#define PLL_DECIMAL_DIV_START_2 0x00F0
|
||||
#define PLL_FRAC_DIV_START_LOW_2 0x00F4
|
||||
#define PLL_FRAC_DIV_START_MID_2 0x00F8
|
||||
#define PLL_FRAC_DIV_START_HIGH_2 0x00FC
|
||||
#define PLL_MASH_CONTROL 0x0100
|
||||
#define PLL_SSC_STEPSIZE_LOW 0x0104
|
||||
#define PLL_SSC_STEPSIZE_HIGH 0x0108
|
||||
#define PLL_SSC_DIV_PER_LOW 0x010C
|
||||
#define PLL_SSC_DIV_PER_HIGH 0x0110
|
||||
#define PLL_SSC_ADJPER_LOW 0x0114
|
||||
#define PLL_SSC_ADJPER_HIGH 0x0118
|
||||
#define PLL_SSC_MUX_CONTROL 0x011C
|
||||
#define PLL_SSC_STEPSIZE_LOW_1 0x0120
|
||||
#define PLL_SSC_STEPSIZE_HIGH_1 0x0124
|
||||
#define PLL_SSC_DIV_PER_LOW_1 0x0128
|
||||
#define PLL_SSC_DIV_PER_HIGH_1 0x012C
|
||||
#define PLL_SSC_ADJPER_LOW_1 0x0130
|
||||
#define PLL_SSC_ADJPER_HIGH_1 0x0134
|
||||
#define PLL_SSC_STEPSIZE_LOW_2 0x0138
|
||||
#define PLL_SSC_STEPSIZE_HIGH_2 0x013C
|
||||
#define PLL_SSC_DIV_PER_LOW_2 0x0140
|
||||
#define PLL_SSC_DIV_PER_HIGH_2 0x0144
|
||||
#define PLL_SSC_ADJPER_LOW_2 0x0148
|
||||
#define PLL_SSC_ADJPER_HIGH_2 0x014C
|
||||
#define PLL_SSC_CONTROL 0x0150
|
||||
#define PLL_PLL_OUTDIV_RATE 0x0154
|
||||
#define PLL_PLL_LOCKDET_RATE_1 0x0158
|
||||
#define PLL_PLL_LOCKDET_RATE_2 0x015C
|
||||
#define PLL_PLL_PROP_GAIN_RATE_1 0x0160
|
||||
#define PLL_PLL_PROP_GAIN_RATE_2 0x0164
|
||||
#define PLL_PLL_BAND_SEL_RATE_1 0x0168
|
||||
#define PLL_PLL_BAND_SEL_RATE_2 0x016C
|
||||
#define PLL_PLL_INT_GAIN_IFILT_BAND_1 0x0170
|
||||
#define PLL_PLL_INT_GAIN_IFILT_BAND_2 0x0174
|
||||
#define PLL_PLL_FL_INT_GAIN_PFILT_BAND_1 0x0178
|
||||
#define PLL_PLL_FL_INT_GAIN_PFILT_BAND_2 0x017C
|
||||
#define PLL_PLL_FASTLOCK_EN_BAND 0x0180
|
||||
#define PLL_FREQ_TUNE_ACCUM_INIT_MID 0x0184
|
||||
#define PLL_FREQ_TUNE_ACCUM_INIT_HIGH 0x0188
|
||||
#define PLL_FREQ_TUNE_ACCUM_INIT_MUX 0x018C
|
||||
#define PLL_PLL_LOCK_OVERRIDE 0x0190
|
||||
#define PLL_PLL_LOCK_DELAY 0x0194
|
||||
#define PLL_PLL_LOCK_MIN_DELAY 0x0198
|
||||
#define PLL_CLOCK_INVERTERS 0x019C
|
||||
#define PLL_SPARE_AND_JPC_OVERRIDES 0x01A0
|
||||
#define PLL_BIAS_CONTROL_1 0x01A4
|
||||
#define PLL_BIAS_CONTROL_2 0x01A8
|
||||
#define PLL_ALOG_OBSV_BUS_CTRL_1 0x01AC
|
||||
#define PLL_COMMON_STATUS_ONE 0x01B0
|
||||
#define PLL_COMMON_STATUS_TWO 0x01B4
|
||||
#define PLL_BAND_SEL_CAL 0x01B8
|
||||
#define PLL_ICODE_ACCUM_STATUS_LOW 0x01BC
|
||||
#define PLL_ICODE_ACCUM_STATUS_HIGH 0x01C0
|
||||
#define PLL_FD_OUT_LOW 0x01C4
|
||||
#define PLL_FD_OUT_HIGH 0x01C8
|
||||
#define PLL_ALOG_OBSV_BUS_STATUS_1 0x01CC
|
||||
#define PLL_PLL_MISC_CONFIG 0x01D0
|
||||
#define PLL_FLL_CONFIG 0x01D4
|
||||
#define PLL_FLL_FREQ_ACQ_TIME 0x01D8
|
||||
#define PLL_FLL_CODE0 0x01DC
|
||||
#define PLL_FLL_CODE1 0x01E0
|
||||
#define PLL_FLL_GAIN0 0x01E4
|
||||
#define PLL_FLL_GAIN1 0x01E8
|
||||
#define PLL_SW_RESET 0x01EC
|
||||
#define PLL_FAST_PWRUP 0x01F0
|
||||
#define PLL_LOCKTIME0 0x01F4
|
||||
#define PLL_LOCKTIME1 0x01F8
|
||||
#define PLL_DEBUG_BUS_SEL 0x01FC
|
||||
#define PLL_DEBUG_BUS0 0x0200
|
||||
#define PLL_DEBUG_BUS1 0x0204
|
||||
#define PLL_DEBUG_BUS2 0x0208
|
||||
#define PLL_DEBUG_BUS3 0x020C
|
||||
#define PLL_ANALOG_FLL_CONTROL_OVERRIDES 0x0210
|
||||
#define PLL_VCO_CONFIG 0x0214
|
||||
#define PLL_VCO_CAL_CODE1_MODE0_STATUS 0x0218
|
||||
#define PLL_VCO_CAL_CODE1_MODE1_STATUS 0x021C
|
||||
#define PLL_RESET_SM_STATUS 0x0220
|
||||
#define PLL_TDC_OFFSET 0x0224
|
||||
#define PLL_PS3_PWRDOWN_CONTROLS 0x0228
|
||||
#define PLL_PS4_PWRDOWN_CONTROLS 0x022C
|
||||
#define PLL_PLL_RST_CONTROLS 0x0230
|
||||
#define PLL_GEAR_BAND_SELECT_CONTROLS 0x0234
|
||||
#define PLL_PSM_CLK_CONTROLS 0x0238
|
||||
#define PLL_SYSTEM_MUXES_2 0x023C
|
||||
#define PLL_VCO_CONFIG_1 0x0240
|
||||
#define PLL_VCO_CONFIG_2 0x0244
|
||||
#define PLL_CLOCK_INVERTERS_1 0x0248
|
||||
#define PLL_CLOCK_INVERTERS_2 0x024C
|
||||
#define PLL_CMODE_1 0x0250
|
||||
#define PLL_CMODE_2 0x0254
|
||||
#define PLL_ANALOG_CONTROLS_FIVE_1 0x0258
|
||||
#define PLL_ANALOG_CONTROLS_FIVE_2 0x025C
|
||||
#define PLL_PERF_OPTIMIZE 0x0260
|
||||
|
||||
/* Register Offsets from PHY base address */
|
||||
#define PHY_CMN_CLK_CFG0 0x010
|
||||
#define PHY_CMN_CLK_CFG1 0x014
|
||||
#define PHY_CMN_GLBL_CTRL 0x018
|
||||
#define PHY_CMN_RBUF_CTRL 0x01C
|
||||
#define PHY_CMN_CTRL_0 0x024
|
||||
#define PHY_CMN_CTRL_2 0x02C
|
||||
#define PHY_CMN_CTRL_3 0x030
|
||||
#define PHY_CMN_PLL_CNTRL 0x03C
|
||||
#define PHY_CMN_GLBL_DIGTOP_SPARE4 0x128
|
||||
|
||||
/* Bit definition of SSC control registers */
|
||||
#define SSC_CENTER BIT(0)
|
||||
#define SSC_EN BIT(1)
|
||||
#define SSC_FREQ_UPDATE BIT(2)
|
||||
#define SSC_FREQ_UPDATE_MUX BIT(3)
|
||||
#define SSC_UPDATE_SSC BIT(4)
|
||||
#define SSC_UPDATE_SSC_MUX BIT(5)
|
||||
#define SSC_START BIT(6)
|
||||
#define SSC_START_MUX BIT(7)
|
||||
|
||||
/* Dynamic Refresh Control Registers */
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL0 (0x014)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL1 (0x018)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL2 (0x01C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL3 (0x020)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL4 (0x024)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL5 (0x028)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL6 (0x02C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL7 (0x030)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL8 (0x034)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL9 (0x038)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL10 (0x03C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL11 (0x040)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL12 (0x044)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL13 (0x048)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL14 (0x04C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL15 (0x050)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL16 (0x054)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL17 (0x058)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL18 (0x05C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL19 (0x060)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL20 (0x064)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL21 (0x068)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL22 (0x06C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL23 (0x070)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL24 (0x074)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL25 (0x078)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL26 (0x07C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL27 (0x080)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL28 (0x084)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL29 (0x088)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL30 (0x08C)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_CTRL31 (0x090)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_UPPER_ADDR (0x094)
|
||||
#define DSI_DYNAMIC_REFRESH_PLL_UPPER_ADDR2 (0x098)
|
||||
|
||||
#define DSI_PHY_TO_PLL_OFFSET (0x500)
|
||||
|
||||
enum {
|
||||
DSI_PLL_0,
|
||||
DSI_PLL_1,
|
||||
DSI_PLL_MAX
|
||||
};
|
||||
|
||||
struct dsi_pll_div_table pll_4nm_dphy_lb[] = {
|
||||
{27270000, 30000000, 2, 11},
|
||||
{30000000, 33330000, 4, 5},
|
||||
{33330000, 37500000, 2, 9},
|
||||
{37500000, 40000000, 8, 2},
|
||||
{40000000, 42860000, 1, 15},
|
||||
{42860000, 46150000, 2, 7},
|
||||
{46150000, 50000000, 1, 13},
|
||||
{50000000, 54550000, 4, 3},
|
||||
{54550000, 60000000, 1, 11},
|
||||
{60000000, 66670000, 2, 5},
|
||||
{66670000, 75000000, 1, 9},
|
||||
{75000000, 85710000, 8, 1},
|
||||
{85710000, 100000000, 1, 7},
|
||||
{100000000, 120000000, 2, 3},
|
||||
{120000000, 150000000, 1, 5},
|
||||
{150000000, 200000000, 4, 1},
|
||||
{200000000, 300000000, 1, 3},
|
||||
{300000000, 600000000, 2, 1},
|
||||
{600000000, 1500000000, 1, 1}
|
||||
};
|
||||
|
||||
struct dsi_pll_div_table pll_4nm_dphy_hb[] = {
|
||||
{68180000, 75000000, 2, 11},
|
||||
{75000000, 83330000, 4, 5},
|
||||
{83330000, 93750000, 2, 9},
|
||||
{93750000, 100000000, 8, 2},
|
||||
{100000000, 107140000, 1, 15},
|
||||
{107140000, 115380000, 2, 7},
|
||||
{115380000, 125000000, 1, 13},
|
||||
{125000000, 136360000, 4, 3},
|
||||
{136360000, 150000000, 1, 11},
|
||||
{150000000, 166670000, 2, 5},
|
||||
{166670000, 187500000, 1, 9},
|
||||
{187500000, 214290000, 8, 1},
|
||||
{214290000, 250000000, 1, 7},
|
||||
{250000000, 300000000, 2, 3},
|
||||
{300000000, 375000000, 1, 5},
|
||||
{375000000, 500000000, 4, 1},
|
||||
{500000000, 750000000, 1, 3},
|
||||
{750000000, 1500000000, 2, 1},
|
||||
{1500000000, 5000000000, 1, 1}
|
||||
};
|
||||
|
||||
struct dsi_pll_div_table pll_4nm_cphy_lb[] = {
|
||||
{30000000, 37500000, 4, 5},
|
||||
{37500000, 50000000, 8, 2},
|
||||
{50000000, 60000000, 4, 3},
|
||||
{60000000, 75000000, 2, 5},
|
||||
{75000000, 100000000, 8, 1},
|
||||
{100000000, 120000000, 2, 3},
|
||||
{120000000, 150000000, 1, 5},
|
||||
{150000000, 200000000, 4, 1},
|
||||
{200000000, 300000000, 1, 3},
|
||||
{300000000, 600000000, 2, 1},
|
||||
{600000000, 1500000000, 1, 1}
|
||||
};
|
||||
|
||||
struct dsi_pll_div_table pll_4nm_cphy_hb[] = {
|
||||
{75000000, 93750000, 4, 5},
|
||||
{93750000, 12500000, 8, 2},
|
||||
{125000000, 150000000, 4, 3},
|
||||
{150000000, 187500000, 2, 5},
|
||||
{187500000, 250000000, 8, 1},
|
||||
{250000000, 300000000, 2, 3},
|
||||
{300000000, 375000000, 1, 5},
|
||||
{375000000, 500000000, 4, 1},
|
||||
{500000000, 750000000, 1, 3},
|
||||
{750000000, 1500000000, 2, 1},
|
||||
{1500000000, 5000000000, 1, 1}
|
||||
};
|
Yeni konuda referans
Bir kullanıcı engelle