diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-01-22 15:12:14 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-01-25 08:50:17 +0000 |
commit | e4abe7fd5afcf35db8ac51969f716592f4bdf253 (patch) | |
tree | 6e8b8a4f1b2d62f213f9b5652ec80a547e7831a7 /src/drivers/generic | |
parent | f06d046c1041477adbd6e40a038667a620641b38 (diff) |
bayhub bh720: Configure VIH tuning via devicetree
There's no need to repeat the same code on every board.
Change-Id: I2e19decfe8609fa644e609673a56ee5109bafefa
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49831
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/generic')
-rw-r--r-- | src/drivers/generic/bayhub/bh720.c | 13 | ||||
-rw-r--r-- | src/drivers/generic/bayhub/chip.h | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/drivers/generic/bayhub/bh720.c b/src/drivers/generic/bayhub/bh720.c index cdac9fe35a..24386642eb 100644 --- a/src/drivers/generic/bayhub/bh720.c +++ b/src/drivers/generic/bayhub/bh720.c @@ -44,6 +44,19 @@ static void bh720_init(struct device *dev) } board_bh720(dev); + + if (config && config->vih_tuning_value) { + /* Tune VIH */ + u32 bh720_pcr_data; + pci_write_config32(dev, BH720_PROTECT, + BH720_PROTECT_OFF | BH720_PROTECT_LOCK_OFF); + bh720_pcr_data = pci_read_config32(dev, BH720_PCR_DrvStrength_PLL); + bh720_pcr_data &= 0xFFFFFF00; + bh720_pcr_data |= config->vih_tuning_value; + pci_write_config32(dev, BH720_PCR_DrvStrength_PLL, bh720_pcr_data); + pci_write_config32(dev, BH720_PROTECT, + BH720_PROTECT_ON | BH720_PROTECT_LOCK_ON); + } } static struct device_operations bh720_ops = { diff --git a/src/drivers/generic/bayhub/chip.h b/src/drivers/generic/bayhub/chip.h index dacad7cb84..f898378cb4 100644 --- a/src/drivers/generic/bayhub/chip.h +++ b/src/drivers/generic/bayhub/chip.h @@ -8,4 +8,7 @@ struct drivers_generic_bayhub_config { /* 1 to enable power-saving mode, 0 to disable */ int power_saving; + + /* CLK and DAT tuning values */ + uint8_t vih_tuning_value; }; |