blob: be8052c3baa77d43c3c98f0e1c760e7b77653129 [file] [log] [blame]
Nicolas Reinecke572795b2014-12-29 19:57:29 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2010 coresystems GmbH
5 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
6 * Copyright (C) 2014 Vladimir Serbinenko
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Nicolas Reinecke572795b2014-12-29 19:57:29 +010016 */
17
18#include <arch/byteorder.h>
19#include <arch/io.h>
Nicolas Reinecke572795b2014-12-29 19:57:29 +010020#include <console/console.h>
21#include <northbridge/intel/sandybridge/raminit_native.h>
22#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020023#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
24#include <northbridge/intel/sandybridge/sandybridge.h>
25#include <device/device.h>
26#include <device/pci.h>
27
28static void hybrid_graphics_init(void)
29{
30 bool peg, igd;
31 u32 reg32;
32
33 early_hybrid_graphics(&igd, &peg);
34
Evgeny Zinoviev384e9ae2018-08-30 02:18:48 +030035 if (peg && igd)
36 return;
37
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020038 /* Hide disabled devices */
39 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
40 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
41
42 if (peg)
43 reg32 |= DEVEN_PEG10;
44
45 if (igd)
46 reg32 |= DEVEN_IGD;
47 else
48 /* Disable IGD VGA decode, no GTT or GFX stolen */
49 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
50
51 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
52}
Nicolas Reinecke572795b2014-12-29 19:57:29 +010053
54void pch_enable_lpc(void)
55{
56 /* EC Decode Range Port60/64, Port62/66 */
57 /* Enable EC, PS/2 Keyboard/Mouse */
58 pci_write_config16(PCH_LPC_DEV, LPC_EN,
Patrick Rudolph93eac6a2017-05-04 19:10:50 +020059 CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010060
61 pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601);
62 pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1);
63 pci_write_config32(PCH_LPC_DEV, LPC_GEN4_DEC, 0x0c06a1);
64
Patrick Rudolphac27d362017-05-04 19:00:33 +020065 pci_write_config32(PCH_LPC_DEV, ETR3, 0x10000);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010066}
67
Nico Huberff4025c2018-01-14 12:34:43 +010068void mainboard_rcba_config(void)
Nicolas Reinecke572795b2014-12-29 19:57:29 +010069{
Nicolas Reinecke572795b2014-12-29 19:57:29 +010070 RCBA32(BUC) = 0;
71}
72
73const struct southbridge_usb_port mainboard_usb_ports[] = {
74 { 0, 1, -1 }, /* P0 empty */
75 { 1, 1, 1 }, /* P1 system port 2 (To system port) (EHCI debug), OC 1 */
76 { 1, 1, -1 }, /* P2: HALF MINICARD (WLAN) no oc */
77 { 1, 0, -1 }, /* P3: WWAN, no OC */
78 { 1, 1, -1 }, /* P4: smartcard, no OC */
79 { 1, 1, -1 }, /* P5: ExpressCard, no OC */
80 { 0, 0, -1 }, /* P6: empty */
81 { 0, 0, -1 }, /* P7: empty */
82 { 0, 1, -1 }, /* P8: empty (touch panel) */
83 { 1, 0, 5 }, /* P9: system port 1 (To USBAO) (EHCI debug), OC 5 */
84 { 1, 0, -1 }, /* P10: fingerprint reader, no OC */
85 { 1, 1, -1 }, /* P11: bluetooth, no OC. */
86 { 1, 1, -1 }, /* P12: docking, no OC */
87 { 1, 1, -1 }, /* P13: camera (LCD), no OC */
88};
89
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +020090void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
91 read_spd(&spd[0], 0x50, id_only);
92 read_spd(&spd[2], 0x51, id_only);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010093}
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010094
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020095void mainboard_early_init(int s3resume)
96{
97 hybrid_graphics_init();
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010098}
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010099
100void mainboard_config_superio(void)
101{
102}