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 | |
| 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 Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 50 | |
| 51 | void 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 Rudolph | 93eac6a | 2017-05-04 19:10:50 +0200 | [diff] [blame] | 56 | CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN); |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 57 | |
| 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 Rudolph | ac27d36 | 2017-05-04 19:00:33 +0200 | [diff] [blame] | 62 | pci_write_config32(PCH_LPC_DEV, ETR3, 0x10000); |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | void rcba_config(void) |
| 66 | { |
| 67 | /* Disable unused devices (board specific) */ |
| 68 | RCBA32(FD) = 0x1eb51fe3; |
| 69 | RCBA32(BUC) = 0; |
| 70 | } |
| 71 | |
| 72 | const 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älkki | e258b9a | 2016-11-18 19:59:23 +0200 | [diff] [blame] | 89 | void 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 Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 92 | } |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 93 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame^] | 94 | void mainboard_early_init(int s3resume) |
| 95 | { |
| 96 | hybrid_graphics_init(); |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 97 | } |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 98 | |
| 99 | void mainboard_config_superio(void) |
| 100 | { |
| 101 | } |