blob: 89afaeed208287ff074eef3ca18b95a74a0ad6f6 [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Timothy Pearson4b373c92015-04-05 17:54:08 -05002
Timothy Pearson4b373c92015-04-05 17:54:08 -05003#include <console/console.h>
Arthur Heymans4496a2e2018-09-16 15:58:36 +02004#include <southbridge/intel/common/gpio.h>
Timothy Pearson4b373c92015-04-05 17:54:08 -05005#include <northbridge/intel/gm45/gm45.h>
Patrick Rudolph24680d02017-07-25 18:18:57 +02006#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
Timothy Pearson4b373c92015-04-05 17:54:08 -05007
Patrick Rudolph24680d02017-07-25 18:18:57 +02008static void hybrid_graphics_init(sysinfo_t *sysinfo)
9{
10 bool peg, igd;
11
12 early_hybrid_graphics(&igd, &peg);
13
14 sysinfo->enable_igd = igd;
15 sysinfo->enable_peg = peg;
16}
Arthur Heymansf9d53082017-01-02 16:16:45 +010017
Patrick Georgi40b8f012021-05-12 14:52:12 +020018void get_mb_spd_addrmap(u8 spd_addrmap[4])
Arthur Heymans3b0eb602019-01-31 22:47:09 +010019{
20 spd_addrmap[0] = 0x50;
21 spd_addrmap[2] = 0x51;
22}
Timothy Pearson4b373c92015-04-05 17:54:08 -050023
Arthur Heymans3b0eb602019-01-31 22:47:09 +010024void mb_pre_raminit_setup(sysinfo_t *sysinfo)
25{
Arthur Heymans03180212018-09-16 18:55:28 +020026 if (CONFIG(BOARD_LENOVO_R500)) {
27 int use_integrated = get_gpio(21);
28 printk(BIOS_DEBUG, "R500 variant found with an %s GPU\n",
29 use_integrated ? "integrated" : "discrete");
30 if (use_integrated) {
31 sysinfo->enable_igd = 1;
32 sysinfo->enable_peg = 0;
33 } else {
34 sysinfo->enable_igd = 0;
35 sysinfo->enable_peg = 1;
36 }
37 } else {
38 hybrid_graphics_init(sysinfo);
39 }
Arthur Heymans3b0eb602019-01-31 22:47:09 +010040}
Timothy Pearson4b373c92015-04-05 17:54:08 -050041
Arthur Heymans3b0eb602019-01-31 22:47:09 +010042void mb_post_raminit_setup(void)
43{
44 /* FIXME: make a proper SMBUS mux support. */
45 /* Set the SMBUS mux to the eeprom */
Arthur Heymans32a414f2019-01-31 22:53:09 +010046 set_gpio(42, GPIO_LEVEL_LOW);
Timothy Pearson4b373c92015-04-05 17:54:08 -050047}