blob: 00148f2e22c9b796ffdbc814ef34e43096bfd414 [file] [log] [blame]
Stefan Reinauere1ae4b22012-04-27 23:20:58 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020014 */
15
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050016#include <arch/acpi.h>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020017#include <arch/io.h>
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020018#include <console/console.h>
19#include <cpu/x86/smm.h>
20#include <southbridge/intel/bd82x6x/nvs.h>
21#include <southbridge/intel/bd82x6x/pch.h>
22#include <southbridge/intel/bd82x6x/me.h>
23#include <northbridge/intel/sandybridge/sandybridge.h>
24#include <cpu/intel/model_206ax/model_206ax.h>
25
david80ef7b72015-01-19 17:11:36 +080026/* Include for SIO helper functions */
27#include <superio/ite/it8772f/it8772f.h>
Edward O'Callaghan1f9653a2014-07-14 16:31:25 +100028#define DUMMY_DEV PNP_DEV(0x2e, 0)
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020029
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020030/*
31 * Change LED_POWER# (SIO GPIO 45) state based on sleep type.
david80ef7b72015-01-19 17:11:36 +080032*/
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020033void mainboard_smi_sleep(u8 slp_typ)
34{
david80ef7b72015-01-19 17:11:36 +080035 printk(BIOS_DEBUG, "SMI: sleep S%d\n", slp_typ);
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020036 switch (slp_typ) {
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050037 case ACPI_S3:
38 case ACPI_S4:
Elyes HAOUASa5aad2e2016-09-19 09:47:16 -060039 it8772f_gpio_led(DUMMY_DEV, 4 /* set */, (0x1 << 5) /* select */,
40 (0x1 << 5) /* polarity */, (0x1 << 5) /* 1 = pullup */,
41 (0x1 << 5) /* output */, 0x00, /* 0 = Alternate function */
david80ef7b72015-01-19 17:11:36 +080042 SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020043 break;
44
Aaron Durbin30b0c7a2016-07-13 13:01:13 -050045 case ACPI_S5:
Elyes HAOUASa5aad2e2016-09-19 09:47:16 -060046 it8772f_gpio_led(DUMMY_DEV, 4 /* set */, (0x1 << 5) /* select */,
47 0x00 /* polarity: non-inverting */, 0x00 /* 0 = pulldown */,
48 (0x1 << 5) /* output */, (0x1 << 5) /* 1 = Simple IO function */,
david80ef7b72015-01-19 17:11:36 +080049 SIO_GPIO_BLINK_GPIO45, IT8772F_GPIO_BLINK_FREQUENCY_1_HZ);
50 break;
51 default:
Stefan Reinauere1ae4b22012-04-27 23:20:58 +020052 break;
53 }
54}