Angel Pons | 2e8a4b0 | 2020-04-05 13:22:54 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 2 | |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 3 | #include <device/device.h> |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 4 | #include <device/pci_ops.h> |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 5 | #include <drivers/intel/gma/int15.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 6 | #include <acpi/acpi.h> |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 7 | #include <southbridge/intel/bd82x6x/pch.h> |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 8 | #include <ec/quanta/it8518/ec.h> |
| 9 | |
Elyes HAOUAS | 32f48a2 | 2019-05-02 21:21:42 +0200 | [diff] [blame] | 10 | #include "ec.h" |
| 11 | #include "onboard.h" |
| 12 | |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 13 | void mainboard_suspend_resume(void) |
| 14 | { |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 15 | /* Stout EC needs to be put back in ACPI mode */ |
| 16 | ec_write_cmd(EC_CMD_NOTIFY_ACPI_ENTER); |
| 17 | } |
| 18 | |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 19 | static void mainboard_init(struct device *dev) |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 20 | { |
| 21 | struct device *ethernet_dev = NULL; |
| 22 | |
| 23 | /* Initialize the Embedded Controller */ |
| 24 | stout_ec_init(); |
| 25 | |
| 26 | /* |
| 27 | * Battery life time - LAN PCIe should enter ASPM L1 to save |
| 28 | * power when LAN connection is idle. |
| 29 | * enable CLKREQ: LAN pci config space 0x81h=01 |
| 30 | */ |
| 31 | ethernet_dev = dev_find_device(STOUT_NIC_VENDOR_ID, |
| 32 | STOUT_NIC_DEVICE_ID, dev); |
| 33 | |
| 34 | if (ethernet_dev != NULL) |
| 35 | pci_write_config8(ethernet_dev, 0x81, 0x01); |
| 36 | } |
| 37 | |
Elyes HAOUAS | d129d43 | 2018-05-04 20:23:33 +0200 | [diff] [blame] | 38 | static void mainboard_enable(struct device *dev) |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 39 | { |
| 40 | dev->ops->init = mainboard_init; |
Vladimir Serbinenko | a2a906e | 2014-09-01 01:41:37 +0200 | [diff] [blame] | 41 | install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS, GMA_INT15_PANEL_FIT_DEFAULT, GMA_INT15_BOOT_DISPLAY_DEFAULT, 0); |
Stefan Reinauer | b7ecf6d | 2013-03-13 17:13:32 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | struct chip_operations mainboard_ops = { |
| 45 | .enable_dev = mainboard_enable, |
| 46 | }; |