![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/mmio.h>
#include <console/console.h>
#include <delay.h>
#include <device/device.h>
#include <edid.h>
#include <string.h>
#include <soc/addressmap.h>
#include <soc/display.h>
#include <soc/edp.h>
#include <timer.h>
#include <types.h>
Go to the source code of this file.
Macros | |
#define | edp_debug(x...) do {if (0) printk(BIOS_DEBUG, x); } while (0) |
#define | MAX_CR_LOOP 5 |
#define | MAX_EQ_LOOP 5 |
#define | DP_LINK_STATUS_SIZE 6 |
#define | DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_1200 |
#define | DP_PRE_EMPHASIS_MAX DP_TRAIN_PRE_EMPHASIS_9_5 |
Functions | |
static void | rk_edp_init_refclk (struct rk_edp *edp) |
static void | rk_edp_init_interrupt (struct rk_edp *edp) |
static void | rk_edp_enable_sw_function (struct rk_edp *edp) |
static int | rk_edp_get_pll_lock_status (struct rk_edp *edp) |
static void | rk_edp_init_analog_func (struct rk_edp *edp) |
static void | rk_edp_init_aux (struct rk_edp *edp) |
static int | rk_edp_aux_enable (struct rk_edp *edp) |
static int | rk_edp_is_aux_reply (struct rk_edp *edp) |
static int | rk_edp_start_aux_transaction (struct rk_edp *edp) |
static int | rk_edp_dpcd_transfer (struct rk_edp *edp, unsigned int val_addr, u8 *data, unsigned int length, enum dpcd_request request) |
static int | rk_edp_dpcd_read (struct rk_edp *edp, u32 addr, u8 *values, size_t size) |
static int | rk_edp_dpcd_write (struct rk_edp *edp, u32 addr, u8 *values, size_t size) |
static int | rk_edp_link_power_up (struct rk_edp *edp) |
static int | rk_edp_link_configure (struct rk_edp *edp) |
static void | rk_edp_set_link_training (struct rk_edp *edp, const u8 *training_values) |
static u8 | edp_link_status (const u8 *link_status, int r) |
static int | rk_edp_dpcd_read_link_status (struct rk_edp *edp, u8 *link_status) |
static u8 | edp_get_lane_status (const u8 *link_status, int lane) |
static int | rk_edp_clock_recovery_ok (const u8 *link_status, int lane_count) |
static int | rk_edp_channel_eq_ok (const u8 *link_status, int lane_count) |
static u8 | rk_edp_get_adjust_request_voltage (const u8 *link_status, int lane) |
static u8 | rk_edp_get_adjust_request_pre_emphasis (const u8 *link_status, int lane) |
static void | edp_get_adjust_train (const u8 *link_status, int lane_count, u8 train_set[]) |
static int | rk_edp_link_train_cr (struct rk_edp *edp) |
static int | rk_edp_link_train_ce (struct rk_edp *edp) |
static int | rk_edp_init_training (struct rk_edp *edp) |
static int | rk_edp_hw_link_training (struct rk_edp *edp) |
static int | rk_edp_select_i2c_device (struct rk_edp *edp, unsigned int device_addr, unsigned int val_addr) |
static int | rk_edp_read_bytes_from_i2c (struct rk_edp *edp, unsigned int device_addr, unsigned int val_addr, unsigned int count, u8 edid[]) |
static int | rk_edp_read_edid (struct rk_edp *edp, struct edid *edid) |
static int | rk_edp_set_link_train (struct rk_edp *edp) |
static void | rk_edp_init_video (struct rk_edp *edp) |
static void | rk_edp_config_video_slave_mode (struct rk_edp *edp) |
static void | rk_edp_set_video_cr_mn (struct rk_edp *edp, enum clock_recovery_m_value_type type, u32 m_value, u32 n_value) |
static int | rk_edp_is_video_stream_clock_on (struct rk_edp *edp) |
static int | rk_edp_is_video_stream_on (struct rk_edp *edp) |
static int | rk_edp_config_video (struct rk_edp *edp) |
static void | rockchip_edp_force_hpd (struct rk_edp *edp) |
static int | rockchip_edp_get_plug_in_status (struct rk_edp *edp) |
static void | rk_edp_wait_hpd (struct rk_edp *edp) |
int | rk_edp_get_edid (struct edid *edid) |
int | rk_edp_prepare (void) |
int | rk_edp_enable (void) |
void | rk_edp_init (void) |
Variables | |
static struct rk_edp | rk_edp |
static const char * | voltage_names [] |
static const char * | pre_emph_names [] |
#define DP_PRE_EMPHASIS_MAX DP_TRAIN_PRE_EMPHASIS_9_5 |
#define DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_1200 |
#define edp_debug | ( | x... | ) | do {if (0) printk(BIOS_DEBUG, x); } while (0) |
Definition at line 407 of file edp.c.
References BIOS_DEBUG, DP_PRE_EMPHASIS_MAX, DP_TRAIN_MAX_PRE_EMPHASIS_REACHED, DP_TRAIN_MAX_SWING_REACHED, DP_TRAIN_PRE_EMPHASIS_MASK, DP_TRAIN_PRE_EMPHASIS_SHIFT, DP_TRAIN_VOLTAGE_SWING_MASK, DP_TRAIN_VOLTAGE_SWING_SHIFT, DP_VOLTAGE_MAX, pre_emph_names, printk, rk_edp_get_adjust_request_pre_emphasis(), rk_edp_get_adjust_request_voltage(), and voltage_names.
Referenced by rk_edp_link_train_ce(), and rk_edp_link_train_cr().
Definition at line 343 of file edp.c.
References DPCD_LANE0_1_STATUS, edp_link_status(), and s.
Referenced by rk_edp_channel_eq_ok(), and rk_edp_clock_recovery_ok().
Definition at line 332 of file edp.c.
References DPCD_LANE0_1_STATUS.
Referenced by edp_get_lane_status(), rk_edp_channel_eq_ok(), rk_edp_get_adjust_request_pre_emphasis(), and rk_edp_get_adjust_request_voltage().
|
static |
Definition at line 138 of file edp.c.
References rk_edp_regs::aux_ch_ctl_2, AUX_EN, read32(), rk_edp::regs, setbits32, stopwatch_expired(), and stopwatch_init_msecs_expire().
Referenced by rk_edp_start_aux_transaction().
|
static |
Definition at line 365 of file edp.c.
References DP_CHANNEL_EQ_BITS, DP_INTERLANE_ALIGN_DONE, DPCD_LANE_ALIGN_STATUS_UPDATED, edp_get_lane_status(), and edp_link_status().
Referenced by rk_edp_link_train_ce().
|
static |
Definition at line 352 of file edp.c.
References DP_LANE_CR_DONE, and edp_get_lane_status().
Referenced by rk_edp_link_train_cr().
|
static |
Definition at line 887 of file edp.c.
References CALCULATED_M, clrbits32, DP_PLL_UNLOCKED, edp_debug, F_SEL, rk_edp::regs, rk_edp_config_video_slave_mode(), rk_edp_get_pll_lock_status(), rk_edp_is_video_stream_clock_on(), rk_edp_set_video_cr_mn(), rk_edp_regs::video_ctl_1, rk_edp_regs::video_ctl_10, and VIDEO_MUTE.
Referenced by rk_edp_prepare().
Definition at line 803 of file edp.c.
References clrbits32, rk_edp_regs::func_en_1, rk_edp::regs, VID_CAP_FUNC_EN_N, and VID_FIFO_FUNC_EN_N.
Referenced by rk_edp_config_video().
Definition at line 271 of file edp.c.
References addr, DPCD_READ, and rk_edp_dpcd_transfer().
Referenced by rk_edp_dpcd_read_link_status(), rk_edp_init_training(), and rk_edp_link_power_up().
Definition at line 337 of file edp.c.
References DP_LINK_STATUS_SIZE, DPCD_LANE0_1_STATUS, and rk_edp_dpcd_read().
Referenced by rk_edp_link_train_ce(), and rk_edp_link_train_cr().
|
static |
Definition at line 203 of file edp.c.
References rk_edp_regs::aux_addr_15_8, AUX_ADDR_15_8, rk_edp_regs::aux_addr_19_16, AUX_ADDR_19_16, rk_edp_regs::aux_addr_7_0, AUX_ADDR_7_0, rk_edp_regs::aux_ch_ctl_1, AUX_LENGTH, AUX_TX_COMM_DP_TRANSACTION, AUX_TX_COMM_READ, AUX_TX_COMM_WRITE, BIOS_WARNING, BUF_CLR, rk_edp_regs::buf_data, rk_edp_regs::buf_data_ctl, DPCD_READ, DPCD_WRITE, length, MIN, printk, read32(), rk_edp::regs, rk_edp_start_aux_transaction(), val, and write32().
Referenced by rk_edp_dpcd_read(), and rk_edp_dpcd_write().
Definition at line 277 of file edp.c.
References addr, DPCD_WRITE, and rk_edp_dpcd_transfer().
Referenced by rk_edp_link_configure(), rk_edp_link_power_up(), rk_edp_link_train_ce(), and rk_edp_link_train_cr().
int rk_edp_enable | ( | void | ) |
Definition at line 986 of file edp.c.
References rk_edp::regs, rk_edp_is_video_stream_on(), setbits32, rk_edp_regs::video_ctl_1, and VIDEO_EN.
Referenced by rk_display_init().
Definition at line 85 of file edp.c.
References clrbits32, rk_edp_regs::func_en_1, rk_edp::regs, and SW_FUNC_EN_N.
Referenced by rk_edp_init().
Definition at line 395 of file edp.c.
References DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT, DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT, DP_TRAIN_PRE_EMPHASIS_SHIFT, DPCD_ADJUST_REQUEST_LANE0_1, edp_link_status(), and s.
Referenced by edp_get_adjust_train().
Definition at line 384 of file edp.c.
References DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT, DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT, DP_TRAIN_VOLTAGE_SWING_SHIFT, DPCD_ADJUST_REQUEST_LANE0_1, edp_link_status(), and s.
Referenced by edp_get_adjust_train().
int rk_edp_get_edid | ( | struct edid * | edid | ) |
Definition at line 954 of file edp.c.
References rk_edp_read_edid().
Referenced by rk_display_init().
|
static |
Definition at line 90 of file edp.c.
References rk_edp_regs::dp_debug_ctl, DP_PLL_LOCKED, DP_PLL_UNLOCKED, PLL_LOCK, read32(), rk_edp::regs, and val.
Referenced by rk_edp_config_video(), and rk_edp_init_analog_func().
|
static |
Definition at line 605 of file edp.c.
References BIOS_ERR, rk_edp_regs::dp_hw_link_training, HW_LT_EN, HW_LT_ERR_CODE_MASK, HW_LT_ERR_CODE_SHIFT, link_train::lane_count, rk_edp_regs::lane_count_set, rk_edp_regs::link_bw_set, link_train::link_rate, rk_edp::link_train, printk, read32(), rk_edp::regs, rk_edp_link_train_ce(), rk_edp_link_train_cr(), stopwatch_expired(), stopwatch_init_msecs_expire(), val, and write32().
Referenced by rk_edp_set_link_train().
Definition at line 994 of file edp.c.
References EDP_BASE, rk_edp::regs, rk_edp_enable_sw_function(), rk_edp_init_analog_func(), rk_edp_init_aux(), rk_edp_init_interrupt(), rk_edp_init_refclk(), and rk_edp_wait_hpd().
Referenced by rk_display_init().
Definition at line 98 of file edp.c.
References AUX_FUNC_EN_N, BIOS_ERR, clrbits32, rk_edp_regs::common_int_sta_1, rk_edp_regs::dp_debug_ctl, rk_edp_regs::dp_pd, DP_PLL_UNLOCKED, F_PLL_LOCK, rk_edp_regs::func_en_2, LS_CLK_DOMAIN_FUNC_EN_N, PLL_LOCK_CHG, PLL_LOCK_CTRL, PLL_LOCK_TIMEOUT, printk, rk_edp::regs, rk_edp_get_pll_lock_status(), SERDES_FIFO_FUNC_EN_N, SSC_FUNC_EN_N, stopwatch_expired(), stopwatch_init_msecs_expire(), and write32().
Referenced by rk_edp_init().
Definition at line 123 of file edp.c.
References rk_edp_regs::aux_ch_defer_dtl, AUX_FUNC_EN_N, clrbits32, DEFER_COUNT, DEFER_CTRL_EN, rk_edp_regs::dp_int_sta, rk_edp_regs::func_en_2, rk_edp::regs, setbits32, and write32().
Referenced by rk_edp_init().
Definition at line 65 of file edp.c.
References rk_edp_regs::common_int_mask_1, rk_edp_regs::common_int_mask_2, rk_edp_regs::common_int_mask_3, rk_edp_regs::common_int_mask_4, rk_edp_regs::common_int_sta_1, rk_edp_regs::common_int_sta_2, rk_edp_regs::common_int_sta_3, rk_edp_regs::common_int_sta_4, rk_edp_regs::dp_int_sta, rk_edp_regs::int_ctl, INT_POL, rk_edp_regs::int_sta_mask, rk_edp::regs, and write32().
Referenced by rk_edp_init().
Definition at line 33 of file edp.c.
References rk_edp_regs::analog_ctl_2, AUX_TERM_50OHM, CH0_CH2_SWING_EMP_CTRL, CH1_CH3_SWING_EMP_CTRL, CHG_PUMP_CUR_SEL_5US, CHG_PUMP_INOUT_CTRL_1200MV, CHG_PUMP_INPUT_CTRL_OP, rk_edp_regs::dp_aux, DP_AUX_COMMON_MODE, DP_AUX_EN, DP_BG_OUT_SEL, DP_BG_SEL, rk_edp_regs::dp_bias, DP_DB_CUR_CTRL, rk_edp_regs::dp_reserv2, DP_RESISTOR_TUNE_BG, KVCO_DEFALUT, LDO_OUTPUT_V_SEL_145, LOCK_DET_BYPASS, LOCK_DET_CNT_SEL_256, LOOP_FILTER_RESET, LP_MODE_CLK_REGULATOR, PALL_SSC_RESET, PLL_LOCK_DET_FORCE, PLL_LOCK_DET_MODE, rk_edp_regs::pll_reg_1, rk_edp_regs::pll_reg_2, rk_edp_regs::pll_reg_3, rk_edp_regs::pll_reg_5, PRE_DRIVER_PW_CTRL1, REF_CLK_24M, rk_edp::regs, REGULATOR_V_SEL_950MV, RESISTOR_CTRL, RESISTOR_MSB_CTRL, SEL_24M, SSC_DEPTH, SSC_MODE, SSC_OFFSET, rk_edp_regs::ssc_reg, STANDBY_CUR_SEL, rk_edp_regs::tx_common, TX_SWING_PRE_EMP_MODE, V2L_CUR_SEL_1MA, and write32().
Referenced by rk_edp_init().
|
static |
Definition at line 569 of file edp.c.
References DP_MAX_LANE_COUNT_MASK, DPCD_DPCD_REV, edp_debug, link_train::lane_count, link_train::link_rate, LINK_RATE_1_62GBPS, LINK_RATE_2_70GBPS, rk_edp::link_train, link_train::revision, rk_edp_dpcd_read(), rk_edp_link_configure(), and rk_edp_link_power_up().
Referenced by rk_edp_set_link_train().
Definition at line 789 of file edp.c.
References CHA_CRI, CHA_CTRL, rk_edp_regs::common_int_sta_1, rk_edp::regs, rk_edp_regs::sys_ctl_2, val, VID_CLK_CHG, VID_FORMAT_CHG, VID_HRES_TH, VID_VRES_TH, rk_edp_regs::video_ctl_8, VSYNC_DET, and write32().
Referenced by rk_edp_prepare().
|
static |
Definition at line 153 of file edp.c.
References rk_edp_regs::dp_int_sta, read32(), rk_edp::regs, RPLY_RECEIV, stopwatch_expired(), stopwatch_init_msecs_expire(), and write32().
Referenced by rk_edp_start_aux_transaction().
|
static |
Definition at line 840 of file edp.c.
References CHA_STA, DET_STA, read32(), rk_edp::regs, stopwatch_expired(), stopwatch_init_msecs_expire(), rk_edp_regs::sys_ctl_1, rk_edp_regs::sys_ctl_2, val, and write32().
Referenced by rk_edp_config_video().
|
static |
Definition at line 867 of file edp.c.
References read32(), rk_edp::regs, stopwatch_expired(), stopwatch_init_msecs_expire(), STRM_VALID, rk_edp_regs::sys_ctl_3, val, and write32().
Referenced by rk_edp_enable().
|
static |
Definition at line 313 of file edp.c.
References DPCD_LINK_BW_SET, link_train::lane_count, link_train::link_rate, rk_edp::link_train, and rk_edp_dpcd_write().
Referenced by rk_edp_init_training().
|
static |
Definition at line 283 of file edp.c.
References DP_SET_POWER_D0, DP_SET_POWER_MASK, DPCD_LINK_POWER_STATE, rk_edp::link_train, mdelay(), link_train::revision, rk_edp_dpcd_read(), rk_edp_dpcd_write(), and value.
Referenced by rk_edp_init_training().
|
static |
Definition at line 523 of file edp.c.
References BIOS_DEBUG, BIOS_ERR, DP_LINK_STATUS_SIZE, DP_TRAIN_PRE_EMPHASIS_MASK, DP_TRAIN_PRE_EMPHASIS_SHIFT, DP_TRAIN_VOLTAGE_SWING_MASK, DP_TRAINING_PATTERN_2, rk_edp_regs::dp_training_ptn_set, DPCD_TRAINING_LANE0_SET, DPCD_TRAINING_PATTERN_SET, edp_get_adjust_train(), link_train::lane_count, rk_edp::link_train, printk, rk_edp::regs, rk_edp_channel_eq_ok(), rk_edp_dpcd_read_link_status(), rk_edp_dpcd_write(), rk_edp_set_link_training(), rk_edp::train_set, udelay(), value, and write32().
Referenced by rk_edp_hw_link_training().
|
static |
Definition at line 448 of file edp.c.
References BIOS_DEBUG, BIOS_ERR, DP_LINK_STATUS_SIZE, DP_TRAIN_MAX_SWING_REACHED, DP_TRAIN_PRE_EMPHASIS_MASK, DP_TRAIN_PRE_EMPHASIS_SHIFT, DP_TRAIN_VOLTAGE_SWING_MASK, DP_TRAINING_PATTERN_1, rk_edp_regs::dp_training_ptn_set, DPCD_TRAINING_LANE0_SET, DPCD_TRAINING_PATTERN_SET, edp_get_adjust_train(), link_train::lane_count, rk_edp::link_train, MAX_CR_LOOP, mdelay(), memset(), printk, rk_edp::regs, rk_edp_clock_recovery_ok(), rk_edp_dpcd_read_link_status(), rk_edp_dpcd_write(), rk_edp_set_link_training(), rk_edp::train_set, value, voltage, and write32().
Referenced by rk_edp_hw_link_training().
int rk_edp_prepare | ( | void | ) |
Definition at line 969 of file edp.c.
References BIOS_ERR, printk, rk_edp_config_video(), rk_edp_init_video(), and rk_edp_set_link_train().
Referenced by rk_display_init().
|
static |
Definition at line 668 of file edp.c.
References ADDR_ONLY, rk_edp_regs::aux_ch_ctl_1, rk_edp_regs::aux_ch_ctl_2, AUX_LENGTH, rk_edp_regs::aux_rx_comm, AUX_RX_COMM_AUX_DEFER, AUX_RX_COMM_I2C_DEFER, AUX_TX_COMM_I2C_TRANSACTION, AUX_TX_COMM_READ, BUF_CLR, rk_edp_regs::buf_data, rk_edp_regs::buf_data_ctl, clrbits32, count, edp_debug, read32(), rk_edp::regs, rk_edp_select_i2c_device(), rk_edp_start_aux_transaction(), val, and write32().
Referenced by rk_edp_read_edid().
Definition at line 738 of file edp.c.
References BIOS_ERR, buf, decode_edid(), EDID_ADDR, EDID_CONFORMANT, EDID_EXTENSION_FLAG, EDID_HEADER, EDID_LENGTH, edp_debug, printk, and rk_edp_read_bytes_from_i2c().
Referenced by rk_edp_get_edid().
|
static |
Definition at line 635 of file edp.c.
References rk_edp_regs::aux_addr_15_8, rk_edp_regs::aux_addr_19_16, rk_edp_regs::aux_addr_7_0, rk_edp_regs::aux_ch_ctl_1, AUX_TX_COMM_I2C_TRANSACTION, AUX_TX_COMM_MOT, AUX_TX_COMM_WRITE, rk_edp_regs::buf_data, edp_debug, rk_edp::regs, rk_edp_start_aux_transaction(), val, and write32().
Referenced by rk_edp_read_bytes_from_i2c().
|
static |
Definition at line 775 of file edp.c.
References BIOS_ERR, printk, rk_edp_hw_link_training(), and rk_edp_init_training().
Referenced by rk_edp_prepare().
Definition at line 323 of file edp.c.
References link_train::lane_count, rk_edp::link_train, rk_edp_regs::ln_link_trn_ctl, rk_edp::regs, and write32().
Referenced by rk_edp_link_train_ce(), and rk_edp_link_train_cr().
|
static |
Definition at line 809 of file edp.c.
References clrbits32, FIX_M_VID, rk_edp_regs::m_vid_0, rk_edp_regs::m_vid_1, rk_edp_regs::m_vid_2, rk_edp_regs::n_vid_0, rk_edp_regs::n_vid_1, rk_edp_regs::n_vid_2, REGISTER_M, rk_edp::regs, setbits32, rk_edp_regs::sys_ctl_4, type, val, and write32().
Referenced by rk_edp_config_video().
|
static |
Definition at line 169 of file edp.c.
References AUX_ERR, AUX_STATUS_MASK, rk_edp_regs::dp_int_sta, edp_debug, read32(), rk_edp::regs, rk_edp_aux_enable(), rk_edp_is_aux_reply(), val, and write32().
Referenced by rk_edp_dpcd_transfer(), rk_edp_read_bytes_from_i2c(), and rk_edp_select_i2c_device().
Definition at line 939 of file edp.c.
References BIOS_DEBUG, printk, rockchip_edp_force_hpd(), rockchip_edp_get_plug_in_status(), stopwatch_expired(), stopwatch_init_msecs_expire(), and udelay().
Referenced by rk_edp_init().
Definition at line 911 of file edp.c.
References F_HPD, HPD_CTRL, read32(), rk_edp::regs, rk_edp_regs::sys_ctl_3, val, and write32().
Referenced by rk_edp_wait_hpd().
|
static |
Definition at line 920 of file edp.c.
References HPD_STATUS, read32(), rk_edp::regs, rk_edp_regs::sys_ctl_3, and val.
Referenced by rk_edp_wait_hpd().
|
static |
Definition at line 26 of file edp.c.
Referenced by edp_get_adjust_train().
|
static |
Definition at line 23 of file edp.c.
Referenced by edp_get_adjust_train().