blob: ad49637e2c0e1484d9c5ed57acef98aad1755ff4 [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
35 /* Hide disabled devices */
36 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
37 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
38
39 if (peg)
40 reg32 |= DEVEN_PEG10;
41
42 if (igd)
43 reg32 |= DEVEN_IGD;
44 else
45 /* Disable IGD VGA decode, no GTT or GFX stolen */
46 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
47
48 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
49}
Nicolas Reinecke572795b2014-12-29 19:57:29 +010050
51void pch_enable_lpc(void)
52{
53 /* EC Decode Range Port60/64, Port62/66 */
54 /* Enable EC, PS/2 Keyboard/Mouse */
55 pci_write_config16(PCH_LPC_DEV, LPC_EN,
Patrick Rudolph93eac6a2017-05-04 19:10:50 +020056 CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010057
58 pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601);
59 pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1);
60 pci_write_config32(PCH_LPC_DEV, LPC_GEN4_DEC, 0x0c06a1);
61
Patrick Rudolphac27d362017-05-04 19:00:33 +020062 pci_write_config32(PCH_LPC_DEV, ETR3, 0x10000);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010063}
64
65void rcba_config(void)
66{
67 /* Disable unused devices (board specific) */
68 RCBA32(FD) = 0x1eb51fe3;
69 RCBA32(BUC) = 0;
70}
71
72const struct southbridge_usb_port mainboard_usb_ports[] = {
73 { 0, 1, -1 }, /* P0 empty */
74 { 1, 1, 1 }, /* P1 system port 2 (To system port) (EHCI debug), OC 1 */
75 { 1, 1, -1 }, /* P2: HALF MINICARD (WLAN) no oc */
76 { 1, 0, -1 }, /* P3: WWAN, no OC */
77 { 1, 1, -1 }, /* P4: smartcard, no OC */
78 { 1, 1, -1 }, /* P5: ExpressCard, no OC */
79 { 0, 0, -1 }, /* P6: empty */
80 { 0, 0, -1 }, /* P7: empty */
81 { 0, 1, -1 }, /* P8: empty (touch panel) */
82 { 1, 0, 5 }, /* P9: system port 1 (To USBAO) (EHCI debug), OC 5 */
83 { 1, 0, -1 }, /* P10: fingerprint reader, no OC */
84 { 1, 1, -1 }, /* P11: bluetooth, no OC. */
85 { 1, 1, -1 }, /* P12: docking, no OC */
86 { 1, 1, -1 }, /* P13: camera (LCD), no OC */
87};
88
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +020089void mainboard_get_spd(spd_raw_data *spd, bool id_only) {
90 read_spd(&spd[0], 0x50, id_only);
91 read_spd(&spd[2], 0x51, id_only);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010092}
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010093
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020094void mainboard_early_init(int s3resume)
95{
96 hybrid_graphics_init();
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010097}
Vladimir Serbinenkoffbb3c02016-02-10 01:36:25 +010098
99void mainboard_config_superio(void)
100{
101}