Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 1 | /* |
| 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 Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #include <arch/byteorder.h> |
| 19 | #include <arch/io.h> |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 20 | #include <console/console.h> |
| 21 | #include <northbridge/intel/sandybridge/raminit_native.h> |
| 22 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 23 | #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 | |
| 28 | static void hybrid_graphics_init(void) |
| 29 | { |
| 30 | bool peg, igd; |
| 31 | u32 reg32; |
| 32 | |
| 33 | early_hybrid_graphics(&igd, &peg); |
| 34 | |
Evgeny Zinoviev | 384e9ae | 2018-08-30 02:18:48 +0300 | [diff] [blame^] | 35 | if (peg && igd) |
| 36 | return; |
| 37 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 38 | /* 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 Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 53 | |
| 54 | void 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 Rudolph | 93eac6a | 2017-05-04 19:10:50 +0200 | [diff] [blame] | 59 | CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN); |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 60 | |
| 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 Rudolph | ac27d36 | 2017-05-04 19:00:33 +0200 | [diff] [blame] | 65 | pci_write_config32(PCH_LPC_DEV, ETR3, 0x10000); |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 66 | } |
| 67 | |
Nico Huber | ff4025c | 2018-01-14 12:34:43 +0100 | [diff] [blame] | 68 | void mainboard_rcba_config(void) |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 69 | { |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 70 | RCBA32(BUC) = 0; |
| 71 | } |
| 72 | |
| 73 | const 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älkki | e258b9a | 2016-11-18 19:59:23 +0200 | [diff] [blame] | 90 | void 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 Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 93 | } |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 94 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 95 | void mainboard_early_init(int s3resume) |
| 96 | { |
| 97 | hybrid_graphics_init(); |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 98 | } |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 99 | |
| 100 | void mainboard_config_superio(void) |
| 101 | { |
| 102 | } |