tegra124/nyan: various fixes and additions
Tegra124: SDMMC: Configure base clock frequency. Reviewed-on: https://chromium-review.googlesource.com/173841 (cherry picked from commit d3157e9a380cfb018cc69a1f23f277c3c5b680a6) Tegra124: SDMMC: Configure pinmux for MMC 3/4. Reviewed-on: https://chromium-review.googlesource.com/174011 (cherry picked from commit 55af9a86a56d6bc0ce9bcff4fd5226a60ae2033b) tegra124: Move DMA-related #defines and definitions to header Reviewed-on: https://chromium-review.googlesource.com/174444 (cherry picked from commit 9d917927a5b7151958289469b9049ac91efa41e3) tegra124: Assign console address for kernel. Reviewed-on: https://chromium-review.googlesource.com/174486 (cherry picked from commit 36e9370f30bd173879958d164156997841ec4e9c) nyan: Fix up the gpio indices in chromeos.c. Reviewed-on: https://chromium-review.googlesource.com/174418 (cherry picked from commit fba4ae1080c19f11abe1205b871ada14db996c61) Nyan: turn on the backlight. Reviewed-on: https://chromium-review.googlesource.com/174533 (cherry picked from commit 12649c9611981dd8d6567ba0238c8b8247c52215) tegra124: Fix the disp1 source field. Reviewed-on: https://chromium-review.googlesource.com/174701 (cherry picked from commit eed380e09075e1eef0bde7d1bb15c4343f30bfe0) nyan: set up the aux channel i2c interface Reviewed-on: https://chromium-review.googlesource.com/174620 (cherry picked from commit ea81cb44a1c11cd78643c69ac818304cd393749e) tegra124: fix typos in the clock code. Reviewed-on: https://chromium-review.googlesource.com/174684 (cherry picked from commit 72365c33693db4eb6e01032938221f592b7e5a02) tegra124: Revamp clock source/divisor configuration Reviewed-on: https://chromium-review.googlesource.com/174804 (cherry picked from commit 3f31a634f69595bcc6a473301d1492c97a767809) tegra: Add gpio_output_open_drain() function Reviewed-on: https://chromium-review.googlesource.com/174650 (cherry picked from commit bc1c28926810e722e9b82339ea0585d083e3fa8c) tegra124: add nvidia-generated files Reviewed-on: https://chromium-review.googlesource.com/174610 (cherry picked from commit 7706f3200f7fc11b7a443f336bff6a37afa94652) nyan: Ignore the dev mode GPIO. Reviewed-on: https://chromium-review.googlesource.com/174837 (cherry picked from commit 9513e608f3063fdb3e9d8bd04e6e5fe35a5bfcee) Tegra124: Add support for the ARM architectural timer. Reviewed-on: https://chromium-review.googlesource.com/174835 (cherry picked from commit 25a91fcf7e79cc450caa59bc6b65f954bb96ac6c) nyan: Initialize the ARM architectural timer in the RAM stage. Reviewed-on: https://chromium-review.googlesource.com/174836 (cherry picked from commit 581f592c12de91c0cf8279ede2850e38dd0cd2e8) tegra124: nyan: Move mainboard level clock stuff into the mainboard source. Reviewed-on: https://chromium-review.googlesource.com/174843 (cherry picked from commit 5ab100b0bad22814261f9b755b59394562c9145a) tegra124: add some explanatory text about U7.1 computations. Reviewed-on: https://chromium-review.googlesource.com/173910 (cherry picked from commit 822cad0ceeceeb5160c8216e05eec13fd04a6413) Set the EC SPI clock source to PLLP and divide down to around 5MHz Reviewed-on: https://chromium-review.googlesource.com/173954 (cherry picked from commit c0e22d76d3887ca1f727443a47db38dec12c0b74) nyan: Move non-essential configuration out of bootblock and into ram stage. Reviewed-on: https://chromium-review.googlesource.com/174844 (cherry picked from commit dad7f68c76f7b83edacd8b22c9dbd3f0ff027397) tegra124: clocks: Save some IOs in clock_enable_clear_reset. Reviewed-on: https://chromium-review.googlesource.com/174845 (cherry picked from commit 81b977a2758d42471667e2cbe31f160dfda5bca4) tegra124: re-write SPI driver w/ full duplex support Reviewed-on: https://chromium-review.googlesource.com/174446 (cherry picked from commit 51c9a34240d6a068780a7d1c27b032b56b2d3e54) tegra124: move SPI-related structures from .c to .h Reviewed-on: https://chromium-review.googlesource.com/174637 (cherry picked from commit 36760a4463c2c33f494ca7ea5a36810fa4502058) tegra124: add frame header info to SPI channel struct Reviewed-on: https://chromium-review.googlesource.com/174638 (cherry picked from commit e24773eb946e2c4cb5e828f055d45d92bd1a4f9f) tegra124: re-factor tegra_spi_init() Reviewed-on: https://chromium-review.googlesource.com/174639 (cherry picked from commit 88354b996459a702c36604f5f92c24e63df8de7e) nyan: Set CrOS EC frame header parameters for SPI Reviewed-on: https://chromium-review.googlesource.com/174710 (cherry picked from commit 29173ba5863eebb2864a8384435cde2f0d5ca233) tegra124: Add Rx frame header support to SPI code Reviewed-on: https://chromium-review.googlesource.com/174711 (cherry picked from commit 1d1630e770804649ef74d31db194d3bde9968832) tegra124: add support for the Serial Output Resource (sor) Reviewed-on: https://chromium-review.googlesource.com/174612 (cherry picked from commit 3eebd10afea4498380582e04560af89126911ed9) nyan: tegra124: Enable I, D and L2 caches in romstage. Reviewed-on: https://chromium-review.googlesource.com/173777 (cherry picked from commit 74512b7ecfbd50f01a25677307084699ee8c6007) tegra and tegra124: Bring up graphics Reviewed-on: https://chromium-review.googlesource.com/174613 (cherry picked from commit 7e944208a176cdac44a31e2a9961c8bd5dc4ece8) nyan: Move the DMA memory region. Reviewed-on: https://chromium-review.googlesource.com/174953 (cherry picked from commit c66e22859252eaebceb07a3118ac61f4cf6289eb) tegra124: Increase CBFS cache buffer size Reviewed-on: https://chromium-review.googlesource.com/174950 (cherry picked from commit 6dbb4e5f0d66c68df45ac73e3f223b856b715026) tegra124: Add USB PLL, PHY and EHCI setup code Reviewed-on: https://chromium-review.googlesource.com/174651 (cherry picked from commit ecd5c398ff6748a7d40089019471357b58d3a6ea) tegra124: add in some undocument clock source and PLL registers Reviewed-on: https://chromium-review.googlesource.com/174948 (cherry picked from commit 73fcc4981da6e4415b514eaafb42bc265ab0cd9a) tegra124: small cleanups of the code Reviewed-on: https://chromium-review.googlesource.com/174995 (cherry picked from commit 7256aba07e9567ef8d73f05e1f80c4d45fd57bda) Squashed 34 commits for tegra124 / nyan support. Change-Id: I050c7ad962e0d24550b0b33c9318e89c80d01f00 Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6870 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: build bot (Jenkins)
This commit is contained in:
committed by
Isaac Christensen
parent
bca446d471
commit
2fc3b6281f
169
src/soc/nvidia/tegra124/sor.c
Normal file
169
src/soc/nvidia/tegra124/sor.c
Normal file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* drivers/video/tegra/dc/sor.c
|
||||
*
|
||||
* Copyright (c) 2011-2013, NVIDIA Corporation.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <console/console.h>
|
||||
#include <arch/io.h>
|
||||
#include <stdint.h>
|
||||
#include <lib.h>
|
||||
#include <stdlib.h>
|
||||
#include <delay.h>
|
||||
#include <soc/addressmap.h>
|
||||
#include <device/device.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cpu/cpu.h>
|
||||
#include <boot/tables.h>
|
||||
#include <cbmem.h>
|
||||
#include <soc/nvidia/tegra/dc.h>
|
||||
#include "sor.h"
|
||||
#include <soc/nvidia/tegra/displayport.h>
|
||||
#include "clk_rst.h"
|
||||
#include <soc/clock.h>
|
||||
#include "chip.h"
|
||||
#include <soc/display.h>
|
||||
|
||||
#define APBDEV_PMC_DPD_SAMPLE (0x20)
|
||||
#define APBDEV_PMC_DPD_SAMPLE_ON_DISABLE (0)
|
||||
#define APBDEV_PMC_DPD_SAMPLE_ON_ENABLE (1)
|
||||
#define APBDEV_PMC_SEL_DPD_TIM (0x1c8)
|
||||
#define APBDEV_PMC_SEL_DPD_TIM_SEL_DPD_TIM_DEFAULT (0x7f)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ (0x1c0)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_LVDS_SHIFT (25)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_LVDS_OFF (0 << 25)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_LVDS_ON (1 << 25)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_CODE_SHIFT (30)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_CODE_DEFAULT_MASK (0x3 << 30)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_CODE_IDLE (0 << 30)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_CODE_DPD_OFF (1 << 30)
|
||||
#define APBDEV_PMC_IO_DPD2_REQ_CODE_DPD_ON (2 << 30)
|
||||
#define APBDEV_PMC_IO_DPD2_STATUS (0x1c4)
|
||||
#define APBDEV_PMC_IO_DPD2_STATUS_LVDS_SHIFT (25)
|
||||
#define APBDEV_PMC_IO_DPD2_STATUS_LVDS_OFF (0 << 25)
|
||||
#define APBDEV_PMC_IO_DPD2_STATUS_LVDS_ON (1 << 25)
|
||||
|
||||
|
||||
static inline u32 tegra_sor_readl(struct tegra_dc_sor_data *sor, u32 reg)
|
||||
{
|
||||
u32 reg_val = readl((sor->base + reg * 4));
|
||||
return reg_val;
|
||||
}
|
||||
|
||||
static inline void tegra_sor_writel(struct tegra_dc_sor_data *sor,
|
||||
u32 reg, u32 val)
|
||||
{
|
||||
writel(val, (sor->base + reg * 4));
|
||||
}
|
||||
|
||||
static inline void tegra_sor_write_field(struct tegra_dc_sor_data *sor,
|
||||
u32 reg, u32 mask, u32 val)
|
||||
{
|
||||
u32 reg_val = tegra_sor_readl(sor, reg);
|
||||
reg_val &= ~mask;
|
||||
reg_val |= val;
|
||||
tegra_sor_writel(sor, reg, reg_val);
|
||||
}
|
||||
|
||||
void tegra_dc_sor_set_dp_linkctl(struct tegra_dc_sor_data *sor, int ena,
|
||||
u8 training_pattern, const struct tegra_dc_dp_link_config *cfg)
|
||||
{
|
||||
u32 reg_val;
|
||||
|
||||
reg_val = tegra_sor_readl(sor, NV_SOR_DP_LINKCTL(sor->portnum));
|
||||
|
||||
if (ena)
|
||||
reg_val |= NV_SOR_DP_LINKCTL_ENABLE_YES;
|
||||
else
|
||||
reg_val &= NV_SOR_DP_LINKCTL_ENABLE_NO;
|
||||
|
||||
reg_val &= ~NV_SOR_DP_LINKCTL_TUSIZE_MASK;
|
||||
reg_val |= (cfg->tu_size << NV_SOR_DP_LINKCTL_TUSIZE_SHIFT);
|
||||
|
||||
if (cfg->enhanced_framing)
|
||||
reg_val |= NV_SOR_DP_LINKCTL_ENHANCEDFRAME_ENABLE;
|
||||
|
||||
tegra_sor_writel(sor, NV_SOR_DP_LINKCTL(sor->portnum), reg_val);
|
||||
|
||||
switch (training_pattern) {
|
||||
case trainingPattern_1:
|
||||
tegra_sor_writel(sor, NV_SOR_DP_TPG, 0x41414141);
|
||||
break;
|
||||
case trainingPattern_2:
|
||||
case trainingPattern_3:
|
||||
reg_val = (cfg->link_bw == NV_SOR_LINK_SPEED_G5_4) ?
|
||||
0x43434343 : 0x42424242;
|
||||
tegra_sor_writel(sor, NV_SOR_DP_TPG, reg_val);
|
||||
break;
|
||||
default:
|
||||
tegra_sor_writel(sor, NV_SOR_DP_TPG, 0x50505050);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void tegra_dc_sor_set_dp_lanedata(struct tegra_dc_sor_data *sor,
|
||||
u32 lane, u32 pre_emphasis, u32 drive_current, u32 tx_pu)
|
||||
{
|
||||
u32 d_cur;
|
||||
u32 p_emp;
|
||||
|
||||
|
||||
d_cur = tegra_sor_readl(sor, NV_SOR_DC(sor->portnum));
|
||||
p_emp = tegra_sor_readl(sor, NV_SOR_PR(sor->portnum));
|
||||
|
||||
switch (lane) {
|
||||
case 0:
|
||||
p_emp &= ~NV_SOR_PR_LANE2_DP_LANE0_MASK;
|
||||
p_emp |= (pre_emphasis <<
|
||||
NV_SOR_PR_LANE2_DP_LANE0_SHIFT);
|
||||
d_cur &= ~NV_SOR_DC_LANE2_DP_LANE0_MASK;
|
||||
d_cur |= (drive_current <<
|
||||
NV_SOR_DC_LANE2_DP_LANE0_SHIFT);
|
||||
break;
|
||||
case 1:
|
||||
p_emp &= ~NV_SOR_PR_LANE1_DP_LANE1_MASK;
|
||||
p_emp |= (pre_emphasis <<
|
||||
NV_SOR_PR_LANE1_DP_LANE1_SHIFT);
|
||||
d_cur &= ~NV_SOR_DC_LANE1_DP_LANE1_MASK;
|
||||
d_cur |= (drive_current <<
|
||||
NV_SOR_DC_LANE1_DP_LANE1_SHIFT);
|
||||
break;
|
||||
case 2:
|
||||
p_emp &= ~NV_SOR_PR_LANE0_DP_LANE2_MASK;
|
||||
p_emp |= (pre_emphasis <<
|
||||
NV_SOR_PR_LANE0_DP_LANE2_SHIFT);
|
||||
d_cur &= ~NV_SOR_DC_LANE0_DP_LANE2_MASK;
|
||||
d_cur |= (drive_current <<
|
||||
NV_SOR_DC_LANE0_DP_LANE2_SHIFT);
|
||||
break;
|
||||
case 3:
|
||||
p_emp &= ~NV_SOR_PR_LANE3_DP_LANE3_MASK;
|
||||
p_emp |= (pre_emphasis <<
|
||||
NV_SOR_PR_LANE3_DP_LANE3_SHIFT);
|
||||
d_cur &= ~NV_SOR_DC_LANE3_DP_LANE3_MASK;
|
||||
d_cur |= (drive_current <<
|
||||
NV_SOR_DC_LANE3_DP_LANE3_SHIFT);
|
||||
break;
|
||||
default:
|
||||
printk(BIOS_SPEW, "dp: sor lane count %d is invalid\n", lane);
|
||||
}
|
||||
|
||||
tegra_sor_write_field(sor, NV_SOR_DP_LINKCTL(sor->portnum),
|
||||
NV_SOR_DP_PADCTL_TX_PU_VALUE_DEFAULT_MASK,
|
||||
tx_pu << NV_SOR_DP_PADCTL_TX_PU_VALUE_SHIFT);
|
||||
|
||||
tegra_sor_writel(sor, NV_SOR_DC(sor->portnum), d_cur);
|
||||
tegra_sor_writel(sor, NV_SOR_PR(sor->portnum), p_emp);
|
||||
}
|
||||
|
Reference in New Issue
Block a user