summaryrefslogtreecommitdiffstats
path: root/src/soc/nvidia/tegra124/sor.c
diff options
context:
space:
mode:
authorNeil Chen <neilc@nvidia.com>2014-09-23 17:41:59 +0800
committerAaron Durbin <adurbin@google.com>2015-04-04 04:03:48 +0200
commit8c440a6befb735a4c1c553f5ff2e4539ec50e490 (patch)
treeb881c957f768542ad740fc4a0ebbc8b06282c1f9 /src/soc/nvidia/tegra124/sor.c
parent9dceb0e30abe5d91bca0c7d6af3fe82281e82865 (diff)
downloadcoreboot-8c440a6befb735a4c1c553f5ff2e4539ec50e490.tar.gz
coreboot-8c440a6befb735a4c1c553f5ff2e4539ec50e490.tar.bz2
coreboot-8c440a6befb735a4c1c553f5ff2e4539ec50e490.zip
tegra124: add support for full DP link training
The original dp driver supports only fast link training and a special drive setting is used for the link training sequence. This might not be accepted by all panels. The better way is to go through full link training sequence to negotiate for a best drive setting. With the change, dp driver will try fast link training first, this is same as before. If it fails in fast link training, will try full link training. BUG=chrome-os-partner:32129 TEST=all panels on blaze/big devices work fine. Original-Change-Id: I6f3402c4c5993a156c965c7f52b011d336a2946f Original-Signed-off-by: Neil Chen <neilc@nvidia.com> Original-Reviewed-on: https://chromium-review.googlesource.com/219543 Original-Reviewed-by: Jimmy Zhang <jimmzhang@nvidia.com> Original-Reviewed-by: Julius Werner <jwerner@chromium.org> (cherry picked from commit 24966517d41252384af3c2784def36aebad42434) Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: I3e7e7e749e5c8a9f07ac6132859fcad6fc96c39c Reviewed-on: http://review.coreboot.org/9247 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'src/soc/nvidia/tegra124/sor.c')
-rw-r--r--src/soc/nvidia/tegra124/sor.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/soc/nvidia/tegra124/sor.c b/src/soc/nvidia/tegra124/sor.c
index 2c059bf06645..1f9df6ce06f9 100644
--- a/src/soc/nvidia/tegra124/sor.c
+++ b/src/soc/nvidia/tegra124/sor.c
@@ -79,6 +79,28 @@ static inline void tegra_sor_write_field(struct tegra_dc_sor_data *sor,
tegra_sor_writel(sor, reg, reg_val);
}
+void tegra_dp_disable_tx_pu(struct tegra_dc_sor_data *sor)
+{
+ tegra_sor_write_field(sor,
+ NV_SOR_DP_PADCTL(sor->portnum),
+ NV_SOR_DP_PADCTL_TX_PU_MASK,
+ NV_SOR_DP_PADCTL_TX_PU_DISABLE);
+}
+
+void tegra_dp_set_pe_vs_pc(struct tegra_dc_sor_data *sor, u32 mask,
+ u32 pe_reg, u32 vs_reg, u32 pc_reg, u8 pc_supported)
+{
+ tegra_sor_write_field(sor, NV_SOR_PR(sor->portnum),
+ mask, pe_reg);
+ tegra_sor_write_field(sor, NV_SOR_DC(sor->portnum),
+ mask, vs_reg);
+ if (pc_supported) {
+ tegra_sor_write_field(
+ sor, NV_SOR_POSTCURSOR(sor->portnum),
+ mask, pc_reg);
+ }
+}
+
static u32 tegra_dc_sor_poll_register(struct tegra_dc_sor_data *sor,
u32 reg, u32 mask, u32 exp_val, u32 poll_interval_us, u32 timeout_us)
{
@@ -873,3 +895,33 @@ void tegra_dc_sor_power_down_unused_lanes(struct tegra_dc_sor_data *sor)
drive_current);
tegra_sor_writel(sor, NV_SOR_PR(sor->portnum), pre_emphasis);
}
+
+void tegra_sor_precharge_lanes(struct tegra_dc_sor_data *sor)
+{
+ const struct tegra_dc_dp_link_config *cfg = sor->link_cfg;
+ u32 val = 0;
+
+ switch (cfg->lane_count) {
+ case 4:
+ val |= (NV_SOR_DP_PADCTL_PD_TXD_3_NO |
+ NV_SOR_DP_PADCTL_PD_TXD_2_NO);
+ /* fall through */
+ case 2:
+ val |= NV_SOR_DP_PADCTL_PD_TXD_1_NO;
+ /* fall through */
+ case 1:
+ val |= NV_SOR_DP_PADCTL_PD_TXD_0_NO;
+ break;
+ default:
+ printk(BIOS_ERR,
+ "dp: invalid lane number %d\n", cfg->lane_count);
+ return;
+ }
+
+ tegra_sor_write_field(sor, NV_SOR_DP_PADCTL(sor->portnum),
+ (0xf << NV_SOR_DP_PADCTL_COMODE_TXD_0_DP_TXD_2_SHIFT),
+ (val << NV_SOR_DP_PADCTL_COMODE_TXD_0_DP_TXD_2_SHIFT));
+ udelay(100);
+ tegra_sor_write_field(sor, NV_SOR_DP_PADCTL(sor->portnum),
+ (0xf << NV_SOR_DP_PADCTL_COMODE_TXD_0_DP_TXD_2_SHIFT), 0);
+}