blob: bee82af4cee21ad1fbd18f7459fc6b1fdfa17edd [file] [log] [blame]
Angel Ponsae593872020-04-04 18:50:57 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Marc Jones24484842017-05-04 21:17:45 -06002
Martin Roth933ca5b2017-08-17 15:15:55 -06003#ifndef __STONEYRIDGE_CHIP_H__
4#define __STONEYRIDGE_CHIP_H__
Marc Jones24484842017-05-04 21:17:45 -06005
Aaron Durbin36dbf1d2017-11-10 13:16:23 -07006#include <stddef.h>
Marc Jones24484842017-05-04 21:17:45 -06007#include <stdint.h>
Aaron Durbin36dbf1d2017-11-10 13:16:23 -07008#include <commonlib/helpers.h>
Justin TerAvest13101a72018-01-24 14:23:12 -07009#include <drivers/i2c/designware/dw_i2c.h>
Felix Heldd8bcad52022-01-10 22:27:29 +010010#include <gpio.h>
Marshall Dawsonf42344a2019-05-02 12:53:00 -060011#include <soc/i2c.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -070012#include <acpi/acpi_device.h>
Marc Jones24484842017-05-04 21:17:45 -060013
Marshall Dawson5bb0d752017-09-25 10:00:47 -060014#define MAX_NODES 1
Marshall Dawsone1988f52019-11-25 11:15:35 -070015#if CONFIG(AMD_APU_MERLINFALCON)
Richard Spiegel9247e862019-06-28 09:18:47 -070016#define MAX_DRAM_CH 2
17#define MAX_DIMMS_PER_CH 2
Marshall Dawsone1988f52019-11-25 11:15:35 -070018#else /* AMD_APU_STONEYRIDGE || AMD_APU_PRAIRIEFALCON */
Marshall Dawson5bb0d752017-09-25 10:00:47 -060019#define MAX_DRAM_CH 1
20#define MAX_DIMMS_PER_CH 2
Richard Spiegel9247e862019-06-28 09:18:47 -070021#endif
Marshall Dawson5bb0d752017-09-25 10:00:47 -060022
Justin TerAvest13101a72018-01-24 14:23:12 -070023#define STONEY_I2C_DEV_MAX 4
24
Marshall Dawson4e101ad2017-06-15 12:17:38 -060025struct soc_amd_stoneyridge_config {
Marc Jonesafd03d82017-11-16 10:01:08 -070026 u8 spd_addr_lookup[MAX_NODES][MAX_DRAM_CH][MAX_DIMMS_PER_CH];
Richard Spiegel67c2a7b2017-11-09 16:04:35 -070027 enum {
28 DRAM_CONTENTS_KEEP,
29 DRAM_CONTENTS_CLEAR
30 } dram_clear_on_reset;
Aaron Durbin36dbf1d2017-11-10 13:16:23 -070031
32 enum {
33 /* Do not enable UMA in the system. */
34 UMAMODE_NONE,
35 /* Enable UMA with a specific size. */
36 UMAMODE_SPECIFIED_SIZE,
37 /* Let AGESA determine the proper size. Non-legacy requires
38 * the resolution to be specified PLATFORM_CONFIGURATION */
39 UMAMODE_AUTO_LEGACY,
40 UMAMODE_AUTO_NON_LEGACY,
41 } uma_mode;
42
43 /* Used if UMAMODE_SPECIFIED_SIZE is set. */
44 size_t uma_size;
Justin TerAvest13101a72018-01-24 14:23:12 -070045
Richard Spiegel5401aa22018-09-11 11:36:38 -070046 /*
Karthikeyan Ramasubramanian0dbea482021-03-08 23:23:50 -070047 * If sb_reset_i2c_peripherals() is called, this devicetree register
Richard Spiegel5401aa22018-09-11 11:36:38 -070048 * defines which I2C SCL will be toggled 9 times at 100 KHz.
Karthikeyan Ramasubramanian0dbea482021-03-08 23:23:50 -070049 * For example, should we need I2C0 and I2C3 have their peripheral
Martin Roth26f97f92021-10-01 14:53:22 -060050 * devices reset by toggling SCL, use:
Richard Spiegel5401aa22018-09-11 11:36:38 -070051 *
52 * register i2c_scl_reset = (GPIO_I2C0_SCL | GPIO_I2C3_SCL)
53 */
54 u8 i2c_scl_reset;
Justin TerAvest13101a72018-01-24 14:23:12 -070055 struct dw_i2c_bus_config i2c[STONEY_I2C_DEV_MAX];
Richard Spiegelc703beb2018-09-10 13:42:00 -070056 u8 stapm_percent;
Richard Spiegelde5d0402018-10-11 08:15:43 -070057 u32 stapm_time_ms;
58 u32 stapm_power_mw;
Chris Wang50c11602018-11-05 12:09:24 +080059 /*
60 * This specifies the LVDS/eDP power-up sequence time for the delay
61 * between VaryBL and BLON.
62 * 0 - Use the VBIOS default (default). The video BIOS default is 32ms.
63 * n - Values other than zero specify a setting of (4 * n) milliseconds
64 * time delay.
65 */
66 u8 lvds_poseq_varybl_to_blon;
67 u8 lvds_poseq_blon_to_varybl;
Marc Jones24484842017-05-04 21:17:45 -060068};
69
Martin Roth933ca5b2017-08-17 15:15:55 -060070#endif /* __STONEYRIDGE_CHIP_H__ */